:root {
  color-scheme: light;
  --paper: #f3efe6;
  --paper-bright: #fbfaf6;
  --ink: #171d1b;
  --muted: #5f6762;
  --line: rgba(23, 29, 27, .2);
  --teal: #138c79;
  --teal-soft: #dcebe5;
  --orange: #e96315;
  --orange-soft: #f2ddc8;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
html, body { min-width: 320px; margin: 0; background: var(--paper); color: var(--ink); }
body { overflow-x: hidden; }
button, a { font: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: .5rem;
  left: .5rem;
  padding: .8rem 1rem;
  background: var(--ink);
  color: white;
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 3rem);
  border-bottom: 1px solid rgba(255,255,255,.25);
  background: rgba(18, 23, 22, .82);
  color: white;
  backdrop-filter: blur(12px);
}
.back-link, .wordmark {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-decoration: none;
}
.back-link span:first-child { color: #79cfbd; font-size: 1.15rem; }

.hero {
  position: relative;
  display: flex;
  min-height: 100svh;
  align-items: flex-end;
  overflow: hidden;
  background: #202726;
  color: white;
}
.hero-image { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-shade { position: absolute; z-index: 1; inset: 0; background: rgba(9, 13, 12, .42); }
.hero-copy {
  position: relative;
  z-index: 2;
  width: min(100%, 92rem);
  margin: 0 auto;
  padding: 8rem clamp(1.25rem, 6vw, 7rem) clamp(4rem, 8vh, 7rem);
}
.hero-copy > p, .life-opening > p:first-child, .life-chapter header > p, .life-reading .reading-inner > p {
  margin: 0 0 1.1rem;
  color: #83dbc8;
  font-size: clamp(.68rem, .9vw, .84rem);
  font-weight: 900;
  letter-spacing: 0;
}
.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 10vw, 10rem);
  font-weight: 400;
  line-height: .86;
  letter-spacing: 0;
}
.hero-copy > strong {
  display: block;
  margin-top: 1.5rem;
  color: #ff8a3a;
  font-size: clamp(1rem, 2vw, 1.6rem);
  letter-spacing: 0;
}
.hero-copy > span {
  display: block;
  max-width: 39rem;
  margin-top: 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  line-height: 1.5;
}
.hero-copy > a {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2.4rem;
  padding: .9rem 0;
  border-bottom: 2px solid white;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-decoration: none;
}
.hero-copy > a b { color: #83dbc8; font-size: 1.25rem; }

.life-opening {
  display: flex;
  min-height: 84svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(5rem, 10vw, 10rem) 1.25rem;
  background: var(--paper-bright);
  text-align: center;
}
.life-opening > p:first-child { color: var(--orange); }
.life-opening h2 {
  max-width: 18ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7.5vw, 7rem);
  font-weight: 400;
  line-height: .92;
  letter-spacing: 0;
}
.opening-copy {
  display: grid;
  width: min(100%, 68rem);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.opening-copy p { margin: 0; padding: 1.4rem clamp(1rem, 3vw, 2.5rem); color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.55; }
.opening-copy p + p { border-left: 1px solid var(--line); }
.selection-status {
  margin: 2rem 0 0;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: 0;
}
.selection-status strong { color: var(--teal); font-size: 1rem; }

.life-line { position: relative; isolation: isolate; }
.life-line::before, .life-progress {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: max(2.5rem, calc((100% - 82rem) / 2 + 3.9rem));
  width: 2px;
  background: rgba(23, 29, 27, .2);
  pointer-events: none;
}
.life-progress {
  z-index: 4;
  bottom: auto;
  height: 100%;
  background: var(--orange);
  transform: scaleY(var(--life-progress, 0));
  transform-origin: top;
}
.life-chapter { position: relative; min-height: 78svh; border-top: 1px solid var(--line); }
.chapter-birth { background: #f0e0cb; }
.chapter-child { background: #dfece6; }
.chapter-teen { background: #f8f5ec; }
.chapter-adult { background: #dbe8ea; }
.chapter-old { background: #ede1d4; }
.chapter-end { background: #1b2522; color: white; }
.chapter-inner {
  display: grid;
  width: min(100%, 82rem);
  min-height: inherit;
  grid-template-columns: 8rem minmax(18rem, .8fr) minmax(24rem, 1.2fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 5rem);
  margin: 0 auto;
  padding: 5rem clamp(1.25rem, 4vw, 4rem);
}
.chapter-age { position: relative; z-index: 5; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.chapter-age > span { font-family: Georgia, "Times New Roman", serif; font-size: 3rem; }
.chapter-age > small { display: block; max-width: 7rem; margin-top: .45rem; font-size: .63rem; font-weight: 900; line-height: 1.35; letter-spacing: 0; }
.chapter-age > i {
  position: absolute;
  left: 2.82rem;
  top: 50%;
  width: 1.15rem;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: inherit;
  transform: translate(-50%, -50%);
  transition: background-color .25s ease, border-color .25s ease, transform .25s ease;
}
.life-chapter.is-current .chapter-age > i { border-color: var(--orange); background: var(--orange); transform: translate(-50%, -50%) scale(1.25); }
.life-chapter.has-selection .chapter-age > i { box-shadow: 0 0 0 .55rem rgba(233, 99, 21, .16); }
.life-chapter header > p { color: var(--teal); }
.chapter-end header > p { color: #82d9c7; }
.life-chapter h2 {
  max-width: 12ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 4.5vw, 5rem);
  font-weight: 400;
  line-height: .95;
  letter-spacing: 0;
}
.life-chapter fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.life-chapter legend { grid-column: 1 / -1; width: 100%; margin-bottom: .6rem; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 1rem; }
.chapter-end legend { color: rgba(255,255,255,.68); }
.possibility {
  position: relative;
  display: grid;
  min-height: 5.2rem;
  grid-template-columns: 1.3rem minmax(0, 1fr);
  align-items: center;
  gap: .8rem;
  padding: .9rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: rgba(255,255,255,.27);
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(.96rem, 1.25vw, 1.1rem);
  line-height: 1.3;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.possibility:hover { transform: translateY(-2px); }
.possibility input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-box { position: relative; width: 1.15rem; height: 1.15rem; border: 1px solid currentColor; }
.choice-box::after { content: ""; position: absolute; inset: .22rem; background: transparent; }
.possibility:has(input:focus-visible) { outline: 3px solid var(--orange); outline-offset: 3px; }
.possibility.is-selected { background: var(--ink); color: white; }
.possibility.is-selected .choice-box::after { background: var(--orange); }
.chapter-end .possibility { background: rgba(255,255,255,.04); }
.chapter-end .possibility.is-selected { background: #f4efe6; color: var(--ink); }

.life-reading { min-height: 92svh; padding: clamp(5rem, 10vw, 10rem) 1.25rem; background: var(--teal); color: white; }
.reading-inner { width: min(100%, 74rem); margin: 0 auto; }
.life-reading .reading-inner > p { color: #ffe0c8; }
.life-reading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.3rem, 8vw, 8rem); font-weight: 400; line-height: .9; letter-spacing: 0; }
.reading-output { min-height: 12rem; margin-top: 3.2rem; border-top: 1px solid rgba(255,255,255,.35); border-bottom: 1px solid rgba(255,255,255,.35); }
.reading-output > p { margin: 0; padding: 2rem 0; color: rgba(255,255,255,.78); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.1rem, 1.8vw, 1.4rem); }
.reading-output ol { margin: 0; padding: 0; list-style: none; }
.reading-output li { display: grid; grid-template-columns: minmax(10rem, .35fr) minmax(0, 1fr); gap: 2rem; padding: 1.25rem 0; border-bottom: 1px solid rgba(255,255,255,.18); }
.reading-output li:last-child { border-bottom: 0; }
.reading-output li span { color: #ffe0c8; font-size: .7rem; font-weight: 900; letter-spacing: 0; text-transform: uppercase; }
.reading-output li strong { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1rem, 1.7vw, 1.35rem); font-weight: 400; line-height: 1.4; }
.reset-button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  gap: .8rem;
  margin-top: 2rem;
  padding: .7rem 1rem;
  border: 1px solid white;
  border-radius: 3px;
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: 0;
}
.reset-button span { color: #ffe0c8; font-size: 1.15rem; }
.reset-button:hover { background: white; color: var(--ink); }
.reading-inner > small { display: block; max-width: 38rem; margin-top: 1rem; color: rgba(255,255,255,.7); font-size: .7rem; line-height: 1.45; letter-spacing: 0; }

footer { display: flex; min-height: 7rem; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem clamp(1.25rem, 5vw, 5rem); background: var(--paper); }
footer a { font-size: .78rem; font-weight: 900; text-decoration: none; }
footer p { margin: 0; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: 0; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }

@media (max-width: 980px) {
  .chapter-inner { grid-template-columns: 6rem minmax(0, 1fr); gap: 2rem; }
  .chapter-age { grid-row: 1 / span 2; }
  .life-chapter header, .life-chapter fieldset { grid-column: 2; }
  .life-line::before, .life-progress { left: max(2.5rem, calc((100% - 82rem) / 2 + 3.95rem)); }
}

@media (max-width: 700px) {
  .topbar { min-height: 3.6rem; }
  .hero { min-height: 90svh; }
  .hero-image { object-position: 58% center; }
  .hero-copy { padding: 7rem 1.15rem 3.5rem; }
  .hero h1 { font-size: 3.35rem; }
  .opening-copy { grid-template-columns: 1fr; }
  .opening-copy p + p { border-top: 1px solid var(--line); border-left: 0; }
  .life-chapter { min-height: auto; }
  .chapter-inner { grid-template-columns: 3.4rem minmax(0, 1fr); gap: 1.1rem; padding: 4.5rem 1rem; }
  .chapter-age { grid-row: 1 / span 2; justify-content: flex-start; }
  .chapter-age > span { font-size: 1.8rem; }
  .chapter-age > small { max-width: 3.2rem; font-size: .5rem; }
  .chapter-age > i { left: 1.3rem; top: 7rem; }
  .life-line::before, .life-progress { left: 2.3rem; }
  .life-chapter h2 { font-size: clamp(2.35rem, 10.5vw, 3.5rem); }
  .life-chapter fieldset { grid-template-columns: 1fr; }
  .possibility { min-height: 4.4rem; }
  .reading-output li { grid-template-columns: 1fr; gap: .55rem; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
  .hero h1 { font-size: 3rem; }
  .life-opening h2 { font-size: 2.75rem; }
  .chapter-inner { grid-template-columns: 3rem minmax(0, 1fr); }
  .life-line::before, .life-progress { left: 2.05rem; }
  .chapter-age > i { left: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
