/* amoeba.shop — the A rotation + Talk to Moe.
   Phones follow the Figma frame "USE THIS" (wireframes / territories, 288:1318), which is the full 390×844 iPhone screen:
   the header and the A hang from the top (frame y minus the 28px status bar), the copy, Talk to Moe and Terms sit
   at their frame distance from the bottom of the screen, so they land just above Safari's floating bar.
   1u = 1px of that frame (or of the 1440×900 desktop frame). */

:root {
  --bg: #050506;
  --lilac: #F1EDFF;
  --cream: #F2EBD9;
  --ink: #0A0A0A;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --a-x: 50%;
  --lvh: 100vh; /* phones: the large viewport, so the page runs under Safari's bars. everything else: the visible screen */
  --H: calc(var(--lvh) - env(safe-area-inset-top));
  --svh: 100vh;
  --lift: max(0px, calc(var(--lvh) - var(--svh))); /* how much of the page sits below the visible screen */
  /* full width on phones; shrinks only when the screen is too short for the A, the copy and the pill without overlap */
  --u: min(calc(100vw / 390), calc(var(--H) / 745));
}
@supports (height: 100dvh) { :root { --lvh: 100dvh; } }
@supports (height: 100svh) { :root { --svh: 100svh; } }
@media (pointer: coarse) and (max-width: 600px) {
  @supports (height: 100lvh) { :root { --lvh: 100lvh; } }
}
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  :root { --u: min(calc(100vw / 1440), calc(var(--lvh) / 900)); --a-x: 28.4722%; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; overflow: hidden; overscroll-behavior: none; background: #050506; } /* never scrolls */
body { height: var(--lvh); overflow: hidden; overscroll-behavior: none; background: #050506; }
html { color: var(--lilac); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'DM Mono', ui-monospace, Menlo, monospace;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--lilac); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 1px solid var(--lilac); outline-offset: 4px; }

.serif {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-variation-settings: 'SOFT' 100, 'WONK' 0;
  letter-spacing: -0.02em;
}

/* ---------- the stage ---------- */

/* a solid black edge at the very top: Safari tints its toolbar from the page's top edge */
.topcap { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 20; background: var(--bg); pointer-events: none; }

.stage {
  position: relative;
  height: var(--lvh);
  overflow: hidden;
  background: var(--bg);
}
.stage > :not(.plates), .thanks .wordmark { margin-top: env(safe-area-inset-top); }

/* spores: a WebGL glow under everything (spores.js); the page stays plain black without it */
.spores { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; margin-top: 0 !important; pointer-events: none; }

/* each A is one opaque plate (page black + the photo A); plates crossfade whole */
.plates { position: absolute; inset: 0; z-index: 0; }
.plate { position: absolute; inset: 0; overflow: hidden; will-change: opacity; } /* transparent: the texture shows through */
.plate img { position: absolute; max-width: none; }
.plate__a {
  left: calc(50% - 167.66 * var(--u));   /* Figma x 27.34 */
  top: calc(92 * var(--u));              /* Figma y 120 */
  width: calc(340.13 * var(--u));
  height: calc(302 * var(--u));
}

/* ---------- header: wordmark + load bar on one line ---------- */

.wordmark {
  position: absolute;
  z-index: 3;
  left: calc(50% - 173 * var(--u));
  top: calc(16 * var(--u));
  font-size: calc(22 * var(--u));
  font-variation-settings: 'SOFT' 100, 'WONK' 0, 'opsz' 17.99; /* above opsz 18 Fraunces swaps in its leggy m */
  line-height: calc(28 * var(--u));
  text-decoration: none;
}

.bar {
  position: absolute;
  z-index: 3;
  left: calc(50% - 17 * var(--u));       /* Figma x 178 */
  top: calc(26 * var(--u));              /* centered on the wordmark */
  width: calc(189 * var(--u));
  height: calc(8 * var(--u));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: opacity .25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.bar::before { content: ''; position: absolute; inset: -12px -8px; }
.bar__dots { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bar__dots path { fill: var(--lilac); opacity: .3; }   /* each dot fades gray → white on its own (site.js) */
.bar__fill { position: absolute; width: 0; height: 0; } /* invisible: just the clock the dots follow */
.is-paused .bar { opacity: .5; }

.brackets { display: none; }

/* tap the A to skip */
.specimen {
  position: absolute;
  z-index: 2;
  left: calc(50% - 167.66 * var(--u));
  top: calc(92 * var(--u));
  width: calc(340.13 * var(--u));
  height: calc(302 * var(--u));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.specimen:focus-visible { outline-offset: -1px; }

/* ---------- copy: the intro line + two paragraphs, 10px mono, white at 50% ---------- */

.copy {
  position: absolute;
  z-index: 3;
  left: calc(50% - 164 * var(--u));      /* Figma x 31 */
  bottom: max(calc(191 * var(--u)), calc(var(--lift) + 97 * var(--u))); /* Figma: 27 above the pill */
  width: calc(341 * var(--u));
  margin: 0;
  color: #fff;
  font-size: calc(10 * var(--u));
  line-height: 1.45;
}
.copy h1, .copy p { margin: 0; font: inherit; }
.copy p { opacity: .5; } /* the intro line stays full white */
.copy p { margin-top: 1.45em; } /* a blank line between the intro and each paragraph */

/* ---------- Talk to Moe ---------- */

.pill {
  --dx: 0px; /* how far the circle has moved */
  --p: 0;    /* the same, 0–1 */
  position: absolute;
  z-index: 3;
  left: calc(50% - 173 * var(--u));
  bottom: max(calc(106 * var(--u)), calc(var(--lift) + 12 * var(--u))); /* just above the visible bottom (Safari's bar) */
  width: calc(346 * var(--u));
  height: calc(58 * var(--u));
  border: 1px solid rgba(242, 235, 217, .45);
  border-radius: calc(29 * var(--u));
  background: rgba(242, 235, 217, .08);
  color: var(--cream);
  text-decoration: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .2s var(--ease);
}
@media (hover: hover) { .pill:hover { border-color: rgba(242, 235, 217, .7); } }

/* the fill behind the circle: at rest it hides exactly under it, then stretches out behind it as it moves */
.pill__fill {
  position: absolute;
  left: calc(5 * var(--u) - 1px);
  top: calc(6 * var(--u) - 1px);
  width: calc(46 * var(--u) + var(--dx));
  height: calc(46 * var(--u));
  border-radius: calc(23 * var(--u));
  background: rgba(241, 237, 255, .3);
}

/* the words fade out over the first 40% of the swipe */
.pill__words {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(16 * var(--u));
  line-height: normal;
  white-space: nowrap;
  opacity: clamp(0, calc(1 - var(--p) * 2.5), 1);
}
.pill__words span { grid-area: 1 / 1; opacity: .5; transition: opacity .2s var(--ease); }
.pill__words .w-number, .pill.is-number .w-talk { opacity: 0; }
.pill.is-number .w-number { opacity: .5; }

/* the circle with the hugs guy, always in front, never changes */
.pill__thumb {
  position: absolute;
  left: calc(5 * var(--u) - 1px);
  top: calc(6 * var(--u) - 1px);
  width: calc(46 * var(--u));
  height: calc(46 * var(--u));
  border-radius: 50%;
  background: var(--lilac);
  transform: translate3d(var(--dx), 0, 0);
  touch-action: none;
  cursor: grab;
}
.pill.is-dragging .pill__thumb { cursor: grabbing; }
.pill__thumb img {
  position: absolute;
  left: calc(4 * var(--u));
  top: calc(8 * var(--u));
  width: calc(34 * var(--u));
  height: calc(30 * var(--u));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.legal {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: max(calc(80 * var(--u)), calc(var(--lift) - 14 * var(--u))); /* in the gap above Safari's bar, as in the Figma */
  margin: 0;
  translate: -50% 0;
  font-size: calc(10 * var(--u));
  line-height: normal;
  letter-spacing: .06em;
  white-space: nowrap;
  opacity: .5;
}
.legal a { text-decoration: none; }
@media (hover: hover) { .legal a:hover { text-decoration: underline; text-underline-offset: 3px; } }

/* ---------- thank you (after texting Moe) ---------- */

.thanks {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--lvh);
  z-index: 10;
  overflow: hidden;
  background: var(--bg);
  opacity: 0;
  transition: opacity .6s var(--ease);
}
.thanks.is-in { opacity: 1; }
.thanks .wordmark { z-index: 2; }
.ty { position: absolute; left: calc(var(--xm) * 1%); top: calc(var(--ym) * 1%); width: 0; height: 0; }
.ty img { position: absolute; left: 0; top: 0; max-width: none; height: auto; translate: -50% -50%; }
.ty__glow { width: calc(var(--wm) * 1.9 * var(--u)); opacity: .38; filter: blur(calc(20 * var(--u))); }
.ty__star { width: calc(var(--wm) * var(--u)); rotate: var(--r); }
.thanks__msg {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  margin: 0;
  translate: -50% -50%;
  font-size: calc(12 * var(--u));
  line-height: 1.45;
  white-space: nowrap;
  opacity: .6;
}


/* ---------- desktop: the A at 28.5%, the copy and Moe on the right ---------- */

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .plate__a { left: var(--a-x); top: 50%; width: calc(600 * var(--u)); height: calc(533 * var(--u)); translate: -50% -50%; }
  .specimen { left: var(--a-x); top: 50%; width: calc(600 * var(--u)); height: calc(533 * var(--u)); translate: -50% -50%; }

  .wordmark { left: calc(56 * var(--u)); top: calc(42 * var(--u)); font-size: calc(26 * var(--u)); line-height: calc(34 * var(--u)); }
  .bar { left: auto; right: calc(56 * var(--u)); top: calc(55 * var(--u)); }

  .copy { left: 58.3333%; top: calc(50% - 150 * var(--u)); bottom: auto; width: calc(470 * var(--u)); font-size: calc(13 * var(--u)); }
  .pill { left: 58.3333%; top: calc(50% + 24 * var(--u)); bottom: auto; width: calc(480 * var(--u)); }
  .legal { left: calc(58.3333% + 240 * var(--u)); top: calc(50% + 104 * var(--u)); bottom: auto; }

  .ty { left: calc(var(--xd) * 1%); top: calc(var(--yd) * 1%); }
  .ty__glow { width: calc(var(--wd) * 1.9 * var(--u)); opacity: .36; filter: blur(calc(30 * var(--u))); }
  .ty__star { width: calc(var(--wd) * var(--u)); }
  .thanks__msg { font-size: calc(24 * var(--u)); }
}
