:root {
  --night: #101a33;
  --night-deep: #0a1124;
  --dawn: #f2b872;
  --ink: #f3ede2;
  --mist: #a3adc2;
  --rule: rgba(243, 237, 226, 0.16);
  --paper: #e8e2d6;
  --paper-ink: #26221c;
  --paper-dim: #6b6358;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 400 19px/1.65 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2 { font-weight: 400; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--dawn); outline-offset: 4px; }

.press {
  display: inline-block;
  font: 500 18px/1 var(--serif);
  color: var(--night-deep);
  background: var(--dawn);
  border: 0;
  border-radius: 6px;
  padding: 16px 26px 17px;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s;
}
.press:hover { background: #f7c98f; }
.quiet {
  font: italic 400 18px/1 var(--serif);
  color: var(--ink);
  background: none;
  border: 0;
  padding: 16px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--rule);
}
.quiet:hover { text-decoration-color: var(--ink); }

.wordmark {
  position: absolute; z-index: 3; top: 28px; left: clamp(20px, 5vw, 64px);
  font-size: 17px; font-style: italic; text-decoration: none; color: var(--ink); opacity: .85;
}

/* ---------- birth: the page opens before you are born ---------- */
.birth {
  position: relative;
  min-height: min(100svh, 980px);
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  background: var(--night-deep);
}
.sky, .scene {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.sky { object-position: center 70%; }
.scene { opacity: 0; transition: opacity 1.1s ease; }
.birth::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10,17,36,.55) 0%, rgba(10,17,36,0) 45%, rgba(10,17,36,0) 80%, rgba(10,17,36,.7) 100%);
  transition: background 1.1s ease;
}
.birth[data-state="born"] .scene { opacity: 1; }
.birth[data-state="born"]::after {
  background: linear-gradient(90deg, rgba(10,17,36,.88) 0%, rgba(10,17,36,.6) 42%, rgba(10,17,36,0) 72%);
}
.birth-copy {
  position: relative; z-index: 2;
  padding: 120px clamp(20px, 5vw, 64px) 22vh;
  max-width: 900px;
}
.counter {
  font-size: clamp(34px, 5.2vw, 68px);
  line-height: 1.1;
  font-weight: 300;
  letter-spacing: -0.02em;
  max-width: 15em;
}
#born { font-variant-numeric: tabular-nums; color: var(--dawn); }
.aside { margin-top: 22px; font-size: 22px; font-style: italic; color: var(--mist); }
.waiting .press { margin-top: 36px; }

.born { display: none; }
.birth[data-state="born"] .waiting { display: none; }
.birth[data-state="born"] .born { display: block; max-width: 560px; }
.born h1 { font-size: clamp(40px, 5.6vw, 72px); line-height: 1.05; font-weight: 300; }
.odds { margin-top: 22px; font-size: 21px; color: var(--ink); opacity: .88; max-width: 30em; }
.actions { margin-top: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.credit {
  position: absolute; z-index: 2; bottom: 20px; left: clamp(20px, 5vw, 64px); right: 20px;
  font-size: 14px; color: var(--mist); opacity: .8;
}

main { overflow: hidden; }

/* ---------- life: a real sequence, so ages are the markers ---------- */
.life { max-width: 1180px; margin: 0 auto; padding: 140px clamp(20px, 5vw, 48px) 60px; }
.life-head { max-width: 34em; margin: 0 0 80px calc(140px + 48px); }
.life-head h2 { font-size: clamp(34px, 4vw, 52px); line-height: 1.1; margin-bottom: 20px; }
.life-head p { color: var(--mist); }

.years { list-style: none; margin: 0; padding: 0; }
.years li {
  display: grid;
  grid-template-columns: 140px 1.35fr 1fr;
  gap: 48px;
  align-items: start;
  padding-bottom: 72px;
  position: relative;
}
.years li::before {
  content: ''; position: absolute; left: 164px; top: 10px; bottom: 0; width: 1px; background: var(--rule);
}
.years li:last-child::before { display: none; }
.age {
  text-align: right;
  font-size: 76px; line-height: .9; font-weight: 300;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--dawn);
}
.years figure { margin: 0; }
.years img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; }
.entry { padding-top: 6px; }
.log { font-size: 23px; line-height: 1.4; }
.entry p + p { margin-top: 14px; color: var(--mist); }
.choice { font-style: italic; }

/* ---------- the record: the one place the page turns to paper ---------- */
.record {
  max-width: 1180px; margin: 60px auto 0; padding: 0 clamp(20px, 5vw, 48px) 140px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: center;
}
.obit {
  background: var(--paper); color: var(--paper-ink);
  padding: 48px 48px 40px;
  border-radius: 2px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  transform: rotate(-1.2deg);
}
.obit-place { font-size: 16px; color: var(--paper-dim); }
.obit h2 { font-size: 46px; line-height: 1.1; margin: 8px 0 22px; }
.obit-body { font-size: 19px; line-height: 1.6; }
.obit-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 30px 0 0; padding-top: 20px; border-top: 1px solid rgba(38,34,28,.2);
}
.obit-stats dt { font-size: 14px; color: var(--paper-dim); }
.obit-stats dd { margin: 2px 0 0; font-size: 30px; font-weight: 300; font-variant-numeric: tabular-nums; }
.record-copy h2 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; margin-bottom: 22px; }
.record-copy p { color: var(--mist); max-width: 30em; }
.record-copy p + p { margin-top: 14px; font-style: italic; color: var(--ink); }

/* ---------- the app ---------- */
.phone {
  background: var(--night-deep);
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; align-items: center;
  padding: 120px max(clamp(20px, 5vw, 48px), calc((100vw - 1180px) / 2));
}
.phone img { width: 100%; border-radius: 6px; }
.phone h2 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; margin-bottom: 26px; }
.phone ul { margin: 0 0 36px; padding: 0; list-style: none; }
.phone li { padding: 12px 0; border-top: 1px solid var(--rule); color: var(--mist); font-size: 18px; }
.phone li:last-child { border-bottom: 1px solid var(--rule); }
.later { margin-top: 14px; font-size: 15px; color: var(--mist); font-style: italic; }

footer { padding: 40px clamp(20px, 5vw, 64px) 56px; font-size: 15px; color: var(--mist); }
footer .fine { margin-top: 8px; font-size: 13px; max-width: 46em; opacity: .8; }

/* ---------- privacy page ---------- */
.doc { max-width: 680px; margin: 0 auto; padding: 120px 20px 80px; }
.doc h1 { font-size: clamp(36px, 5vw, 52px); font-weight: 300; margin-bottom: 8px; }
.doc h2 { font-size: 24px; margin: 40px 0 10px; }
.doc p { color: var(--mist); }
.doc p + p { margin-top: 12px; }

@media (max-width: 860px) {
  body { font-size: 18px; }
  .birth { justify-content: flex-end; }
  .birth-copy { padding-bottom: 72px; }
  .birth[data-state="born"]::after {
    background: linear-gradient(0deg, rgba(10,17,36,.94) 0%, rgba(10,17,36,.7) 45%, rgba(10,17,36,.1) 75%);
  }
  .sky { object-position: 30% 70%; }
  .birth::after { background: linear-gradient(0deg, rgba(10,17,36,.9) 0%, rgba(10,17,36,.5) 40%, rgba(10,17,36,0) 65%); }
  .life { padding-top: 96px; }
  .life-head { margin: 0 0 56px; }
  .years li { grid-template-columns: 1fr; gap: 16px; padding: 0 0 56px 28px; }
  .years li::before { left: 0; top: 0; }
  .age { text-align: left; font-size: 52px; }
  .record { grid-template-columns: 1fr; gap: 48px; padding-bottom: 96px; }
  .obit { padding: 32px 26px 28px; transform: none; }
  .obit h2 { font-size: 36px; }
  .obit-stats { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .phone { grid-template-columns: 1fr; gap: 40px; padding-top: 80px; padding-bottom: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene, .birth::after, .press { transition: none; }
}
