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

@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
  }
  html {
    -webkit-text-size-adjust: 100%;
  }
  body {
    margin: 0;
  }
  h1, h2, h3, h4, p, ul, ol {
    margin-top: 0;
  }
  img, svg {
    display: block;
    max-width: 100%;
  }
}

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

    --bg: #fafaf9;
    --surface: #ffffff;
    --surface-subtle: #f3f2ee;
    --surface-hover: #eae8e2;
    --ink: #141413;
    --ink-secondary: #4a4843;
    --ink-muted: #69665f;
    --border: rgba(20, 20, 19, 0.11);
    --border-strong: rgba(20, 20, 19, 0.22);

    --btn-bg: #141413;
    --btn-ink: #fafaf9;
    --btn-bg-hover: #2b2a27;

    --accent: #1d4ed8;
    --accent-soft: rgba(29, 78, 216, 0.08);
    --safe: #047857;
    --safe-soft: rgba(4, 120, 87, 0.09);
    --amber: #b45309;
    --amber-soft: rgba(180, 83, 9, 0.1);
    --leak: #b91c1c;

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --max-w: 1080px;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0c0c0b;
      --surface: #141413;
      --surface-subtle: #1b1b19;
      --surface-hover: #242421;
      --ink: #f5f5f3;
      --ink-secondary: #c5c2ba;
      --ink-muted: #949087;
      --border: rgba(245, 245, 243, 0.11);
      --border-strong: rgba(245, 245, 243, 0.22);

      --btn-bg: #f5f5f3;
      --btn-ink: #0c0c0b;
      --btn-bg-hover: #e2e0d8;

      --accent: #60a5fa;
      --accent-soft: rgba(96, 165, 250, 0.12);
      --safe: #34d399;
      --safe-soft: rgba(52, 211, 153, 0.12);
      --amber: #fbbf24;
      --amber-soft: rgba(251, 191, 36, 0.12);
      --leak: #f87171;
    }
  }
}

@layer base {
  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }

  a {
    color: var(--accent);
    text-decoration: none;
  }

  a:hover {
    text-decoration: underline;
  }

  code, .mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }

  .tabular {
    font-variant-numeric: tabular-nums;
  }
}

@layer layout {
  .container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
  }

  .site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
    text-decoration: none;
  }

  .brand:hover {
    text-decoration: none;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--btn-bg);
    color: var(--btn-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
  }

  .nav-links a {
    color: var(--ink-secondary);
  }

  .nav-links a:hover {
    color: var(--ink);
  }

  section {
    padding: 64px 0;
    border-bottom: 1px solid var(--border);
  }

  section:last-of-type {
    border-bottom: none;
  }
}

@layer components {
  .eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 14px;
  }

  .hero {
    padding: 72px 0 64px;
  }

  .hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 40px;
    align-items: start;
  }

  .hero h1 {
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 18px;
  }

  .hero-lead {
    font-size: 18px;
    color: var(--ink-secondary);
    max-width: 56ch;
    margin-bottom: 28px;
  }

  .cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 140ms ease, border-color 140ms ease;
  }

  .btn:hover {
    text-decoration: none;
  }

  .btn-primary {
    background: var(--btn-bg);
    color: var(--btn-ink);
  }

  .btn-primary:hover {
    background: var(--btn-bg-hover);
  }

  .btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--border-strong);
  }

  .btn-secondary:hover {
    background: var(--surface-subtle);
  }

  .telemetry-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink-secondary);
  }

  .telemetry-strip strong {
    color: var(--ink);
  }

  .spec-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .spec-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-secondary);
  }

  .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    background: var(--safe-soft);
    color: var(--safe);
  }

  .spec-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .spec-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
  }

  .spec-list li:last-child {
    border-bottom: none;
  }

  .spec-size {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
  }

  .spec-meta {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--safe);
  }

  .budget-preview {
    padding: 16px 18px;
    background: var(--surface-subtle);
    border-top: 1px solid var(--border);
  }

  .budget-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 12px;
    margin-bottom: 8px;
  }

  .meter-track {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
  }

  .meter-fill {
    height: 100%;
    width: 32%;
    background: var(--safe);
    border-radius: 999px;
  }

  .section-head {
    max-width: 64ch;
    margin-bottom: 32px;
  }

  .section-head h2 {
    font-size: clamp(24px, 3.2vw, 32px);
    letter-spacing: -0.025em;
    line-height: 1.18;
    margin-bottom: 10px;
  }

  .section-head p {
    color: var(--ink-secondary);
    margin-bottom: 0;
  }

  .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
  }

  .card h3 {
    font-size: 16px;
    letter-spacing: -0.015em;
    margin-bottom: 8px;
  }

  .card p {
    font-size: 14.5px;
    color: var(--ink-secondary);
    margin-bottom: 0;
  }

  .card-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    margin-bottom: 10px;
  }

  .table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
  }

  th, td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
  }

  tr:last-child td {
    border-bottom: none;
  }

  th {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--surface-subtle);
  }

  .col-highlight {
    background: var(--accent-soft);
  }

  .pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 32px;
  }

  .price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .price-card.featured {
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
  }

  .price-amount {
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
  }

  .price-period {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
  }

  .feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--ink-secondary);
    flex: 1;
  }

  .feature-list li::before {
    content: "✓ ";
    color: var(--safe);
    font-family: var(--font-mono);
    font-weight: 700;
  }

  .prose {
    max-width: 72ch;
  }

  .prose h1 {
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 12px;
  }

  .prose h2 {
    font-size: 20px;
    letter-spacing: -0.02em;
    margin-top: 32px;
    margin-bottom: 10px;
  }

  .prose p, .prose li {
    color: var(--ink-secondary);
  }

  .prose ul {
    padding-left: 20px;
  }

  .callout {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--safe);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin: 24px 0;
    font-size: 14.5px;
  }

  .cs-studio-footer {
    padding: 36px 24px 48px;
    border-top: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--ink-muted);
    text-align: center;
  }

  .cs-studio-footer p {
    margin: 0 0 8px 0;
  }

  .cs-studio-footer p:last-child {
    margin-bottom: 0;
  }

  .cs-studio-footer strong {
    color: var(--ink);
  }
}

@media (max-width: 860px) {
  .hero-grid,
  .grid-3,
  .grid-2,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 44px 0 40px;
  }

  section {
    padding: 44px 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .nav-links {
    gap: 14px;
  }

  .btn {
    width: 100%;
  }
}
