/* barnacle.qa: a dive, scrubbed by the scroll. The film is the page; the words sit in the water,
   and his floating window rides over it the way it rides over your apps. */

/* Paragraphs and everything else: Hanken Grotesk. */
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk.woff2') format('woff2');
  font-weight: 100 900; font-display: swap;
}
/* Headings: Mona Sans, a little wide. */
@font-face {
  font-family: 'Mona Sans';
  src: url('fonts/mona-sans.woff2') format('woff2');
  font-weight: 200 900; font-stretch: 75% 125%; font-display: swap;
}
/* The name, wherever it's the name: Young Serif. */
@font-face {
  font-family: 'Young Serif';
  src: url('fonts/young-serif.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}

:root {
  /* One accent: the sun on the water. (His window has its own, as in the app.) */
  --foam: #f2f4ee;
  --ink: #0f2622;
  --accent: #f0be45;
  --deep: #0b2420;
  /* The bottom: the barnacle film's own dark, which the water fades to on the way down. */
  --abyss: #0a0a18;
  /* His window, in his colors (src/components/barnie/look.ts: seafoam.scene). */
  --stage: #1f433c;
  --stage-text: #eef8f3;
  --stage-dim: #b6d9cc;
  --stage-accent: #f2b49c;

  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 40px; --s5: 64px; --s6: 104px;
  --r: 18px;
  --gutter: clamp(20px, 5vw, 72px);
  --display: clamp(68px, 11.5vw, 184px);
  --heading: clamp(40px, 4.8vw, 76px);
  --body: clamp(18px, 1.3vw, 21px);
  --small: 15px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--deep) url('frames/wide/080.webp') center / cover fixed; color: var(--foam);
  font: 400 var(--body) / 1.5 'Hanken Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* (With the film drawn, the body is just the deep behind it.) */
.js body { background: var(--abyss); }
h1, h2, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h2 { font-family: 'Mona Sans', 'Hanken Grotesk', system-ui, sans-serif; font-weight: 700; font-stretch: 112.5%; }
h2 { font-size: var(--heading); line-height: 1; letter-spacing: -0.03em; max-width: 12ch; text-wrap: balance; }
a { color: inherit; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.frame { width: min(100% - 2 * var(--gutter), 1240px); margin-inline: auto; }

/* The film fills the window at its tallest (100lvh: it doesn't jump when iOS's toolbar folds). */
.film, .film-edge { display: none; }
.js .film, .js .film-edge {
  display: block; position: fixed; left: 0; top: 0; z-index: 0; width: 100vw; height: 100vh; height: 100lvh;
}
/* The surface, until the first still is drawn over it (index.html preloads it), sized as home.js
   draws the stills (covering the window, and 2% over) so nothing moves when it does. */
.js .film {
  background: var(--abyss) url('frames/wide/000.webp') center no-repeat;
  background-size: max(102vw, 102vh * 16 / 9);
  background-size: max(102vw, 102lvh * 16 / 9);
}
@media (orientation: portrait) {
  .js .film {
    background-image: url('frames/tall/000.webp');
    background-size: max(102vw, 102vh * 9 / 16);
    background-size: max(102vw, 102lvh * 9 / 16);
  }
}
/* The window's edges darken a little, as they do underwater: over the surface and the stills alike. */
.js .film-edge {
  pointer-events: none;
  background: radial-gradient(circle farthest-corner at 50% 45%, rgb(4 22 19 / 0) 30%, rgb(4 22 19 / 0.55) 120%);
  background: radial-gradient(circle at 50% 45%, rgb(4 22 19 / 0) min(26vw, 26lvh), rgb(4 22 19 / 0.55) hypot(62vw, 62lvh));
}
main { position: relative; z-index: 1; }

/* ───────────── Masthead ───────────── */
/* Its ink follows the water under it: dark over the sky, foam once under (home.js: .mast--dark). */
.mast {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--gutter); padding-top: max(var(--s3), env(safe-area-inset-top));
  color: var(--foam); font-size: var(--small); transition: color 0.4s;
}
.mast--dark { color: var(--ink); }
.mark { display: inline-flex; align-items: center; gap: var(--s1); text-decoration: none; font-family: 'Young Serif', Georgia, serif; font-weight: 400; font-size: 20px; letter-spacing: -0.005em; }
.mark svg { width: 34px; height: 21px; }
/* One "Barnacle" on screen at a time: the word waits until the title has gone. */
.mark span { transition: opacity 0.4s; }
.js .mark span { opacity: 0; }
.js .past-title .mark span { opacity: 1; }
.mast-link { text-decoration: none; opacity: 0.85; transition: opacity 0.3s; }
.mast-link:hover { opacity: 1; }
/* (At the end it would only repeat the heading.) */
.at-soon .mast-link { opacity: 0; pointer-events: none; }
.mark:focus-visible, .mast-link:focus-visible, .notify:focus-visible, .foot a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 4px; }

/* ───────────── The surface ───────────── */
/* Dark words over the evening sky; they fade as you go under (home.js: --gone). */
.hero { min-height: 100vh; min-height: 100svh; }
.hero-copy { padding-top: clamp(112px, 20vh, 220px); color: var(--ink); opacity: calc(1 - var(--gone, 0)); }
.title { font-family: 'Young Serif', Georgia, serif; font-weight: 400; font-size: var(--display); line-height: 0.9; letter-spacing: -0.02em; margin-left: -0.03em; }
.lede { max-width: 28ch; margin-top: var(--s4); font-size: clamp(20px, 1.75vw, 27px); line-height: 1.38; font-weight: 500; letter-spacing: -0.01em; }
.cue { display: flex; align-items: center; gap: var(--s1); margin-top: var(--s4); font-size: var(--small); font-weight: 500; opacity: 0.75; }
.cue svg { width: 12px; height: 16px; animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 50% { transform: translateY(4px); } }

/* ───────────── Scenes ───────────── */
/* Each holds still for a while (the stage is sticky) while the film runs on under it; a brief one
   doesn't hold at all, and scrolls by. */
.scene { height: 200vh; height: 200svh; }
.scene--long { height: 300vh; height: 300svh; }
.scene--brief { height: 100vh; height: 100svh; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: var(--s5);
  /* The words rise in as the scene arrives, and go as it leaves (home.js: --in). */
  opacity: var(--in, 1); translate: 0 calc((1 - var(--in, 1)) * 24px);
}
.copy p { max-width: 30ch; margin-top: var(--s3); opacity: 0.88; }
.copy, .moments, .sayings, .colonies { text-shadow: 0 1px 28px rgb(4 22 19 / 0.35); }

/* Where his window comes to rest in a scene (home.js moves it here): the window's own shape. */
.dock { aspect-ratio: 200 / 84; width: min(100%, 540px); justify-self: center; }

/* He catches what drifts by: the week, as his memory lists it. The one asked for lights up (home.js: .lit). */
.moments { display: grid; max-width: 520px; justify-self: end; width: 100%; }
.moments li { display: grid; gap: 2px; padding: var(--s2) 0 var(--s2) var(--s3); border-top: 1px solid rgb(242 244 238 / 0.2); position: relative; transition: opacity 0.5s; }
.moments li:last-child { border-bottom: 1px solid rgb(242 244 238 / 0.2); }
.moments li::before { content: ''; position: absolute; left: 0; top: var(--s2); bottom: var(--s2); width: 3px; border-radius: 2px; background: var(--accent); transform: scaleY(0); transition: transform 0.5s; }
.moments b { font-size: clamp(19px, 1.5vw, 23px); font-weight: 600; letter-spacing: -0.01em; }
.moment-when, .moment-said { font-size: var(--small); opacity: 0.72; }
.moments.asked li { opacity: 0.42; }
.moments.asked li.lit { opacity: 1; }
.moments li.lit::before { transform: scaleY(1); }

/* Say the word: the one being said is bright; his window answers it. */
.sayings { display: grid; gap: var(--s1); justify-self: end; }
.sayings li { font-size: clamp(26px, 2.7vw, 42px); font-weight: 500; letter-spacing: -0.025em; line-height: 1.2; opacity: 0.3; transition: opacity 0.4s; }
.sayings li.said { opacity: 1; }

/* Everything you keep: a colony each, settling in turn (home.js: --show). */
.colonies { display: grid; gap: var(--s3); justify-self: end; width: 100%; max-width: 520px; }
.colonies li {
  display: grid; grid-template-columns: 136px auto 1fr; align-items: center; gap: var(--s2);
  opacity: var(--show, 1); translate: 0 calc((1 - var(--show, 1)) * 16px);
}
.colony-shells { display: flex; align-items: flex-end; }
.colony-shells svg { width: 52px; height: 50px; margin-right: -12px; filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.25)); }
.colony-shells svg:nth-child(2) { width: 42px; height: 40px; }
.colony-shells svg:nth-child(3) { width: 34px; height: 33px; }
/* The tag: the app's chip. */
.colonies b { padding: 5px 14px; border-radius: var(--r); background: var(--foam); color: var(--ink); font-size: var(--small); font-weight: 600; text-shadow: none; }
.colonies li > span:last-child { font-size: var(--small); opacity: 0.8; }

/* The demo: its cover (the video's thumbnail), a play button in the one accent, and where it goes
   (YouTube, in a new tab). */
.demo { display: grid; gap: var(--s2); justify-self: end; width: 100%; max-width: 640px; color: inherit; text-decoration: none; }
.demo-film {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r);
  background: var(--abyss); box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 18px 44px rgb(2 14 12 / 0.45);
}
.demo-film img { display: block; width: 100%; height: 100%; object-fit: cover; transition: scale 0.6s cubic-bezier(0.3, 0.7, 0.2, 1); }
.demo-play {
  position: absolute; left: 50%; top: 50%; width: clamp(56px, 6vw, 80px); height: auto; translate: -50% -50%;
  fill: var(--accent); filter: drop-shadow(0 10px 24px rgb(0 0 0 / 0.4)); transition: scale 0.25s;
}
.demo-play path { fill: var(--ink); }
.demo-note { display: flex; align-items: center; gap: var(--s1); font-size: var(--small); font-weight: 500; opacity: 0.75; transition: opacity 0.25s; }
.demo-note svg { width: 11px; height: 11px; }
.demo:hover .demo-film img { scale: 1.03; }
.demo:hover .demo-play { scale: 1.08; }
.demo:hover .demo-note { opacity: 1; }
.demo:focus-visible { outline: none; }
.demo:focus-visible .demo-film { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ───────────── The bottom ───────────── */
/* The film has gone dark by now; the barnacle's film rises out of it (its top dissolves into the
   same deep), and the words sit to its left, over the open water. */
.soon {
  position: relative; min-height: max(100vh, 680px); min-height: max(100svh, 680px);
  display: grid; grid-template-rows: 1fr auto auto; overflow: hidden;
  /* (Clear at its top, so the film's last stills darken into it with no seam.) */
  background: linear-gradient(transparent, var(--abyss) 45%);
}
.deep {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%;
  -webkit-mask-image: linear-gradient(transparent, #000 38%); mask-image: linear-gradient(transparent, #000 38%);
}
.soon-inner { position: relative; display: grid; justify-items: start; align-content: center; gap: var(--s3); padding-top: var(--s6); }
.soon h2 { max-width: 12ch; }
.soon-inner > p { max-width: 24ch; opacity: 0.88; }
/* The sign-up: the address and the button on one line (stacked on a phone), the answer under them. */
.join { display: grid; gap: var(--s2); margin-top: var(--s2); width: min(100%, 560px); }
.join-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.join-row { display: flex; gap: var(--s1); }
.join input {
  flex: 1; min-width: 0; padding: var(--s2) var(--s3); border-radius: var(--r);
  border: 1px solid rgb(242 244 238 / 0.35); background: rgb(10 10 24 / 0.55); color: var(--foam);
  font: inherit; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: border-color 0.25s;
}
.join input::placeholder { color: var(--foam); opacity: 0.5; }
.join input:focus { outline: none; border-color: var(--accent); }
.join[data-state="error"] input { border-color: var(--stage-accent); }
.notify {
  display: inline-flex; align-items: center; justify-content: center; padding: var(--s2) var(--s4);
  border: 0; border-radius: var(--r); background: var(--accent); color: var(--ink);
  font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; transition: transform 0.25s, box-shadow 0.25s, opacity 0.25s;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
}
.notify:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgb(0 0 0 / 0.45); }
.notify:disabled { opacity: 0.6; cursor: default; transform: none; }
.notify-note { font-size: var(--small); opacity: 0.7; }
.notify-note:empty { display: none; }
.join[data-state="done"] .notify-note, .join[data-state="error"] .notify-note { opacity: 1; }
.join[data-state="done"] .join-row { display: none; }
/* Who backs us: its own band across the bottom, over the dark, in the page's own white, each logo at
   the height that gives it the same weight. */
.backers-band { position: relative; display: grid; gap: var(--s3); padding-top: var(--s5); }
.backers-label { font-size: var(--small); opacity: 0.75; }
.backers { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4); }
.backer { display: block; width: auto; filter: brightness(0) invert(1) drop-shadow(0 0 4px rgb(0 0 0 / 0.7)) drop-shadow(0 0 16px rgb(0 0 0 / 0.6)); opacity: 0.95; }
.backer--a16z { height: 34px; }
.backer--thrive { height: 21px; }
.backer--slow { height: 19px; }
.backer--lowercase { height: 34px; }
.backer--endeavor { height: 19px; }
.backer--form { height: 26px; }
.backer--shrug { height: 24px; }
.foot { position: relative; display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s5) 0 max(var(--s4), env(safe-area-inset-bottom)); font-size: var(--small); opacity: 0.7; }
.foot a { text-decoration: none; }

/* ───────────── His floating window ───────────── */
/* Drawn at the app's 200 by 84 and scaled (home.js: its transform), so it's the same window at any size. */
.pip { display: none; }
.js .pip {
  display: block; position: fixed; left: 0; top: 0; z-index: 6; width: 200px; height: 84px;
  border-radius: var(--r); background: var(--stage); color: var(--stage-text);
  transform-origin: 0 0; opacity: 0; overflow: hidden; pointer-events: none;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 18px 44px rgb(2 14 12 / 0.45);
  font-size: 13px; line-height: 16px; will-change: transform, opacity;
}
/* Idle, he sits in the middle; with something to show, at the left (as in PipStage). */
.pip-avatar { position: absolute; left: 4px; top: 50%; width: 78px; height: 75px; translate: 57px -50%; transition: translate 0.45s cubic-bezier(0.3, 0.7, 0.2, 1); }
.pip:not([data-state='idle']) .pip-avatar { translate: 0 -50%; }
.pip-content {
  position: absolute; left: 86px; right: 8px; top: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  opacity: 0; transition: opacity 0.3s;
}
.pip:not([data-state='idle']) .pip-content { opacity: 1; transition-delay: 0.12s; }
.pip-content > * { display: none; }
.pip-heard, .pip-reply span, .pip-note { -webkit-box-orient: vertical; overflow: hidden; }
.pip-reply span { display: -webkit-box; }
.pip-heard { font-weight: 600; -webkit-line-clamp: 3; }
.pip-step { font-size: 12px; font-weight: 700; color: var(--stage-accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-reply { gap: 4px; align-items: flex-start; font-weight: 700; }
.pip-reply span { -webkit-line-clamp: 3; }
.pip-icon { flex: none; width: 11px; height: 11px; margin-top: 2.5px; color: var(--stage-accent); }
.pip-note { font-size: 11px; line-height: 14px; color: var(--stage-dim); -webkit-line-clamp: 3; }
.pip-dots { gap: 3px; margin-top: 3px; }
.pip-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--stage-dim); animation: dot 1s ease-in-out infinite; }
.pip-dots i:nth-child(2) { animation-delay: 0.15s; }
.pip-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 50% { opacity: 0.3; transform: translateY(-2px); } }

.pip[data-state='hearing'] .pip-heard { display: -webkit-box; }
/* (What was heard stays, small, over what he's doing and his answer.) */
.pip[data-state='working'] .pip-heard, .pip[data-state='reply'] .pip-heard { display: -webkit-box; font-size: 11px; line-height: 14px; font-weight: 500; color: var(--stage-dim); -webkit-line-clamp: 2; }
.pip[data-state='reply'] .pip-heard { -webkit-line-clamp: 1; }
.pip[data-state='working'] .pip-step { display: block; }
.pip[data-state='working'] .pip-dots { display: flex; }
.pip[data-state='reply'] .pip-reply, .pip[data-state='asleep'] .pip-reply { display: flex; }
.pip[data-state='asleep'] .pip-reply { font-weight: 700; color: var(--stage-text); }
.pip[data-state='asleep'] .pip-icon { color: var(--stage-text); }
.pip[data-state='asleep'] .pip-note { display: -webkit-box; }

/* Barnie, in layers: his legs comb the water behind the shell; his eyes blink; the plates close when he sleeps. */
.barnie { position: relative; width: 100%; height: 100%; }
.barnie svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.b-legs { transition: opacity 0.3s, transform 0.4s; transform-origin: 50% 30%; }
.b-legs g { animation: comb 2.8s ease-in-out infinite; }
@keyframes comb {
  0%, 100% { transform: rotate(-9deg) scale(0.9); }
  50% { transform: rotate(7deg) scale(1.03); }
}
.b-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; transition: opacity 0.2s; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
.b-sleep { opacity: 0; transition: opacity 0.2s; }
.b-lid-l, .b-lid-r { transform-box: view-box; transform: scaleX(0); transition: transform 0.5s cubic-bezier(0.6, 0, 0.3, 1) 0.15s; }
.b-seam { opacity: 0; transition: opacity 0.2s; }
.pip[data-state='reply'] .barnie { animation: hop 0.55s cubic-bezier(0.3, 0.7, 0.2, 1); }
@keyframes hop { 40% { translate: 0 -5px; } }

/* Asleep: legs in, plates shut, eyes closed (the smile stays). */
.pip[data-state='asleep'] .b-legs { opacity: 0; transform: scale(0.3); }
.pip[data-state='asleep'] .b-lid-l, .pip[data-state='asleep'] .b-lid-r { transform: scaleX(1); }
.pip[data-state='asleep'] .b-seam { opacity: 1; transition-delay: 0.6s; }
.pip[data-state='asleep'] .b-eyes { opacity: 0; animation: none; transition-delay: 0.5s; }
.pip[data-state='asleep'] .b-sleep { opacity: 1; transition-delay: 0.5s; }

/* ───────────── Small screens ───────────── */
@media (max-width: 820px) {
  .stage {
    grid-template-columns: minmax(0, 1fr); align-content: center; gap: var(--s4);
    padding-top: 72px; padding-bottom: 120px;
  }
  .copy p { margin-top: var(--s2); }
  .moments, .sayings, .colonies, .demo { justify-self: stretch; }
  .moments li { padding-block: 12px; }
  .moments li:nth-child(n + 4) { display: none; }
  .sayings li { font-size: clamp(22px, 6vw, 30px); }
  .colonies { gap: var(--s2); }
  .colonies li { grid-template-columns: 100px auto 1fr; gap: 12px; }
  .colony-shells svg { width: 40px; height: 38px; margin-right: -10px; }
  .colony-shells svg:nth-child(2) { width: 32px; height: 31px; }
  .colony-shells svg:nth-child(3) { width: 26px; height: 25px; }
  .dock { width: min(100%, 360px); }
  /* (On a phone the words go above him.) */
  .soon-inner { align-content: start; padding-top: 120px; }
  /* He stands in the lower part, whole, with the footer on the dark under him. */
  .deep {
    top: auto; height: 460px; object-position: 50% 50%;
    -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 72%, rgb(0 0 0 / 0.25));
    mask-image: linear-gradient(transparent, #000 30%, #000 72%, rgb(0 0 0 / 0.25));
  }
  .foot { text-shadow: 0 1px 12px rgb(0 0 0 / 0.6); }
  .foot { flex-direction: column; gap: var(--s1); }
  /* (The logos two by two.) */
  /* (Two by two, a little smaller, above his room: the band takes the room under the words.) */
  .backers-band { padding-top: 0; padding-bottom: 300px; }
  .backers { display: grid; grid-template-columns: repeat(2, max-content); justify-content: start; gap: 24px 32px; }
  .backer--a16z { height: 28px; }
  .backer--thrive { height: 16px; }
  .backer--slow { height: 15px; }
  .backer--lowercase { height: 25px; }
  .backer--endeavor { height: 14px; }
  .backer--form { height: 20px; }
  .backer--shrug { height: 19px; }
  /* On a phone the barnacle gets its own room below the words, not under them: the section is as
     tall as they are plus his film, which sits at the bottom with the footer over his shell. */
  .soon { min-height: 0; }
  .soon-inner { padding-bottom: var(--s5); }
  .join-row { flex-direction: column; }
}
@media (max-width: 820px) and (max-height: 700px) {
  .copy p { font-size: 17px; }
  h2 { font-size: 36px; }
}

/* Still water for those who'd rather: the film steps from scene to scene, and nothing loops. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cue svg, .b-legs g, .b-eyes, .pip-dots i, .pip[data-state='reply'] .barnie { animation: none !important; }
  .pip-avatar, .pip-content, .b-lid-l, .b-lid-r, .b-legs, .demo-film img, .demo-play { transition: none !important; }
}
