/* ============================================================================
   Brute Info — css/pages/auth-recovery.css
   forgot-password.html and reset-password.html.

   These two pages sit inside the split-screen auth shell defined in
   css/pages/auth.css (loaded first): .auth-split, .auth-brand, .auth-panel,
   .auth-card, .af-* fields, .af-strength and the .auth-stagger entrance are
   all reused as they are. Nothing here restyles them.

   What is genuinely new to recovery, and therefore lives here:
     1. View swapping inside the card
     2. Confirmation artwork — animated envelope, drawn tick
     3. The reset-link block (no mail server: the link is handed over on screen)
     4. Resend control with its cooldown ring
     5. Live requirements checklist
     6. Redirect countdown
     7. Token-check placeholder
     8. Narrow-width row breaks

   Every value is a token. base.css collapses motion globally; §9 additionally
   stops the idle loops outright.
   ========================================================================== */

/* ==========================================================================
   1. VIEWS INSIDE THE CARD
   ========================================================================== */
.auth-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.auth-view[hidden] { display: none; }

/* A view that has just replaced another takes focus so the change is
   announced; the ring belongs on the controls inside it, not on the heading. */
.auth-view [tabindex="-1"]:focus { outline: none; }

.recovery-art {
  display: grid;
  place-items: center;
  padding-block: var(--space-2);
}

.recovery-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-align: center;
}
.recovery-heading {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
}

/* The back link keeps the arrow tied to its label. */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.auth-back svg {
  width: 1rem;
  height: 1rem;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.auth-back:hover svg { transform: translateX(-0.15rem); }

/* The fine print under the card. Pitched below .auth-foot so the card ends
   quietly instead of shouting its footnote. */
.auth-legal {
  text-align: center;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--text-muted);
  text-wrap: pretty;
}
.auth-legal a { font-weight: var(--fw-medium); }

/* ==========================================================================
   2. CONFIRMATION ARTWORK
   ========================================================================== */

/* --- Envelope ----------------------------------------------------------- */
.envelope {
  width: 8rem;
  height: 8rem;
  overflow: visible;
}

/* transform-box keeps every origin relative to the shape itself, so the
   animation survives any viewBox scaling. */
.envelope-halo,
.envelope-shell,
.envelope-letter,
.envelope-flap,
.envelope-spark { transform-box: fill-box; }

.envelope-halo {
  transform-origin: center;
  animation: bi-env-halo 2.8s var(--ease-standard) infinite;
}
.envelope-shell {
  transform-origin: center bottom;
  animation: bi-env-pop var(--dur-slower) var(--ease-spring) both;
}
.envelope-letter {
  transform-origin: center bottom;
  animation: bi-env-letter 3.2s var(--ease-out) infinite;
}
.envelope-flap {
  transform-origin: center top;
  animation: bi-env-flap 3.2s var(--ease-out) infinite;
}
.envelope-spark {
  transform-origin: center;
  animation: bi-env-spark 3.2s var(--ease-standard) infinite;
}
.envelope-spark-2 { animation-delay: 0.35s; }
.envelope-spark-3 { animation-delay: 0.7s; }

@keyframes bi-env-pop {
  from { opacity: 0; transform: scale(0.86) translateY(0.5rem); }
  to   { opacity: 1; transform: none; }
}
/* The halo is a glow behind the artwork, never a disc in front of the page.
   Its opacity range stays close to the 0.1 the markup asks for — anything
   higher fills in the outline drawing it is meant to sit behind, in both
   themes. Matches the range .tick-glow uses. */
@keyframes bi-env-halo {
  0%, 100% { opacity: 0.09; transform: scale(0.96); }
  50%      { opacity: 0.18; transform: scale(1.04); }
}
@keyframes bi-env-flap {
  0%, 12%   { transform: scaleY(1); }
  24%, 70%  { transform: scaleY(-0.82); }
  88%, 100% { transform: scaleY(1); }
}
@keyframes bi-env-letter {
  0%, 16%   { transform: translateY(0.9rem); opacity: 0; }
  34%, 62%  { transform: translateY(-0.55rem); opacity: 1; }
  80%, 100% { transform: translateY(0.9rem); opacity: 0; }
}
@keyframes bi-env-spark {
  0%, 30%   { opacity: 0; transform: translateY(0.25rem) scale(0.6); }
  48%       { opacity: 1; transform: translateY(-0.15rem) scale(1); }
  70%, 100% { opacity: 0; transform: translateY(-0.5rem) scale(0.7); }
}

/* --- Success tick, drawn rather than dropped in -------------------------- */
.tick {
  width: 5.5rem;
  height: 5.5rem;
  color: var(--success);
}
.tick-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-dasharray: 138;
  stroke-dashoffset: 138;
  animation: bi-tick-ring var(--dur-slower) var(--ease-out) forwards;
}
.tick-mark {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: bi-tick-mark var(--dur-slow) var(--ease-out) var(--dur-slow) forwards;
}
.tick-glow {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: bi-tick-glow 1.6s var(--ease-standard) var(--dur-slow) infinite;
}
@keyframes bi-tick-ring { to { stroke-dashoffset: 0; } }
@keyframes bi-tick-mark { to { stroke-dashoffset: 0; } }
@keyframes bi-tick-glow {
  0%, 100% { opacity: 0.08; transform: scale(0.94); }
  50%      { opacity: 0.16; transform: scale(1.03); }
}

/* ==========================================================================
   3. RESET-LINK BLOCK
   With no mail server the one-time link is handed over here, so it is built
   as a real affordance: readable, copyable, openable.
   ========================================================================== */
.link-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--card-pad-tight);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.link-block-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  /* --text-subtle clears 4.5:1 on --surface but not on --surface-2, which is
     what this block sits on. Every label inside it uses --text-muted. */
  color: var(--text-muted);
}
.link-block-label svg { width: 0.95rem; height: 0.95rem; }
.link-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.link-url {
  flex: 1 1 12rem;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--primary-soft-text);
  word-break: break-all;
  transition: color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
}
.link-url:hover { color: var(--primary-hover); border-color: var(--primary-border); }
.link-url:focus-visible { outline-offset: 2px; }
.link-copy { flex: 0 0 auto; }
.link-expiry {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.link-expiry svg { flex: 0 0 auto; width: 1rem; height: 1rem; }
.link-explainer {
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--text-muted);
}

/* ==========================================================================
   4. RESEND CONTROL AND ITS COOLDOWN RING
   ========================================================================== */
.resend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  min-height: var(--control-h);
}
.resend-copy {
  font-size: var(--fs-md);
  color: var(--text-muted);
}
.resend-cool {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.resend-cool[hidden] { display: none; }
.resend-cool .ring-text { font-size: var(--fs-2xs); }

/* The shared .ring-track is --surface-3, which all but vanishes on a card in
   dark. These two rings are read as a clock, so the unspent part has to stay
   legible: --border-strong is the one token that reads in both themes. */
.resend-cool .ring-track,
.countdown .ring-track { stroke: var(--border-strong); }

/* ==========================================================================
   5. LIVE REQUIREMENTS CHECKLIST
   ========================================================================== */
.req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}
.req {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--text-muted);
  transition: color var(--dur-base) var(--ease-standard);
}
.req-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: transparent;
  transition: background-color var(--dur-base) var(--ease-standard),
              border-color var(--dur-base) var(--ease-standard),
              color var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-spring);
}
.req-icon svg { width: 0.75rem; height: 0.75rem; }
.req.is-met { color: var(--text); }
.req.is-met .req-icon {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-inverse);
  transform: scale(1.08);
}
.req-note {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ==========================================================================
   6. REDIRECT COUNTDOWN
   ========================================================================== */
.countdown {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--text-muted);
}
.countdown[hidden] { display: none; }
/* Once the redirect is cancelled the row stays as a quiet confirmation line
   with the ring removed, so the space never goes blank. */
.countdown.is-stopped { font-size: var(--fs-sm); }

/* ==========================================================================
   7. TOKEN CHECK — reserves the height so nothing jumps when it resolves
   ========================================================================== */
.auth-checking { min-height: 17rem; }

/* ==========================================================================
   8. NARROW WIDTHS
   Below ~460px the card is the full viewport, so the two-column rows inside it
   (label + right-aligned note, link + button) run out of room and start
   breaking mid-phrase. Each one gets a second line instead.
   ========================================================================== */
@media (max-width: 460px) {
  /* The "Recommended" tag drops under its requirement rather than squeezing
     the wording into a three-word column. */
  .req {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-3);
    row-gap: var(--space-1);
  }
  .req-note {
    grid-column: 2;
    margin-left: 0;
    justify-self: start;
  }

  /* Copy takes the full width: the link then wraps over fewer lines and the
     button is a proper thumb target. */
  .link-copy { flex: 1 0 100%; }
}

/* ==========================================================================
   9. MOTION OPT-OUT
   base.css collapses durations; these rules stop the idle loops outright so
   nothing animates in the background.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .envelope-halo,
  .envelope-letter,
  .envelope-flap,
  .envelope-spark,
  .tick-glow { animation: none; }
  .envelope-letter { opacity: 1; transform: translateY(-0.55rem); }
  .envelope-spark { opacity: 1; }
  .tick-glow { opacity: 0.1; }
  .tick-ring,
  .tick-mark { stroke-dashoffset: 0; }
}

:root[data-motion="reduced"] .envelope-halo,
:root[data-motion="reduced"] .envelope-letter,
:root[data-motion="reduced"] .envelope-flap,
:root[data-motion="reduced"] .envelope-spark,
:root[data-motion="reduced"] .tick-glow { animation: none; }
:root[data-motion="reduced"] .envelope-letter { opacity: 1; transform: translateY(-0.55rem); }
:root[data-motion="reduced"] .envelope-spark { opacity: 1; }
:root[data-motion="reduced"] .tick-glow { opacity: 0.1; }
:root[data-motion="reduced"] .tick-ring,
:root[data-motion="reduced"] .tick-mark { stroke-dashoffset: 0; }
