/* Self-hosted fonts (latin subsets from Google Fonts, all OFL): no third-party requests. */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("fonts/fraunces.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/fraunces-italic.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/inter.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/courier-prime-400.woff2") format("woff2"); }
@font-face { font-family: "DM Serif Display"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/dm-serif-display-400.woff2") format("woff2"); }
/* Mrs Saint Delafield, subset to the signature only: "Tamberly Williams" */
@font-face { font-family: "Signature"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/signature.woff2") format("woff2"); }

:root {
  --ink: #2d2142;      /* aubergine: text, buttons */
  --violet: #5b3f8c;   /* wordmark, links, ink */
  --lavender: #a996cc;
  --sage: #8c9a7b;
  --muted: #4a3f5a;
  --vellum: #fbf7ef;
  --paper: #efe6d6;
  --nav-h: 60px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
  --sign: "Signature", cursive;
  /* stand-in for the licensed Catchy Mager wordmark font */
  --mark: "DM Serif Display", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .closing is display:flex; without this the hidden overlay still covers the page */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  background: var(--paper) url("img/paper.webp") repeat;
  background-size: 512px;
}
img { max-width: 100%; display: block; }
a { color: var(--violet); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 30; background: var(--ink); color: var(--vellum); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  background: rgba(239, 230, 214, .96); border-bottom: 1px solid rgba(45, 33, 66, .1);
  transition: box-shadow .3s;
}
.nav.scrolled { box-shadow: 0 6px 18px rgba(45, 33, 66, .07); }
.wordmark { font: 400 1.9rem/1 var(--mark); color: var(--violet); text-decoration: none; letter-spacing: .01em; }
.nav-end { display: flex; align-items: center; gap: 6px; }
.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: 8px; }
/* phones: the links drop down under the bar from the menu button */
.nav-links { display: none; }
.nav.open .nav-links {
  display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
  padding: 6px max(16px, env(safe-area-inset-left)) 14px; background: rgb(239, 230, 214);
  border-bottom: 1px solid rgba(45, 33, 66, .1); box-shadow: 0 14px 24px rgba(45, 33, 66, .1);
}
.nav-links a { padding: 14px 4px; font: 500 1.05rem/1.2 var(--sans); color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(45, 33, 66, .08); }
.nav-links a:last-child { border-bottom: 0; }
.nav-links a:hover { color: var(--violet); }
@media (min-width: 900px) { /* desktop: the links sit in the bar */
  .menu-btn { display: none; }
  .nav-links, .nav.open .nav-links { display: flex; flex-direction: row; gap: 32px; position: static; padding: 0; background: none; border: 0; box-shadow: none; order: 1; }
  .nav-end { order: 2; }
  .nav-links a { padding: 8px 0; font-size: .95rem; border: 0; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--vellum);
  font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color .2s, transform .2s;
}
.btn:hover { background: var(--violet); color: var(--vellum); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-small { min-height: 40px; padding: 0 18px; font-size: .9rem; }
.btn-wide { width: 100%; margin-top: 8px; }
.link-btn { background: none; border: 0; padding: 10px 4px; color: var(--violet); font: 500 .95rem var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn.center { display: block; margin: 6px auto 0; }

/* ---------- flock canvas ---------- */
#flock { position: fixed; top: 0; left: 0; z-index: 1; pointer-events: none; } /* size set in flock.js to match its bitmap */
main { position: relative; z-index: 2; }

/* ---------- beats: tall sections with a sticky stage = shape slot + copy ---------- */
.beat { height: 150svh; }
.beat-many { height: 330svh; }
/* phones: slot above copy, centred together (app.js sizes each slot to fit its shape and the copy) */
.stage { /* min-height + safe centring: with very large text the stage grows downward instead of clipping */
  position: sticky; top: 0; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; justify-content: safe center; gap: 18px;
  padding: calc(var(--nav-h) + 8px) 22px max(22px, calc(env(safe-area-inset-bottom) + 14px));
}
.shape-slot { position: relative; width: 100%; height: 40svh; flex: none; }
.copy { position: relative; width: 100%; max-width: 26rem; text-align: center; }
.copy p { margin: 0 0 12px; }
.copy > :last-child { margin-bottom: 0; }
.copy h2 { font: 400 clamp(1.75rem, 7.6vw, 2.6rem)/1.12 var(--serif); margin: 0 0 12px; letter-spacing: -.01em; text-wrap: balance; }
.headline { font: italic 400 clamp(2rem, 8.8vw, 2.7rem)/1.12 var(--serif); margin: 0 0 14px; color: var(--violet); letter-spacing: -.01em; text-wrap: balance; }
.lede { color: var(--muted); }
.actions { display: flex; align-items: center; justify-content: center; gap: 10px 14px; margin-top: 18px; flex-wrap: wrap; }
.actions .btn { padding: 0 20px; }
.cue { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .95rem; text-decoration: none; padding: 12px 0; white-space: nowrap; }
@media (max-height: 500px) and (max-width: 899px) { .headline { font-size: 1.75rem; } } /* the smallest phones */
.copy .statline { font-size: clamp(1.5rem, 6.4vw, 2.1rem); }
.source { font-size: .82rem; color: var(--muted); }
.copy .bridge { font: italic 400 1.2rem/1.4 var(--serif); color: var(--violet); margin-top: 16px; }

/* founder */
.founder-photo {
  /* the wreath needs ~32px around the oval; app.js sizes the slot */
  height: min(calc(100% - 64px), calc((100vw - 80px) * 1.25)); aspect-ratio: 4 / 5; margin: 32px auto 0; /* never wider than the screen */
  border-radius: 50%; padding: 6px; background: #f8f2e6; overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 10px 24px rgba(45, 33, 66, .16); transform: rotate(-1.5deg);
}
.founder-photo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 30%; }
.stamp {
  display: inline-block; font: 700 .8rem/1 var(--type); letter-spacing: .16em; text-transform: uppercase;
  color: var(--violet); border: 2px solid var(--violet); border-radius: 4px; padding: 7px 10px;
  background: rgba(251, 247, 239, .75); transform: rotate(-4deg);
}
.beat-founder .stamp { /* stamped over the bottom of the portrait, in the wreath's opening; small on phones */
  position: absolute; left: 50%; bottom: 8px; margin: 0; z-index: 1; transform: translateX(-50%) rotate(-4deg); white-space: nowrap;
  font-size: .62rem; padding: 5px 8px; letter-spacing: .12em;
}
.beat-founder .stage { gap: 8px; }
.copy .story { font-size: .875rem; line-height: 1.55; }
.copy .signoff { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 12px; margin: 10px 0 0; }
.copy .signature { font: 400 2.3rem/1 var(--sign); color: var(--violet); margin: 0; }
.copy .sig-role { font: 400 .78rem/1 var(--type); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0; }

/* one becomes many */
.specimens { pointer-events: none; }
.spec { position: absolute; opacity: 0; transition: opacity .6s ease, transform .6s ease; filter: drop-shadow(0 6px 8px rgba(45, 33, 66, .12)); }
.spec-1 { height: 96%; width: auto; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.92); }
.spec-2, .spec-3, .spec-4 { width: 26%; height: auto; transform: translate(-50%, -50%) scale(.8); }
.spec-2 { left: 14%; top: 28%; }
.spec-3 { left: 86%; top: 34%; }
.spec-4 { left: 80%; top: 78%; }
.beat-many[data-step="1"] .spec-1, .beat-many[data-step="2"] .spec-1 { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.beat-many[data-step="2"] .spec-2, .beat-many[data-step="2"] .spec-3, .beat-many[data-step="2"] .spec-4 { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.copy-many .m { transition: opacity .5s ease; }
.copy-many { position: static; } /* so .m3 is placed against the stage, i.e. the middle of the screen */
.copy-many .m1, .copy-many .m2 { font: 400 clamp(1.4rem, 5.8vw, 2rem)/1.25 var(--serif); }
.copy-many .m3 { /* in the middle of the screen, in the hole the full field leaves, on a slip of paper so it reads over the flowers */
  position: absolute; top: 50%; left: 50%; width: max-content; max-width: calc(100% - 40px); transform: translate(-50%, -50%); text-align: center;
  margin: 0; padding: 14px 18px;
  background: rgba(251, 247, 239, .94); border-radius: 3px; box-shadow: 0 8px 30px rgba(45, 33, 66, .14);
}
.beat-many[data-step="1"] .m2, .beat-many[data-step="1"] .m3,
.beat-many[data-step="2"] .m3,
.beat-many[data-step="3"] .m1, .beat-many[data-step="3"] .m2 { opacity: 0; }

/* ---------- sign-up: the last thing on the page, centred in the flower frame ---------- */
.join { /* exactly one screen, with gutters for the flowers that frame the card */
  height: 100svh; display: flex; justify-content: center; align-items: center;
  padding: calc(var(--nav-h) + 30px) 34px max(26px, calc(env(safe-area-inset-bottom) + 18px));
}
.card {
  position: relative; width: 100%; max-width: 30rem; max-height: 100%; display: flex; flex-direction: column;
  background: var(--vellum); border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 18px 50px rgba(45, 33, 66, .16);
}
.card-body { min-height: 0; overflow-y: auto; scroll-padding-block: 8px; padding: 22px 18px 12px; }
.card::before { /* a strip of paper tape holding the card down */
  content: ""; position: absolute; top: -12px; left: 50%; width: 120px; height: 26px; transform: translateX(-50%) rotate(-2deg);
  background: rgba(233, 222, 199, .82); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 48%);
}
.card h2 { font: 400 1.7rem/1.1 var(--serif); margin: 0 0 6px; outline: none; }
.card .sub { color: var(--muted); margin: 0 0 12px; }
.field { display: block; margin: 0 0 6px; }
.field span { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 5px; }
.field input {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #857a68; border-radius: 6px;
  background: #fff; color: var(--ink); font: 400 1.05rem var(--sans);
}
.field input:focus { border-color: var(--violet); outline: 2px solid rgba(91, 63, 140, .35); outline-offset: 0; }
.field input[name="code"] { letter-spacing: .4em; font-size: 1.3rem; }
.help, .hint { font-size: .85rem; color: var(--muted); margin: 0 0 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 8px 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--violet); }
.error { color: #9b1c31; font-size: .9rem; margin: 8px 0 0; }
.error:empty, .hint:empty, .status:empty { margin: 0; } /* stay in the page (live regions) but take no space */
.status { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.fine { font-size: .78rem; color: var(--muted); margin: 14px 0 0; }
.card-legal { margin-top: 12px; padding-top: 8px; border-top: 1px solid #e6dccb; text-align: center; font-size: .72rem; color: var(--muted); }
.card-legal nav { display: flex; gap: 4px 14px; justify-content: center; flex-wrap: wrap; }
.card-legal p { margin: 4px 0 0; }

.flowers { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.flower { position: relative; display: block; cursor: pointer; }
.flower input { position: absolute; opacity: 0; inset: 0; }
.flower .face {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 10px; height: 100%;
  border: 1px solid #ddd2bf; border-radius: 6px; background: #fffdf8; transition: border-color .2s, box-shadow .2s;
}
.flower img { height: 92px; width: auto; object-fit: contain; }
.flower b { font: 400 .78rem/1.2 var(--type); text-transform: uppercase; letter-spacing: .08em; text-align: center; }
.flower small { color: var(--muted); font-size: .8rem; text-align: center; line-height: 1.3; }
.flower input:checked + .face { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet); background: #f6f1fb; }
.flower input:focus-visible + .face { outline: 3px solid var(--violet); outline-offset: 2px; }

/* ---------- welcome page ---------- */
.welcome { min-height: 100svh; display: grid; place-items: center; padding: 96px 20px 48px; text-align: center; }
.welcome .wordmark { font-size: clamp(3.2rem, 14vw, 5rem); }
.welcome h1 { font: 400 clamp(1.8rem, 7vw, 2.6rem)/1.15 var(--serif); margin: 18px 0 10px; }
.welcome p { color: var(--muted); max-width: 30rem; margin: 0 auto 22px; }
.welcome img { height: 180px; width: auto; margin: 8px auto 4px; }
.welcome .flower-label { display: inline-block; font: 400 .8rem/1 var(--type); letter-spacing: .14em; text-transform: uppercase; color: var(--violet); padding: 6px 10px; margin: 0 0 18px; background: rgba(251, 247, 239, .75); border: 1px solid rgba(91, 63, 140, .35); }

/* ---------- legal pages: terms.html, privacy.html, health-data.html ---------- */
.legal-top, .legal-foot { max-width: 46rem; margin: 0 auto; padding: 14px 16px; }
.legal-top { display: flex; align-items: center; justify-content: space-between; }
.legal {
  max-width: 46rem; margin: 6px auto 0; padding: 30px 20px 36px; overflow-wrap: anywhere;
  background: var(--vellum); border-radius: 3px; box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 18px 50px rgba(45, 33, 66, .12);
}
.legal h1 { font: 400 clamp(2rem, 8vw, 2.7rem)/1.1 var(--serif); margin: 0 0 8px; letter-spacing: -.01em; text-wrap: balance; }
.legal .updated { font: 400 .78rem/1.4 var(--type); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 24px; }
.legal h2 { font: 400 1.45rem/1.2 var(--serif); margin: 36px 0 10px; }
.legal h3 { font: 600 1rem/1.3 var(--sans); margin: 22px 0 6px; }
.legal p { margin: 0 0 12px; }
.legal ul { padding-left: 1.2em; margin: 0 0 12px; }
.legal li { margin: 0 0 6px; }
.legal .short { margin: 0 0 8px; padding: 16px 18px 6px; background: #f3ecf9; border-left: 3px solid var(--lavender); }
.legal .short h2 { margin-top: 0; font-size: 1.2rem; }
.legal mark { background: #f6e7a8; color: var(--ink); padding: 0 3px; } /* a blank to fill in before launch */
.legal-foot { padding-bottom: 40px; text-align: center; font-size: .85rem; color: var(--muted); }
.legal-foot nav { display: flex; gap: 4px 18px; justify-content: center; flex-wrap: wrap; }
.legal-foot p { margin: 6px 0 0; }
@media (min-width: 700px) { .legal { padding: 52px 60px 60px; } }

/* ---------- closing: "You deserve clarity." -> "Clary" ---------- */
.closing {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--paper) url("img/paper.webp") repeat; background-size: 512px; opacity: 0; transition: opacity .5s ease;
}
.closing.on { opacity: 1; }
.closing-flower { position: relative; transition: transform .9s cubic-bezier(.6, 0, .2, 1), opacity .6s ease; }
.closing-flower img {
  height: min(52svh, 90vw); width: auto; transform: scale(1.07);
  filter: drop-shadow(0 26px 22px rgba(45, 33, 66, .22)); transition: transform .45s cubic-bezier(.2, .8, .2, 1), filter .45s ease;
}
.closing-flower.pressed img { transform: scale(1); filter: drop-shadow(0 3px 3px rgba(45, 33, 66, .16)); }
.closing-flower::before, .closing-flower::after { /* tape lands after the press */
  content: ""; position: absolute; width: 92px; height: 22px; background: rgba(233, 222, 199, .85); opacity: 0; transition: opacity .3s ease .45s;
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 48%); z-index: 1;
}
.closing-flower::before { top: 46%; left: 50%; transform: translateX(-80%) rotate(-24deg); }
.closing-flower::after { top: 70%; left: 50%; transform: translateX(-20%) rotate(18deg); }
.closing-flower.pressed::before, .closing-flower.pressed::after { opacity: 1; }
.closing-flower.lift { transform: translateY(-14svh) scale(.62); opacity: .35; }
.closing-line { position: absolute; top: 58%; left: 0; right: 0; text-align: center; font: 400 clamp(2.2rem, 10vw, 4.4rem)/1 var(--mark); color: var(--violet); margin: 0; white-space: pre; opacity: 0; transition: opacity .6s ease; }
.closing-line.on { opacity: 1; }
.closing-line.final { transform: scale(1.4); transition: opacity .6s ease, transform 1s cubic-bezier(.3, 0, .2, 1); }
.closing-line span { display: inline-block; transition: opacity .55s ease, transform .8s cubic-bezier(.6, 0, .25, 1); }
.closing-line .gone { opacity: 0; }
.closing-line .cc { position: relative; }
.closing-line .cc .up { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity .5s ease; }
.closing-line .cc.swap .low { opacity: 0; transition: opacity .5s ease; }
.closing-line .cc.swap .up { opacity: 1; }

/* ---------- desktop and landscape phones: copy on the left, the flock on the right ---------- */
/* keep this query in sync with WIDE in app.js */
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  .beat-many { height: 520svh; } /* the full field holds longer; wheels and trackpads scroll fast */
  .stage { flex-direction: row-reverse; justify-content: space-between; gap: 4vw; padding: var(--nav-h) 6vw 0; }
  .shape-slot { width: 50vw; height: 76vh; }
  .copy { width: min(30rem, 36vw); max-width: none; text-align: left; }
  .copy h2 { font-size: clamp(2.2rem, 3.4vw, 3rem); }
  .headline { font-size: clamp(2.6rem, 4.2vw, 3.8rem); }
  .actions { justify-content: flex-start; }
  .beat-founder .shape-slot { height: calc(min(64vh, 40vw) + 64px); } /* the portrait plus room for its wreath */
  .copy-many .m1, .copy-many .m2 { font-size: 2.2rem; }
  .beat-founder .stamp { font-size: .8rem; padding: 7px 10px; letter-spacing: .16em; }
  .copy .story { font-size: .95rem; }
  .copy .signoff { justify-content: flex-start; margin-top: 14px; }
  .copy .signature { font-size: 2.9rem; }
  .card-body { padding: 34px 36px 16px; }
  .card h2 { font-size: 2rem; }
}
/* landscape phones: the side-by-side layout, but sized for a short screen (touch only, so zooming in
   on a laptop, which also makes the viewport short and wide, never shrinks the text) */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) and (pointer: coarse) {
  .beat-open .shape-slot { width: 40vw; } /* room for the headline, button and cue side by side */
  .beat-open .copy { width: 46vw; }
  .stage { padding-bottom: 10px; }
  .shape-slot { height: calc(100svh - var(--nav-h) - 10px); }
  .beat-founder .shape-slot { height: calc(100svh - var(--nav-h) - 10px); }
  .copy { font-size: .9rem; }
  .copy h2, .copy .statline { font-size: 1.45rem; }
  .headline { font-size: 1.8rem; }
  .copy p { margin-bottom: 8px; }
  .copy .bridge { font-size: 1rem; margin-top: 8px; }
  .copy .story { font-size: .85rem; line-height: 1.4; }
  .copy .signoff { margin-top: 4px; }
  .copy .signature { font-size: 2rem; }
  .copy-many .m1, .copy-many .m2 { font-size: 1.5rem; }
  .beat-founder .shape-slot { width: 40vw; } /* the portrait is sized by height: give her story more width */
  .beat-founder .copy { width: 44vw; }
  .beat-founder .stamp { font-size: .62rem; padding: 5px 8px; letter-spacing: .12em; }
  .join { padding: calc(var(--nav-h) + 20px) 24px 16px; }
  .card-body { padding: 14px 20px 8px; }
  .card h2 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
