:root {
  --bg: #f7f6f3;
  --ink: #111;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --card: #fff;
  --border: rgba(0,0,0,.08);
  --notch-w: 196px;
  --notch-h: 34px;
  --face-h: 112px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.5;
  min-height: 100svh; overflow: hidden; position: relative;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

.top { position: absolute; inset: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 26px 44px; z-index: 2; }
.wordmark { font-weight: 800; font-size: 32px; letter-spacing: -0.05em; line-height: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: 14px; }
.pill.ghost { border: 1px solid var(--border); background: var(--card); color: var(--ink); }
.pill.dark { background: var(--ink); color: #fff; padding: 16px 28px; font-size: 18px; min-width: 210px; justify-content: center; gap: 12px; transition: background .2s, transform .2s; }
.pill.dark:hover { background: #333; transform: translateY(-2px); }
.pill.dark img { filter: invert(1); }

/* Sprite frames: 4 x 2 sheet, frame index → background-position (set from JS or data-frame). */
.sprite { background-image: url('assets/portraits/bae.webp');
  background-size: 400% 200%; background-repeat: no-repeat; }

/* Notch demo. Phases (data-phase on .demo): enter → show → out → rest. The black box grows down from the page edge,
   she slides down inside it, the bubble pops; between reminders everything collapses back up. */
.demo { position: absolute; inset: 0 0 auto; height: 280px; z-index: 3; pointer-events: none; }
.notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: var(--notch-w); height: calc(var(--notch-h) + var(--face-h));
  background: #000; border-radius: 0 0 26px 26px; overflow: hidden; pointer-events: auto; cursor: pointer;
  transition: height .48s cubic-bezier(.22,1,.36,1), transform .48s cubic-bezier(.22,1,.36,1);
  animation: arrival-notch .8s cubic-bezier(.22,1,.36,1) .15s backwards;
}
.portrait {
  position: absolute; bottom: -8px; left: 50%; margin-left: calc(var(--face-h) / -2); width: var(--face-h); height: var(--face-h);
  transition: transform .48s cubic-bezier(.22,1,.36,1), opacity .25s, background-position .15s;
}
.bubble {
  position: absolute; left: calc(50% + var(--notch-w) / 2 - 30px); top: calc(var(--notch-h) + var(--face-h) * .58);
  background: var(--card); border: .5px solid var(--border); border-radius: 22px; padding: 15px 36px 15px 18px;
  width: max-content; max-width: 320px; min-width: 178px; box-shadow: 0 7px 25px rgba(32,32,30,.09); pointer-events: auto;
  transition: opacity .23s, transform .32s cubic-bezier(.22,1,.36,1); transform-origin: 0 25px;
  animation: arrival-bubble .4s ease-out .7s backwards;
}
.bubble::before { content: ""; position: absolute; left: 12px; top: -10px; border-right: 22px solid transparent; border-bottom: 14px solid var(--card); }
.bubble .line { font-weight: 650; font-size: 16px; line-height: 1.3; letter-spacing: -.3px; }
.bubble .answers { display: flex; gap: 20px; margin-top: 10px; font-size: 13px; font-weight: 600; color: rgba(0,0,0,.72); }
.bubble .answers:empty { display: none; }
.bubble .answers button { padding: 0; }
.bubble .answers button:hover { color: var(--ink); text-decoration: underline; }
.bubble.reaction { padding-right: 14px; }
.bubble .close { position: absolute; right: 6px; top: 5px; width: 24px; height: 24px; font-size: 18px; color: rgba(0,0,0,.35); line-height: 1; opacity: 0; transition: opacity .2s; }
.bubble:hover .close, .bubble:focus-within .close { opacity: 1; }
.bubble.reaction .close { display: none; }
.demo[data-phase="out"] .bubble, .demo[data-phase="rest"] .bubble, .demo[data-phase="enter"] .bubble { opacity: 0; transform: translate(-9px,-5px) scale(.95); pointer-events: none; }
.demo[data-phase="out"] .portrait, .demo[data-phase="rest"] .portrait { transform: translateY(-140px); opacity: 0; }
.demo[data-phase="out"] .notch, .demo[data-phase="rest"] .notch { height: 0; transform: translate(-50%,-5px); }

/* One entrance per page load: notch drops in, eyebrow, bubble, typed headline, then the rest of the copy. */
.eyebrow { animation: arrival-copy .7s ease-out .4s backwards; }
.hero h1 { animation: arrival-bubble .001s linear 1s backwards; }
.typed-letter { animation: arrival-letter .001s step-end backwards; }
.hero .sub { animation: arrival-copy .65s ease-out 3.1s backwards; }
.hero .download, .hero .fine { animation: arrival-copy .65s ease-out 3.6s backwards; }
@keyframes arrival-notch { from { transform: translate(-50%,-100%); } to { transform: translate(-50%,0); } }
@keyframes arrival-letter { from { visibility: hidden; } to { visibility: visible; } }
@keyframes arrival-bubble { from { opacity: 0; } to { opacity: 1; } }
@keyframes arrival-copy { from { opacity: 0; transform: translateY(6px); visibility: hidden; } to { opacity: 1; transform: none; visibility: visible; } }

/* Buy Pro: a soft light sweeps round the rim once on load and again on hover. */
.pill.ghost.rim { position: relative; isolation: isolate; overflow: hidden; padding: 1px; background: #d9d9d5; border: 0; }
.pill.ghost.rim > span { display: inline-flex; align-items: center; padding: 9px 17px; border-radius: 999px; background: var(--bg); width: 100%; height: 100%; }
.pill.ghost.rim::before { content: ""; position: absolute; z-index: -1; inset: -100%; background: conic-gradient(from 0deg, transparent 0deg 220deg, #8b8b85 250deg, #fff 280deg, #8b8b85 310deg, transparent 340deg); animation: rim 2.4s ease-in-out .6s both; }
.pill.ghost.rim:hover::before { animation: rim 1.5s ease-in-out both; }
@keyframes rim { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.hero { text-align: center; min-height: 100svh; padding: 40svh 24px 175px; display: flex; flex-direction: column; align-items: center; gap: 0; }
.eyebrow { font-size: 13px; letter-spacing: 5px; text-transform: uppercase; color: #787876; font-weight: 600; margin-bottom: 28px; }
h1 { font-size: clamp(36px, 4.2vw, 64px); font-weight: 500; letter-spacing: -0.045em; line-height: 1.12; }
.sub { font-size: 24px; color: var(--muted); letter-spacing: -.02em; margin: 18px 0 42px; }
.fine { font-size: 14px; color: var(--faint); margin-top: 16px; }

.bottom { position: absolute; top: calc(100svh - 80px); left: 0; width: 100%; min-height: 58px; padding: 0 44px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; font-size: 13px; color: var(--muted); gap: 18px; }
.controls { display: flex; align-items: center; gap: 12px; }
.controls select { font: inherit; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; }
.controls select:hover { border-color: var(--border); background: var(--card); }
.controls button { font-size: 14px; padding: 2px 6px; }
.links { display: flex; gap: 17px; justify-self: end; }

/* Pro dialog: centred, her face on top, one full-width button, blurred page behind. */
body.pro-open { overflow: hidden; }
.pro-dialog { box-sizing: border-box; width: min(440px, calc(100% - 40px)); max-height: calc(100svh - 40px); margin: auto; padding: 30px 32px 26px; overflow: auto; border: 1px solid rgba(255,255,255,.7); border-radius: 28px; background: var(--card); color: var(--ink); box-shadow: 0 24px 80px rgba(21,21,21,.14); text-align: center; }
.pro-dialog::backdrop { background: rgba(21,21,21,.21); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.pro-dialog[open] { animation: pro-arrive .24s cubic-bezier(.22,1,.36,1); }
.pro-dialog[open]::backdrop { animation: pro-dim .2s ease-out; }
.pro-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #7c7c78; font-size: 22px; line-height: 1; transition: background .2s, color .2s; }
.pro-close:hover { background: #f0f0ed; color: var(--ink); }
.pro-portrait { width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 50%; background-color: #000; }
.pro-dialog h2 { font-size: 26px; letter-spacing: -0.03em; font-weight: 700; }
.pro-intro { color: var(--muted); font-size: 17px; margin-top: 4px; letter-spacing: -.2px; }
.pro-features { display: grid; gap: 18px; list-style: none; margin: 26px 0 28px; text-align: left; }
.pro-features li { display: grid; gap: 3px; }
.pro-features strong { font-size: 16.5px; font-weight: 600; letter-spacing: -.3px; }
.pro-features span { color: var(--muted); font-size: 14.5px; line-height: 1.45; letter-spacing: -.15px; }
.pro-checkout { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 13px 20px; border-radius: 999px; background: #191919; color: #fff; font-size: 18px; font-weight: 600; letter-spacing: -.3px; transition: background .2s, transform .2s, box-shadow .2s; }
.pro-checkout:hover { background: #303030; transform: translateY(-1px); box-shadow: 0 5px 12px rgba(21,21,21,.08); }
.pro-checkout[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.pro-terms { margin-top: 13px; color: #767674; font-size: 13px; line-height: 1.5; }
@keyframes pro-arrive { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pro-dim { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 760px) {
  :root { --notch-w: 150px; --face-h: 84px; --notch-h: 28px; }
  .bubble { left: 50%; transform: translateX(-50%); top: calc(var(--notch-h) + var(--face-h) + 14px); max-width: min(320px, calc(100% - 40px)); }
  .bubble::before { left: calc(50% - 11px); }
  .demo[data-phase="out"] .bubble, .demo[data-phase="rest"] .bubble, .demo[data-phase="enter"] .bubble { transform: translate(-50%,-10px); }
  .bubble .close { opacity: 1; }
  .top { padding: 24px 22px; }
  .wordmark { font-size: 25px; }
  .hero { padding: max(300px, 40svh) 24px 165px; }
  .sub { font-size: 17px; margin: 20px auto 28px; max-width: 320px; }
  .bottom { top: auto; bottom: 14px; padding: 0 22px; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 11px; }
  .controls { grid-column: 1 / -1; justify-content: center; }
  .made { display: none; }
  .pro-dialog { padding: 28px 22px 24px; border-radius: 24px; }
  .pro-features { gap: 14px; }
  .pro-features strong { font-size: 15.5px; }
  .pro-features span { font-size: 13.5px; }
}
