/* ==========================================================================
   FamTrack — Design tokens (Monochrome theme)
   Palette   : solid white stage, near-black ink & accent — true monochrome,
               no hue anywhere. Depth comes from layered CSS gradients and
               glass, not from a photo or any color accent.
   Type      : Fraunces (display, modern-classic serif) + Inter (UI) +
               IBM Plex Mono (coordinates / timestamps — reads like instrument data)
   Signature : the "liquid" divided button + the genie-smoke info card transition
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,340;0,9..144,480;1,9..144,420&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f5;
  --ink: #141414;
  --ink-dim: #5c5c5a;
  --ink-faint: #8f8e8b;
  --hairline: rgba(20, 20, 20, 0.12);
  --glass: rgba(20, 20, 20, 0.035);
  --glass-strong: rgba(20, 20, 20, 0.065);
  --glass-border: rgba(20, 20, 20, 0.12);
  --accent: #141414;        /* monochrome — near-black, the only "brand" color */
  --accent-ink: #ffffff;
  --signal: #3a3a38;        /* dark gray — live/active state, distinguished by motion not hue */
  --danger: #b3413a;        /* kept slightly warm on purpose: pure gray errors are easy to miss — see note in chat */
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smoke: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

* {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; }
a { color: inherit; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

.scene {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  isolation: isolate;
}

/* Monochrome ambient backdrop — pure CSS, no photo/image file involved.
   Two soft radial fields in grayscale give the white page depth so the
   glass card still has something to "float" on. Kept intentionally quiet. */
.scene__bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 45% at 18% 8%, rgba(20,20,20,0.05), transparent 70%),
    radial-gradient(55% 40% at 88% 92%, rgba(20,20,20,0.045), transparent 70%),
    var(--bg);
  animation: bg-in 1s var(--ease-smoke) both;
}

/* faint film-grain so the flat white doesn't look like a plain overlay */
.scene__grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes bg-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------------------------------------------------------------- info button */

.info-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--ink);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.35s var(--ease-spring), background 0.3s ease;
  animation: fade-up 0.8s 0.4s var(--ease-smoke) both;
}
.info-btn:hover { transform: scale(1.08); background: var(--glass-strong); }
.info-btn:active { transform: scale(0.94); }
.info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------------------------------------------------------------- welcome */

.welcome {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 44px 32px 40px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 24px 60px -24px rgba(20,20,20,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
  animation: card-in 0.9s 0.15s var(--ease-smoke) both;
}

/* ---- desktop: roomier card, larger type scale, info button becomes a proper corner mark ---- */
@media (min-width: 900px) {
  .scene { padding: 48px; }
  .welcome { max-width: 460px; padding: 56px 48px 48px; }
  .desc { max-width: 32ch; }
  .info-btn { top: 32px; left: 32px; width: 44px; height: 44px; font-size: 18px; }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.eyebrow .line { width: 28px; height: 1px; background: var(--hairline); }

.headline {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 480;
  font-style: italic;
  font-size: clamp(44px, 13vw, 58px);
  line-height: 1;
  letter-spacing: -0.01em;
}

.desc {
  margin: 0 0 30px;
  max-width: 30ch;
  color: var(--ink-dim);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ---------------------------------------------------------------- liquid button (signature) */

.btn-liquid {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 13px 12px 13px 26px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(246,246,245,0.6));
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,20,20,0.04);
  transition: transform 0.45s var(--ease-spring), box-shadow 0.45s var(--ease-spring);
}
.btn-liquid::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120px 60px at var(--mx, 50%) var(--my, 50%), rgba(20,20,20,0.08), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.btn-liquid:hover::before { opacity: 1; }
.btn-liquid:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(20,20,20,0.35); }
.btn-liquid:active { transform: translateY(0) scale(0.97); }
.btn-liquid:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-liquid .divider {
  width: 1px;
  height: 18px;
  background: var(--glass-border);
}

.btn-liquid .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-liquid .icon svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- info card — "genie smoke" transition */

.info-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20,20,20,0.28);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.info-overlay.is-open { opacity: 1; pointer-events: auto; }

.info-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 26px;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  border: 1px solid var(--glass-border);
  box-shadow: 0 30px 80px -24px rgba(20,20,20,0.28);
  transform-origin: 40px 24px; /* anchored near the "!" button, top-left */
  opacity: 0;
  filter: blur(14px);
  transform: scale(0.35);
  transition:
    opacity 0.5s var(--ease-smoke),
    filter 0.55s var(--ease-smoke),
    transform 0.55s var(--ease-smoke);
}
.info-overlay.is-open .info-card {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}
.info-overlay.is-closing .info-card {
  opacity: 0;
  filter: blur(16px);
  transform: scale(0.4);
  transition-duration: 0.35s;
}

.info-card h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 480;
  font-size: 22px;
}
.info-card .sub {
  margin: 0 0 18px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.info-card ol {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.info-card li {
  display: flex;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}
.info-card li span.num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
}
.info-card .close-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.25s ease;
}
.info-card .close-btn:hover { background: var(--glass-strong); }

/* ---------------------------------------------------------------- login sheet */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20,20,20,0.32);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.login-overlay.is-open { opacity: 1; pointer-events: auto; }

.login-sheet {
  width: 100%;
  max-width: 440px;
  padding: 30px 26px calc(30px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--bg-soft);
  border: 1px solid var(--glass-border);
  border-bottom: none;
  box-shadow: 0 -20px 60px -24px rgba(20,20,20,0.25);
  transform: translateY(100%);
  transition: transform 0.5s var(--ease-smoke);
}
.login-overlay.is-open .login-sheet { transform: translateY(0); }

@media (min-width: 640px) {
  .login-overlay { align-items: center; }
  .login-sheet {
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--glass-border);
    transform: translateY(24px) scale(0.97);
    opacity: 0;
    transition: transform 0.5s var(--ease-smoke), opacity 0.4s ease;
  }
  .login-overlay.is-open .login-sheet { transform: translateY(0) scale(1); opacity: 1; }
}

.login-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
  margin: 0 auto 22px;
}
@media (min-width: 640px) { .login-sheet__handle { display: none; } }

.login-sheet h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 480;
  font-size: 26px;
}
.login-sheet .sub {
  margin: 0 0 26px;
  color: var(--ink-faint);
  font-size: 13px;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}
.field input {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(20,20,20,0.025);
  color: var(--ink);
  font-size: 14.5px;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(20,20,20,0.04);
}

.form-error {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: rgba(226,104,90,0.12);
  border: 1px solid rgba(226,104,90,0.3);
  color: #f0a99f;
  font-size: 13px;
}
.form-error.is-visible { display: flex; }

.submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.3s var(--ease-spring), opacity 0.3s ease;
}
.submit-btn:hover { transform: translateY(-1px); }
.submit-btn:active { transform: translateY(0) scale(0.98); }
.submit-btn:disabled { opacity: 0.65; cursor: default; transform: none; }

.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(26,20,8,0.35);
  border-top-color: var(--accent-ink);
  animation: spin 0.7s linear infinite;
}
.submit-btn.is-loading .spinner { display: inline-block; }
.submit-btn.is-loading .btn-label { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

.close-sheet {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 640px) { .close-sheet { display: flex; } }
.login-sheet { position: relative; }
