/* Trauma Response Assessment
   Every colour here is from BUILD-SPEC §4. No others are used anywhere. */

:root {
  --page:            #FAF9F7;
  --card:            #FFFFFF;
  --text-primary:    #1A1A18;
  --text-secondary:  #57564F;
  --text-muted:      #85837A;
  --border:          #E5E3DD;
  --border-strong:   #CFCCC4;
  --gold:            #EFC64C;
  --on-gold:         #2C2C2A;
  --panel:           #151412;
  --panel-text:      #F5F4F1;
  --panel-secondary: #A8A69E;
  --panel-muted:     #7E7C75;
  --panel-divider:   #35322D;
  --notice-bg:       #FAEEDA;
  --notice-text:     #6B4A0B;
  --radius:          8px;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  /* iOS Safari: without this the address bar can crop the last row of buttons */
  min-height: 100svh;
}

/* The serif is never bold. Size carries the weight, per spec. */
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; margin: 0; }

/* Every figure in the build lines up in columns. */
.num, .score, tbody td { font-variant-numeric: tabular-nums; }

button, input, select { font: inherit; color: inherit; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- shell */

.wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 2.75rem;
}

.logo { display: block; width: 190px; max-width: 55vw; height: auto; margin: 0 auto 2.5rem; }

.legal { font-size: 11px; line-height: 1.5; color: var(--text-muted); }

.view[hidden] { display: none !important; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: 52px; padding: .9rem 1.5rem;
  background: var(--gold); color: var(--on-gold);
  font-size: 16px; font-weight: 500; line-height: 1.2;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: opacity .15s ease;
}
.btn:hover:not(:disabled) { opacity: .88; }
.btn:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

/* Back is a plain text link, not a button. Spec §5.2. */
.back {
  display: inline-block; margin-top: 1.5rem;
  font-size: 15px; color: var(--text-muted);
  background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline;
}

/* ---------------------------------------------------------------- landing */

.landing { text-align: center; }
.eyebrow {
  font-size: 13px; color: var(--text-muted);
  margin: 0 0 1.25rem; letter-spacing: .01em;
}
.landing h1 { font-size: 42px; line-height: 1.12; letter-spacing: -.015em; margin: 0 0 1.5rem; }
.landing .sub {
  font-size: 17px; line-height: 1.65; color: var(--text-secondary);
  margin: 0 auto 2.25rem; max-width: 34rem;
}
.landing .trust { font-size: 13px; color: var(--text-muted); margin: 1rem 0 2rem; }

/* ---------------------------------------------------------------- quiz */

.progress-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: .75rem;
}
.screen-label { font-size: 12px; color: var(--text-muted); letter-spacing: .01em; }

.bar { display: flex; gap: 4px; margin-bottom: 2.25rem; }
.bar span {
  flex: 1; height: 3px; border-radius: 2px; background: var(--border);
}
.bar span.on { background: var(--text-primary); }

.q-headline { font-size: 26px; line-height: 1.25; margin: 0 0 .75rem; }
.q-instruction { font-size: 15px; color: var(--text-secondary); margin: 0 0 2.5rem; }

.item + .item { margin-top: 2.25rem; padding-top: 2.25rem; border-top: 0.5px solid var(--border); }
.item .statement { font-size: 17px; line-height: 1.5; margin: 0 0 1rem; }

/* Five equal columns that must survive down to 360px without wrapping. */
.scale { display: flex; gap: 6px; }
.scale button {
  flex: 1 1 0; min-width: 0;                 /* min-width:0 is what stops the overflow */
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  min-height: 62px; padding: .6rem .25rem;
  background: var(--card); color: var(--text-secondary);
  border: 0.5px solid var(--border); border-radius: var(--radius);
  font-size: 12px; line-height: 1.25; text-align: center; cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.scale button .dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: transparent; flex: none;
}
.scale button:hover { border-color: var(--border-strong); }
.scale button[aria-pressed="true"] {
  background: var(--gold); color: var(--on-gold); border-color: var(--gold);
}
.scale button[aria-pressed="true"] .dot { background: var(--on-gold); border-color: var(--on-gold); }
.scale button .lbl { display: block; overflow-wrap: normal; word-break: keep-all; }

.actions { margin-top: 2.75rem; }

/* ---------------------------------------------------------------- screen 5 */

.choice { display: flex; flex-direction: column; gap: 10px; }
.choice button {
  display: flex; align-items: flex-start; gap: .9rem; width: 100%;
  padding: 1.15rem 1.25rem; text-align: left; cursor: pointer;
  background: var(--card); border: 0.5px solid var(--border); border-radius: var(--radius);
  transition: background .12s ease, border-color .12s ease;
}
.choice button:hover { border-color: var(--border-strong); }
.choice button[aria-pressed="true"] { background: #FDFBF4; border-color: var(--gold); }
.choice .radio {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--card);
  display: grid; place-items: center;
}
.choice button[aria-pressed="true"] .radio { background: var(--gold); border-color: var(--gold); }
.choice .radio svg { display: none; }
.choice button[aria-pressed="true"] .radio svg { display: block; }
.choice .keyword { font-weight: 500; }
.choice .text { color: var(--text-secondary); }
.choice .copy { font-size: 16px; line-height: 1.5; }

/* ---------------------------------------------------------------- gate */

.gate-stack { position: relative; }
.blurred {
  filter: blur(7px);
  -webkit-user-select: none; user-select: none;
  pointer-events: none;
  /* The panel overlaps this with a negative margin, so some of it must show
     above and around the panel. Spec §5.4. */
  max-height: 420px; overflow: hidden;
}
.gate-panel {
  position: relative; z-index: 2;
  margin: -300px auto 0; max-width: 560px;
  background: var(--card); border: 0.5px solid var(--border-strong); border-radius: 14px;
  padding: 2.5rem;
}
.gate-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem;
}
.gate-status { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--text-secondary); }
.gate-status svg { flex: none; }
.gate-step { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.gate-panel h2 { font-size: 28px; line-height: 1.2; margin: 0 0 .75rem; }
.gate-panel .sub { font-size: 15px; line-height: 1.6; color: var(--text-secondary); margin: 0 0 1.75rem; }
.gate-panel p + p { margin-top: .75rem; }

.field { margin-bottom: .75rem; }
.field input {
  width: 100%; min-height: 50px; padding: .8rem 1rem;
  background: var(--card); border: 0.5px solid var(--border-strong);
  border-radius: var(--radius); font-size: 16px;   /* 16px stops iOS zooming on focus */
}
.field input::placeholder { color: var(--text-muted); }
.field input[aria-invalid="true"] { border-color: #A3391F; }
.err { display: none; font-size: 13px; color: #A3391F; margin: .4rem 0 0; }
.err.on { display: block; }
.reassurance { font-size: 13px; color: var(--text-muted); margin: 1rem 0 0; text-align: center; }
.compliance { font-size: 11px; line-height: 1.5; color: var(--text-muted); margin: 1rem 0 0; }
.skip {
  display: block; width: 100%; margin: 1.25rem 0 0; padding: 0;
  background: none; border: none; cursor: pointer;
  font-size: 15px; color: var(--text-secondary); text-decoration: underline; text-align: center;
}
/* Honeypot: off-screen rather than display:none, which some bots skip. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- report */

.report-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding-bottom: .85rem; border-bottom: 1px solid var(--text-primary); margin-bottom: 2.25rem;
}
.report-head .t { font-size: 13px; font-weight: 500; }
.report-head .r { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.finding-label { font-size: 12px; color: var(--text-muted); margin: 0 0 .6rem; }
.finding-name { font-size: 30px; line-height: 1.15; margin: 0 0 .6rem; }
.finding-runner { font-size: 15px; color: var(--text-secondary); margin: 0; }

.chart { margin: 2.5rem 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-label { font-size: 12px; color: var(--text-muted); margin: 0 0 1rem; }

.notice {
  display: flex; gap: .85rem; align-items: flex-start;
  background: var(--notice-bg); color: var(--notice-text);
  border-radius: var(--radius); padding: 1rem 1.15rem;
  font-size: 14px; line-height: 1.55; margin: 2.25rem 0;
}
.notice svg { flex: none; margin-top: 2px; }

/* --- expandable responses --- */
.responses { margin-top: 2.5rem; }
details { border-top: 0.5px solid var(--border); }
details:last-of-type { border-bottom: 0.5px solid var(--border); }
summary {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem 0; cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
.rank-icon {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 0.5px solid var(--border-strong);
  display: grid; place-items: center; color: var(--text-secondary);
}
.rank-meta { flex: 1 1 auto; min-width: 0; }
.rank-label { font-size: 12px; color: var(--text-muted); }
/* All four rows use identical type sizes. Only ring fill and rank label differ. */
.rank-name { font-family: var(--serif); font-size: 19px; line-height: 1.25; }
.ring { flex: none; position: relative; width: 46px; height: 46px; }
.ring svg { display: block; }
.ring .score {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 500;
}
.chev { flex: none; color: var(--text-muted); transition: transform .18s ease; }
details[open] .chev { transform: rotate(180deg); }

.detail { padding: 0 0 1.75rem; }
.detail p { font-size: 16px; line-height: 1.65; color: var(--text-secondary); margin: 0 0 1.25rem; }
.detail h4 {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--text-muted); margin: 1.5rem 0 .5rem;
}
.behaviors { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.behaviors li { font-size: 15px; line-height: 1.5; color: var(--text-secondary); }

/* --- offer panel: bleeds 0.5rem wider than the card on both sides --- */
.offer {
  background: var(--panel); color: var(--panel-text);
  border-radius: 12px; padding: 2.5rem 2rem;
  margin: 3rem -0.5rem 2rem;
}
.offer h3 { font-size: 30px; line-height: 1.18; margin: 0 0 1.25rem; color: var(--panel-text); }
.offer p { font-size: 15px; line-height: 1.7; color: var(--panel-secondary); margin: 0 0 1rem; }
.offer .hook { color: var(--panel-text); }
/* The only uppercase in the build, per spec §4. */
.offer .col-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--panel-muted); margin: 0 0 .85rem;
}
.offer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin: 2rem 0; }
.offer-cols ul { margin: 0; padding: 0; list-style: none; }
.offer-cols li { font-size: 14px; line-height: 1.5; color: var(--panel-secondary); padding: .3rem 0; }
.offer .price { font-family: var(--serif); font-size: 26px; color: var(--panel-text); margin: 0 0 .25rem; }
.offer .price-sub { font-size: 13px; color: var(--panel-muted); margin: 0; }
.offer .guarantees {
  display: flex; flex-wrap: wrap; gap: 1.25rem;
  border-top: 0.5px solid var(--panel-divider); border-bottom: 0.5px solid var(--panel-divider);
  padding: 1.15rem 0; margin: 1.75rem 0;
}
.offer .guarantees div { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--panel-secondary); }
.offer .closer { color: var(--panel-text); margin-bottom: 1.5rem; }
.offer .btn { text-decoration: none; }
.offer .url { font-size: 12px; color: var(--panel-muted); text-align: center; margin: .85rem 0 0; word-break: break-all; }

/* Shipped hidden. No normative data exists yet; spec §11. */
.percentile { display: none; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 720px) {
  .wrap { padding: 2rem 1rem 3rem; }
  .card { padding: 1.25rem; border-radius: 12px; }
  .landing h1 { font-size: 32px; }
  .landing .sub { font-size: 16px; }
  .q-headline { font-size: 22px; }
  .gate-panel { padding: 1.5rem; margin-top: -280px; }
  .gate-panel h2 { font-size: 24px; }
  .finding-name { font-size: 26px; }
  .offer { padding: 1.75rem 1.25rem; margin-left: -0.5rem; margin-right: -0.5rem; }
  .offer h3 { font-size: 24px; }
  .offer-cols { grid-template-columns: 1fr; gap: 1.5rem; }
  .behaviors { grid-template-columns: 1fr; }
  .item + .item { margin-top: 1.75rem; padding-top: 1.75rem; }
  /* Title and ref fight for one line at 375px; stack them instead of
     letting "Trauma response profile" break over three. */
  .report-head { flex-direction: column; align-items: flex-start; gap: .35rem; }
}

/* The five buttons stay in one row to 360px. Only the labels shrink. */
@media (max-width: 460px) {
  .scale { gap: 4px; }
  .scale button { font-size: 11px; padding: .55rem .15rem; min-height: 58px; letter-spacing: -.01em; }
}
/* "Sometimes" is the longest single word on the scale and it decides the floor
   here: at 375px it needs 52.6px and only had 51.4px, so it split into an
   orphaned "s". Buy the room back from the gap and the padding, then shave the
   font. Two-word labels like "Almost always" still wrap, which is fine. */
/* "Sometimes" is the longest single word on the scale and it sets the floor
   here. Rather than shrink the type until it is unreadable, take the width
   back from the card padding: at 375px that returns 8px, which is more than
   the word was short by. Two-word labels like "Almost always" still wrap over
   two lines, which is fine; a word split into an orphaned "s" is not. */
@media (max-width: 400px) {
  .card { padding: 1rem; }
  .scale { gap: 2px; }
  .scale button { font-size: 10px; padding: .55rem 0; gap: 5px; }
  .scale button .dot { width: 8px; height: 8px; }
}

/* ---------------------------------------------------------------- index */

.quiz-list { display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 2rem 0 0; }
.quiz-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.25rem 1.35rem; text-decoration: none; color: inherit;
  background: var(--card); border: 0.5px solid var(--border); border-radius: var(--radius);
  transition: border-color .12s ease;
}
.quiz-row:hover { border-color: var(--border-strong); }
.quiz-copy { flex: 1 1 auto; min-width: 0; }
.quiz-title { display: block; font-family: var(--serif); font-size: 20px; line-height: 1.25; }
.quiz-blurb {
  display: block; margin-top: .3rem; font-size: 14px; line-height: 1.5;
  color: var(--text-secondary);
}
.quiz-go { flex: none; color: var(--text-muted); font-size: 18px; }
