/* ----------------------------------------------------------
   Ambic · Beta LP Wireframe v3 (single version)
   Cool greige + ink + slate-blue. Geist sans.
----------------------------------------------------------- */

:root{
  --paper: #ecebe6;
  --paper-2: #e3e2dc;
  --ink: #17191c;
  --ink-2: #3a3e44;
  --ink-3: #7b8088;
  --rule: #17191c1f;
  --rule-strong: #17191c55;
  --accent: oklch(0.58 0.06 245);
  --accent-soft: oklch(0.88 0.03 245);
  --success: #a7d6ab;
  --success-ink: #173222;
  --error: #f1b7ae;
  --error-ink: #5c241d;

  --sw-leather: #5e4a3c;
  --sw-wood:    #a38a6e;
  --sw-cream:   #e0d9c8;
  --sw-stone:   #cfcabd;
  --sw-sage:    #8a9a7b;
  --sw-rust:    #a85a3e;
  --sw-wall:    #d8d4c9;
  --sw-floor:   #b7a286;
  --sw-ink:     #2a2d32;

  --col: 480px;
  --ease: cubic-bezier(.6,.05,.15,1);
  --reveal: 0;
  --app-height: 100vh;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{background:#c9c8c2}
body{
  font-family: "Geist", "Inter Tight", -apple-system, system-ui, sans-serif;
  color: var(--ink);
  background: #c9c8c2;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  font-feature-settings: "ss01","cv11";
}

.scroll-track{ height: calc(var(--app-height) * 5.6); }

.viewport{
  position: fixed; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
  z-index: 1;
  height: var(--app-height);
}

/* ---------- Signup (behind the card) ---------- */
.signup{
  position: fixed; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center;
  padding: 0 24px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  background: #2a2420;
  color: var(--paper);
  z-index: 0;
  opacity: calc(0.22 + var(--reveal) * 1.1);
  min-height: var(--app-height);
}
.signup-inner{
  width: 100%;
  max-width: calc(var(--col) - 40px);
  text-align: left;
  padding-top: calc(var(--app-height) * 0.44);  /* keep reveal depth synced to the live viewport */
  display: grid;
  grid-template-rows: auto auto auto minmax(120px, auto);
  align-content: start;
}
.signup h2{
  font-weight: 500;
  font-size: clamp(32px, 8.5vw, 44px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 28px;
  color: var(--paper);
}
.signup h2 em{ font-style:normal; color:#8fb0d9 }
.signup p{
  font-size: 15px;
  line-height: 1.45;
  color: #b8bcc2;
  margin: 0;
  max-width: 32ch;
}

.signup-form{
  display:flex;
  gap:8px;
  background: #ffffff0c;
  border: 1px solid #ffffff20;
  border-radius: 999px;
  padding: 6px;
  align-items: center;
  width: 100%;
  box-shadow: 0 16px 32px -20px #00000080;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

/* platform segmented toggle */
.platform{
  display:flex;
  background: #ffffff0a;
  border: 1px solid #ffffff1e;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
  font: 500 12px/1 "Geist", sans-serif;
  letter-spacing:.02em;
}
.platform button{
  background: transparent; border: none; cursor: pointer;
  color: #b8bcc2;
  padding: 9px 16px;
  border-radius: 999px;
  font: inherit;
}
.platform button.on{
  background: var(--paper); color: var(--ink);
}

.signup-form input{
  flex:1; min-width:0; background:transparent; border:none; outline:none;
  color: var(--paper);
  font: 400 15px/1.2 inherit;
}
.signup-form input::placeholder{ color:#ffffff66 }
.signup-form button[type="submit"]{
  background: var(--paper); color: var(--ink);
  border:none; border-radius:999px;
  padding: 11px 16px;
  font: 500 13px/1 inherit; letter-spacing:.01em;
  cursor:pointer; white-space:nowrap;
  transition: background .2s ease, color .2s ease, opacity .2s ease;
}
.signup-form.is-error{
  background: color-mix(in oklch, var(--error) 18%, transparent);
  border-color: color-mix(in oklch, var(--error) 48%, transparent);
  box-shadow: 0 16px 32px -20px #00000080, 0 0 0 1px #f1b7ae33;
}
.signup-form.is-success{
  background: color-mix(in oklch, var(--success) 22%, transparent);
  border-color: color-mix(in oklch, var(--success) 54%, transparent);
  box-shadow: 0 16px 32px -20px #00000080, 0 0 0 1px #a7d6ab33;
}
.signup-form.is-success input{
  color: var(--success-ink);
}
.signup-form.is-success input::placeholder{
  color: color-mix(in oklch, var(--success-ink) 55%, white);
}
.signup-form.is-success button[type="submit"]{
  background: var(--success);
  color: var(--success-ink);
}
.signup-form button[type="submit"]:disabled,
.signup-form input:disabled{
  cursor: default;
}
.signup-support{
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.signup-feedback{
  margin: 0 0 10px;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1.4;
  max-width: none;
  width: 100%;
  opacity: 0;
  transform: translateY(-4px);
  max-height: 0;
  overflow: hidden;
  transition: opacity .18s ease, transform .18s ease, max-height .18s ease, margin-bottom .18s ease;
}
.signup-feedback.is-visible{
  opacity: 1;
  transform: translateY(0);
  max-height: 56px;
}
.signup-feedback.is-error{
  color: var(--error);
}
.signup-feedback.is-success{
  color: #cfe7d2;
}
.account-check{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #ffffff18;
  border-radius: 16px;
  background: #ffffff08;
  color: #d7dadf;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, max-height .2s ease, padding .2s ease, border-color .2s ease;
}
.account-check input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.account-check .checkmark{
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  border: 1px solid #ffffff44;
  background: #ffffff08;
  display: inline-grid;
  place-items: center;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.account-check .checkmark::after{
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .18s ease, transform .18s ease;
}
.account-check input:checked + .checkmark{
  background: var(--paper);
  border-color: var(--paper);
}
.account-check input:checked + .checkmark::after{
  opacity: 1;
  transform: scale(1);
}
.account-copy{
  font-size: 13px;
  line-height: 1.4;
}
.signup-note{
  margin-top: 16px;
  color: #b8bcc2;
  max-width: 36ch;
  opacity: 1;
  transform: translateY(0);
  transition: margin-top .2s ease, transform .2s ease;
}
.account-check.is-visible{
  opacity: 1;
  transform: translateY(0);
  max-height: 80px;
  pointer-events: auto;
}
.account-check.is-submitted{
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  pointer-events: none;
}

/* ---------- THE CARD ---------- */
.card{
  position: relative;
  width: 100%;
  max-width: var(--col);
  height: var(--app-height);
  background: var(--paper);
  pointer-events: auto;
  overflow: hidden;
  transform-origin: 50% 100%;
  will-change: transform, border-radius;
  box-shadow:
    0 0 0 1px #00000010,
    0 30px 80px -20px #00000033;
  display: flex; flex-direction: column;
  padding: 60px 22px 26px;

  transform:
    translateY(calc(var(--reveal) * -0.44 * var(--app-height)))
    scale(calc(1 - var(--reveal) * 0.34));
  border-radius: calc(var(--reveal) * 22px);
}

/* ---------- Meta (fixed outside the card so it never gets covered) ---------- */
.meta{
  position: fixed; top:0; left:0; right:0;
  z-index: 10;
  max-width: var(--col);
  margin: 0 auto;
  display:flex; justify-content:space-between; align-items:center;
  padding: 14px 22px;
  font: 500 10px/1 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px dashed var(--rule);
  background: color-mix(in oklch, var(--paper) 90%, transparent);
  backdrop-filter: blur(6px);
}
.meta .brand{ color: var(--ink); letter-spacing: .32em; font-weight:600 }
.meta .right{ display:flex; gap:10px; align-items:center }
.meta .dot{ width:6px; height:6px; border-radius:50%; background: var(--accent) }
.nav-cta{
  background: none; color: var(--ink);
  border: none; padding: 0;
  font: 500 13px/1 "Geist","Inter Tight",sans-serif;
  letter-spacing: .02em; cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-3);
  transition: text-decoration-color .15s, opacity .15s;
}
.nav-cta:hover{ text-decoration-color: var(--ink); }

/* ---------- Copy stack ---------- */
.copy{ position: relative; min-height: 112px; margin-top: 16px }
.moment{
  position: absolute; inset: 0;
  opacity: 0;
  transform: translateY(var(--m-y, 8px));
  pointer-events: none;
  /* Opacity/transform are written directly by JS each frame — no transition lag */
}
.moment.active{ pointer-events: auto }
.eyebrow{
  font: 500 10px/1 "JetBrains Mono", monospace;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-3);
  display:flex; align-items:center; gap:8px;
  margin-bottom: 14px;
}
.eyebrow .num{
  display:inline-grid; place-items:center;
  width:18px; height:18px; border:1px solid currentColor;
  border-radius:50%; font-size: 9px;
}
.display{
  font-weight: 500;
  font-size: clamp(28px, 7.6vw, 38px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
}
.display em{ font-style: normal; color: var(--accent) }
.lede{
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 34ch;
  margin: 10px 0 0;
}

/* ---------- Stage (the area the room/board lives in) ---------- */
.stage{
  position: relative;
  flex-shrink: 0;
  margin: 0 auto;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: transparent;
  /* Continuous micro-motion: every px of scroll nudges the stage
     vertically and scales it subtly, so scroll always produces feedback
     even when keyframe interpolation is "at rest". */
  transform: translateY(var(--stage-y, 0)) scale(var(--stage-s, 1));
  transform-origin: 50% 40%;
}

/* Room frame — visible in state 0 & 1, fades out by state 2 */
.room-frame{
  position: absolute; inset: 0;
  border: 1px dashed var(--rule);
  border-radius: 10px;
  opacity: var(--room-frame, 1);
  overflow: hidden;
  background:
    linear-gradient(to bottom, var(--sw-wall) 0%, var(--sw-wall) 62%, var(--sw-floor) 62%, var(--sw-floor) 100%);
}
.stage-tag{
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 10px/1 "JetBrains Mono", monospace;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-3);
  opacity: 1;
  transition: opacity .2s ease;
}
.stage-tag .num{
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  letter-spacing: 0;
}
.stage-tag.is-hidden{ opacity: 0 }

/* ---------- Tiles ---------- */
.tile{
  position: absolute;
  background: #fff;
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: 0 1px 0 #00000008, 0 10px 24px -14px #00000030;
  will-change: transform, opacity;
  /* Position/size follow scroll directly — no lag.
     Only subjective properties (ring, chip, shadow swap) ease. */
  transition:
    box-shadow .35s var(--ease);
}
.tile .ph{
  position:absolute; inset:0;
  background:
    repeating-linear-gradient(45deg, #00000008 0 6px, transparent 6px 14px),
    var(--fill, var(--sw-stone));
  transition: background .35s var(--ease);
}
.tile .cap{
  position:absolute; left:8px; bottom:6px; right:8px;
  font: 500 8px/1 "JetBrains Mono", monospace;
  letter-spacing:.1em; text-transform:uppercase;
  color: var(--ink-3);
  opacity: var(--cap-alpha, 1);
  transition: opacity .4s var(--ease);
}
.tile .ring{
  position:absolute; inset:-1px;
  border: 1.5px solid var(--accent);
  opacity: 0;
  transition: opacity .5s var(--ease);
  pointer-events:none;
  border-radius: inherit;
}
.tile.match .ring{ opacity: 1 }
.tile.match{ box-shadow: 0 0 0 1px var(--accent), 0 12px 28px -14px #3a5a8044 }
.tile.dim{ opacity: .35 }

/* "NEW" chip on match proposals */
.tile .chip{
  position:absolute; top:6px; left:6px;
  font: 500 8px/1 "JetBrains Mono", monospace;
  letter-spacing:.14em; text-transform:uppercase;
  color: var(--paper); background: var(--accent);
  padding: 3px 6px; border-radius: 999px;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.tile.match .chip{ opacity: 1 }


/* ---------- Progress rail (left-edge vertical fill) ---------- */
.progress{
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  z-index: 200;
  background: #17191c1a;
  pointer-events: none;
}
.progress .fill{
  position: absolute;
  left: 0; right: 0; top: 0;
  height: calc(var(--scroll, 0) * 100%);
  background: var(--ink);
  /* no transition — driven directly by scroll each frame */
}

.hint{
  position:absolute; right: 22px; bottom: 22px;
  font: 500 10px/1 "JetBrains Mono", monospace;
  letter-spacing:.16em; text-transform:uppercase;
  color: var(--ink-3);
  display:flex; align-items:center; gap:8px;
  z-index: 5;
  opacity: calc(1 - var(--reveal) * 2);
}
.hint .arr{
  display:inline-block; width:10px; height:10px;
  border-right:1px solid currentColor; border-bottom:1px solid currentColor;
  transform: rotate(45deg) translate(-2px,-2px);
  animation: bob 1.6s var(--ease) infinite;
}
@keyframes bob{
  0%,100%{ transform: rotate(45deg) translate(-2px,-2px) }
  50%{    transform: rotate(45deg) translate(0,0) }
}

/* Alt-stack for state 4 — small variant thumbnails floating on the right */
.alt-label{
  position:absolute;
  font: 500 9px/1 "JetBrains Mono", monospace;
  letter-spacing:.12em; text-transform:uppercase;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity .5s var(--ease);
  z-index: 4;
}
.alt-label.show{ opacity: 1 }
