/* ==========================================================================
   SignLater Design 2.0 — Shared Components
   Requires: tokens.css (load first).

   Amber law: amber appears ONLY on reveal elements (Second Number, delta,
   gap segments, chart reveal encodings). Buttons are INK, never amber.
   ========================================================================== */

/* ---------- Layout ---------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: var(--wrap-narrow); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow {
  font-size: var(--fs-eyebrow); letter-spacing: .16em; font-weight: var(--fw-bold);
  color: var(--muted); text-transform: uppercase;
}

/* ---------- Skip link (GATE 10) ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 12px 20px;
  border-radius: 0 0 var(--r-6) 0; font-weight: var(--fw-bold);
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253,253,251,.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.site-nav.scrolled {
  border-bottom-color: var(--hairline);
  box-shadow: 0 8px 24px -16px rgba(27,27,25,.18);
}
.nav-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: var(--s-8); height: 72px;
}
.wordmark { font-weight: var(--fw-black); font-size: 20px; letter-spacing: -.02em; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav-links { display: flex; gap: var(--s-6); margin-left: auto; align-items: center; }
.nav-links a {
  text-decoration: none; font-size: var(--fs-small); font-weight: var(--fw-medium);
  color: var(--muted); padding: var(--s-3) var(--s-2); border-radius: var(--r-6);
  min-height: 44px; display: inline-flex; align-items: center;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: var(--fw-bold); }
.nav-cta {
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  border-radius: var(--r-6); padding: 12px 22px; font-weight: var(--fw-bold);
  font-size: var(--fs-small); text-decoration: none; min-height: 44px;
  display: inline-flex; align-items: center;
}
.nav-cta:hover { background: #2A2A26; }

/* Search trigger */
.nav-search-btn {
  background: var(--field1); border: 1px solid var(--hairline);
  border-radius: var(--r-6); padding: 10px 14px; font-size: var(--fs-small);
  color: var(--muted); display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px;
}
.nav-search-btn kbd {
  font-family: inherit; font-size: 11px; background: var(--paper);
  border: 1px solid var(--hairline); border-radius: var(--r-3); padding: 2px 6px;
}

/* Mobile menu button */
.menu-btn {
  display: none; background: none; border: 1px solid var(--hairline);
  border-radius: var(--r-6); min-width: 44px; min-height: 44px;
  align-items: center; justify-content: center;
}

/* Mobile full-screen menu */
.mobile-menu {
  position: fixed; inset: 0; z-index: 150; background: var(--paper);
  transform: translateY(-100%); visibility: hidden;
  transition: transform .45s var(--ease), visibility 0s linear .45s;
  overflow-y: auto; padding: 88px var(--gutter-mobile) var(--s-12);
}
.mobile-menu.open { transform: translateY(0); visibility: visible; transition: transform .45s var(--ease); }
.mobile-menu .mm-close {
  position: absolute; top: 14px; right: var(--gutter-mobile);
  min-width: 44px; min-height: 44px; border-radius: var(--r-6);
  border: 1px solid var(--hairline); background: var(--paper);
  font-size: 20px;
}
.mm-dec { display: block; padding: var(--s-4) 0; border-bottom: 1px solid var(--hairline); text-decoration: none; min-height: 44px; }
.mm-dec .t { display: block; font-size: 19px; font-weight: var(--fw-bold); }
.mm-dec .n { display: block; font-size: 15px; color: var(--amber); font-weight: var(--fw-bold); margin-top: 2px; }

/* Mega menu (desktop instruments dropdown) */
.mega-wrap { position: relative; }
.mega {
  position: absolute; top: calc(100% + 12px); left: 50%; translate: -50% 8px;
  width: min(720px, 90vw); background: var(--paper); border: 1px solid var(--hairline);
  border-radius: var(--r-8); box-shadow: var(--sh-card); padding: var(--s-6);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--t-med) var(--ease), translate var(--t-med) var(--ease), visibility 0s linear var(--t-med);
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); z-index: 120;
}
.mega-wrap:hover .mega, .mega-wrap:focus-within .mega { opacity: 1; visibility: visible; pointer-events: auto; translate: -50% 0; transition: opacity var(--t-med) var(--ease), translate var(--t-med) var(--ease); }
.mega a {
  display: block; padding: var(--s-4); border-radius: var(--r-6); text-decoration: none;
  border: 1px solid transparent;
}
.mega a:hover { background: var(--field1); border-color: var(--hairline); }
.mega .mt { font-weight: var(--fw-bold); font-size: var(--fs-small); }
.mega .mn { color: var(--amber); font-weight: var(--fw-bold); font-size: var(--fs-small); margin-top: 2px; }
.mega .md { color: var(--muted); font-size: var(--fs-caption); margin-top: 2px; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { background: var(--inkbg); color: #EDEDE8; padding: var(--s-20) 0 var(--s-8); }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: var(--s-12);
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
}
.footer-brand .wordmark { color: #fff; }
.footer-promise { color: #A8A8A0; font-size: var(--fs-small); margin-top: var(--s-4); max-width: 300px; }
.footer-promise .sn { color: var(--amber-on-dark); font-weight: var(--fw-bold); }
.footer-col h4 {
  font-size: var(--fs-eyebrow); letter-spacing: .14em; text-transform: uppercase;
  color: #8A8A82; margin-bottom: var(--s-4);
}
.footer-col a {
  display: block; color: #C9C9C2; text-decoration: none; font-size: var(--fs-small);
  padding: 7px 0; min-height: 44px;
}
.footer-col a:hover { color: #fff; }
/* Phase E: alternate footer structure (search, article) — same 44px hit areas */
.site-footer nav[aria-label] a {
  display: block; min-height: 44px; padding: 10px 0;
  color: #C9C9C2; text-decoration: none; font-size: var(--fs-small);
}
.site-footer nav[aria-label] a:hover { color: #fff; }
.footer-base {
  max-width: var(--wrap); margin: var(--s-16) auto 0; padding: var(--s-6) var(--gutter) 0;
  border-top: 1px solid var(--hairline-dark);
  display: flex; justify-content: space-between; gap: var(--s-6); flex-wrap: wrap;
  font-size: var(--fs-caption); color: #8A8A82;
}
.footer-nogate { color: #A8A8A0; }

/* ==========================================================================
   TRUST TAXONOMY
   ========================================================================== */
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
.trust-card {
  background: var(--paper); border: 1px solid var(--hairline);
  border-top: 3px solid var(--ink); border-radius: var(--r-8); padding: var(--s-6);
}
.trust-card .tt { font-weight: var(--fw-bold); font-size: var(--fs-small); margin-bottom: var(--s-2); }
.trust-card .td { font-size: var(--fs-caption); color: var(--muted); line-height: 1.55; }
.trust-card.is-verified   { border-top-color: var(--green); }
.trust-card.is-calculated { border-top-color: var(--ink); }
.trust-card.is-illustrative { border-top-color: var(--faint); }
.trust-card.is-estimated  { border-top-color: var(--amber); } /* amber = genuine uncertainty range */

.tax-label {
  display: inline-block; font-size: 10.5px; font-weight: var(--fw-bold);
  letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
  border: 1px solid var(--hairline); border-radius: var(--r-3); padding: 3px 8px;
  background: var(--paper);
}

/* ==========================================================================
   BUTTONS & LINKS — primary is INK, never amber
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  border-radius: var(--r-6); font-weight: var(--fw-bold); font-size: var(--fs-small);
  padding: 13px 24px; min-height: 44px; text-decoration: none;
  border: 1px solid transparent; transition: background var(--t-fast) var(--ease);
}
.btn-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-ink:hover { background: #2A2A26; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-light { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.btn-light:hover { background: rgba(255,255,255,.14); }

.link-arrow { font-weight: var(--fw-bold); text-decoration: underline; text-underline-offset: 4px; }
.link-arrow:hover { color: var(--amber); } /* hover-only affordance, not persistent amber */

/* ==========================================================================
   SLIDERS + NUMERIC INPUTS — two-way bound, 44px targets
   ========================================================================== */
.ctl { margin-bottom: var(--s-6); }
.ctl-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s-2); }
.ctl-top label { font-weight: var(--fw-bold); font-size: var(--fs-small); }
.ctl-row { display: flex; align-items: center; gap: var(--s-4); min-height: 44px; }

input[type="range"].slider {
  -webkit-appearance: none; appearance: none; flex: 1; height: 44px;
  background: transparent; cursor: pointer; margin: 0;
}
input[type="range"].slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: var(--r-3); background: var(--field2);
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px;
  border-radius: 50%; background: var(--paper); border: 3px solid var(--ink);
  margin-top: -11px; box-shadow: 0 2px 6px rgba(27,27,25,.25);
}
input[type="range"].slider::-moz-range-track {
  height: 6px; border-radius: var(--r-3); background: var(--field2);
}
input[type="range"].slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--paper);
  border: 3px solid var(--ink); box-shadow: 0 2px 6px rgba(27,27,25,.25);
}

.num-in {
  width: 120px; padding: 11px 14px; border: 1px solid var(--hairline);
  border-radius: var(--r-6); background: var(--paper); text-align: right;
  font-weight: var(--fw-bold); min-height: 44px;
}
.num-in:focus { border-color: var(--ink); outline: none; }

.field-err {
  display: none; color: var(--red); font-size: var(--fs-caption); margin-top: var(--s-1);
}
.ctl.invalid .field-err { display: block; }
.ctl.invalid .num-in { border-color: var(--red); }

/* ==========================================================================
   STATE BADGES — Illustrative / Your scenario / assumed tags
   ========================================================================== */
.state-badge {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-caption); font-weight: var(--fw-bold);
  border: 1px solid var(--hairline); border-radius: var(--r-pill);
  padding: 7px 14px; background: var(--paper); color: var(--muted);
  min-height: 32px;
}
.state-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.state-badge.is-yours { color: var(--ink); border-color: var(--ink); }
.state-badge.is-yours .dot { background: var(--green); }

.assumed-tag {
  font-size: 11px; color: var(--faint); border-bottom: 1px dotted var(--faint);
  margin-left: var(--s-2); font-weight: var(--fw-medium);
}
.edited-tag {
  font-size: 11px; color: var(--green); font-weight: var(--fw-bold); margin-left: var(--s-2);
}

/* ==========================================================================
   METHODOLOGY / ASSUMPTIONS PANELS
   ========================================================================== */
.panel {
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: var(--r-8); padding: var(--s-8);
}
.panel h3 { font-size: var(--fs-h3); margin-bottom: var(--s-2); }
.panel .psub { color: var(--muted); font-size: var(--fs-small); margin-bottom: var(--s-6); }
.assump-row {
  display: grid; grid-template-columns: 180px 1fr; gap: var(--s-4);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--hairline); font-size: var(--fs-small);
}
.assump-row:last-child { border-bottom: none; }
.assump-row .k { font-weight: var(--fw-bold); }
.assump-row .v { color: var(--muted); }

details.method { border-top: 1px solid var(--hairline); padding: var(--s-4) 0; }
details.method summary {
  font-weight: var(--fw-bold); font-size: var(--fs-small); cursor: pointer;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  min-height: 44px;
}
details.method summary::-webkit-details-marker { display: none; }
details.method summary::after { content: "+"; font-size: 20px; color: var(--muted); }
details.method[open] summary::after { content: "–"; }
details.method .formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-caption);
  background: var(--field1); border-radius: var(--r-3); padding: var(--s-3) var(--s-4);
  margin: var(--s-3) 0; overflow-x: auto;
}

/* ==========================================================================
   BEFORE-YOU-SIGN CHECKLIST
   ========================================================================== */
.bys { background: var(--inkbg); color: #EDEDE8; border-radius: var(--r-8); padding: var(--s-12); }
.bys .eyebrow { color: #8A8A82; }
.bys h2 { color: #fff; font-size: var(--fs-h2); margin: var(--s-3) 0 var(--s-2); }
.bys .bsub { color: #A8A8A0; margin-bottom: var(--s-8); }
.bys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.bys-card {
  background: var(--inkbg2); border: 1px solid var(--hairline-dark);
  border-radius: var(--r-6); padding: var(--s-6);
  transition: border-color var(--t-fast) var(--ease);
}
.bys-card:hover { border-color: #5A5A52; }
.bys-card .qn { color: var(--amber-on-dark); font-size: var(--fs-caption); font-weight: var(--fw-bold); }
.bys-card p { font-size: var(--fs-small); margin-top: var(--s-2); color: #D8D8D2; }
.bys-card p b, .bys-card p strong { color: #fff; }

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */
.crumbs {
  display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap;
  font-size: var(--fs-caption); color: var(--faint);
}
.crumbs a { color: var(--muted); text-decoration: none; padding: 10px 4px; min-height: 44px; display: inline-flex; align-items: center; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs .sep { color: var(--hairline); }

/* ==========================================================================
   SECOND NUMBER — the brand asset
   ========================================================================== */
.second-number {
  color: var(--amber); font-weight: var(--fw-black); letter-spacing: -.03em;
  line-height: 1;
}
.sn-hero { font-size: clamp(72px, 9vw, 150px); }
.sn-large { font-size: clamp(56px, 7vw, 104px); }
.sn-med { font-size: clamp(40px, 5vw, 64px); }

.delta-pill {
  display: inline-block; background: var(--amber-wash); color: var(--amber);
  border: 1px solid var(--amber-pale); border-radius: var(--r-6);
  font-weight: var(--fw-bold); font-size: var(--fs-small); padding: 8px 16px;
}
.on-dark .second-number { color: var(--amber-on-dark); }
.on-dark .delta-pill { background: rgba(232,163,61,.12); border-color: rgba(232,163,61,.35); color: var(--amber-on-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .trust-grid { grid-template-columns: 1fr 1fr; }
  .bys-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .mega { display: none; } /* mobile uses full-screen menu instead */
}
@media (max-width: 640px) {
  .wrap, .wrap-narrow, .nav-inner { padding-left: var(--gutter-mobile); padding-right: var(--gutter-mobile); }
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; }
  .trust-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-8); }
  .assump-row { grid-template-columns: 1fr; gap: var(--s-1); }
  .num-in { width: 110px; }
}
