/* Rate C v2 form (memory/rate-c-spec.md). Palette mirrors public/rate_a.html.
   Self-hosted Outfit (SIL OFL, public/fonts/Outfit-OFL.txt) so the strict CSP
   can keep font-src 'self'. Layout uses classes and the hidden attribute only. */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/fonts/outfit-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --teal:       #2AAFBF;
  /* teal-dark and silver are darker than the site palette (#1A8A99, #8A9BB0)
     so Rate C text meets WCAG AA 4.5:1 on white, cloud and the pink pill (P4 axe). */
  --teal-dark:  #167683;
  --teal-light: #E6F7F9;
  --navy:       #1C2B3A;
  --slate:      #4A5568;
  --silver:     #616D7C;
  --cloud:      #F4F8FA;
  --white:      #FFFFFF;
  --rule:       #D6E4EA;
  --amber:      #F59E0B;
  --amber-light:#FEF3C7;
  --red:        #C62828;
  --red-light:  #FDECEA;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--navy);
  background: var(--cloud);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Nav ── */
.nav {
  background: rgba(255,255,255,0.97);
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px; height: 60px; position: sticky; top: 0; z-index: 100;
}
.nav-logo { display: inline-flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 700; color: var(--navy); text-decoration: none; letter-spacing: -0.02em; }
.nav-logo-text span { color: var(--teal); }
.nav-logo-icon { display: block; width: 28px; height: 28px; }
.nav-links { display: flex; gap: 12px; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 500; color: var(--navy); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.nav-link:hover { background: var(--cloud); }
.nav-link-icon { flex: none; }

/* ── Page ── */
/* Bottom room so any revealed section's header can scroll up under the nav,
   and a collapsing section never shortens the page under the reader (that
   made S3 -> S4 snap instead of scroll; SA UAT P6a). */
.container { max-width: 600px; margin: 28px auto; padding: 0 16px max(72px, calc(100vh - 160px)); }
.form-header { margin-bottom: 20px; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.header-line2 { color: var(--teal-dark); font-size: 1.2rem; font-weight: 500; }
.header-time { color: var(--silver); font-size: 0.88rem; }

.identity-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--rule); border-radius: 8px;
  padding: 8px 14px; margin-bottom: 16px; font-size: 0.83rem; color: var(--slate);
}
.identity-bar strong { color: var(--navy); }
.logout-link { color: var(--slate); text-decoration: none; font-weight: 500; flex-shrink: 0; }
.logout-link:hover { text-decoration: underline; }

.page-error {
  background: var(--red-light); border: 1px solid var(--red); color: var(--red);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem;
}

/* ── Sections ── */
.sec {
  border: 1px solid var(--rule); border-radius: 10px; background: var(--white);
  padding: 14px 18px 18px; margin-bottom: 14px; min-width: 0;
  scroll-margin-top: 72px; /* clear the sticky nav when a section is revealed */
}
.sec > legend {
  font-size: 1.05rem; font-weight: 600; padding: 0 6px; margin-left: -6px; color: var(--navy);
  /* reveal() scrolls the LEGEND into view, so it needs its own clearance below
     the 60px sticky nav (the .sec margin above doesn't apply to it; SA UAT P6a). */
  scroll-margin-top: 76px;
}
.sec > legend:focus { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.sec-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5em; height: 1.5em; border-radius: 50%;
  background: var(--teal-light); color: var(--teal-dark); font-size: 0.85em; font-weight: 700;
}
.sec[data-mode="complete"] { padding-bottom: 12px; }
.sec[data-mode="complete"] .sec-num { background: var(--teal); color: var(--white); }

.sec-summary { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.92rem; color: var(--slate); }
.summary-text { overflow-wrap: anywhere; }
.change-link {
  background: none; border: none; color: var(--teal-dark); font: inherit; font-weight: 600;
  cursor: pointer; padding: 4px 2px; flex-shrink: 0; text-decoration: underline;
}

/* ── Fields ── */
.field { margin-top: 14px; border: none; min-width: 0; }
.field > label, .radio-group > legend { display: block; font-size: 0.92rem; font-weight: 500; margin-bottom: 6px; }
input[type="text"], input[type="email"], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--navy);
  border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: var(--white);
}
input[readonly] { background: var(--cloud); color: var(--slate); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
[aria-invalid="true"] { border-color: var(--red); }
textarea { resize: vertical; }

.radio-group { padding: 0; }
.radio-label, .check-label { display: flex; align-items: flex-start; gap: 8px; font-size: 0.95rem; padding: 6px 0; cursor: pointer; }
.radio-label input, .check-label input { margin-top: 4px; flex-shrink: 0; width: 1.05em; height: 1.05em; accent-color: var(--teal-dark); }

.amount-wrap { display: flex; align-items: stretch; }
.amount-prefix {
  display: flex; align-items: center; padding: 0 12px; font-weight: 600; color: var(--slate);
  background: var(--cloud); border: 1px solid var(--rule); border-right: none; border-radius: 8px 0 0 8px;
}
.amount-prefix:empty { display: none; }
.amount-prefix + input { border-radius: 0 8px 8px 0; }

.mjc-intro p { margin-top: 8px; font-size: 1rem; }
.mjc-intro p.hint { font-size: 0.85rem; }
.hint { font-size: 0.82rem; color: var(--silver); margin-top: 6px; }
.mjc-hint { margin: -2px 0 8px; color: var(--slate); }
/* S4 question (P6a): reads as the question it is, not a field caption. */
.field > label.mjc-question { font-size: 1rem; font-weight: 600; }
.notice {
  font-size: 0.86rem; color: var(--navy); background: var(--teal-light);
  border-radius: 6px; padding: 8px 10px; margin-top: 10px;
}
/* D2 (MJC < ETC): light-pink pill (SA 2026-10-07); still never blocks submit. */
.notice-warn { background: var(--red-light); }
/* "Review maximum justifiable cost" (S7) lands on S4 with the MJC box in the
   same light pink, so the traveler sees where to edit (SA 2026-10-09). Cleared
   on the first edit or when S4 is left. */
#ui_max_just_cost.review-highlight { background: var(--red-light); }
.field-error { color: var(--red); font-size: 0.85rem; margin-top: 6px; }
.field-error:empty { display: none; }

.btn-continue {
  margin-top: 18px; width: 100%; font: inherit; font-size: 1rem; font-weight: 600;
  color: var(--white); background: var(--teal-dark); border: none; border-radius: 8px;
  padding: 12px 16px; cursor: pointer;
}
.btn-continue:hover { background: var(--navy); }
.btn-continue:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ── S5 itinerary ── */
.airport-input { text-transform: uppercase; letter-spacing: 0.04em; }
.airport-input::placeholder { text-transform: none; letter-spacing: normal; }
input[type="date"] {
  width: 100%; font: inherit; font-size: 1rem; color: var(--navy); min-height: 44px;
  border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: var(--white);
}
.field-info { font-size: 0.85rem; color: var(--teal-dark); margin-top: 6px; }
.field-info:empty { display: none; }
.risk-high { color: var(--red); font-weight: 600; }
.summary-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.summary-hint { font-size: 0.82rem; color: var(--silver); overflow-wrap: anywhere; }
.summary-hint:empty { display: none; }

/* ── S6 cost + carbon ticket ── */
.inline-link { padding: 0; margin-left: 4px; text-align: left; }
.ct-block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.ct-block > legend { font-weight: 500; }
/* In S7 the CT opens the section, so no divider above it. */
#sec7 .ct-block { margin-top: 10px; padding-top: 0; border-top: none; }
.ct-question { display: block; font-size: 1rem; }
.btn-secondary {
  margin-top: 8px; font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--teal-dark);
  background: var(--white); border: 1px solid var(--teal-dark); border-radius: 8px; padding: 8px 14px; cursor: pointer;
}
.btn-continue:disabled { background: var(--silver); cursor: wait; }
.submit-blocked { margin-top: 14px; color: var(--slate); }

/* QR attendees (Rate C P7): session banner and the closed/paused message. */
.qr-banner {
  background: var(--teal-light); border: 1px solid var(--rule); border-radius: 8px;
  padding: 8px 14px; margin-bottom: 16px; font-size: 0.9rem; color: var(--navy);
}
.qr-inactive {
  background: var(--red-light); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 16px; font-size: 0.95rem; color: var(--navy);
}

/* New-user mode (?new=1): Turnstile slot above Submit; the "Got it" panel. */
.turnstile-box { margin: 16px 0 4px; min-height: 65px; }
.new-user-next { margin: 0 0 14px; font-size: 0.92rem; }
.new-user-done {
  background: var(--teal-light); border: 1px solid var(--rule); border-radius: 10px;
  padding: 20px 18px; font-size: 1.05rem; color: var(--navy);
}
.new-user-done p { margin: 0; }
.new-user-done:focus { outline: 2px solid var(--teal-dark); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
