/* LugaReader: the colours are the app icon's (the great wave on parchment, the red sun, the teal whale) and the app's own
   (cream paper, rust accent, the serif of its headings). Night swaps the parchment for a dark sky and the sun for a moon. */

:root {
  --sky: #F3E1C1;
  --page: #F8F0E3;
  --paper: #FFFBF4;
  --ink: #2A1E17;
  --muted: #6E5F52;
  --rust: #B85429;
  --rust-soft: rgba(184, 84, 41, 0.16);
  --cta: linear-gradient(180deg, color-mix(in srgb, var(--rust) 82%, #fff), var(--rust));
  --sun: #EE6A4A;
  --line: #14304D;
  --indigo: #1F3F63;
  --indigo-deep: #17324F;
  --spray: #FFFBF2;
  --teal: #2F8582;
  --glass: rgba(255, 251, 244, 0.72);
  --glass-edge: rgba(42, 30, 23, 0.10);
  --shadow: rgba(80, 40, 18, 0.28);
  --stars: 0;
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}

/* Night: what the system asks for, unless the sun or the whale was tapped. */
:root[data-theme="dark"] {
  --sky: #0F1B2B;
  --page: #111A26;
  --paper: #182433;
  --ink: #F2E8DA;
  --muted: #A99C8C;
  --rust: #ED8F54;
  --rust-soft: rgba(237, 143, 84, 0.22);
  --sun: #F3E1C1;
  --line: #9DB9CF;
  --indigo: #13263D;
  --indigo-deep: #0C1A2B;
  --glass: rgba(24, 36, 51, 0.72);
  --glass-edge: rgba(242, 232, 218, 0.12);
  --shadow: rgba(0, 0, 0, 0.5);
  --stars: 1;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky: #0F1B2B;
    --page: #111A26;
    --paper: #182433;
    --ink: #F2E8DA;
    --muted: #A99C8C;
    --rust: #E58459;
    --rust-soft: rgba(229, 132, 89, 0.22);
    --sun: #F3E1C1;
    --line: #9DB9CF;
    --indigo: #13263D;
    --indigo-deep: #0C1A2B;
    --glass: rgba(24, 36, 51, 0.72);
    --glass-edge: rgba(242, 232, 218, 0.12);
    --shadow: rgba(0, 0, 0, 0.5);
    --stars: 1;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--page);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
  transition: background-color .7s ease, color .7s ease;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

.kicker {
  font: 700 13px/1.2 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--rust);
  margin-bottom: 14px; transition: color .7s ease;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(42px, 5.2vw, 84px); line-height: 1.02; }
h2 { font-size: clamp(32px, 4.2vw, 56px); line-height: 1.06; }
.sub { font-size: clamp(17px, 1.5vw, 21px); color: var(--muted); margin-top: 18px; text-wrap: pretty; transition: color .7s ease; }

/* ---------- navigation: a glass pill, like the app's controls ---------- */
.nav {
  position: fixed; z-index: 50; top: max(12px, env(safe-area-inset-top)); left: 50%; translate: -50% 0;
  width: min(1100px, calc(100% - 24px)); height: 54px; padding: 0 10px 0 12px;
  display: flex; align-items: center; gap: 24px;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 27px;
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 8px 30px rgba(20, 30, 50, .12);
  transition: background-color .7s ease, border-color .7s ease;
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 18px var(--serif); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.links { display: flex; gap: 22px; margin-left: auto; font-size: 15px; }
.links a { text-decoration: none; color: var(--muted); }
.links a:hover { color: var(--ink); }
.soon {
  font-size: 14px; font-weight: 600; color: #fff; background: var(--cta); padding: 8px 14px; border-radius: 18px;
  white-space: nowrap;
}
@media (max-width: 560px) { .links { display: none; } .soon { margin-left: auto; } }

/* ---------- the hero: a tall section whose stage stays on screen while the wave plays ---------- */
.hero { height: 460vh; position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.sky {
  position: absolute; inset: 0; background: var(--sky);
  transition: background-color .7s ease;
}
.sky::after { /* a warm haze low in the sky, and a cooler one at night */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 60% at 70% 30%, rgba(255, 210, 160, .35), transparent 70%);
  opacity: calc(1 - var(--stars)); transition: opacity .7s ease;
}
.stars {
  position: absolute; inset: 0; opacity: var(--stars); transition: opacity 1s ease; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1px 1px at 28% 8%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1.6px 1.6px at 46% 22%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1px 1px at 58% 12%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1.3px 1.3px at 66% 34%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1px 1px at 74% 6%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1.5px 1.5px at 92% 28%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1px 1px at 84% 44%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1.2px 1.2px at 36% 40%, #F3E1C1 60%, transparent 61%),
    radial-gradient(1px 1px at 6% 46%, #F3E1C1 60%, transparent 61%);
}

/* The sun, or at night the moon: a crescent comes over it from the right. */
.sun {
  position: absolute; z-index: 1; right: 7vw; top: 13vh; width: clamp(72px, 11vh, 120px); aspect-ratio: 1;
  border-radius: 50%; background: var(--sun); overflow: hidden;
  box-shadow: 0 0 0 0 rgba(243, 225, 193, 0);
  transition: background-color .7s ease, box-shadow .7s ease, transform .4s cubic-bezier(.3, 1.6, .5, 1);
}
.sun::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--sky);
  transform: translate(120%, -60%); transition: transform .8s cubic-bezier(.6, 0, .2, 1), background-color .7s ease;
}
:root[data-theme="dark"] .sun { box-shadow: 0 0 70px 14px rgba(243, 225, 193, .18); }
:root[data-theme="dark"] .sun::after { transform: translate(34%, -22%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun { box-shadow: 0 0 70px 14px rgba(243, 225, 193, .18); }
  :root:not([data-theme="light"]) .sun::after { transform: translate(34%, -22%); }
}
.sun:hover { transform: scale(1.06); }
.sun:focus-visible, .whale:focus-visible { outline: 3px solid var(--rust); outline-offset: 6px; }
.sun.boop { animation: boop .6s ease; }
@keyframes boop { 40% { transform: scale(1.18); } }

/* The wave, the whale and the spray move together: the script places this layer. */
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; pointer-events: none; }
.world .sea { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; }
.world .whale {
  position: absolute; left: 0; top: 0; width: 22%; aspect-ratio: 1; pointer-events: auto;
  transform-origin: 43% 56%; will-change: transform; -webkit-tap-highlight-color: transparent;
}
.whale img { width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(11, 26, 49, .3)); }
.whale.spin img { animation: spin .9s cubic-bezier(.4, 0, .2, 1); }
@keyframes spin { 50% { transform: rotate(-24deg) scale(1.12); } }
.spray i {
  position: absolute; border-radius: 50%; background: var(--spray); border: 1.5px solid #14304D;
  will-change: transform, opacity;
}

.hero-phone {
  position: absolute; left: 0; top: 0; z-index: 0; opacity: 0; will-change: transform, opacity;
}
.intro, .reveal { position: absolute; z-index: 3; }
.intro { right: 4vw; top: 20vh; width: min(560px, 44vw); }
.intro h1 { color: var(--ink); transition: color .7s ease; }
.reveal { left: 58vw; top: 50%; width: min(470px, 36vw); opacity: 0; transform: translateY(-50%); pointer-events: none; }
.reveal h2 { font-size: clamp(32px, 3.4vw, 50px); }
/* The app's main button: its accent colour with the system's light-to-full gradient, white type, round corners. */
.store {
  display: inline-flex; align-items: center; margin-top: 28px; padding: 16px 26px; border-radius: 18px;
  background: var(--cta); color: #fff; font-weight: 600; font-size: 17px; box-shadow: 0 10px 24px var(--rust-soft);
}
.cue {
  position: absolute; z-index: 3; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); translate: -50% 0;
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink);
  background: var(--glass); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.cue span { width: 2px; height: 14px; background: var(--rust); border-radius: 1px; animation: cue 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Small and upright screens: the words above the wave, the reveal's words after the wave. */
@media (max-aspect-ratio: 9/10), (max-width: 899px) {
  .intro { left: 7vw; right: 7vw; top: calc(76px + 4vh); width: auto; }
  .intro h1 { font-size: clamp(38px, 10vw, 64px); }
  .sun { top: calc(84px + 3vh); right: 7vw; width: 52px; }
  .reveal { display: none; }
}

/* ---------- a phone and a tablet, drawn as the App Store pages draw them ---------- */
.device { background: #211A16; position: relative;
  box-shadow: 0 36px 70px var(--shadow), 0 8px 22px rgba(80, 40, 18, .18), inset 0 0 0 2.5px #3d332d; }
.phone { border-radius: 13.5% / 6.3%; padding: 3.2%; }
.phone .screen { border-radius: 10.5% / 4.9%; }
.screen { overflow: hidden; background: #FAF7F2; }
.screen img { width: 100%; height: auto; aspect-ratio: 1320 / 2868; object-fit: cover; object-position: top; }
.hero-phone { width: calc((min(80svh, 800px)) * 0.4605); }
@media (max-aspect-ratio: 9/10), (max-width: 899px) { .hero-phone { width: min(calc(72svh * 0.4605), 74vw); } }
.tablet { border-radius: 5.5%; padding: 2.8%; }
.tablet .screen { border-radius: 3%; }
.tablet .screen img { aspect-ratio: 2064 / 2752; }

/* ---------- the reveal, for small screens and reduced motion ---------- */
.reveal-static { display: none; padding: 40px 7vw 20px; background: var(--sky); text-align: center; transition: background-color .7s; }
.reveal-static .device { width: min(320px, 76vw); margin: 34px auto 0; }
@media (max-aspect-ratio: 9/10), (max-width: 899px) { .reveal-static { display: block; } .reveal-static .device { display: none; } }

/* ---------- read along: scrolling lights each sentence in turn ---------- */
.read-along { height: 300vh; position: relative; background: var(--sky); transition: background-color .7s; }
.stage2 { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-items: center; padding: 80px 6vw 30px; }
.page {
  width: min(760px, 100%); background: var(--paper); border-radius: 28px; padding: clamp(26px, 4vw, 56px);
  box-shadow: 0 30px 80px var(--shadow); transition: background-color .7s;
}
.book { font: italic 15px var(--serif); color: var(--muted); margin-bottom: 18px; }
.passage { font: 400 clamp(19px, 2.1vw, 27px)/1.6 var(--serif); }
.passage p + p { margin-top: .7em; }
.s { color: var(--muted); border-radius: 4px; padding: 1px 0; transition: color .35s ease, background-color .35s ease; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.s.read { color: var(--ink); }
.s.now { color: var(--ink); background: var(--rust-soft); }
.player { display: flex; align-items: center; gap: 16px; margin-top: 28px; }
.play {
  width: 56px; height: 56px; border-radius: 50%; background: var(--rust); flex: none;
  display: flex; align-items: center; justify-content: center; gap: 3px; transition: background-color .7s;
}
/* The seven bars of the app's play button: tallest in the middle, each on its own beat. */
.play i { width: 3px; height: 26px; border-radius: 2px; background: #fff; transform: scaleY(.3); }
.playing .play i { animation: bar var(--d) ease-in-out infinite alternate; }
.play i:nth-child(1) { --h: .45; --d: .53s; } .play i:nth-child(2) { --h: .7; --d: .41s; }
.play i:nth-child(3) { --h: .9; --d: .47s; }  .play i:nth-child(4) { --h: 1; --d: .37s; }
.play i:nth-child(5) { --h: .85; --d: .51s; } .play i:nth-child(6) { --h: .65; --d: .43s; }
.play i:nth-child(7) { --h: .45; --d: .57s; }
@keyframes bar { from { transform: scaleY(calc(var(--h) * .25)); } to { transform: scaleY(var(--h)); } }
.where { flex: 1; display: grid; gap: 8px; font-size: 15px; }
.track { height: 4px; border-radius: 2px; background: var(--glass-edge); overflow: hidden; }
.fill { display: block; height: 100%; width: 0; background: var(--rust); transition: background-color .7s; }

/* ---------- the tide line: the wave's outline drawn as the page scrolls ---------- */
/* The big wave's outline from the icon, small and centred, between the passage and the features. */
.tide { background: linear-gradient(var(--sky), var(--page)); padding: 30px 0 10px; }
.tide svg { display: block; width: min(420px, 76vw); height: auto; margin: 0 auto; overflow: visible; }
.tide path { fill: none; stroke: var(--line); stroke-width: 3; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: var(--drawn, 1); stroke-linejoin: round; transition: stroke .7s; }

/* ---------- features ---------- */
.features { width: min(1120px, 100%); margin: 0 auto; padding: 60px 6vw 40px; display: grid; gap: clamp(80px, 12vw, 160px); }
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 7vw; }
.feature:nth-child(even) .device { order: 2; }
.feature .device { width: min(330px, 100%); justify-self: center;
  opacity: 0; transform: translateY(60px) rotate(-4deg); transition: opacity .9s ease, transform 1.1s cubic-bezier(.2, .8, .2, 1); }
.feature:nth-child(even) .device { transform: translateY(60px) rotate(4deg); }
.feature .copy { opacity: 0; transform: translateY(30px); transition: opacity .9s ease .1s, transform 1s cubic-bezier(.2, .8, .2, 1) .1s; }
.feature.in .device, .feature.in .copy { opacity: 1; transform: none; }
.copy p:not(.kicker) { font-size: clamp(17px, 1.6vw, 21px); color: var(--muted); margin-top: 16px; text-wrap: pretty; transition: color .7s; }
.copy p.small { font-size: 15px; }
@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .feature .device { order: 2 !important; width: min(290px, 76vw); }
}

/* ---------- devices ---------- */
.devices { width: min(1180px, 100%); margin: 0 auto; padding: 120px 6vw; display: grid; grid-template-columns: 1fr 1.25fr; gap: 6vw; align-items: center; }
.devices .tablet { width: 100%; max-width: 620px; justify-self: center; }
.formats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.formats li { font-size: 14px; font-weight: 600; padding: 7px 13px; border-radius: 16px; border: 1px solid var(--glass-edge); background: var(--paper); transition: background-color .7s, border-color .7s; }
@media (max-width: 760px) { .devices { grid-template-columns: 1fr; text-align: center; } .formats { justify-content: center; } }

/* ---------- plans: on the wave's dark blue, flecked with its mist ---------- */
.plans { position: relative; overflow: hidden; background: var(--indigo); color: #FFF8EC; text-align: center; padding: 120px 6vw 110px; transition: background-color .7s; }
.plans .kicker { color: #F3B08F; }
.mist { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(circle, rgba(255, 251, 242, .7) 1.2px, transparent 1.6px), radial-gradient(circle, rgba(255, 251, 242, .45) 1px, transparent 1.4px);
  background-size: 46px 52px, 31px 37px; background-position: 0 0, 13px 21px; }
.cards { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); justify-content: center; gap: 24px; margin-top: 50px; text-align: left; }
.card { background: var(--paper); color: var(--ink); border-radius: 26px; padding: 32px 30px; box-shadow: 0 24px 60px rgba(5, 15, 30, .35); transition: background-color .7s, color .7s; }
.card h3 { font-size: 26px; }
.price { font: 700 40px var(--serif); margin: 8px 0 18px; }
.price small { font: 500 16px var(--sans); color: var(--muted); }
.card ul { list-style: none; display: grid; gap: 10px; }
.card li { padding-left: 26px; position: relative; color: var(--muted); }
.card li::before { content: ""; position: absolute; left: 0; top: .5em; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); }
.card.pro { outline: 3px solid var(--rust); }
.card.pro li::before { background: var(--rust); }
.note { position: relative; margin-top: 26px; font-size: 14px; opacity: .75; }
@media (max-width: 760px) { .cards { grid-template-columns: minmax(0, 420px); } }

/* ---------- the end: the sky again, the whale leaping from the sea ---------- */
.end {
  position: relative; overflow: hidden; min-height: 100svh; display: flex; flex-direction: column; text-align: center;
  --sea-w: max(780px, 104vw);   /* the wave's width */
  --shown: 50svh;               /* how much of it rises above the bottom of the page */
  --whale: clamp(110px, 13vw, 190px);
}
.end .sky { z-index: 0; }
.end .sun { top: 12vh; right: 10vw; }
.cta { position: relative; z-index: 3; padding: 10vh 6vw 0; }
.appicon { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 22px; box-shadow: 0 14px 30px var(--shadow); }
.cta h2 { font-size: clamp(40px, 5vw, 64px); }
/* The whole wave, crest and curl against the sky, running on past the bottom of the page; the whale leaps in the hollow
   under the curl, coming up from behind the sea and going back behind it. */
.shore { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: var(--shown); pointer-events: none; }
.shore .sea { position: absolute; left: 50%; top: 0; width: var(--sea-w); max-width: none; translate: -50% 0; }
.end .whale {
  position: absolute; z-index: 1; bottom: 0; width: var(--whale); aspect-ratio: 1;
  left: calc(50% + 0.16 * var(--sea-w) - 0.43 * var(--whale));
}
.end .whale.leaping { animation: leap 7s ease-in-out infinite; }
@keyframes leap {
  0%, 45%, 100% { transform: translate(-50%, 115%) rotate(-40deg); }
  65% { transform: translate(0%, -60%) rotate(-4deg); }
  85% { transform: translate(55%, 115%) rotate(40deg); }
}
.fine {
  position: absolute; z-index: 3; left: 50%; translate: -50% 0; bottom: max(16px, env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100% - 24px); padding: 8px 16px; border-radius: 18px; font-size: 13px; color: var(--muted);
  background: var(--glass); border: 1px solid var(--glass-edge); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.fine a { color: var(--ink); }

/* ---------- reduced motion: no pinning, no flight; everything shown as it rests ---------- */
.still .hero { height: auto; }
.still .stage { position: relative; height: 100svh; }
.still .reveal, .still .cue, .still .hero-phone { display: none; }
.still .reveal-static { display: block; }
.still .reveal-static .device { display: block; }
.still .read-along { height: auto; }
.still .stage2 { position: relative; height: auto; padding: 60px 6vw; }
.still .s { color: var(--ink); }
.still .feature .device, .still .feature .copy { opacity: 1; transform: none; transition: none; }
.still .end .whale.leaping { animation: none; transform: translate(0, -40%) rotate(-8deg); }
.still .tide path { stroke-dashoffset: 0; }

/* ---------- the privacy page: one column of plain text on paper ---------- */
.doc { width: min(760px, 100%); margin: 0 auto; padding: 120px 6vw 80px; }
.doc header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.doc header .sun { position: relative; inset: auto; width: 54px; flex: none; margin-top: 6px; }
.doc h1 { font-size: clamp(40px, 6vw, 64px); }
.doc .updated { color: var(--muted); margin-top: 10px; }
.doc .short { margin-top: 36px; padding: 26px 28px; border-radius: 22px; background: var(--paper); box-shadow: 0 16px 40px var(--shadow); transition: background-color .7s; }
.doc .short ul { margin-top: 10px; }
.doc h2 { font-size: clamp(24px, 3vw, 32px); margin-top: 44px; }
.doc p, .doc li { font-size: 17px; color: var(--muted); margin-top: 12px; transition: color .7s; }
.doc ul { padding-left: 22px; }
.doc li { margin-top: 8px; }
.doc strong { color: var(--ink); }
.doc .back { display: inline-block; margin-top: 50px; color: var(--rust); font-weight: 600; text-decoration: none; }
