@layer reset, tokens, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; }
  img, picture, video { display: block; max-width: 100%; }
  input, button, textarea { font: inherit; }
  a { color: inherit; }
}

@layer tokens {
  :root {
    color-scheme: light;
    --bg:       light-dark(#fafafa, #0f1115);
    --surface:  light-dark(#ffffff, #181b22);
    --fg:       light-dark(#111418, #e6e8ee);
    --muted:    light-dark(#5a6573, #9aa3b2);
    --pri:      oklch(62% 0.19 28);
    --pri-soft: color-mix(in oklch, var(--pri), white 80%);
    --pri-soft-dark: color-mix(in oklch, var(--pri), black 40%);
    --line:     light-dark(#e6e8ec, #2a2f3a);
    --code-bg:  light-dark(#f3f4f6, #1f2330);
    --ok:       oklch(70% 0.16 145);
    --radius:   0.75rem;
    --radius-sm: 0.4rem;
    --space-1: 0.25rem; --space-2: 0.5rem;
    --space-3: 1rem;    --space-4: 1.5rem;
    --space-5: 2.5rem;  --space-6: 4rem;
    --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Pretendard", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
    --max-w: 900px;
  }

  :root[data-theme="dark"] { color-scheme: dark; }
}

@layer base {
  body {
    font-family: var(--font-sans);
    line-height: 1.65;
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
  }

  main {
    max-width: var(--max-w);
    margin-inline: auto;
    padding: var(--space-5) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }

  h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
  h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
  h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-bottom: var(--space-3); }
  h3 { font-size: 1.1rem; margin-bottom: var(--space-2); }
  p  { color: var(--fg); }

  code {
    font-family: var(--font-mono);
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    font-size: 0.92em;
  }

  pre {
    background: var(--code-bg);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-bottom: var(--space-2);
  }

  pre code { background: none; padding: 0; }
}

@layer components {
  .hero {
    text-align: center;
    padding-block: var(--space-5);
    border-bottom: 1px solid var(--line);
  }

  .kicker {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8rem;
    color: var(--pri);
    font-weight: 600;
    margin-bottom: var(--space-2);
  }

  .accent {
    background: linear-gradient(135deg, var(--pri), color-mix(in oklch, var(--pri), oklch(70% 0.18 60) 40%));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .lede {
    color: var(--muted);
    margin-block: var(--space-3) var(--space-4);
    font-size: 1.1rem;
    max-width: 38ch;
    margin-inline: auto;
  }

  .hero-meta {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    flex-wrap: wrap;
  }

  .btn {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--pri);
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s, transform 0.1s;
  }
  .btn:hover { background: color-mix(in oklch, var(--pri), black 12%); }
  .btn:active { transform: translateY(1px); }

  .btn.ghost {
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--line);
  }
  .btn.ghost:hover { background: var(--code-bg); }

  .tldr {
    background: var(--surface);
    padding: var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--line);
  }
  .tldr ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }
  .tldr li {
    padding-left: var(--space-4);
    position: relative;
  }
  .tldr li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--pri);
    font-weight: 700;
  }

  .verdict-card {
    background: var(--pri-soft);
    border-left: 4px solid var(--pri);
    padding: var(--space-4);
    border-radius: var(--radius);
  }
  :root[data-theme="dark"] .verdict-card { background: var(--pri-soft-dark); }
  .verdict-badge {
    display: inline-block;
    background: var(--pri);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
  }

  .table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
  }
  th, td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
  }
  th {
    background: var(--code-bg);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }
  tbody tr:last-child td { border-bottom: none; }
  tr.winner {
    background: color-mix(in oklch, var(--ok), transparent 88%);
    font-weight: 500;
  }

  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }
  .grid article {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: var(--space-3);
    border-radius: var(--radius);
  }
  .muted { color: var(--muted); font-size: 0.9rem; }

  .quickstart ol {
    counter-reset: step;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .quickstart li {
    counter-increment: step;
    padding: var(--space-2) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding-left: 3rem;
    position: relative;
  }
  .quickstart li::before {
    content: counter(step);
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: var(--pri);
    color: white;
    width: 1.6rem; height: 1.6rem;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
  }

  .check-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  .check-list li {
    padding-left: var(--space-4);
    position: relative;
  }
  .check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--ok);
    font-weight: 700;
  }

  footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
    padding-top: var(--space-4);
  }

  #theme-toggle {
    position: fixed;
    top: 1rem; right: 1rem;
    width: 2.4rem; height: 2.4rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--fg);
    cursor: pointer;
    font-size: 1.1rem;
    display: grid; place-items: center;
    transition: transform 0.2s;
  }
  #theme-toggle:hover { transform: rotate(180deg); }
}

@container (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  main { padding: var(--space-4) var(--space-3); }
}
