/* The Daily Next — sign-in / endless-watch-wall login.
   Shared design tokens live in tokens.css (loaded first). Only wall-layout
   locals are defined here. */
:root {
  --col-w: 240px;
  --gap: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* A class with an explicit `display` outranks the UA `[hidden]{display:none}`
   rule — force hidden to win so toggled buttons/dividers actually disappear. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  /* Block sideways drift from the bleeding wall, but let the card scroll on short
     viewports so the submit button is never clipped out of reach. */
  overflow-x: hidden;
  overflow-y: auto;
}

/* ── ENDLESS WATCH WALL ─────────────────────────────── */
.wall {
  position: fixed;
  inset: -6vh -2px -6vh -2px;      /* bleed past edges so columns never show a hard end */
  display: flex;
  gap: var(--gap);
  padding: 0 var(--gap);
  z-index: 0;
  /* Settle the imagery back a touch so the card reads on top, but keep it bright
     enough that dark-dial watches stay visible (not just white-background shots). */
  filter: brightness(0.86) saturate(0.92) contrast(1.0);
  opacity: 0;
  transition: opacity 1.1s ease;
}
.wall.ready { opacity: 1; }

.wall-col {
  flex: 1 0 var(--col-w);
  min-width: 0;
  position: relative;
}
.wall-track {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  animation: drift var(--dur, 90s) linear infinite;
  animation-direction: var(--dir, normal);
  transform: translateZ(0);   /* own layer for smooth drift, without will-change's memory cost */
  backface-visibility: hidden;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -50%, 0); }
}

.wall-cell {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #131317;
  aspect-ratio: 4 / 5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset,
              0 10px 30px rgba(0, 0, 0, 0.35);
}
.wall-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.7s ease;
}
.wall-cell img.loaded { opacity: 1; }
.wall-cell::after {   /* hairline frame + faint warm bloom, unifies the mixed sources */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  pointer-events: none;
}

/* ── SCRIM / VIGNETTE ───────────────────────────────── */
.wall-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 44%,
      rgba(12, 12, 14, 0.14) 0%,
      rgba(12, 12, 14, 0.34) 42%,
      rgba(12, 12, 14, 0.66) 78%,
      rgba(9, 9, 11, 0.9) 100%),
    linear-gradient(to bottom,
      rgba(12, 12, 14, 0.62) 0%,
      rgba(12, 12, 14, 0) 24%,
      rgba(12, 12, 14, 0) 76%,
      rgba(12, 12, 14, 0.72) 100%);
}

/* ── STAGE + CARD ───────────────────────────────────── */
.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
  gap: 20px;
}

.card {
  width: 100%;
  max-width: 408px;
  background: rgba(18, 18, 22, 0.66);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
  border: 1px solid var(--accent-line);
  border-radius: 22px;
  padding: 40px 38px 34px;
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.62),
    0 2px 0 rgba(255, 255, 255, 0.04) inset,
    0 0 0 1px rgba(0, 0, 0, 0.4);
  animation: rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── BRAND ──────────────────────────────────────────── */
.brand { text-align: center; margin-bottom: 26px; }
.brand-mark {
  font-family: Georgia, 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
  font-size: clamp(18px, 5vw, 23px);
  line-height: 1.2;
  color: var(--text);
  text-indent: 0.2em;   /* balance the trailing letter-spacing */
  /* Wrap gracefully rather than force the card wider than a narrow viewport. */
  overflow-wrap: break-word;
}
.brand-rule {
  display: flex;
  justify-content: center;
  margin: 14px 0 16px;
}
.brand-rule span {
  display: block;
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
}
.brand-tag {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 30ch;
  margin: 0 auto;
}

/* ── ALT AUTH (Google / passkey) ────────────────────── */
.alt-auth { display: grid; gap: 10px; margin-bottom: 20px; }
.alt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.06s ease;
}
.alt-btn:hover { border-color: var(--accent-soft); background: rgba(255, 255, 255, 0.07); }
.alt-btn:active { transform: translateY(1px); }
.alt-ico { flex: 0 0 auto; }
/* Passkey helper note + signup opt-in checkbox */
.alt-note { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 2px 2px 0; text-align: center; }
.check-field { display: flex; align-items: flex-start; gap: 9px; margin: -4px 2px 6px; cursor: pointer; }
.check-field input { margin-top: 2px; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--accent-soft); cursor: pointer; }
.check-field span { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* ── DIVIDER ────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── FORM ───────────────────────────────────────────── */
.form { display: grid; gap: 14px; }
.form[hidden] { display: none; }
.field { display: grid; gap: 6px; }
.field-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 2px;
}
.field input {
  width: 100%;
  background: rgba(10, 10, 12, 0.55);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 15px;
  font: inherit;
  font-size: 15px;   /* ≥16px avoids iOS zoom-on-focus? use 16 to be safe */
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input::placeholder { color: #55555f; }
.field input:focus {
  outline: none;
  border-color: var(--accent-soft);
  background: rgba(10, 10, 12, 0.75);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.12);
}

.submit {
  margin-top: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #17130a;
  cursor: pointer;
  background: linear-gradient(180deg, #dcbf85 0%, #c9a96e 55%, #b8955a 100%);
  box-shadow: 0 8px 24px rgba(201, 169, 110, 0.22), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
  transition: filter 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}
.submit:hover { filter: brightness(1.05); }
.submit:active { transform: translateY(1px); }
.submit:disabled { opacity: 0.6; cursor: default; filter: none; transform: none; }

.form-error {
  min-height: 0;
  color: var(--red);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 0;
  transition: margin 0.2s ease;
}
.form-error.show { min-height: 18px; margin-bottom: 14px; }
.form-error.notice { color: var(--muted); }

/* ── FOOTER LINKS ───────────────────────────────────── */
.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 22px;
}
.link {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.link:hover { color: var(--accent); }
.link.accent { color: var(--accent); }
.link.accent:hover { color: var(--text); }

.stage-credit {
  color: rgba(138, 138, 151, 0.55);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-align: center;
  min-height: 14px;
}

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --col-w: 150px; --gap: 12px; }
  .card { padding: 32px 22px 28px; border-radius: 20px; }
  .brand { margin-bottom: 22px; }
  .brand-mark { letter-spacing: 0.14em; }
}
@media (max-width: 400px) {
  :root { --col-w: 132px; }
  .brand-mark { letter-spacing: 0.1em; }
}

/* Larger tap target text on iOS without triggering focus-zoom */
@media (max-width: 720px) {
  .field input { font-size: 16px; }
}

/* ── REDUCED MOTION ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .wall-track { animation: none !important; }
  .card { animation: none; }
  .wall, .wall-cell img { transition: none; }
}
