/* Bore Me to Sleep: the page is one night. The field colour, the clock and the astronaut all follow the scroll. */
@font-face { font-family: "Young Serif"; src: url("/assets/fonts/young-serif.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/assets/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #222872;            /* the sky; story.js walks it from dusk to midnight, one flat colour at a time */
  --ink: #F5F2FF;
  --soft: #CFCCF4;
  --yellow: #FFC94A;
  --violet: #A596FF;
  --orange: #FF7A3D;
  --navy: #0D0F2E;
  --panel: rgba(255,255,255,.075);   /* a step in tone, never a line */
  --margin: clamp(20px, 3.2vw, 48px);
  --serif: "Young Serif", Georgia, serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  /* the whole page is set in these six sizes */
  --t-sm: 15px;
  --t-body: clamp(17px, 1.25vw, 18px);
  --t-lead: clamp(20px, 1.7vw, 24px);
  --t-title: clamp(26px, 2.6vw, 37px);
  --t-h2: clamp(36px, 4.1vw, 59px);
  --t-h1: clamp(42px, 6.9vw, 99px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-body)/1.55 var(--sans); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
::selection { background: var(--yellow); color: var(--navy); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--margin); top: -80px; z-index: 30; background: var(--yellow); color: var(--navy); padding: 10px 16px; border-radius: 99px; font-weight: 600; }
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- bar */
.bar { position: fixed; inset: 0 0 auto 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px var(--margin); background: var(--bg); transition: none; }
.mark { white-space: nowrap; font: 400 var(--t-lead)/1 var(--serif); text-decoration: none; justify-self: start; letter-spacing: -.01em; }
.mark em { font-style: normal; color: var(--violet); }
.clock { white-space: nowrap; font: 500 var(--t-body)/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--soft); letter-spacing: .02em; }
.bar .btn { justify-self: end; }

.btn { display: inline-block; background: var(--yellow); color: var(--navy); font: 600 var(--t-body)/1 var(--sans); padding: 16px 28px; border: 0; border-radius: 99px; text-decoration: none; cursor: pointer; transition: transform .18s var(--ease), background-color .18s; }
.btn:hover { transform: translateY(-2px); background: #FFD66E; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-sm { padding: 12px 20px; font-size: var(--t-sm); }

/* ---------------------------------------------------------------- hero */
.hero { min-height: 100svh; padding: clamp(92px, 11vh, 130px) var(--margin) var(--margin); display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); grid-template-areas: "text art"; align-items: center; gap: 0 2vw; }
.hero-text { grid-area: text; position: relative; z-index: 2; }
h1 { font: 400 var(--t-h1)/.98 var(--serif); letter-spacing: -.03em; }
.lede { max-width: 34ch; margin-top: clamp(20px, 2.6vw, 36px); font-size: var(--t-lead); line-height: 1.42; color: var(--ink); }
.stores { display: flex; flex-wrap: wrap; gap: 14px; margin-top: clamp(26px, 3vw, 44px); }
.store { display: inline-flex; align-items: baseline; gap: 12px; padding: 15px 26px 16px; background: var(--ink); color: var(--navy); border-radius: 99px; text-decoration: none; transition: transform .18s var(--ease), background-color .18s; }
.store:hover { transform: translateY(-3px); background: #fff; }
.store-sm { order: 2; font: 500 var(--t-sm)/1 var(--sans); color: #4B4F85; }
.store-lg { font: 400 var(--t-lead)/1 var(--serif); }
.hero-art { grid-area: art; position: relative; justify-self: end; width: min(100%, 44vw); aspect-ratio: 1; }
.art-moon { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.spark { position: absolute; width: clamp(34px, 4vw, 64px); }
.hero-art .s1 { left: -4%; top: 12%; } .hero-art .s2 { right: 4%; top: 2%; width: clamp(24px, 2.6vw, 42px); } .hero-art .s3 { left: 10%; bottom: 8%; width: clamp(22px, 2.4vw, 38px); }

/* ---------------------------------------------------------------- story: text left, the night's stage pinned right */
.story { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 0 3vw; padding: 0 var(--margin); }
.chap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: clamp(16px, 1.8vw, 26px); padding: clamp(80px, 12vh, 140px) 0; max-width: 46rem; }
.chap.wide { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 28px 4vw; }
h2 { font: 400 var(--t-h2)/1.04 var(--serif); letter-spacing: -.025em; text-wrap: balance; max-width: 20ch; }
.chap p { max-width: 36em; }
.small { color: var(--soft); font-size: var(--t-sm); }
.chap-art { display: none; }
.pose-inline { width: min(46vw, 200px); }

.stage { grid-column: 2; grid-row: 1; position: relative; }
.stage-sky { position: sticky; top: 0; height: 100vh; display: grid; place-items: center; }
.stage-moon { position: absolute; width: min(30vw, 440px); right: 4%; top: 50%; transform: translateY(-48%); opacity: .95; }
.stage-star { position: absolute; width: clamp(30px, 3vw, 52px); }
.stage-star.a { left: 6%; top: 26%; } .stage-star.b { right: 12%; bottom: 20%; width: clamp(22px, 2vw, 34px); }
.poses { position: relative; width: min(22vw, 340px); aspect-ratio: 1 / 1.08; margin-right: 6%; }
.pose { position: absolute; left: 50%; bottom: 0; width: 100%; max-height: 100%; object-fit: contain; object-position: bottom; transform: translate(-50%, 24px) scale(.94); opacity: 0; transition: opacity .7s var(--ease), transform .9s var(--ease); }
.pose.on { opacity: 1; transform: translate(-50%, 0) scale(1); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 -10px; } }

/* the topic desk: the one live thing */
.desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.desk-row { display: flex; gap: 10px; }
.desk input { flex: 1; min-width: 0; width: 100%; font: 400 var(--t-title)/1.1 var(--serif); color: var(--ink); background: var(--panel); border: 0; border-radius: 99px; padding: 16px 26px; }
.desk input::placeholder { color: #A9A6D8; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 var(--t-sm)/1 var(--sans); color: var(--ink); background: var(--panel); border: 0; border-radius: 99px; padding: 12px 18px; cursor: pointer; transition: background-color .18s, transform .18s var(--ease), color .18s; }
.chip:hover { background: rgba(255,255,255,.15); transform: translateY(-2px); }
.chip[aria-pressed="true"] { background: var(--yellow); color: var(--navy); }
.book { background: var(--panel); border-radius: 28px; padding: clamp(22px, 2.4vw, 36px); display: grid; gap: 12px; animation: rise .6s var(--ease) both; }
.book[hidden] { display: none; }
.book h3 { font: 400 var(--t-title)/1.05 var(--serif); letter-spacing: -.02em; }
.book-blurb { color: var(--soft); }
.book-chapters { display: grid; gap: 4px; counter-reset: c; }
.book-chapters li { counter-increment: c; font: 400 var(--t-lead)/1.3 var(--serif); padding: 7px 0; opacity: 0; animation: rise .5s var(--ease) forwards; }
.book-chapters li::before { content: "Chapter " counter(c) ". "; color: var(--yellow); font: 500 var(--t-sm) var(--sans); }
.book-note { font-size: var(--t-sm); color: var(--soft); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* voices */
.voices { display: flex; flex-wrap: wrap; gap: 12px; }
.voice { display: flex; align-items: baseline; gap: 10px; font: 400 var(--t-title)/1 var(--serif); color: var(--ink); background: var(--panel); border: 0; border-radius: 99px; padding: 16px 26px; cursor: pointer; transition: background-color .18s, transform .18s var(--ease), color .18s; }
.voice:hover { transform: translateY(-2px); background: rgba(255,255,255,.15); }
.voice-note { font: 500 var(--t-sm)/1 var(--sans); color: var(--soft); }
.voice[aria-pressed="true"] { background: var(--yellow); color: var(--navy); }
.voice[aria-pressed="true"] .voice-note { color: #4B4F85; }
.voice[aria-pressed="true"] .voice-name::after { content: " \25B6"; font-size: .55em; vertical-align: .2em; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* the boredom ladder: the sentences themselves get quieter */
.dial-copy { grid-column: 1; display: grid; gap: 18px; align-self: end; }
.ladder { grid-column: 1; display: grid; gap: clamp(12px, 1.4vw, 20px); }
.lad { display: grid; gap: 4px; padding: clamp(14px, 1.4vw, 20px) clamp(18px, 2vw, 28px); border-radius: 22px; background: var(--panel); transform-origin: left center; }
.lad-name { font: 600 var(--t-sm)/1 var(--sans); color: var(--yellow); }
.lad q { quotes: none; font: 400 var(--t-lead)/1.32 var(--serif); }
.lad-1 q { color: var(--ink); }
.lad-2 q { color: #E4E1FA; }
.lad-3 q { color: var(--soft); }
.lad-4 { background: rgba(255,255,255,.04); }
.lad-4 q { color: #A9A6D8; }
.phone { grid-column: 2; grid-row: 1 / span 2; width: clamp(200px, 20vw, 300px); background: #050619; padding: clamp(7px, .7vw, 11px); border-radius: clamp(28px, 3vw, 44px); }
.phone img { width: 100%; border-radius: clamp(22px, 2.4vw, 34px); }
.phone-dial { rotate: 2.5deg; align-self: center; }
.phone-player { rotate: -2.5deg; }

/* lengths: bars drawn to scale */
.lengths { display: grid; gap: 10px; margin-top: 6px; max-width: 34rem; }
.lengths li { width: var(--w); min-width: 150px; background: var(--yellow); color: var(--navy); border-radius: 99px; padding: 14px 24px; font: 400 var(--t-lead)/1 var(--serif); transform-origin: left; }
.lengths li:nth-child(2) { background: #FFD66E; } .lengths li:nth-child(3) { background: var(--violet); } .lengths li:nth-child(4) { background: var(--ink); }

.drift-copy { display: grid; gap: 20px; max-width: 36rem; }
.plain { display: grid; gap: 10px; }
.plain li { position: relative; padding-left: 26px; }
.plain li::before { content: ""; position: absolute; left: 0; top: .62em; width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); }

/* ---------------------------------------------------------------- goodnight */
.film { display: grid; justify-items: center; gap: clamp(20px, 3vw, 36px); padding: clamp(56px, 9vh, 110px) var(--margin) clamp(40px, 6vh, 80px); }
.film-copy { max-width: 56ch; text-align: center; }
.film-copy h2 { font: 400 var(--t-title)/1.1 var(--serif); }
.film-copy p { margin-top: 14px; color: var(--soft); font-size: var(--t-body); line-height: 1.5; }
.film-frame { width: min(100%, 960px); margin: 0; }
.film-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: var(--navy); border-radius: clamp(14px, 2vw, 26px); box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08); }
.film-frame figcaption { margin-top: 12px; text-align: center; font-size: var(--t-sm); color: var(--soft); }
.goodnight { position: relative; min-height: 112vh; padding: clamp(80px, 12vh, 150px) var(--margin) clamp(24px, 4vh, 48px); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.gn-text { position: relative; z-index: 2; max-width: 38rem; display: grid; gap: 4px; }
.gn-line { font: 400 var(--t-h1)/.95 var(--serif); letter-spacing: -.03em; }
.gn-scene { position: relative; grid-row: 2; justify-self: end; align-self: end; width: min(64vw, 920px); height: clamp(320px, 33vw, 500px); margin-top: -4vh; pointer-events: none; }
.gn-scene img { position: absolute; }
.gn-bed { height: 100%; width: auto; max-width: none; right: 19%; bottom: 0; }
.gn-lamp { width: 14%; right: 3%; bottom: 0; }
.gn-plant { width: 13%; left: 0; bottom: 0; }
.gn-books { width: 10%; left: 14%; bottom: 0; z-index: 2; }
.gn-cat { width: 19%; left: 25%; bottom: -2%; z-index: 2; }
.gn-cloud { width: 27%; right: 0; top: 0; opacity: .92; }
.gn-planet { width: 17%; left: 12%; top: 4%; }
.goodnight .g1 { left: 30%; top: 30%; } .goodnight .g2 { left: 3%; top: 26%; width: clamp(20px, 2vw, 32px); }
.gn-stores { position: relative; z-index: 2; grid-row: 3; margin-top: clamp(28px, 4vh, 48px); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; padding: 22px var(--margin) 34px; background: #05061A; color: var(--soft); font-size: var(--t-sm); }
.foot nav { display: flex; gap: 24px; }
.foot a { text-underline-offset: 4px; }

/* ---------------------------------------------------------------- motion */
.float { animation: drift 7s ease-in-out infinite; }
.float-slow { animation: drift 9s ease-in-out infinite reverse; }
@keyframes drift { 50% { translate: 0 -14px; rotate: 1.2deg; } }
.twinkle { animation: tw 3.6s ease-in-out infinite; }
.spark.s2, .stage-star.b, .g2 { animation-delay: -1.4s; } .spark.s3 { animation-delay: -2.4s; }
@keyframes tw { 0%,100% { opacity: 1; scale: 1; } 50% { opacity: .35; scale: .8; } }
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }
.js .lengths li, .js .lad { opacity: 0; transform: translateX(-26px) scaleX(.92); transition: opacity .7s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0ms); }
.js .in .lengths li, .js .in .lad { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- phones and tablets: the stage steps aside, each chapter keeps its own astronaut */
@media (max-width: 900px) {
  .bar { grid-template-columns: auto 1fr auto; gap: 10px; }
  .mark { font-size: var(--t-body); }
  .clock { font-size: var(--t-sm); }
  .bar .btn { padding: 10px 14px; }
  .clock { justify-self: center; font-size: var(--t-sm); white-space: nowrap; }
  /* Small screens: every little man sits beside his title with his moon behind him, instead of on a line of his own. */
  .hero { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title art" "lede lede" "stores stores"; align-content: start; align-items: center; gap: 0 10px; padding-top: 88px; }
  .hero-text { display: contents; }
  .hero h1 { grid-area: title; font-size: clamp(34px, 9.6vw, 64px); }
  .hero .lede { grid-area: lede; margin-top: 26px; }
  .hero .stores { grid-area: stores; }
  .hero-art { grid-area: art; justify-self: end; width: clamp(130px, 38vw, 260px); }
  .story { grid-template-columns: 1fr; }
  .stage { display: none; }
  .chap { min-height: 0; padding: 64px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 18px; align-items: start; }
  .chap > :not(h2):not(.chap-art), .chap.wide > .dial-copy > :not(h2), .chap.wide > .drift-copy > :not(h2) { grid-column: 1 / -1; }
  .chap.wide { grid-template-columns: minmax(0, 1fr) auto; }
  .dial-copy, .drift-copy { display: contents; }
  .chap h2 { grid-column: 1; grid-row: 1; align-self: center; font-size: clamp(27px, 7.6vw, 46px); max-width: 14ch; }
  .chap-art { display: block; grid-column: 2; grid-row: 1; position: relative; width: clamp(104px, 30vw, 170px); aspect-ratio: 1; justify-self: end; align-self: center; }
  .moon-inline { position: absolute; right: -4%; top: 4%; width: 90%; opacity: .95; }
  .pose-inline { position: absolute; left: 4%; bottom: -3%; height: 96%; width: auto; max-width: 74%; margin: 0; object-fit: contain; object-position: bottom center; }
  .dial-copy, .ladder, .phone { grid-column: 1 / -1; grid-row: auto; }
  .phone { width: min(70vw, 280px); justify-self: center; margin-top: 18px; }
  .desk-row { flex-direction: column; } .desk-row .btn { width: 100%; padding: 18px; }
  .store { flex: 1 1 180px; justify-content: center; }
  .goodnight { min-height: 0; padding-bottom: 28px; }
  .gn-scene { width: 100%; height: 64vw; min-height: 240px; margin: 24px 0 0; justify-self: stretch; order: 2; }
  .gn-text { order: 1; }
  .goodnight .g1 { left: 84%; top: 40%; }
  .gn-stores { order: 3; margin-top: 28px; }
  .goodnight { display: flex; flex-direction: column; }
}
@media (max-width: 520px) {
  /* the bar must fit a 360 px phone: logo, clock and button together were 404 px wide, which made the browser zoom the whole page out */
  .bar { padding: 12px var(--margin); gap: 8px; }
  .mark { font-size: 16px; }
  .clock { font-size: 13px; }
  .bar .btn { padding: 9px 12px; font-size: 14px; }
}
@media (max-width: 360px) { .clock { display: none; } .bar { grid-template-columns: 1fr auto; } }

/* ---------------------------------------------------------------- the real example (demo) and the plans */
.hero-demo { margin-top: 18px; } .hero-demo a { text-underline-offset: 4px; }
.langs { display: flex; flex-wrap: wrap; gap: 8px; }
.lang { font: 500 var(--t-sm)/1 var(--sans); color: var(--ink); background: var(--panel); border: 0; border-radius: 99px; padding: 12px 18px; min-height: 44px; cursor: pointer; transition: background-color .18s, color .18s; }
.lang:hover { background: rgba(255,255,255,.15); }
.lang[aria-selected="true"] { background: var(--yellow); color: var(--navy); }
.demo { background: var(--panel); border-radius: 28px; padding: clamp(22px, 2.4vw, 36px); display: grid; gap: 10px; }
.demo-wait { color: var(--soft); }
.demo-kicker { margin-top: 14px; font: 600 var(--t-sm)/1 var(--sans); color: var(--yellow); letter-spacing: .04em; text-transform: uppercase; }
.demo-kicker:first-child { margin-top: 0; }
.demo-prompt { font: 400 var(--t-lead)/1.3 var(--serif); }
.journey { display: grid; gap: 6px; color: var(--soft); }
.journey li { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid rgba(255,255,255,.08); padding: 6px 0; font-variant-numeric: tabular-nums; }
.journey li span:last-child { color: var(--ink); }
.demo .book-chapters li { opacity: 1; animation: none; font-size: var(--t-body); padding: 3px 0; }
.demo h3 { font: 400 var(--t-title)/1.05 var(--serif); letter-spacing: -.02em; }
.demo audio { width: 100%; margin-top: 8px; accent-color: var(--yellow); }
.plans { display: grid; gap: clamp(22px, 3vw, 40px); padding: clamp(64px, 10vh, 120px) var(--margin); max-width: 1180px; margin: 0 auto; }
.plans-copy { max-width: 52ch; }
.plans-copy h2 { max-width: 18ch; }
.plans-copy p { margin-top: 14px; color: var(--soft); }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tier { background: var(--panel); border-radius: 28px; padding: clamp(22px, 2.2vw, 32px); display: grid; gap: 12px; align-content: start; }
.tier-main { background: var(--yellow); color: var(--navy); }
.tier h3 { font: 400 var(--t-title)/1 var(--serif); }
.tier-price { font: 400 var(--t-h2)/1 var(--serif); font-size: clamp(30px, 3vw, 42px); }
.tier-price span { font: 500 var(--t-sm)/1 var(--sans); opacity: .7; }
.tier-main .plain li::before { background: var(--navy); }
.plans-note { max-width: 70ch; }
@media (max-width: 900px) { .demo { margin-top: 4px; } .chap > .langs, .chap > .demo { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js .reveal, .js .lengths li, .js .lad { opacity: 1; transform: none; }
  .book-chapters li { opacity: 1; }
}

/* ---------------------------------------------------------------- the holding page */
.hold { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; gap: 4vw; padding: 120px var(--margin) 60px; }
.hold .lede { max-width: 32ch; }
.hold-art { width: min(100%, 420px); justify-self: center; }
.hold-mail { margin-top: 26px; }
.store.off { cursor: default; opacity: .62; }
.store.off:hover { transform: none; background: var(--ink); }
.store.picked { opacity: 1; background: var(--yellow); }
.store.picked .store-sm { color: #4B4F85; }
@media (max-width: 900px) { .hold { grid-template-columns: 1fr; padding-top: 100px; } }
