/*! CKCSS v0.1.0-alpha | Foundation and layout layers */
@layer ck-reset, ck-tokens, ck-base, ck-layout;

@layer ck-reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  figure,
  blockquote,
  dl,
  dd {
    margin: 0;
  }

  ul,
  ol {
    margin: 0;
    padding: 0;
  }

  img,
  picture,
  svg,
  canvas,
  video {
    display: block;
    max-inline-size: 100%;
  }

  input,
  button,
  textarea,
  select {
    color: inherit;
    font: inherit;
  }

  button,
  select {
    text-transform: none;
  }

  textarea {
    resize: vertical;
  }

  [hidden] {
    display: none;
  }
}

@layer ck-tokens {
  :root {
    color-scheme: light;

    --ck-color-surface: #ffffff;
    --ck-color-surface-muted: #f8fafc;
    --ck-color-text: #172033;
    --ck-color-text-muted: #526078;
    --ck-color-border: #d7deea;
    --ck-color-primary: #2563eb;
    --ck-color-primary-strong: #1d4ed8;
    --ck-color-focus: #0f62fe;
    --ck-color-selection: #bfdbfe;

    --ck-font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
      "Segoe UI", sans-serif;
    --ck-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --ck-font-size-0: 0.875rem;
    --ck-font-size-1: 1rem;
    --ck-font-size-2: 1.125rem;
    --ck-font-size-3: 1.25rem;
    --ck-font-size-4: clamp(1.5rem, 3vw, 2rem);
    --ck-font-size-5: clamp(2rem, 5vw, 3.25rem);
    --ck-line-tight: 1.15;
    --ck-line-normal: 1.5;
    --ck-line-relaxed: 1.7;

    --ck-space-1: 0.25rem;
    --ck-space-2: 0.5rem;
    --ck-space-3: 0.75rem;
    --ck-space-4: 1rem;
    --ck-space-5: 1.5rem;
    --ck-space-6: 2rem;
    --ck-space-7: 3rem;
    --ck-space-8: 4rem;

    --ck-radius-sm: 0.25rem;
    --ck-radius-md: 0.5rem;
    --ck-radius-lg: 0.75rem;
    --ck-shadow-sm: 0 1px 2px rgb(15 23 42 / 0.08);
    --ck-shadow-md: 0 8px 24px rgb(15 23 42 / 0.12);
    --ck-duration-fast: 160ms;
    --ck-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  }

  [data-ck-theme="dark"] {
    color-scheme: dark;
    --ck-color-surface: #111827;
    --ck-color-surface-muted: #1f2937;
    --ck-color-text: #f8fafc;
    --ck-color-text-muted: #cbd5e1;
    --ck-color-border: #475569;
    --ck-color-primary: #93c5fd;
    --ck-color-primary-strong: #bfdbfe;
    --ck-color-focus: #bfdbfe;
    --ck-color-selection: #1e3a8a;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-ck-theme]) {
      color-scheme: dark;
      --ck-color-surface: #111827;
      --ck-color-surface-muted: #1f2937;
      --ck-color-text: #f8fafc;
      --ck-color-text-muted: #cbd5e1;
      --ck-color-border: #475569;
      --ck-color-primary: #93c5fd;
      --ck-color-primary-strong: #bfdbfe;
      --ck-color-focus: #bfdbfe;
      --ck-color-selection: #1e3a8a;
    }
  }
}

@layer ck-base {
  :where(html) {
    background: var(--ck-color-surface);
    color: var(--ck-color-text);
    font-family: var(--ck-font-sans);
    font-size: var(--ck-font-size-1);
    line-height: var(--ck-line-normal);
  }

  :where(body) {
    min-block-size: 100vh;
    background: var(--ck-color-surface);
    color: var(--ck-color-text);
  }

  :where(h1, h2, h3, h4, h5, h6) {
    color: var(--ck-color-text);
    font-weight: 700;
    line-height: var(--ck-line-tight);
    text-wrap: balance;
  }

  :where(h1) {
    font-size: var(--ck-font-size-5);
  }

  :where(h2) {
    font-size: var(--ck-font-size-4);
  }

  :where(p, li) {
    max-inline-size: 72ch;
  }

  :where(a) {
    color: var(--ck-color-primary);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.16em;
  }

  :where(a:hover) {
    color: var(--ck-color-primary-strong);
  }

  :where(button, input, select, textarea) {
    border-radius: var(--ck-radius-sm);
  }

  :where(button, [role="button"]) {
    cursor: pointer;
  }

  :where(button:disabled, input:disabled, select:disabled, textarea:disabled) {
    cursor: not-allowed;
  }

  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--ck-color-focus);
    outline-offset: 3px;
  }

  ::selection {
    background: var(--ck-color-selection);
    color: var(--ck-color-text);
  }

  @media (prefers-reduced-motion: reduce) {
    :where(*, *::before, *::after) {
      animation-duration: 0.01ms;
      animation-iteration-count: 1;
      scroll-behavior: auto;
      transition-duration: 0.01ms;
    }
  }
}

@layer ck-layout {
  .ck-container {
    inline-size: min(calc(100% - var(--ck-container-inline-space, var(--ck-space-6))), var(--ck-container-max, 72rem));
    margin-inline: auto;
  }

  .ck-container--narrow {
    --ck-container-max: 48rem;
  }

  .ck-container--wide {
    --ck-container-max: 88rem;
  }

  .ck-stack {
    display: flex;
    flex-direction: column;
  }

  .ck-stack > * + * {
    margin-block-start: var(--ck-stack-space, var(--ck-space-4));
  }

  .ck-stack--compact {
    --ck-stack-space: var(--ck-space-2);
  }

  .ck-stack--relaxed {
    --ck-stack-space: var(--ck-space-6);
  }

  .ck-cluster {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--ck-cluster-space, var(--ck-space-3));
  }

  .ck-cluster--spread {
    justify-content: space-between;
  }

  .ck-grid {
    display: grid;
    gap: var(--ck-grid-gap, var(--ck-space-5));
    grid-template-columns: minmax(0, 1fr);
  }

  .ck-grid--auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(min(var(--ck-grid-min, 16rem), 100%), 1fr));
  }

  .ck-sidebar {
    display: grid;
    gap: var(--ck-sidebar-gap, var(--ck-space-6));
    grid-template-columns: minmax(0, 1fr);
  }

  @media (min-width: 40rem) {
    .ck-grid--2 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ck-grid--3 {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  @media (min-width: 48rem) {
    .ck-sidebar {
      grid-template-columns: minmax(var(--ck-sidebar-min, 16rem), 0.35fr) minmax(0, 1fr);
    }

    .ck-sidebar--end {
      grid-template-columns: minmax(0, 1fr) minmax(var(--ck-sidebar-min, 16rem), 0.35fr);
    }
  }
}
