:root {
  color-scheme: light;
  --cream: #faf5ea;
  --ink: #1e342e;
  --soft-ink: #4c5e55;
  --green: #23483b;
  --green-dark: #16352a;
  --blush: #f5ded4;
  --rust: #9c3929;
  --line: #c6bcac;
  --paper: #fffdf7;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--cream);
  font: 1rem/1.55 var(--sans);
}

.frame { width: min(calc(100% - 96px), 1200px); margin-inline: auto; }
.masthead, .footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.masthead { min-height: 84px; border-bottom: 1px solid var(--line); }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: bold 1.32rem/1.1 var(--serif);
  text-decoration: none;
  color: var(--ink);
}
.brand-mark { font: 1.75rem/1 var(--sans); color: var(--rust); }
.edition-label, .eyebrow {
  margin: 0;
  font-size: .72rem;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 750;
}
.edition-label { color: var(--soft-ink); text-align: right; }
.eyebrow { color: var(--rust); }
.eyebrow > span {
  display: inline-block;
  width: .59em;
  height: .59em;
  margin-right: .4em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: .09em;
}
#app { flex: 1; padding-block: 36px 34px; }
.footer {
  min-height: 67px;
  border-top: 1px solid var(--line);
  padding-block: 14px;
  color: var(--soft-ink);
  font-size: .78rem;
}
.footer > :first-child { font: bold 1rem var(--serif); color: var(--ink); }

h1, h2 { font-family: var(--serif); font-weight: normal; line-height: 1.04; margin: 0; }
h1 { font-size: clamp(2.65rem, 5vw, 4.3rem); letter-spacing: -.05em; }
h1:focus { outline: none; }
p { margin: 0; }
button { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #315bc1; outline-offset: 4px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-height: 48px;
  padding: 11px 19px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}
.button span { font-size: 1.28em; line-height: .9; }
.primary { color: #fffdf3; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--green); background: var(--paper); border-color: var(--line); }
.secondary:hover { background: #f4ede0; }
.text-button {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: .24em;
  font-weight: 660;
}
.text-button:hover { color: var(--rust); }
.subtle { color: var(--soft-ink); max-width: 56ch; }

.hero { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, .9fr); gap: 32px; min-height: min(610px, 72vh); }
.hero-copy {
  align-self: center;
  padding: 23px clamp(0px, 3vw, 38px) 29px clamp(0px, 2.5vw, 30px);
}
.hero h1 {
  margin: 15px 0 21px;
  font-size: clamp(4rem, 8.2vw, 8.3rem);
  line-height: .86;
  letter-spacing: -.067em;
}
.hero h1 em { color: var(--rust); font-weight: inherit; }
.intro { max-width: 36ch; font-size: clamp(1rem, 1.62vw, 1.21rem); }
.hero-note { margin-top: 14px; color: var(--soft-ink); font-size: .81rem; }
.hero-art { position: relative; overflow: hidden; background: #eea08e; border-radius: 7px; }
.hero-art img { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: center 54%; display: block; }

.journey {
  min-height: 550px;
  display: grid;
  grid-template-columns: minmax(215px, .37fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: clip;
}
.journey-side { background: #f1dfbf; padding: 37px clamp(20px, 3vw, 42px); }
.step-number { font: 1.7rem/1.15 var(--serif); margin-top: 10px; }
progress {
  width: 100%;
  max-width: 220px;
  height: 7px;
  border: 0;
  border-radius: 8px;
  background: #d5c3a5;
  color: var(--green);
  appearance: none;
}
progress::-webkit-progress-bar { background: #d5c3a5; border-radius: 8px; }
progress::-webkit-progress-value { border-radius: 8px; background: var(--green); }
progress::-moz-progress-bar { border-radius: 8px; background: var(--green); }
.steps { margin: 26px 0 0; padding: 0; list-style: none; color: var(--soft-ink); font-size: .89rem; }
.steps li { margin-top: 10px; }
.steps [aria-current] { color: var(--ink); font-weight: 750; }
.steps [aria-current]::before { content: '→'; margin-right: 7px; }
.question-panel, .paper { background: var(--paper); padding: clamp(25px, 5vw, 65px); }
.question-panel h1, .paper h1, .result-head h1 { margin-block: 12px 13px; }
fieldset { padding: 0; border: 0; margin: 0; min-inline-size: 0; }
.choices { margin-top: 25px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--cream);
  cursor: pointer;
}
.choice:hover { border-color: var(--green); }
.choice:has(input:checked) { border-color: var(--green); background: #e7eee3; }
.choice:has(input:focus-visible) { outline: 3px solid #315bc1; outline-offset: 2px; }
.choice input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--green); }
.choice input:focus-visible { outline: none; }
.error { margin-top: 14px; color: #9c2626; font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 26px; }
.actions .primary { margin-left: auto; }

.paper { border: 1px solid var(--line); border-radius: 8px; }
.summary { max-width: 880px; margin-inline: auto; }
.summary-list { margin: 28px 0 0; border-top: 1px solid var(--line); }
.summary-row {
  display: grid;
  grid-template-columns: minmax(120px, .5fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.summary-row dt { font-weight: 740; }
.summary-row dd { margin: 0; }

.result-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 5px 0 27px; }
.result-head .button { flex-shrink: 0; }
.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.book-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: clip;
}
.book-image {
  display: grid;
  grid-template-areas: 'cover';
  place-items: center;
  padding: 21px;
  min-height: 234px;
  background: var(--blush);
}
.book-card:nth-child(2) .book-image { background: #e1e8d8; }
.book-card:nth-child(3) .book-image { background: #f2e5b9; }
.book-image img, .cover-fallback { grid-area: cover; }
.book-image img { width: auto; height: 188px; max-width: 100%; object-fit: contain; box-shadow: 5px 6px 9px #1e342e32; }
.cover-fallback { font-size: .85rem; color: var(--soft-ink); }
.book-image:has(img) .cover-fallback { visibility: hidden; }
.book-copy { padding: clamp(16px, 2vw, 26px); display: flex; flex-direction: column; flex: 1; }
.book-age { font-size: .74rem; font-weight: 700; color: var(--rust); }
.book-card h2 { font-size: clamp(1.65rem, 2.45vw, 2.25rem); margin-top: 8px; letter-spacing: -.035em; }
.edition { color: var(--soft-ink); font-size: .85rem; margin-top: 10px; }
.edition span { font-variant-numeric: tabular-nums; }
.reason { margin: 17px 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: .91rem; }
.reason .match { margin: 5px 0 3px; font-weight: 720; }
.publisher-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  margin-top: auto;
  color: var(--green);
  font-weight: 700;
  text-underline-offset: .24em;
}
.publisher-link:hover { color: var(--rust); }
.result-actions { margin-top: 16px; }

@media (max-width: 960px) {
  .frame { width: calc(100% - 56px); }
  .hero { min-height: 490px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 660px) {
  .frame { width: calc(100% - 36px); }
  .masthead { min-height: 65px; }
  .wordmark { font-size: 1.1rem; }
  .brand-mark { font-size: 1.4rem; }
  .edition-label { font-size: .61rem; }
  #app { padding-block: 23px 22px; }
  .footer { align-items: flex-start; flex-direction: column; gap: 4px; }
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 14px; }
  .hero-copy { padding: 15px 1px 9px; }
  .hero h1 { font-size: clamp(3.6rem, 14vw, 5.8rem); margin-block: 11px 17px; }
  .hero-art { aspect-ratio: 1; }
  .hero-art img { object-position: center 52%; }
  .journey { display: block; min-height: 0; }
  .journey-side { padding: 11px 17px 14px; }
  .journey-side .eyebrow, .steps { display: none; }
  .step-number { margin-top: 0; font-size: 1.1rem; }
  progress { max-width: none; display: block; margin-top: 8px; height: 5px; }
  .question-panel, .paper { padding: 21px 16px; }
  .choices { grid-template-columns: 1fr; gap: 7px; margin-top: 18px; }
  .choice { min-height: 46px; padding-block: 8px; }
  .actions { margin-top: 19px; gap: 4px; }
  .actions .primary { padding-inline: 12px; }
  .summary-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding-block: 7px; }
  .summary-row dd:first-of-type { grid-column: 1; }
  .summary-row dd:last-child { grid-column: 2; grid-row: 1 / span 2; }
  .result-head { align-items: flex-start; flex-direction: column; gap: 13px; }
  .book-grid { grid-template-columns: 1fr; }
}

.age-select {
  width: 100%;
  max-width: 22rem;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: white;
  color: inherit;
  font: inherit;
}

.reason a { color: inherit; text-underline-offset: .15em; }

/* The illustration, printed-paper palette and ruled margins carry across the journey. */
:root {
  --cream: #f5ecd9;
  --paper: #fffcf2;
  --green: #214638;
  --rust: #943d31;
  --line: #cabb9d;
  --lift: 0 12px 30px #43351812;
}

body {
  background:
    radial-gradient(ellipse at 9% 12%, #f5c2a159 0, transparent 41%),
    radial-gradient(ellipse at 102% 41%, #a9bd9a79 0, transparent 40%),
    repeating-linear-gradient(0deg, #442e1311 0 1px, transparent 1px 5px),
    #f0e2c7;
}

.masthead { min-height: 76px; border-bottom: 2px solid #26483d; }
.wordmark { font-size: clamp(1.13rem, 3vw, 1.65rem); }
.edition-label { color: var(--green); }
#app { padding-block: clamp(24px, 4vw, 54px); }

.hero {
  --hero-seam: 51.813%;
  --hero-start-size: clamp(110px, 11vw, 148px);
  position: relative;
  grid-template-columns: minmax(0, var(--hero-seam)) minmax(0, 1fr);
  gap: 0;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--lift);
}

.hero-copy {
  padding: clamp(25px, 5vw, 74px);
  padding-inline-end: max(clamp(25px, 5vw, 74px), calc(var(--hero-start-size) / 2 + 14px));
}
.hero h1 { font-size: clamp(3.9rem, 7.7vw, 7.65rem); }
.hero-art { border-radius: 0; border-left: 1px solid var(--line); }
.hero-art img { object-position: center; }
.primary { border-radius: 999px; box-shadow: 0 4px 0 #152c21; }
.primary:active { box-shadow: 0 1px 0 #152c21; transform: translateY(3px); }
.secondary { border-radius: 999px; }
.hero-start {
  position: absolute;
  z-index: 1;
  inset: 56% auto auto var(--hero-seam);
  translate: -50% -50%;
  width: var(--hero-start-size);
  height: var(--hero-start-size);
  flex-direction: column;
  gap: .35rem;
  padding: 14px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  box-shadow: 0 0 0 1px #1a3b2e, 0 7px 19px #182f2850;
  font-size: clamp(.88rem, 1.5vw, 1.15rem);
  line-height: 1.1;
}
.hero-start::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid #fff9e885;
  border-radius: inherit;
  pointer-events: none;
}
.hero-start .hero-start-label { max-width: 10ch; font-size: inherit; line-height: inherit; }
.hero-start .hero-start-arrow { font-size: 1.45em; }
.hero-start:active { box-shadow: 0 0 0 1px #1a3b2e, 0 3px 8px #182f2850; }

.journey, .paper { border-radius: 18px; box-shadow: var(--lift); }
.journey-side {
  color: #fffbef;
  background:
    radial-gradient(circle at 0% 100%, #d99a5659, transparent 47%),
    repeating-linear-gradient(135deg, #f8ecd418 0 1px, transparent 1px 12px),
    #224638;
}
.journey-side .eyebrow, .journey-side .steps, .journey-side .steps [aria-current] { color: #fff8e4; }
.journey-side progress::-webkit-progress-value { background: #e6a56c; }
.journey-side progress::-moz-progress-bar { background: #e6a56c; }
.choice { background: #f8f0df; border-radius: 12px; }
.choice:has(input:checked) { background: #e0ead8; }
.choices.single-control { display: block; }
.note-field textarea {
  display: block;
  width: 100%;
  max-width: 41rem;
  resize: vertical;
  min-height: 8rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f0df;
  color: var(--ink);
  font: inherit;
}
.note-preview { margin-top: .5rem; color: var(--soft-ink); font-size: .85rem; }
.summary-row dd { overflow-wrap: anywhere; white-space: pre-wrap; }
.summary-row small { display: block; margin-top: .35rem; color: var(--soft-ink); }

.results-layout {
  display: grid;
  grid-template-columns: minmax(215px, 255px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 40px);
}
.results-filters {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--lift);
  padding: 18px 17px 12px;
}
.results-filters > details > summary {
  cursor: pointer;
  font: 1.55rem/1.2 var(--serif);
  color: var(--green);
}
#filters-form { margin-top: 14px; }
.filter-group {
  padding: 10px 0;
  border-top: 1px solid #ded0b8;
  font-size: .83rem;
}
.filter-group summary { cursor: pointer; font-weight: 750; padding-block: 3px; }
.filter-group small { display: block; color: var(--soft-ink); font-weight: 500; overflow-wrap: anywhere; }
.filter-group small:empty { display: none; }
.filter-controls { margin-top: 8px; }
.filter-options { display: grid; gap: 4px; max-height: 230px; overflow-y: auto; padding: 4px; }
.filter-controls .choice { min-height: 36px; border: 0; border-radius: 6px; padding: 5px 7px; background: transparent; }
.filter-controls .choice:has(input:checked) { background: #e0ead8; }
.filter-controls .choice input { width: 15px; height: 15px; }
.filter-controls .age-select { padding: .5rem; }
.filter-controls textarea { min-height: 4.5rem; padding: .55rem; }
.filter-group .secondary { min-height: 36px; margin-top: 6px; padding: 5px 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.results-filters .result-actions { border-top: 1px solid #ded0b8; margin-top: 0; padding-top: 4px; }
.result-head { margin: 0 0 22px; border-top: 3px solid var(--green); padding: 17px 0 0; }
.result-head h1 { margin-top: 8px; }
.broaden {
  padding: 14px 16px;
  margin-bottom: 20px;
  border-left: 4px solid var(--rust);
  border-radius: 0 12px 12px 0;
  background: #fff5e3;
  color: var(--ink);
}
.broaden-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.broaden-actions .button { margin-top: 8px; font-size: .82rem; min-height: 44px; }
.book-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.book-card { border-radius: 15px; box-shadow: var(--lift); }
.book-card:only-child { max-width: 425px; }
.book-image {
  background: radial-gradient(ellipse at 50% 25%, #f9ecdc, transparent 65%), #eac5ae;
  border-bottom: 1px solid var(--line);
}
.book-card:nth-child(2) .book-image { background: radial-gradient(ellipse at 50% 25%, #f2f3dd, transparent 65%), #c8d8be; }
.book-card:nth-child(3) .book-image { background: radial-gradient(ellipse at 50% 25%, #fff2cc, transparent 65%), #e4d1a3; }

@media (max-width: 800px) {
  .results-layout { grid-template-columns: 1fr; gap: 18px; }
  .results-filters { padding: 12px 14px; }
  .results-filters > details > summary { font-size: 1.2rem; }
}
@media (max-width: 660px) {
  .masthead { min-height: 65px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy {
    position: relative;
    padding: 27px 19px calc(var(--hero-start-size) / 2 + 20px);
  }
  .hero h1 { font-size: clamp(3.15rem, 13.3vw, 5rem); }
  .hero-art { border-left: 0; border-top: 1px solid var(--line); aspect-ratio: 1.28; }
  .hero-start {
    inset: auto auto 0 50%;
    translate: -50% 50%;
  }
  .book-grid { grid-template-columns: 1fr; }
}

.help-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 44px;
  color: var(--green);
  font-size: .9rem;
  font-weight: 720;
  text-underline-offset: .2em;
}
.help-page { flex: 1; padding-block: clamp(24px, 4vw, 54px); }
.help-content { max-width: 760px; margin-inline: auto; }
.help-content h1 { margin-top: 0; }
.help-content section { margin-top: 1.65rem; }
.help-content h2 { font-size: clamp(1.45rem, 3vw, 2rem); margin-bottom: .65rem; }
.help-content p + p, .help-content li + li { margin-top: .5rem; }
.help-content ol { margin: 0; padding-left: 1.35rem; }
.help-return { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--soft-ink); }

.editorial-local { margin-top: .9rem; }
.editorial-dialog {
  width: min(calc(100% - 32px), 810px);
  max-height: calc(100dvh - 32px);
  padding: clamp(18px, 4vw, 33px);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--lift);
}
.editorial-dialog::backdrop { background: #192f27a0; }
.editorial-heading { display: flex; justify-content: space-between; align-items: start; gap: .75rem; margin-bottom: 1rem; }
.editorial-heading h2 { font-size: clamp(1.7rem, 5vw, 2.45rem); }
.editorial-dialog h3 { margin: 0 0 .4rem; font-size: 1rem; }
.editorial-context { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem; }
.editorial-context section { padding: .8rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--cream); }
.editorial-context dl, .editorial-details { margin: 0; overflow-wrap: anywhere; }
.editorial-context dt, .editorial-details dt { font-weight: 700; }
.editorial-context dd, .editorial-details dd { margin: 0 0 .48rem; }
.editorial-context ol, .editorial-context ul { padding-left: 1.2rem; margin: .25rem 0; }
.editorial-context li { margin-bottom: .35rem; }
.editorial-form { margin-top: 1rem; }
.editorial-form label { display: block; font-weight: 700; margin: .65rem 0 .2rem; }
.editorial-form select, .editorial-form input, .editorial-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .45rem;
  padding: .5rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.editorial-form textarea { resize: vertical; }
.editorial-form .subtle { margin-top: .5rem; }
.editorial-cases { padding: 0; list-style: none; }
.editorial-cases li { display: flex; justify-content: space-between; gap: .6rem; border-bottom: 1px solid var(--line); padding-block: .4rem; }
.editorial-cases small { display: block; color: var(--soft-ink); }
@media (max-width: 620px) {
  .editorial-context { grid-template-columns: 1fr; }
  .editorial-dialog .actions .primary { margin-left: 0; }
}

.editorial-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0 .45rem;
}
.editorial-navigation .text-button { font-size: .85rem; }
.editorial-navigation [aria-pressed="true"] { background: #e0ead8; }
@media (max-width: 660px) {
  .masthead:has(.editorial-navigation) { flex-wrap: wrap; padding-block: .6rem; }
  .editorial-navigation { justify-content: flex-start; }
}
