@font-face {
  font-family: "Newsreader";
  src: url("./fonts/Newsreader-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("./fonts/Newsreader-Italic-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("./fonts/SourceSans3-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("./fonts/SourceSans3-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f3f0e8;
  --ink: #1c1917;
  --muted: #6a655e;
  --navy: #1a2744;
  --navy-hover: #243556;
  --navy-fg: #f8f5ee;
  --line: #e2ddd2;
  --track: #e8e3d8;
  --tint: rgba(26, 39, 68, 0.06);
  --tint-strong: rgba(26, 39, 68, 0.1);
  --shadow: 0 16px 40px rgba(28, 25, 23, 0.16);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --measure: 38rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
html { font-size: 17px; height: 100%; }
body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.4; }

.wrap {
  width: min(var(--measure), calc(100% - 2.25rem));
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}

.kicker {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 450;
  font-style: italic;
  letter-spacing: 0;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

h1, h2, h3, .statement {
  font-family: var(--serif);
  font-weight: 450;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

h1 { font-size: clamp(2.35rem, 8vw, 3.35rem); }
h2 { font-size: clamp(1.65rem, 5vw, 2.1rem); margin: 2.4rem 0 0.75rem; }
h3 { font-size: 1.35rem; margin: 0 0 0.35rem; }
.lead, p { margin: 0 0 1rem; }
.lead { font-size: 1.08rem; max-width: 36rem; }
.muted, .note, .small, footer, .band { color: var(--muted); }
.small { font-size: 0.92rem; }
.note { font-size: 0.95rem; margin: 0.2rem 0 1rem; }

.section-label {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0.4rem 0 0;
}

.kinds { list-style: none; padding: 0; margin: 0 0 1.75rem; }
.kinds li { padding: 0.55rem 0; border-top: 1px solid var(--line); }
.kinds li:last-child { border-bottom: 1px solid var(--line); }
.kinds strong { font-weight: 650; }

.scale-line {
  font-size: 0.98rem;
  color: var(--ink);
  margin: 0 0 1.6rem;
}

.actions { display: flex; flex-direction: column; gap: 0.7rem; margin: 1.5rem 0 0.8rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  background: var(--navy);
  color: var(--navy-fg);
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  min-height: 2.9rem;
}
.btn:hover:not(:disabled) { background: var(--navy-hover); }
.btn:focus-visible, .text-btn:focus-visible, .option:focus-within, .chip:focus-visible, .gift summary:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover:not(:disabled) { background: var(--tint); }
.btn-row { display: flex; gap: 0.7rem; }
.btn-row .btn { flex: 1; }

.text-btn {
  border: 0;
  background: none;
  padding: 0.3rem 0;
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

details.why { margin: 1.75rem 0 2rem; }
details.why summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
details.why summary::-webkit-details-marker { display: none; }
details.why summary::after { content: " +"; color: var(--muted); font-weight: 500; }
details.why[open] summary::after { content: " –"; }
details.why ul { margin: 0.7rem 0 0; padding-left: 1.15rem; }
details.why li { margin: 0.45rem 0; }

footer.site {
  margin-top: 2.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  line-height: 1.45;
}
em, i, .book { font-style: italic; }

/* Question chrome */
.q-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.q-head .brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: inherit;
}
.counter { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.progress {
  height: 3px;
  background: var(--track);
  margin: 0 0 1.4rem;
  border-radius: 99px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--navy);
  width: 0;
}

.statement { font-size: clamp(1.45rem, 5vw, 1.85rem); margin: 0.15rem 0 1.25rem; }

.options { display: flex; flex-direction: column; gap: 0.45rem; margin: 0 0 1.6rem; }
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
}
.option .n { font-weight: 650; margin-right: 0.4rem; }
.option.selected {
  border-color: var(--navy);
  background: var(--tint);
}
.check {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  flex: none;
  display: grid;
  place-items: center;
}
.option.selected .check {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--navy-fg);
}
.check svg { width: 0.75rem; height: 0.75rem; display: none; }
.option.selected .check svg { display: block; }

.q-nav {
  display: flex;
  gap: 0.7rem;
  position: sticky;
  bottom: 0;
  padding: 0.8rem 0 0.4rem;
  background: linear-gradient(to bottom, transparent, var(--bg) 0.6rem);
}

/* Results */
.notice {
  background: var(--tint);
  border-left: 3px solid var(--navy);
  padding: 0.8rem 1rem;
  margin: 0 0 1.1rem;
  font-size: 0.98rem;
}
.totals { list-style: none; padding: 0; margin: 1rem 0; }
.totals li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.totals li:last-child { border-bottom: 1px solid var(--line); }
.totals .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.explore-list { list-style: none; padding: 0; margin: 0 0 0.5rem; counter-reset: ex; }
.explore-list li { counter-increment: ex; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.explore-list li:last-child { border-bottom: 1px solid var(--line); }
.explore-list li::before {
  content: counter(ex) ".";
  font-weight: 650;
  margin-right: 0.4rem;
}
.explore-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.explore-score { font-variant-numeric: tabular-nums; color: var(--muted); }

.cat-head { margin-top: 2.2rem; }
.cat-note { margin: 0 0 0.6rem; }

.gift {
  border-top: 1px solid var(--line);
  padding: 0;
}
.gift:last-child { border-bottom: 1px solid var(--line); }
.gift summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 0 0.75rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "name score chev" "band score chev" "bar bar bar";
  column-gap: 0.75rem;
  align-items: start;
}
.gift summary::-webkit-details-marker { display: none; }
.gift-name { grid-area: name; font-family: var(--serif); font-size: 1.28rem; font-weight: 450; letter-spacing: -0.02em; min-width: 0; overflow-wrap: break-word; }
.gift-band { grid-area: band; color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }
.gift-score { grid-area: score; font-variant-numeric: tabular-nums; font-size: 1.15rem; padding-top: 0.15rem; }
.chev {
  grid-area: chev;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.3rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.gift[open] .chev { transform: rotate(180deg); }
.bar {
  grid-area: bar;
  height: 4px;
  background: var(--track);
  margin-top: 0.75rem;
  width: 100%;
}
.bar > i { display: block; height: 100%; background: var(--navy); }
.gift-body { padding: 0.15rem 0 1.1rem; }
.qline { margin: 0 0 0.45rem; font-size: 0.98rem; }
.try { font-weight: 650; margin: 0.7rem 0 0; }

.limits { padding-left: 1.15rem; }
.limits li { margin: 0.45rem 0; }

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  padding: 1rem;
}
.overlay.center { align-items: center; }
.sheet, .dialog {
  background: var(--bg);
  color: var(--ink);
  width: min(28rem, 100%);
  border-radius: 14px 14px 8px 8px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.15rem 1.3rem;
  max-height: min(90dvh, 40rem);
  overflow: auto;
}
.dialog { border-radius: 12px; }
.sheet h2, .dialog h2 { font-size: 1.5rem; margin-top: 0; }
.grid50 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin: 0.9rem 0 1rem;
}
.chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 6px;
  min-height: 2.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chip.here { border-color: var(--navy); background: var(--tint); }
.chip.answered { box-shadow: inset 0 -2px 0 var(--navy); }
.chip:disabled { opacity: 0.35; }
.manual {
  width: 100%;
  min-height: 12rem;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

@media (min-width: 640px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
