@font-face { font-family: "Caveat"; src: url("assets/fonts/caveat_bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Literata"; src: url("assets/fonts/literata_display.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Literata Text"; src: url("assets/fonts/literata_text.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --night: #0b1017;
  --night-2: #111a25;
  --sea: #10202e;
  --sea-2: #0a1722;
  --abyss: #050a10;
  --ink: #eef3f7;
  --muted: #9aa8b6;
  --line: #2a3747;
  --lamp: #e9b872;
  --ice: #9fc4dc;
  --hand: "Caveat", "Segoe Print", cursive;
  --serif: "Literata", Georgia, serif;
  --text: "Literata Text", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 5vw, 56px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 400 1.06rem/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--lamp); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #f4cf98; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; border-radius: 4px; }

/* Stars above the water, drifting snow below (drawn by script.js) */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.sky canvas { width: 100%; height: 100%; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter);
  background: linear-gradient(180deg, rgba(11,16,23,.9), rgba(11,16,23,.55) 70%, transparent);
  backdrop-filter: blur(6px);
}
.mark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.6rem/1 var(--hand); }
.top nav { display: flex; gap: clamp(14px, 3vw, 28px); }
.top nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.top nav a:hover { color: var(--ink); }

main { position: relative; z-index: 1; }
section { max-width: 1120px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); position: relative; }

.kicker { margin: 0 0 6px; color: var(--lamp); font: 600 .78rem/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--hand); font-weight: 700; line-height: .95; margin: 0; }
h1 { font-size: clamp(4.2rem, 13vw, 8.5rem); }
h2 { font-size: clamp(2.8rem, 8vw, 4.8rem); }
h3 { font-size: clamp(2.6rem, 6.5vw, 4.2rem); }

/* Depth gauge */
.gauge { position: fixed; right: clamp(10px, 2vw, 28px); top: 22vh; height: 56vh; width: 2px; z-index: 15; opacity: 0; transition: opacity .6s; }
.gauge.on { opacity: 1; }
.gauge-line { position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(159,196,220,.35) 12%, rgba(159,196,220,.35) 88%, transparent); }
.gauge-dot { position: absolute; left: -4px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 14px rgba(233,184,114,.7); transform: translateY(-50%); }
.gauge-label { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 700 1.15rem/1 var(--hand); color: var(--ice); transition: opacity .3s; }

/* Hero */
.hero {
  min-height: calc(100vh - 70px);
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: clamp(16px, 4vw, 48px);
  padding-top: 24px; padding-bottom: 20px;
}
.squiggle { width: 160px; height: 14px; margin: 14px 0 18px; }
.squiggle path { fill: none; stroke: var(--lamp); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 1.2s .5s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.lead { font: 400 clamp(1.5rem, 3.2vw, 2rem)/1.3 var(--serif); margin: 0 0 14px; }
.lead em { font-style: italic; color: var(--lamp); }
.hero-words p:not(.lead):not(.kicker) { color: var(--muted); max-width: 30em; }
.dive { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font: 700 1.5rem/1 var(--hand); color: var(--ice); text-decoration: none; }
.dive svg { width: 16px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.hero-art { position: relative; margin: 0; }
.hero-art .alpaca { width: 100%; filter: drop-shadow(0 18px 40px rgba(0,0,0,.45)); }
.moon {
  position: absolute; top: 4%; left: 8%; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f7f1e1, #d9cfb4 60%, #b9ae92);
  box-shadow: 0 0 60px 14px rgba(247,241,225,.12);
}

/* The waterline */
.waterline { position: relative; height: 150px; margin-top: 10px; overflow: hidden; }
.tip { position: absolute; left: 50%; bottom: 20px; width: 200px; transform: translateX(-50%); }
.tip .f1 { fill: #dfeaf2; } .tip .f2 { fill: #b9cfde; } .tip .f3 { fill: #f4f8fb; }
.wave { position: absolute; left: 0; bottom: 0; width: 200%; height: 44px; }
.wave path { fill: var(--sea); }
.wave.w1 { animation: tide 22s linear infinite; }
.wave.w2 { opacity: .55; bottom: 6px; animation: tide 34s linear infinite reverse; }
.wave.w2 path { fill: #1a3042; }
@keyframes tide { to { transform: translateX(-50%); } }

/* The sea: everything below the waterline */
.sea {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--sea) 0%, var(--sea-2) 35%, #07111a 70%, var(--abyss) 100%);
  padding-bottom: 20px;
}
.rays { position: absolute; inset: 0 0 auto 0; height: 900px; pointer-events: none; }
.rays i {
  position: absolute; top: -40px; width: 140px; height: 820px;
  background: linear-gradient(180deg, rgba(159,196,220,.10), transparent 85%);
  transform: rotate(14deg); transform-origin: top; filter: blur(6px);
  animation: shimmer 9s ease-in-out infinite;
}
.rays i:nth-child(1) { left: 18%; }
.rays i:nth-child(2) { left: 46%; width: 90px; animation-delay: -3s; }
.rays i:nth-child(3) { left: 70%; width: 160px; animation-delay: -6s; }
@keyframes shimmer { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.berg { position: absolute; left: 50%; top: 0; width: min(900px, 120%); height: 3000px; transform: translateX(-50%); pointer-events: none; }

.intro { text-align: center; padding-top: 50px; padding-bottom: 30px; }
.tagline { font: 400 clamp(1.4rem, 3.4vw, 2rem)/1.3 var(--serif); margin: 14px 0 0; color: var(--ice); }

/* Chapters */
.chapter { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(24px, 6vw, 80px); padding-top: 90px; padding-bottom: 90px; }
.chapter.flip .chapter-words { order: 2; }
.chapter-words p:not(.num):not(.hint) { color: var(--muted); max-width: 26em; font-size: 1.08rem; }
.num { margin: 0; font: 700 2rem/1 var(--hand); color: var(--lamp); }
.chapter h3 { margin: 6px 0 14px; }
.hint { font: 700 1.35rem/1.2 var(--hand); color: var(--ice); margin-top: 18px; }

/* Phones */
.phone {
  margin: 0 auto; width: clamp(200px, 26vw, 280px); aspect-ratio: 9 / 19.5;
  border-radius: 34px; padding: 8px; background: #05080c;
  box-shadow: 0 0 0 1px #2a3747, 0 30px 80px rgba(0,0,0,.55), 0 0 60px rgba(159,196,220,.10);
  position: relative; overflow: hidden;
}
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 27px; }
.phone::after { content: ""; position: absolute; inset: 8px; border-radius: 27px; pointer-events: none; background: linear-gradient(115deg, rgba(255,255,255,.07), transparent 35%); }
.floaty { animation: float 7s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-12px) rotate(1deg); } }

/* ii. Lines sinking into the deep */
.sinking {
  position: relative; height: 380px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 55%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 12%, #000 55%, transparent);
}
.sinking p {
  position: absolute; left: var(--x); top: 0; margin: 0; max-width: 70%;
  font: 700 clamp(1.3rem, 2.4vw, 1.7rem)/1.2 var(--hand); color: var(--ink);
  animation: sink 16s linear infinite; animation-delay: var(--d);
}
@keyframes sink {
  0%   { transform: translateY(0) rotate(-2deg); opacity: 0; filter: blur(0); }
  8%   { opacity: .95; }
  100% { transform: translateY(360px) rotate(2deg); opacity: .1; filter: blur(1.5px); color: var(--ice); }
}

/* iii. The deep: tap a light, it rises */
.chapter.wide { grid-template-columns: .8fr 1.2fr; }
.deep {
  position: relative; height: 460px; border-radius: 26px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, rgba(159,196,220,.10), transparent 60%), linear-gradient(180deg, #0e1d2a, #060c13);
  box-shadow: inset 0 0 0 1px rgba(159,196,220,.12), 0 30px 80px rgba(0,0,0,.4);
}
.surface { position: absolute; left: 0; right: 0; top: 12%; height: 1px; background: linear-gradient(90deg, transparent, rgba(159,196,220,.55), transparent); }
.mark-age { position: absolute; left: 14px; font: 600 .7rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: rgba(154,168,182,.45); }
.mark-age::after { content: ""; display: inline-block; width: 18px; height: 1px; margin-left: 8px; vertical-align: middle; background: rgba(154,168,182,.3); }
.idea {
  position: absolute; left: var(--x); top: var(--y); width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%;
  transition: left 1.6s cubic-bezier(.22,.8,.3,1), top 1.6s cubic-bezier(.22,.8,.3,1);
}
.idea::before {
  content: ""; position: absolute; inset: calc(50% - 6px * var(--k)); border-radius: 50%;
  background: radial-gradient(circle, #fff3dc 0%, var(--lamp) 45%, rgba(233,184,114,0) 72%);
  box-shadow: 0 0 calc(18px * var(--k)) rgba(233,184,114,.55);
  opacity: calc(.45 + .5 * var(--k));
  animation: twinkle 4s ease-in-out infinite; animation-delay: calc(var(--k) * -7s);
  transition: inset .6s, opacity .6s;
}
.idea.ice::before { background: radial-gradient(circle, #f2fbff 0%, var(--ice) 45%, rgba(159,196,220,0) 72%); box-shadow: 0 0 calc(18px * var(--k)) rgba(159,196,220,.6); }
.idea:hover::before { inset: calc(50% - 9px); opacity: 1; }
.idea.up { left: 50%; top: 12%; z-index: 2; }
.idea.up::before { inset: -4px; opacity: 1; animation: none; }
@keyframes twinkle { 0%,100% { transform: scale(1); } 50% { transform: scale(.78); } }
.note {
  position: absolute; left: 50%; top: calc(12% + 34px); width: min(78%, 360px); margin: 0; padding: 16px 20px 14px;
  background: #f3ece0; color: #2a2620; border-radius: 6px 18px 8px 14px; box-shadow: 0 20px 50px rgba(0,0,0,.45);
  transform: translate(-50%, 10px) rotate(-1deg); opacity: 0; transition: opacity .6s, transform .6s; pointer-events: none;
}
.note.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }
.note-text { margin: 0; font: 700 1.45rem/1.2 var(--hand); white-space: pre-line; }
.note-meta { margin: 8px 0 0; font: 600 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #8a5a1c; }

/* Also in the ice */
.tools { text-align: center; padding-top: 70px; padding-bottom: 60px; }
.tool-row { display: flex; justify-content: center; gap: clamp(16px, 4vw, 48px); margin-top: 40px; }
.tool-row figure { margin: 0; }
.tool-row .phone { width: clamp(150px, 20vw, 220px); }
.tool-row figure:nth-child(2) { transform: translateY(30px); }
.tool-row figcaption { margin-top: 16px; font: 700 1.3rem/1.15 var(--hand); color: var(--ice); }

/* Privacy */
.quiet { text-align: center; padding-top: 110px; padding-bottom: 60px; }
.lock { width: 40px; height: 40px; fill: none; stroke: var(--lamp); stroke-width: 2; stroke-linecap: round; margin: 0 auto 10px; display: block; }
.big { font: 400 clamp(1.8rem, 4.6vw, 3rem)/1.2 var(--serif); margin: 0 0 10px; }
.quiet p:not(.big) { color: var(--muted); margin: 0; }

/* Creatures of the deep */
.creatures { text-align: center; padding-top: 40px; padding-bottom: 40px; }
.creatures p { color: var(--muted); font-family: var(--text); font-style: italic; }
.swim { position: relative; height: 160px; }
.whale { position: absolute; top: 30px; width: 220px; left: 0; fill: rgba(159,196,220,.20); animation: whale 46s linear infinite; }
.whale .fin { fill: rgba(159,196,220,.28); } .whale .eye { fill: rgba(5,10,16,.8); }
.fish { position: absolute; width: 28px; fill: rgba(233,184,114,.45); animation: fish 18s linear infinite; }
.fish.f-a { top: 18px; }
.fish.f-b { top: 120px; width: 20px; animation-duration: 24s; animation-delay: -9s; }
@keyframes whale { 0% { transform: translateX(110vw) translateY(0); } 50% { transform: translateX(40vw) translateY(10px); } 100% { transform: translateX(-260px) translateY(0); } }
@keyframes fish { 0% { transform: translateX(110vw) scaleX(1); } 100% { transform: translateX(-60px); } }

/* Why */
.why { padding-top: 90px; padding-bottom: 40px; display: grid; justify-items: center; }
.letter {
  margin-top: 26px; max-width: 34em; padding: 34px clamp(22px, 5vw, 46px);
  background: #f3ece0; color: #2a2620; border-radius: 6px 22px 8px 18px;
  box-shadow: 0 30px 70px rgba(0,0,0,.45); transform: rotate(-.6deg);
  font: 400 1.08rem/1.75 var(--text);
}
.letter p { margin: 0 0 14px; }
.sign { font: 700 2rem/1 var(--hand); color: #8a5a1c; text-align: right; margin: 6px 0 0 !important; }

/* Hello */
.hello { text-align: center; padding-top: 80px; padding-bottom: 100px; }
.hello-alpaca { margin: 0 auto 10px; animation: float 6s ease-in-out infinite; }
.hello p { color: var(--muted); }

footer { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: .85rem; padding: 26px var(--gutter) 40px; border-top: 1px solid var(--line); background: var(--abyss); }

/* Plain document pages (privacy) */
body:not(.home) { background: linear-gradient(180deg, var(--night) 0%, var(--night) 40%, var(--sea) 100%); }
.doc { max-width: 760px; padding-top: 30px; padding-bottom: 70px; }
.doc-title { font-size: clamp(3.2rem, 10vw, 5rem); margin-bottom: 8px; }
.doc-body { transform: none; max-width: none; font-size: 1rem; }
.doc-body h2 { font: 600 1.25rem/1.3 var(--serif); margin: 26px 0 8px; color: #2a2620; }
.doc-body a { color: #8a5a1c; }
.doc-body code { font-size: .88em; background: #e6dccb; padding: 1px 5px; border-radius: 4px; }
.doc-body ul { padding-left: 1.2em; }
.doc-body table { width: 100%; border-collapse: collapse; font-size: .93rem; margin: 6px 0 10px; display: block; overflow-x: auto; }
.doc-body th, .doc-body td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid #d9ccb6; }
.doc-body th { font-weight: 600; }

/* Gentle reveal on scroll (only when JS runs and motion is welcome) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s ease; }
.js .reveal.seen { opacity: 1; transform: none; }
.js .floaty.reveal.seen { transform: none; }

/* Phones and small screens */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 10px; }
  .hero-art { max-width: 420px; margin: 0 auto; width: 100%; }
  .chapter, .chapter.wide { grid-template-columns: 1fr; padding-top: 60px; padding-bottom: 60px; }
  .chapter.flip .chapter-words { order: 0; }
  .phone { width: min(70%, 260px); }
  .sinking { height: 300px; }
  .sinking p { max-width: 88%; }
  .deep { height: 420px; }
  .note { width: 90%; padding: 14px 16px 12px; }
  .note-text { font-size: 1.3rem; }
  .tool-row { overflow-x: auto; justify-content: flex-start; padding: 0 4px 40px; scroll-snap-type: x mandatory; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); }
  .tool-row figure { scroll-snap-align: center; flex: 0 0 auto; }
  .tool-row figure:nth-child(2) { transform: none; }
  .tool-row .phone { width: 190px; }
  .top nav a:not(:first-child) { display: none; }
  .gauge { display: none; }
  .waterline { height: 120px; }
  .tip { width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .squiggle path { animation: none; stroke-dashoffset: 0; }
  .dive svg, .hello-alpaca, .floaty, .wave, .rays i, .idea::before { animation: none; }
  .whale { animation: none; transform: translateX(55vw); }
  .fish { animation: none; } .fish.f-a { transform: translateX(20vw); } .fish.f-b { transform: translateX(70vw); }
  .sinking p { animation: none; }
  .sinking p:nth-child(1) { transform: translateY(20px); }
  .sinking p:nth-child(2) { transform: translateY(100px); opacity: .7; }
  .sinking p:nth-child(3) { transform: translateY(180px); opacity: .45; }
  .sinking p:nth-child(4) { transform: translateY(250px); opacity: .25; }
  .idea, .note { transition: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
