/* base.css — Calder & Vance (#27) — Phase 1 design system.
   Direction-agnostic: every colour/font references a semantic token from
   identity_tokens.css (--bg/--fg/--accent/--signal/--positive/--rule/--muted/
   --surface/--font-*). No hardcoded hex here — switching $IDENTITY is one
   attribute on <html data-identity>. Layout: 3 breakpoints (1200+ / 900–1199 /
   <=900). Respects prefers-reduced-motion and exposes a visible :focus-visible ring. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
ul, ol { padding-left: 1.2em; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
code, .mono, .reg-ref { font-family: var(--font-mono); font-size: .9em; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 0; border-top: 1px solid var(--rule); }
.section--flush { border-top: 0; }
.eyebrow { font-family: var(--font-ui); font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin: 0 0 .8rem; }
.lede { font-size: 1.2rem; color: var(--fg); max-width: 62ch; }
.muted { color: var(--muted); }
.measure { max-width: 68ch; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- skip link / a11y ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--ink); padding: 10px 16px; border-radius: var(--radius);
}
.skip-link:focus { left: 12px; top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- regime ticker (Direction A signature) ---------- */
.ticker {
  background: var(--surface); border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em;
  color: var(--muted); overflow: hidden; white-space: nowrap;
}
.ticker__inner { display: flex; gap: 2.5rem; padding: 7px 24px; }
.ticker b { color: var(--positive); font-weight: 400; }
.ticker .restricted { color: var(--signal); }

/* ---------- masthead + nav ---------- */
.masthead { background: var(--bg); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 50; }
.masthead__row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 0; }
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1.1; }
.brand__name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; color: var(--fg); }
.brand__tag { font-family: var(--font-ui); font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  font-family: var(--font-ui); font-size: .92rem; text-decoration: none; color: var(--fg);
  padding: 8px 12px; border-radius: var(--radius); border: 1px solid transparent;
}
.nav-link:hover, .nav-link[aria-current="page"] { border-color: var(--rule); color: var(--accent); }
.nav__cta { margin-left: 8px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--rule); color: var(--fg); padding: 10px 16px; min-height: 44px; border-radius: var(--radius); font-family: var(--font-ui); font-size: .95rem; cursor: pointer; }

/* ---------- control line (Direction A signature) ---------- */
.control-line { display: flex; height: 8px; width: 100%; margin: 28px 0; border-radius: 999px; overflow: hidden; }
.control-line span { display: block; height: 100%; }
.control-line .cleared { background: var(--positive); flex: 3; }
.control-line .hairline { background: var(--accent); flex: 0 0 2px; }
.control-line .restricted { background: var(--signal); flex: 1; }
.signature-line {
  font-family: var(--font-mono); font-size: .8rem; color: var(--muted);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.signature-line .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--cleared { background: var(--positive); }
.dot--restricted { background: var(--signal); }

/* ---------- hero ---------- */
.hero { padding: 72px 0 24px; }
.hero h1 { max-width: 18ch; }
.hero .lede { margin-top: 1rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; font-family: var(--font-ui); font-size: .95rem; font-weight: 600;
  text-decoration: none; padding: 13px 22px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--accent); transition: transform .15s ease, background-color .15s ease, color .15s ease;
}
.btn--primary { background: var(--accent); color: var(--ink); }
.btn--primary:hover { transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--rule); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--signal { background: var(--signal); border-color: var(--signal); color: var(--bone); }
.btn--block { display: block; width: 100%; text-align: center; }

/* ---------- cards / grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg);
}
a.card:hover { border-color: var(--accent); }
.card__kicker { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; }
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
.card__more { font-family: var(--font-ui); font-size: .85rem; color: var(--accent); margin-top: auto; }

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.metric { border-left: 2px solid var(--accent); padding-left: 16px; }
.metric__num { font-family: var(--font-display); font-size: 2rem; color: var(--fg); }
.metric__label { color: var(--muted); font-size: .92rem; }

/* ---------- personas ---------- */
.persona { border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; background: var(--surface); }
.persona h3 { font-size: 1.05rem; }

/* ---------- people / monograms ---------- */
.people-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.person { display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: var(--fg); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; background: var(--surface); }
a.person:hover { border-color: var(--accent); }
.monogram {
  flex: 0 0 64px; width: 64px; height: 64px; border-radius: var(--radius);
  background: var(--ink-2); border: 1px solid var(--accent); color: var(--accent);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.3rem; font-weight: 600;
}
.monogram--lg { width: 120px; height: 120px; flex-basis: 120px; font-size: 2.4rem; }
.person__role { color: var(--accent); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; font-family: var(--font-mono); }
.person__spec { color: var(--muted); font-size: .92rem; }

/* ---------- breadcrumbs ---------- */
.breadcrumb { font-size: .82rem; color: var(--muted); padding: 18px 0 0; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current] { color: var(--fg); }

/* ---------- regime / authority callout ---------- */
.callout { border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; background: var(--surface); }
.callout .reg-ref { color: var(--accent); }
.tag { display: inline-block; font-family: var(--font-mono); font-size: .72rem; padding: 3px 8px; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); }

/* ---------- FAQ ---------- */
.faq details { border-bottom: 1px solid var(--rule); padding: 14px 0; }
.faq summary { cursor: pointer; font-family: var(--font-display); font-size: 1.1rem; color: var(--fg); }
.faq summary::-webkit-details-marker { color: var(--accent); }
.faq p { margin-top: 10px; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .88rem; color: var(--fg); }
.field input, .field textarea, .field select {
  font-family: var(--font-ui); font-size: 1rem; color: var(--fg); background: var(--bg);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 11px 13px;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); outline: none; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note { font-size: .82rem; color: var(--muted); }

/* ---------- gated tools ---------- */
.tool { max-width: 720px; }
.tool__progress { font-family: var(--font-mono); font-size: .78rem; color: var(--accent); letter-spacing: .08em; }
.tool fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; margin: 18px 0; }
.tool legend { font-family: var(--font-display); font-size: 1.2rem; padding: 0 8px; }
.tool .opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; }
.tool .opt:hover { border-color: var(--accent); }
.tool .opt input { margin-top: 4px; }
.tool__nav { display: flex; gap: 12px; justify-content: space-between; margin-top: 12px; }
.band { border-left: 4px solid var(--accent); padding: 16px 18px; background: var(--surface); border-radius: var(--radius); margin: 16px 0; }
.band--low { border-color: var(--positive); }
.band--elevated { border-color: var(--accent); }
.band--urgent { border-color: var(--signal); }

/* ---------- insights / article ---------- */
.byline { font-size: .9rem; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.byline .author { color: var(--fg); }
.article__body { max-width: 72ch; }
.article__body p:first-of-type { font-size: 1.12rem; color: var(--fg); }

/* ---------- footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--rule); padding: 56px 0 40px; margin-top: 64px; font-size: .9rem; }
.footer__cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
.footer h4 { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.footer a { color: var(--muted); text-decoration: none; display: block; padding: 3px 0; }
.footer a:hover { color: var(--accent); }
.footer__disclaimer { color: var(--muted); font-size: .82rem; line-height: 1.6; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rule); max-width: 90ch; }
.footer__legal { color: var(--muted); font-size: .82rem; margin-top: 14px; }

/* ---------- utilities ---------- */
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }
.cta-band { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 40px; text-align: center; }
.placeholder-body { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 18px 20px; color: var(--muted); font-size: .92rem; }

/* ============ Breakpoint: 900–1199 ============ */
@media (max-width: 1199px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer__cols { grid-template-columns: 1fr 1fr; }
}

/* ============ Breakpoint: <=900 (mobile) ============ */
@media (max-width: 900px) {
  body { font-size: 16px; }
  .nav { position: fixed; inset: 0 0 0 auto; width: min(78vw, 320px); flex-direction: column; align-items: stretch;
         background: var(--surface); border-left: 1px solid var(--rule); padding: 80px 20px 24px; gap: 4px;
         transform: translateX(100%); transition: transform .25s ease; z-index: 60; }
  .nav[data-open="true"] { transform: translateX(0); }
  .nav-link { min-height: 44px; display: flex; align-items: center; padding: 11px 12px; }
  .nav-toggle { display: inline-flex; align-items: center; z-index: 70; }
  .grid-2, .grid-3, .grid-4, .metrics, .people-grid { grid-template-columns: 1fr; }
  .footer__cols { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
  .hero { padding: 48px 0 16px; }
  .ticker { display: none; }
  .cta-band { padding: 28px 20px; }
}

/* ============ prefers-reduced-motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .nav { transition: none; }
}
