/* Verdix — shared styles. Adjudication-engine identity: engineering-paper
   neutrals, the four verdict states as the only chroma, mono for all data.

   Font families are self-hosted by Next.js (`next/font`) and exposed as
   `--font-*` variables on <html>. When this stylesheet is loaded outside
   Next.js (standalone browser bundle), those variables fall back to the
   system stacks below. */

:root {
  /* Colors */
  --ink: #14171c;
  --ink-2: #3d444d;
  --ink-3: #5f6873;
  --paper: #eef1f0;
  --paper-2: #e6eae8;
  --panel: #ffffff;
  --line: #d5dad8;
  --line-2: #c3c9c6;

  --brand: #34408b;      /* deep adjudication indigo — never a verdict color */
  --brand-ink: #232a5c;

  --pass: #1b6b42;   --pass-bg: #e2efe8;   --pass-line: #b6d8c6;
  --fail: #ad2f2f;   --fail-bg: #f4e1e1;   --fail-line: #e2b9b9;
  --review: #8a5604; --review-bg: #f4ead2; --review-line: #e4cfa0;
  --unknown: #5b6570;--unknown-bg: #e5e9e7;--unknown-line: #c9cfcc;

  /* Typography */
  --display: var(--font-display, 'Space Grotesk'), system-ui, sans-serif;
  --body: var(--font-body, 'Inter'), system-ui, sans-serif;
  --mono: var(--font-mono, 'JetBrains Mono'), ui-monospace, monospace;

  /* Layout */
  --wrap: 1120px;
  --radius: 6px;       /* inputs, tags, small controls */
  --radius-lg: 8px;    /* buttons, alerts, callouts */
  --radius-code: 10px; /* code blocks */
  --radius-card: 12px; /* panels and cards */

  /* Code block surfaces */
  --code-bg: #12141a;
  --code-line: #1e2230;
  --code-text: #e7ebf2;

  /* Spacing Scale - 8px base unit */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Section spacing */
  --section-padding: var(--space-20); /* 80px */
  --hero-padding: var(--space-16); /* 64px */

  /* Component spacing */
  --component-gap: var(--space-4); /* 16px */
  --element-gap: var(--space-3); /* 12px */

  /* Responsive breakpoints */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; margin: 0; }
code, pre, .mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }

/* ---- eyebrow / structural labels (mono, section-numbered) ---- */
.eyebrow {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: attr(data-n); color: var(--brand); font-weight: 600; }

/* ---- nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__in { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.03em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--brand); display: block; flex: 0 0 auto; }
.brand .stamp {
  width: 22px; height: 22px; border: 1.5px solid var(--brand); border-radius: 5px;
  display: grid; place-items: center; color: var(--brand); font-size: 13px; font-weight: 700;
  transform: rotate(-4deg);
}
.nav__links { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.nav__links a { color: var(--ink-2); font-size: 14.5px; font-weight: 450; }
.nav__links a:hover { color: var(--ink); text-decoration: none; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--body);
  font-size: 14.5px; font-weight: 500; padding: 10px 18px; border-radius: var(--radius-lg);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); }
.btn--primary:hover { background: var(--brand-ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--panel); border-color: var(--ink-3); }

/* ---- segmented toggle group (aria-pressed segments) ---- */
.toggle {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px;
}
.toggle button {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
  background: transparent; border: 0; border-radius: 999px;
  padding: 8px 16px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.toggle button:hover { color: var(--brand); }
.toggle button[aria-pressed="true"] {
  background: var(--panel); color: var(--brand);
  box-shadow: 0 1px 2px rgba(20,23,28,.08);
}
.toggle button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ---- verdict loading skeleton (shown until the browser bundle is ready) ---- */
.verdict.is-loading { padding: 20px 18px; display: grid; gap: 12px; }
.skel {
  display: block; height: 12px; border-radius: 4px; background: var(--paper-2);
  animation: skel-pulse 1.2s ease-in-out infinite;
}
.skel.w70 { width: 70%; } .skel.w45 { width: 45%; }
@keyframes skel-pulse { 50% { opacity: .55; } }

/* ---- alert (error / warning) ---- */
.alert { padding: var(--space-4) var(--space-5); border: 1px solid; border-radius: var(--radius-lg); }
.alert--error { background: var(--fail-bg); border-color: var(--fail-line); }
.alert--warning { background: var(--review-bg); border-color: var(--review-line); }
.alert__title { margin: 0; font-family: var(--display); font-size: 14px; letter-spacing: -0.01em; }
.alert--error .alert__title { color: var(--fail); }
.alert--warning .alert__title { color: var(--review); }
.alert__msg { margin: var(--space-2) 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.alert__retry {
  margin-top: var(--space-3); font-family: var(--body); font-size: 13px; font-weight: 500;
  padding: 7px 14px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.alert__retry:hover { background: var(--ink); color: var(--panel); border-color: var(--ink); }

/* ---- full-screen application error screen ---- */
.error-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.error-screen__card {
  max-width: 480px; padding: var(--space-8); text-align: center;
  background: var(--fail-bg); border: 1px solid var(--fail-line); border-radius: var(--radius-card);
}
.error-screen__title { color: var(--fail); font-size: 20px; margin: 0 0 var(--space-3); }
.error-screen__msg { color: var(--ink-2); font-size: 14px; margin: 0 0 var(--space-4); }

/* ---- verdict card (the signature element) ---- */
.verdict {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,23,28,.04), 0 12px 28px -18px rgba(20,23,28,.25);
}
/* Hidden until renderVerdict fills it, so the skeleton stands alone */
.verdict:empty { display: none; }
.verdict__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap;
  padding: 16px 18px; border-bottom: 1px dashed var(--line-2);
}
.verdict__meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; line-height: 1.5; }
.verdict__meta b { color: var(--ink-2); font-weight: 600; }

.ruling {
  display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono);
  font-weight: 600; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; border: 1px solid;
}
.ruling .dot { width: 8px; height: 8px; border-radius: 50%; }
.ruling.is-pass    { color: var(--pass);    background: var(--pass-bg);    border-color: var(--pass-line); }
.ruling.is-pass .dot    { background: var(--pass); }
.ruling.is-fail    { color: var(--fail);    background: var(--fail-bg);    border-color: var(--fail-line); }
.ruling.is-fail .dot    { background: var(--fail); }
.ruling.is-review  { color: var(--review);  background: var(--review-bg);  border-color: var(--review-line); }
.ruling.is-review .dot  { background: var(--review); }
.ruling.is-unknown { color: var(--unknown); background: var(--unknown-bg); border-color: var(--unknown-line); }
.ruling.is-unknown .dot { background: var(--unknown); }

.verdict__summary { padding: 12px 18px; font-size: 14px; color: var(--ink-2); border-bottom: 1px solid var(--line); background: var(--paper-2); }

.check { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.check:last-child { border-bottom: 0; }
.check__glyph { font-family: var(--mono); font-weight: 700; font-size: 14px; line-height: 1.5; text-align: center; }
.check__glyph.is-pass { color: var(--pass); }
.check__glyph.is-fail { color: var(--fail); }
.check__glyph.is-review { color: var(--review); }
.check__glyph.is-unknown { color: var(--unknown); }
.check__label { font-weight: 500; font-size: 14.5px; }
.check__reason { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.check__reason .lo { color: var(--review); }
.check__tags { text-align: right; white-space: nowrap; }
.tag { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.tag.lo { color: var(--review); font-weight: 500; }

/* Nested evidence from group rules: compact rows inset under their group */
.check__children { margin-top: 8px; border-left: 2px solid var(--line); padding-left: 12px; }
.check--nested { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 0; align-items: start; }
.check--nested .check__glyph { font-size: 12px; line-height: 1.6; }
.check--nested .check__label { font-size: 13px; color: var(--ink-2); }
.check--nested .check__reason { font-size: 12px; margin-top: 1px; }
.check--nested .check__tags { white-space: nowrap; }

/* ---- code ---- */
pre.code {
  background: var(--code-bg); color: var(--code-text); border-radius: var(--radius-code); padding: 18px 20px;
  overflow-x: auto; font-size: 13px; line-height: 1.65; margin: 0;
  border: 1px solid var(--code-line); white-space: pre;
}
pre.code .k { color: #c3a0f5; } pre.code .s { color: #96d0a2; }
pre.code .c { color: #6b7480; } pre.code .p { color: #e7c07b; } pre.code .n { color: #79b6f2; }
:not(pre) > code { background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 13px; color: var(--brand-ink); }

/* ---- generic section ---- */
.section {
  padding: var(--section-padding) 0;
  border-top: 1px solid var(--line);
}
.section[id] { scroll-margin-top: 76px; }
.section__title {
  font-size: clamp(28px, 4vw, 40px);
  margin: var(--space-3) 0 0;
  max-width: 20ch;
}
.section__lede {
  font-size: 18px;
  color: var(--ink-2);
  max-width: 60ch;
  margin: var(--space-4) 0 0;
}

/* ---- footer ---- */
.foot {
  border-top: 1px solid var(--line);
  padding: var(--space-12) 0;
  color: var(--ink-3);
  font-size: 14px;
}
.foot__in {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-10);
  align-items: center;
}
.foot a { color: var(--ink-2); }
.foot__in .brand { font-size: 16px; }
.foot__end { margin-left: auto; }

/* ---- responsive (mobile-first floor ~360px) ---- */
@media (max-width: 768px) {
  .wrap { padding: 0 20px; }

  .nav__in {
    flex-wrap: wrap;
    gap: 6px 24px;
    height: auto;
    padding: 10px 0 12px;
  }
  .brand { margin-right: auto; }
  .nav__links {
    margin-left: 0;
    width: 100%;
    gap: 4px 18px;
  }
  .nav__links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
  }

  .btn { min-height: 44px; }

  .foot__in { justify-content: center; text-align: center; }
  .foot__in .brand { margin-right: 0; }
  .foot__end { margin-left: 0; }
  .check { grid-template-columns: 20px 1fr; gap: 6px 10px; }
  .check__tags { grid-column: 2; text-align: left; }
  .toggle button { min-height: 44px; padding: 10px 14px; }
  .toggle { display: flex; width: 100%; }
}


@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto; } }

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* (the single :focus-visible rule lives at the top of this file) */

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --line: #000000;
    --line-2: #333333;
  }
}
