/* ============================================================================
   auth.css — the auth overlay's interior. The shell (.ov, .ov__panel, focus
   ring, scroll lock) is css/overlay.css + js/overlay.js; this styles only
   what auth.js injects. Loaded by BOTH documents — index.html and map.html —
   because the panel opens from either.
   ========================================================================== */

.auth {
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4, 16px);
}

.auth__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: var(--auth-tabs-track);
}

.auth__tab {
  border: 0;
  background: transparent;
  padding: 10px 0;
  border-radius: 8px;
  font: 600 14px/1 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-2, #5B6B7C);
  cursor: pointer;
}

.auth__tab[aria-selected='true'] {
  background: var(--auth-tab-on-bg);
  color: var(--text-1, #16202C);
  box-shadow: var(--auth-tab-on-shadow);
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
}

.auth__label {
  font: 500 13px/1 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-2, #5B6B7C);
  margin-top: var(--sp-2, 8px);
}

.auth__input {
  border: 1px solid var(--border-1, #D6DEE8);
  border-radius: 8px;
  padding: 11px 12px;
  font: 400 15px/1.2 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-1, #16202C);
  background: var(--surface-0, #fff);
}

.auth__input:focus-visible {
  outline: 2px solid var(--brand-teal-bright, #3DE0C4);
  outline-offset: 1px;
}

/* role="alert" text — matches the app's red error line under the fields. */
.auth__error {
  color: var(--danger-text);
  font: 500 13px/1.4 var(--font-sans, "Inter", system-ui, sans-serif);
  margin: 4px 0 0;
}

.auth__submit {
  margin-top: var(--sp-3, 12px);
}

.auth__submit[disabled] {
  opacity: 0.55;
  cursor: wait;
}

/* Check-email and signed-in states */
.auth__state {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3, 12px);
  text-align: center;
  padding-top: var(--sp-4, 16px);
}

.auth__heading {
  font: 800 20px/1.2 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-1, #16202C);
  margin: 0;
}

.auth__copy {
  font: 400 15px/1.5 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-1, #16202C);
  margin: 0;
  overflow-wrap: anywhere; /* long email addresses must wrap, not overflow */
}

.auth__hint {
  font: 400 13px/1.45 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-2, #5B6B7C);
  margin: 0;
}

.auth__link {
  border: 0;
  background: none;
  color: var(--accent-text, #0E7C6B);
  font: 600 14px/1 var(--font-sans, "Inter", system-ui, sans-serif);
  cursor: pointer;
  padding: 8px;
}

/* Success line — the web rendering of the app's "Password reset email sent."
   snackbar. Same slot as the error line, deliberately not red. */
.auth__ok {
  color: var(--accent-text, #0E7C6B);
  font: 500 13px/1.4 var(--font-sans, "Inter", system-ui, sans-serif);
  margin: 4px 0 0;
}

/* "Welcome to Fetch" — the hero's own tokens, so the modal header IS the site
   header treatment rather than a lookalike. No layout had to shrink: the
   panel body scrolls, so the header simply pushes content down. */
.auth__welcome {
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
  font-weight: var(--fw-display, 800);
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: var(--tracking-tight, -0.02em);
  line-height: 1.1;
  color: var(--text-1, #16202C);
  margin: 0 0 var(--sp-2, 8px);
  text-align: center;
  text-wrap: balance;
}

.auth__consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: var(--sp-2, 8px);
  font: 400 14px/1.4 var(--font-sans, "Inter", system-ui, sans-serif);
  color: var(--text-1, #16202C);
  cursor: pointer;
}
.auth__consent input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--brand-teal-bright, #3DE0C4);
  cursor: pointer;
}

/* ── Brandfield instance ─────────────────────────────────────────────────────
   The isobar treatment behind the welcome header and the form card. FULLY
   self-styled here rather than leaning on home.css's .brandfield block,
   because /map loads auth.css but never home.css — the modal must look the
   same in both documents. Parameterisation happens HERE (wash, opacity),
   never by editing the SVG: the symbol byte-matches index.html's and the
   deploy drift gate depends on that.

   --bf-opacity 0.75 quiets the contours at modal size (effective stroke
   opacity 0.15 vs the hero's 0.2): the modal is smaller with a form
   dead-center, and the full-strength field competed with the inputs. */
.ov--auth .brandfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 100% at 12% 0%, rgba(61, 224, 196, 0.14), rgba(61, 224, 196, 0) 58%),
    linear-gradient(180deg, var(--auth-field-top) 0%, var(--auth-field-bot) 72%);
}
.ov--auth .brandfield__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: var(--bf-opacity, 0.75);
}
/* Content rides above the field. */
.ov--auth .ov__bar,
.ov--auth .ov__body {
  position: relative;
  z-index: 1;
}

/* The form card: near-opaque so labels, inputs and error strings keep their
   measured contrast when contours pass beneath — 0.94 white over 0.15-opacity
   teal strokes renders them faint texture, not competition. */
.auth__card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4, 16px);
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-line);
  border-radius: 14px;
  padding: var(--sp-5, 20px);
  box-shadow: var(--auth-card-shadow);
}

/* ============================================================================
   DARK — the auth modal under [data-theme='dark'].

   ⚠ THE CALL: THE WEB MODAL FOLLOWS THE THEME. It does NOT inherit the app's
   fixed-dark auth canvas, and the reasoning matters more than the result.

   The app's auth screen is deliberately pinned to #08161c. That is a FRONT
   DOOR exception: it owns the whole viewport and renders before there is a
   signed-in user whose preference could be read, so "follow the theme" has no
   theme to follow yet. The app's own source says as much at the declaration —
   `_bg = Color(0xFF08161c); // auth front-door dark canvas (not a brand
   token)`. Porting it here would be porting a value the app itself declines
   to call part of its system.

   None of that premise holds on the web. This modal opens INSIDE an
   already-painted, already-themed page, on a user action, over a scrim that
   is itself themed. The theme is known at open time. A fixed-dark panel would
   read not as a front door but as a second product slammed over the first,
   and it would break the one relationship a modal depends on — that the scrim
   dims the page BEHIND it, which only reads if panel and page share a world.

   So: same tokens as everything else. What follows is only where the modal
   needs a rule rather than a value.
   ========================================================================== */
:root[data-theme='dark'] {
  /* The brandfield ground. Light is a teal-tinted white fading to white; dark
     is the same gesture against the page — a teal-tinted navy fading to it —
     rather than a lightened copy of the light gradient. The radial glow keeps
     its alpha: it is the same brand teal and it reads on either ground. */
  --auth-field-top: color-mix(in srgb, var(--brand-teal-bright) 6%, var(--surface));
  --auth-field-bot: var(--surface);
  /* The card is near-opaque in both themes for the same reason — the contours
     must pass beneath as texture, never as competition with a label. */
  --auth-card-bg:     rgba(15, 28, 44, 0.94);   /* fetchDark.card at 0.94 */
  --auth-card-line:   rgba(255, 255, 255, 0.07);
  --auth-card-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  /* ⚠ THE TAB TRACK INVERTS, AND LEAVING IT WOULD INVERT THE AFFORDANCE.
     Light puts the track on --surface-2 (#F1F4F8) and the SELECTED tab on
     --surface-0 (#FFFFFF): the chosen tab sits a step ABOVE its channel. In
     dark those same tokens are #16273A and #0F1C2C — the track ends up
     LIGHTER than the tab, so the selected one reads as a hole punched in the
     control rather than a raised pill. Rebuilt from the elevation rule
     instead: the channel is cut BELOW the card (black at 25% -> ~#0B1521) and
     the selected tab rises to --surface-elevated (#122334). A drop shadow is
     no help on navy, so the raised tab is drawn with a hairline. */
  --auth-tabs-track:   rgba(0, 0, 0, 0.25);
  --auth-tab-on-bg:    var(--surface-elevated);
  --auth-tab-on-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
:root { /* light, at exactly the values already rendering */
  --auth-field-top:     #F2FAF8;
  --auth-field-bot:     #FFFFFF;
  --auth-card-bg:       rgba(255, 255, 255, 0.94);
  --auth-card-line:     rgba(22, 32, 44, 0.06);
  --auth-card-shadow:   0 8px 28px rgba(10, 22, 40, 0.06);
  --auth-tabs-track:    var(--surface-2, #F1F4F8);
  --auth-tab-on-bg:     var(--surface-0, #fff);
  --auth-tab-on-shadow: 0 1px 3px rgba(10, 22, 40, 0.12);
}
