/* The lab sign-in page: a page of yappatyih.com. The site's tokens and its world
 * (src/styles/global.css, src/scene/world.ts through world.js), dark only.
 *
 * Arrival: the world writes the stroke in particles over 2.4 s as soon as world.js
 * has loaded (signin.js); the canvas fades in over 1200 ms as on the site. From
 * 1200 ms the copy rises as the site's hero copy does (8 px, 500 ms, ease-out,
 * 80 ms apart): the eyebrow, "Lab", the lede; the passcode field at 1600 ms. The
 * field takes typing from the first frame. After a failed plain post (the Worker
 * marks body[data-failed]) nothing rises again. Typing, a wrong passcode and the
 * exit are signin.js. Reduced motion: final states, the world one still frame.
 * Only transform and opacity are animated here; the world is the canvas.
 */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/geist-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/geist-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/geist-mono-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #070506;
  --ink: #f3e9ea;
  --ink-2: #c6b4b7;
  --ink-3: #8e7c80;
  --accent-bright: #ff3c4a;
  --accent-soft: #ffb3b8;
  --line-strong: rgba(255, 179, 184, 0.3);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --container: 1280px;
  --gutter: clamp(16px, 5vw, 64px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- the world, as on the site ---------- */
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1200ms var(--ease);
}
#world.is-ready { opacity: 1; }
.world-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(7, 5, 6, 0.18) 30%, var(--bg) 100%),
    linear-gradient(to bottom, rgba(7, 5, 6, 0.5), transparent 30%, transparent 70%, rgba(7, 5, 6, 0.7));
}
@media (min-width: 900px) {
  /* The copy lives on the left; keep that side quiet (the site's fixed-form veil). */
  .world-veil {
    background:
      linear-gradient(90deg, rgba(7, 5, 6, 0.85) 0%, rgba(7, 5, 6, 0.5) 32%, transparent 58%),
      radial-gradient(120% 90% at 50% 40%, transparent 40%, var(--bg) 100%),
      linear-gradient(to bottom, rgba(7, 5, 6, 0.35), transparent 30%, transparent 70%, rgba(7, 5, 6, 0.6));
  }
}

/* ---------- the copy and the field ---------- */
/* Wide: one column at the site's left gutter, vertically centred, beside the stroke.
   Narrow: centred in the lower part of the screen, under the stroke. */
.gate {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(48px, env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    max(48px, env(safe-area-inset-bottom))
    max(var(--gutter), calc((100% - var(--container)) / 2), env(safe-area-inset-left));
}
.col { width: min(100%, 34ch); }
.col { text-shadow: 0 1px 2px rgba(7, 5, 6, 0.7), 0 2px 28px rgba(7, 5, 6, 0.85); }

/* Soft pool of dark behind the column; no box, just contrast (the site's .scrim). */
.scrim { position: relative; }
.scrim::before {
  content: '';
  position: absolute;
  inset: -1.5rem calc(-1 * min(2.5rem, var(--gutter)));
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(7, 5, 6, 0.9), rgba(7, 5, 6, 0.6) 55%, transparent);
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
h1 {
  margin: 0.35em 0 0;
  font-size: clamp(2.5rem, 6.5vw, 5.25rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.lede {
  margin: 0.6em 0 0;
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

form { width: min(100%, 320px); margin-top: clamp(28px, 5vh, 44px); display: grid; gap: 8px; text-shadow: none; }
label { font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); }
input[type='password'] {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: rgba(7, 5, 6, 0.55);
  color: var(--ink);
  caret-color: var(--ink);
  font: 400 18px/1 var(--font);
  letter-spacing: 0.12em;
  transition: border-color 0.2s var(--ease);
}
input[type='password']:hover { border-color: rgba(255, 179, 184, 0.5); }
input[type='password']:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; border-color: var(--accent-soft); }
.error { min-height: 1.5em; margin: 2px 0 0; font-size: 14px; color: var(--accent-soft); }

@media (max-width: 899px) {
  .gate {
    align-content: end;
    justify-items: center;
    text-align: center;
    padding-top: 52vh;
    padding-top: 52dvh;
  }
  form { margin-inline: auto; text-align: left; }
}

/* ---------- arrival: the site's hero rise ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.eyebrow { animation: rise 500ms 1200ms var(--ease) both; }
h1 { animation: rise 500ms 1280ms var(--ease) both; }
.lede { animation: rise 500ms 1360ms var(--ease) both; }
form { animation: rise 500ms 1600ms var(--ease) both; }
/* After a failed plain post: no second arrival. */
body[data-failed] :is(.eyebrow, h1, .lede, form) { animation: none; }

/* ---------- the fallback: no WebGL, the flat mark where the stroke would be ---------- */
.fallback {
  position: fixed;
  z-index: 0;
  left: 50%;
  top: 27%;
  width: min(60vw, 260px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
@media (min-width: 900px) {
  .fallback { left: 67%; top: 50%; width: min(38vw, 360px); }
}
.mark { display: block; width: 100%; height: auto; overflow: visible; }
.mark__stroke { fill: var(--ink); }
.mark__ember { fill: var(--accent-soft); transform-box: fill-box; transform-origin: center; }
.mark__glow { display: none; }
/* 1 2, not 1 1: with 1 1 at offset 1 a zero-length dash sits on the path's end and its round
   cap shows the lift before the pen gets there. */
.mark__pen { stroke-dasharray: 1 2; animation: sign 1200ms var(--ease) both; }
.mark__ember { animation: land 300ms 1130ms ease-out both; }
@keyframes sign { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes land {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .eyebrow, h1, .lede, form, .mark__pen, .mark__ember { animation: none; }
  #world, input[type='password'] { transition: none; }
}
