:root {
  color-scheme: light;
  --ink: #1d241f;
  --muted: #5d665f;
  --soft: #f7f3ea;
  --paper: #fffdf7;
  --grid: #d8cfbd;
  --line: #d6cbbb;
  --brand: #176b57;
  --brand-strong: #0f4f40;
  --mint: #dff3e8;
  --amber: #f6bd4a;
  --amber-strong: #9b5c00;
  --coral: #f36f56;
  --blueprint: #263f68;
  --shadow: 0 24px 70px rgba(32, 42, 35, .12);
  --shadow-tight: 0 12px 30px rgba(32, 42, 35, .11);
  --radius-lg: 30px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --max: 1180px;
  --display: Georgia, 'Times New Roman', serif;
  --body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 107, 87, .045) 1px, transparent 1px),
    linear-gradient(rgba(23, 107, 87, .045) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(246, 189, 74, .24), transparent 34rem),
    var(--soft);
  background-size: 34px 34px, 34px 34px, auto, auto;
  font-family: var(--body);
  line-height: 1.55;
}

a { color: var(--brand-strong); text-decoration-thickness: .09em; text-underline-offset: .22em; }
p, a, label, span, input, textarea, button, summary, li { overflow-wrap: anywhere; }
a:hover { color: var(--amber-strong); }
img, svg { max-width: 100%; display: block; }
button, input, textarea { font: inherit; }
.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .8rem 1rem;
  background: var(--ink);
  color: white;
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 4px solid rgba(246, 189, 74, .85); outline-offset: 3px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 247, .9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(29, 36, 31, .08);
}
.nav-shell {
  width: min(var(--max), calc(100% - 32px));
  margin: auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 850; color: var(--ink); text-decoration: none; }
.brand span { letter-spacing: -.02em; }
.nav-links { display: flex; gap: .4rem; align-items: center; }
.nav-links a, .nav-cta { text-decoration: none; color: var(--ink); font-weight: 730; font-size: .94rem; padding: .62rem .78rem; border-radius: 999px; }
.nav-links a:hover { background: var(--mint); color: var(--brand-strong); }
.nav-cta { background: var(--ink); color: white; box-shadow: var(--shadow-tight); }

main { overflow: hidden; }
section { scroll-margin-top: 96px; }
.section-grid {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: center;
}
.section-grid > *, .hero-copy { min-width: 0; max-width: 100%; }
.hero { padding: clamp(2.3rem, 7vw, 6rem) 0 3rem; }
.eyebrow {
  margin: 0 0 .85rem;
  color: var(--brand-strong);
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .13em;
}
h1, h2, h3 { line-height: 1.04; margin: 0; letter-spacing: -.045em; overflow-wrap: anywhere; }
h1, h2 { font-family: var(--display); }
h1 { font-size: clamp(3rem, 8.2vw, 6.8rem); max-width: 9ch; }
h2 { font-size: clamp(2rem, 4.8vw, 4rem); }
h3 { font-size: clamp(1.18rem, 2vw, 1.55rem); }
.hero-lede, .section-heading p, .cryptic-section p, .limits-section p, .waitlist-section p, .final-cta p { color: var(--muted); font-size: clamp(1.03rem, 2vw, 1.2rem); }
.hero-lede { max-width: 58ch; }
.hero-actions, .form-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.35rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: .78rem 1.1rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #151713; background: var(--amber); border-color: #151713; box-shadow: 4px 4px 0 #151713; }
.button-primary:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 #151713; color: #151713; }
.button-ghost { border-color: rgba(29, 36, 31, .22); color: var(--ink); background: rgba(255, 253, 247, .62); }
.button-subtle { background: transparent; color: var(--brand-strong); border-color: rgba(23, 107, 87, .22); }
.trust-line, .small-note, .privacy-note, .field-help, .caveat { color: var(--muted); font-size: .92rem; }
.trust-line { border-left: 4px solid var(--amber); padding-left: .9rem; max-width: 44rem; }

.solver-card, .candidate-card, .parse-card, .feature-bento article, .limits-section, .waitlist-section, .trust-section, .faq-section, .final-cta {
  background: rgba(255, 253, 247, .9);
  border: 1px solid rgba(29, 36, 31, .12);
  box-shadow: var(--shadow);
}
.solver-card { border-radius: var(--radius-lg); padding: clamp(1rem, 3vw, 1.7rem); position: relative; }
.solver-card::before {
  content: '';
  position: absolute;
  inset: -10px;
  border: 2px dashed rgba(23, 107, 87, .22);
  border-radius: calc(var(--radius-lg) + 10px);
  pointer-events: none;
}
.card-topline { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.card-topline h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); }
.quota-pill, .result-label {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: .35rem .6rem;
  background: var(--mint);
  color: var(--brand-strong);
  font-weight: 850;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.solver-intro { color: var(--muted); }
.solver-form { display: grid; gap: .8rem; }
label, legend { font-weight: 850; }
textarea, input {
  width: 100%;
  border: 2px solid rgba(29, 36, 31, .18);
  border-radius: 16px;
  background: #fff;
  padding: .9rem 1rem;
  color: var(--ink);
  min-height: 48px;
}
textarea:focus, input:focus { border-color: var(--brand); }
.compact-fields { display: grid; grid-template-columns: 1.2fr .8fr; gap: .85rem; }
.mode-fieldset { border: 0; padding: 0; margin: .2rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.mode-fieldset legend { margin-bottom: .45rem; }
.radio-card { display: flex; gap: .55rem; align-items: center; padding: .8rem; border: 2px solid rgba(29, 36, 31, .16); border-radius: 15px; background: #fff; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--mint); }

.results-section, .feature-bento, .cryptic-section, .trust-section, .faq-section, .limits-section, .waitlist-section, .final-cta {
  width: min(var(--max), calc(100% - 32px));
  margin: clamp(2.5rem, 6vw, 5rem) auto;
}
.section-heading { max-width: 720px; margin-bottom: 1.5rem; }
.results-layout { display: grid; grid-template-columns: 1.15fr .85fr .9fr; gap: 1rem; align-items: stretch; }
.candidate-card, .parse-card { border-radius: var(--radius-md); padding: 1.1rem; }
.candidate-card.featured { background: #19251f; color: #fffaf0; }
.candidate-card.featured .caveat, .candidate-card.featured .result-facts, .candidate-card.featured p { color: rgba(255,250,240,.78); }
.candidate-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.candidate-head h3 { font-family: var(--mono); font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: .08em; margin-top: .18rem; }
.confidence { border-radius: 999px; padding: .4rem .62rem; font-weight: 850; font-size: .82rem; white-space: nowrap; }
.confidence.high { background: var(--mint); color: var(--brand-strong); }
.confidence.low { background: #f9ded8; color: #84321f; }
.result-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: 0 0 1rem; }
.result-facts div { padding: .72rem; border-radius: 13px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); }
dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: inherit; opacity: .78; }
dd { margin: .18rem 0 0; font-weight: 850; }
.explanation-box { background: rgba(255,253,247,.12); border: 1px solid rgba(255,255,255,.16); border-radius: 16px; padding: .95rem; }
.explanation-box h4 { margin: 0 0 .35rem; }
.text-button { border: 0; background: transparent; color: var(--amber); font-weight: 850; padding: .75rem 0 0; cursor: pointer; }
.state-stack { display: grid; gap: .75rem; }
.state-card { border-radius: var(--radius-md); padding: 1rem; border: 1px solid rgba(29,36,31,.12); background: var(--paper); }
.state-card.cached { border-left: 6px solid var(--brand); }
.state-card.warning { border-left: 6px solid var(--amber); }
.state-card.quota { border-left: 6px solid var(--coral); }
.state-card p { color: var(--muted); margin: .35rem 0; }
.inline-disclaimer { margin-top: 1rem; padding: .9rem 1rem; border-radius: 16px; background: var(--mint); color: var(--brand-strong); font-weight: 760; }

.cryptic-section { align-items: stretch; }
.cryptic-section > div, .parse-card { align-self: center; }
.parse-card ul { padding-left: 1.2rem; }
.parse-card li + li { margin-top: .55rem; }

.feature-bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature-bento .section-heading { grid-column: 1 / -1; }
.feature-bento article { min-height: 210px; border-radius: var(--radius-md); padding: 1.2rem; display: flex; flex-direction: column; justify-content: space-between; }
.feature-bento article:nth-of-type(1) { background: #193f35; color: #fffaf0; }
.feature-bento article:nth-of-type(1) p, .feature-bento article:nth-of-type(1) a { color: rgba(255,250,240,.86); }
.feature-bento .wide-card { grid-column: span 2; background: #fff0cc; }

.limits-section, .waitlist-section { border-radius: var(--radius-lg); padding: clamp(1.2rem, 4vw, 2rem); display: grid; grid-template-columns: .8fr 1.2fr; gap: 1.3rem; align-items: center; }
.limit-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.limit-cards article { background: #fff; border: 1px solid rgba(29,36,31,.12); border-radius: 16px; padding: 1rem; }
.limit-cards strong, .limit-cards span { display: block; }
.limit-cards span { color: var(--muted); margin-top: .35rem; }
.waitlist-section { background: #193f35; color: #fffaf0; }
.waitlist-section .eyebrow, .waitlist-section a, .waitlist-section p, .waitlist-section .field-help { color: rgba(255,250,240,.82); }
.waitlist-form { display: grid; gap: .7rem; }
.email-row { display: grid; grid-template-columns: 1fr auto; gap: .65rem; }

.trust-section, .faq-section, .final-cta { border-radius: var(--radius-lg); padding: clamp(1.2rem, 4vw, 2rem); }
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.trust-grid p { margin: 0; background: #fff; border: 1px solid rgba(29,36,31,.1); border-radius: 16px; padding: 1rem; font-weight: 730; }
details { border-top: 1px solid rgba(29,36,31,.12); padding: 1rem 0; }
details:last-child { border-bottom: 1px solid rgba(29,36,31,.12); }
summary { cursor: pointer; font-weight: 850; font-size: 1.08rem; }
details p { color: var(--muted); max-width: 78ch; }
.final-cta { text-align: center; background: var(--ink); color: #fffaf0; }
.final-cta p { color: rgba(255,250,240,.78); max-width: 720px; margin-left: auto; margin-right: auto; }

.site-footer { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; padding: 2rem 0 8rem; display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid rgba(29,36,31,.12); }
.site-footer p { color: var(--muted); margin: .35rem 0 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.cookie-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(920px, calc(100% - 32px)); z-index: 30; background: rgba(29,36,31,.96); color: #fffaf0; border-radius: 20px; padding: .85rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); }
.cookie-banner p { margin: 0; font-size: .88rem; flex: 1; color: rgba(255,250,240,.83); }
.cookie-banner div { display: flex; gap: .45rem; flex-wrap: wrap; }
.cookie-banner button { min-height: 38px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: white; padding: .45rem .72rem; font-weight: 800; cursor: pointer; }
.cookie-banner button:last-child { background: var(--amber); color: #151713; border-color: var(--amber); }

@media (max-width: 980px) {
  .nav-links { display: none; }
  .section-grid, .limits-section, .waitlist-section { grid-template-columns: 1fr; }
  h1 { max-width: 12ch; }
  .results-layout { grid-template-columns: 1fr 1fr; }
  .state-stack { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
  .feature-bento { grid-template-columns: 1fr 1fr; }
  .trust-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body { background-size: 24px 24px, 24px 24px, auto, auto; }
  .nav-shell { width: calc(100% - 20px); max-width: var(--max); min-height: 66px; }
  .brand span { font-size: .95rem; }
  .nav-cta { display: none; }
  .hero { padding-top: 2rem; }
  .section-grid, .results-section, .feature-bento, .cryptic-section, .trust-section, .faq-section, .limits-section, .waitlist-section, .final-cta { width: calc(100% - 20px); max-width: var(--max); }
  h1 { font-size: clamp(2.45rem, 12vw, 3.35rem); max-width: 8.9ch; overflow-wrap: normal; word-break: normal; hyphens: none; }
  h2 { font-size: clamp(1.85rem, 8vw, 2.55rem); }
  .eyebrow { font-size: .7rem; line-height: 1.45; letter-spacing: .11em; max-width: 32ch; }
  .hero-lede { max-width: 32ch; font-size: 1rem; }
  .hero-actions, .form-actions, .email-row { grid-template-columns: 1fr; display: grid; }
  .button { width: 100%; }
  .solver-card { padding: 1rem; border-radius: 22px; }
  .solver-card::before { display: none; }
  .card-topline { display: grid; }
  .quota-pill { width: 100%; justify-content: center; }
  .compact-fields, .mode-fieldset, .results-layout, .state-stack, .feature-bento, .limit-cards, .trust-grid { grid-template-columns: 1fr; }
  .feature-bento .wide-card { grid-column: auto; }
  .candidate-head { display: grid; }
  .confidence { width: max-content; }
  .result-facts { grid-template-columns: 1fr; }
  .site-footer { display: grid; padding-bottom: 10rem; }
  .cookie-banner { align-items: stretch; flex-direction: column; }
  .cookie-banner div { display: grid; grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .nav-links a, .candidate-card, .feature-bento article { transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
  .candidate-card:hover, .feature-bento article:hover { transform: translateY(-2px); }
}

/* Frontend v1 dynamic app additions */
.status-panel {
  margin-top: .9rem;
  border-radius: 16px;
  padding: .85rem 1rem;
  border: 1px solid rgba(29,36,31,.12);
  background: #fff;
  color: var(--muted);
}
.status-panel[data-state="success"], .status-panel[data-state="cached_success"] { border-left: 6px solid var(--brand); }
.status-panel[data-state="no_confident_answer"], .status-panel[data-state="validation_error"] { border-left: 6px solid var(--amber); }
.status-panel[data-state="quota_reached"], .status-panel[data-state="generic_error"] { border-left: 6px solid var(--coral); }
.demo-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.demo-controls button { border: 1px solid rgba(29,36,31,.14); background: #fff; border-radius: 999px; padding: .45rem .7rem; font-weight: 760; cursor: pointer; color: var(--brand-strong); }
.demo-controls button:hover { background: var(--mint); }
.results-empty { grid-column: 1 / -1; background: #fff; border: 1px dashed rgba(29,36,31,.25); border-radius: var(--radius-md); padding: 1.1rem; }
.candidate-list { display: contents; }
.error-list { margin: .5rem 0 0; padding-left: 1.1rem; color: #84321f; }
.waitlist-status { margin-top: .7rem; border-radius: 14px; background: rgba(255,253,247,.15); border: 1px solid rgba(255,255,255,.18); padding: .75rem; color: rgba(255,250,240,.88); }
.analytics-note { font-family: var(--mono); font-size: .78rem; overflow-wrap: anywhere; }
.legal-mini { font-size: .86rem; color: var(--muted); }
@media (max-width: 640px) { .demo-controls { display: grid; grid-template-columns: 1fr; } }
