/* ==========================================================================
   Auth pages
   ========================================================================== */

.auth-wrap {
  position: relative;
  isolation: isolate;
  min-height: calc(100svh - var(--header-height, var(--header-clear)));
  display: grid;
  place-items: center;
  padding: var(--page-top) var(--gutter-page);
}
/* Phones: the tab bar covers the bottom of the view, so centre above it. */
@media (max-width: 759.98px) {
  .auth-wrap { min-height: calc(100svh - var(--header-height, var(--header-clear)) - var(--tabbar-clear)); }
}
/* A still bloom behind the card, inside the shell. At violet 18% and teal
   14% the card's --ink-2 lines and the primary label fell to 4.2:1 in mint,
   nova and reverse; at 10% and 5% the worst is 4.57:1 (mint primary). */
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(520px circle at 45% 42%, color-mix(in srgb, var(--violet) 10%, transparent), color-mix(in srgb, var(--violet) 4%, transparent) 38%, transparent 72%),
    radial-gradient(520px circle at 60% 60%, color-mix(in srgb, var(--teal) 5%, transparent), color-mix(in srgb, var(--teal) 2%, transparent) 38%, transparent 72%);
}
:root[data-theme='light'] .auth-wrap::before { opacity: .6; }

.auth-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
  align-items: center;
  gap: 64px;
}
/* The panel is aria-hidden and only repeats the card's promise, so it only
   shows where there is room beside the card. */
.auth-panel { display: none; }
@media (min-width: 1000px) {
  .auth-layout:has(.auth-panel) { grid-template-columns: minmax(0, 360px) minmax(0, 420px); }
  .auth-panel { display: grid; gap: 20px; align-content: center; align-self: start; }
}
.auth-panel-brand { display: flex; align-items: center; gap: 12px; }
.auth-panel-brand .mark { width: 44px; flex: none; }
.auth-panel h2 {
  margin: 0;
  font: 700 1.375rem/1.2 var(--font);
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-panel p {
  margin: 0;
  max-width: 36ch;
  font: 400 var(--step-0)/1.6 var(--font);
  color: var(--text-soft);
}
.auth-benefits { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.auth-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font: 500 var(--step-0s)/1.45 var(--font);
  color: var(--text-soft);
}
.auth-benefits svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--eyebrow-ink); }

.auth-card {
  min-width: 0;
  padding: 32px;
  border-radius: var(--r-card);
  background: var(--mat-neutral);
  box-shadow: var(--glass-rim);
  color: var(--text);
}
@media (max-width: 559.98px) {
  .auth-card { padding: 24px; }
}
.auth-card > .mark { width: 36px; margin: 0 0 18px; }
/* Beside the panel the card's own mark would be the second one in view. */
@media (min-width: 1000px) {
  .auth-layout:has(.auth-panel) .auth-card > .mark { display: none; }
}
.auth-card > .eyebrow { display: block; margin: 0 0 8px; }
.auth-card h1 {
  margin: 0 0 6px;
  font: 700 1.625rem/1.15 var(--font);
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-sub {
  margin: 0 0 24px;
  font: 400 var(--step-0s)/1.5 var(--font);
  color: var(--ink-2);
}
.auth-card form > .btn-block { margin-top: 6px; }

/* --ink-2-strong: at the card's bottom edge the wash is at its teal end, and
   --ink-2 measured 4.3:1 there in reverse at 13px. */
.auth-alt {
  margin-top: 20px;
  padding-top: 18px;
  box-shadow: inset 0 1px 0 var(--hairline);
  text-align: center;
  font-size: var(--step--1);
  color: var(--ink-2-strong);
}

/* Sign up: what is required sits above the hairline, what is a choice below. */
.auth-optional {
  display: grid;
  gap: 14px;
  margin: 24px 0 22px;
  padding-top: 20px;
  box-shadow: inset 0 1px 0 var(--hairline);
}
.auth-card .auth-terms { margin-top: 14px; text-align: center; }

/* Outcome screens: check email, closed, verify result, expired reset link. */
.auth-outcome {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}
.auth-outcome > * { margin: 0; }
.auth-outcome > .card-icon { margin-bottom: 6px; }
.auth-outcome > .eyebrow { margin: 0; }
.auth-outcome h1 { margin: 0; font-size: 1.375rem; }
.auth-outcome .auth-sub { margin: 0; }
.auth-outcome > .btn { justify-self: stretch; margin-top: 14px; }
/* The outcomes that are not good news: the mark loses the accent. */
.card-icon.is-quiet { --mark-c: var(--ink-2); }

/* ==========================================================================
   Fields
   ========================================================================== */

.field { display: grid; gap: 8px; margin: 0 0 18px; min-width: 0; }
fieldset.field { border: 0; padding: 0; }
/* Direct children only: labels nested deeper are controls (swatches,
   switches, upload buttons) with type of their own. */
.field > label,
.field > legend,
.identifier-mode-row > label,
.field-label {
  margin: 0;
  padding: 0;
  font: 600 var(--step--1)/1.3 var(--font);
  color: var(--text);
}
.field > legend { margin-bottom: 12px; }

.field-hint, .hint {
  margin: 0;
  font: 400 var(--step--1)/1.45 var(--font);
  color: var(--ink-2);
}
.checkbox .hint { display: block; margin-top: 2px; }
/* A hint inside a card keeps the hint size, not the card copy size. */
:is(.card, .doc-card-body, .group) .hint { font-size: var(--step--1); line-height: 1.45; color: var(--ink-2); }

.input, .textarea, .select {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-control);
  font: 400 1rem/1.4 var(--font);
  color: var(--text);
  background: var(--mat-etched);
  box-shadow: var(--rim-etched);
  transition: box-shadow var(--dur-chip) linear, background var(--dur-chip) linear;
}
/* --text-soft, not --ink-2: an etched field on glass is one layer brighter
   than glass, and --ink-2 measured 4.1:1 there (dark mint). */
.input::placeholder, .textarea::placeholder { color: var(--text-soft); opacity: 1; }
.input:hover, .textarea:hover, .select:hover { box-shadow: inset 0 0 0 1px var(--etch-line-hover); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--focus-ring), 0 0 0 3px color-mix(in srgb, var(--focus-ring) 28%, transparent);
}
.has-error .input, .input[aria-invalid='true'], .has-error .textarea, .has-error .select {
  box-shadow: inset 0 0 0 1px var(--field-error-ink);
}
/* A refused field keeps its red edge while focused; the halo says focus. */
.has-error .input:focus, .input[aria-invalid='true']:focus, .has-error .textarea:focus, .has-error .select:focus {
  box-shadow: inset 0 0 0 1px var(--field-error-ink), 0 0 0 3px color-mix(in srgb, var(--field-error-ink) 28%, transparent);
}
.input:disabled, .textarea:disabled, .select:disabled { opacity: .5; cursor: not-allowed; }
.textarea { min-height: 120px; padding: 12px 16px; line-height: 1.55; resize: vertical; }
/* A data URI cannot read a custom property: the chevron is --ink-2 per theme. */
.select {
  appearance: none;
  padding-right: 40px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ea4b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 14px center / 16px no-repeat, var(--mat-etched);
}
:root[data-theme='light'] .select {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23595f74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 14px center / 16px no-repeat, var(--mat-etched);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font: 500 var(--step--1)/1.45 var(--font);
  color: var(--field-error-ink);
}
.field-error svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }

/* Leading glyph inside the field; it takes the focus ink while typing and
   the error ink once the server has refused the value. */
.field-icon { position: relative; }
.field-icon .input { padding-left: 42px; }
.field-icon-glyph {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  width: 18px;
  height: 18px;
  color: var(--ink-2);
  pointer-events: none;
  transition: color var(--dur-chip) linear, opacity var(--dur-chip) linear, visibility 0s;
}
.field-icon:focus-within .field-icon-glyph { color: color-mix(in srgb, var(--violet) var(--violet-ink-share), var(--text)); }
.field.has-error .field-icon .field-icon-glyph { color: var(--field-error-ink); }

/* Password eye (partials/field-eye.ejs; site.js flips type and aria-pressed). */
.field-icon.has-eye .input { padding-right: 48px; }
.field-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  translate: 0 -50%;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur-chip) linear, color var(--dur-chip) linear;
}
.field-eye:hover { color: var(--text); background: var(--mat-etched); }
.field-eye[aria-pressed='true'] { color: var(--text); }
.field-eye svg { width: 18px; height: 18px; }
.field-eye .eye-shut { display: none; }
.field-eye[aria-pressed='true'] .eye-open { display: none; }
.field-eye[aria-pressed='true'] .eye-shut { display: block; }

/* ---- Sign-in identifier: one field, two labels ------------------------
   data-identifier-mode on .field (set by site.js) picks the label and the
   glyph. Both labels share one grid cell, and the hidden one takes
   visibility: hidden so the field's accessible name stays single. */
.identifier-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.identifier-mode-row > label { display: grid; align-items: center; }
.identifier-label-email,
.identifier-label-username {
  grid-area: 1 / 1;
  transition: opacity var(--dur-chip) linear, visibility 0s;
}
[data-identifier-mode='email'] .identifier-label-username,
[data-identifier-mode='username'] .identifier-label-email,
[data-identifier-mode='email'] .identifier-glyph-username .field-icon-glyph,
[data-identifier-mode='username'] .identifier-glyph-email .field-icon-glyph {
  opacity: 0;
  visibility: hidden;
  transition-delay: 0s, var(--dur-chip);
}
[data-identifier-mode='email'] .identifier-glyph-username .field-icon-glyph,
[data-identifier-mode='username'] .identifier-glyph-email .field-icon-glyph { transition-delay: 0s, 0s, var(--dur-chip); }

/* A two-column grid so the ::before thumb is exactly one column wide; an
   absolute thumb sized in percent resolves against the padding box and
   overshoots the halves by the track padding. */
.identifier-mode-tabs {
  --seg-i: 0;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--mat-etched);
  box-shadow: var(--rim-etched);
}
/* Username comes first in the markup, so email is the second column. */
[data-identifier-mode='email'] .identifier-mode-tabs { --seg-i: 1; }
.identifier-mode-tabs::before {
  content: '';
  grid-area: 1 / 1;
  z-index: -1;
  border-radius: var(--r-chip);
  background: var(--mat-quiet);
  box-shadow: var(--rim-quiet);
  transform: translateX(calc(var(--seg-i) * 100%));
  transition: transform var(--dur-segment) var(--ease-out-cubic);
}
/* The idle label sits on an etched track on glass, one layer brighter than
   plain glass: --ink-2 measured 3.8 to 4.3:1 there in dark. */
.identifier-mode-tab { grid-row: 1; min-width: 0; min-height: 30px; padding: 5px 14px; color: var(--text-soft); }
.identifier-mode-tab:first-of-type { grid-column: 1; }
.identifier-mode-tab:last-of-type { grid-column: 2; }
.identifier-mode-tabs .period-tab.is-active,
.identifier-mode-tabs .period-tab[aria-pressed='true'] {
  background: transparent;
  box-shadow: none;
  text-shadow: none;
  color: var(--text);
  font-weight: 700;
}

/* ---- Checkbox as a switch ---------------------------------------------- */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font: 500 var(--step-0s)/1.45 var(--font);
  color: var(--text);
}
.checkbox > span { min-width: 0; padding-top: 3px; }
.checkbox input[type='checkbox'] {
  appearance: none;
  flex: none;
  position: relative;
  width: 46px;
  height: 27px;
  margin: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(rgb(var(--ink) / .10), rgb(var(--ink) / .10));
  box-shadow: inset 0 0 0 1px rgb(var(--ink) / .16);
  cursor: pointer;
  transition: background var(--dur-switch) var(--ease-decel), box-shadow var(--dur-switch) var(--ease-decel);
}
.checkbox input[type='checkbox']::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: linear-gradient(#fff, #e9eaf0);
  box-shadow: 0 1.5px 7px rgb(0 0 0 / .28);
  transition: transform var(--dur-switch) var(--ease-decel);
}
.checkbox input[type='checkbox']:checked { background: var(--mat-select); box-shadow: none; }
.checkbox input[type='checkbox']:checked::before { transform: translateX(19px); }
.checkbox input[type='checkbox']:disabled { opacity: .4; cursor: not-allowed; }
.checkbox input[type='checkbox']:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---- hCaptcha ------------------------------------------------------------
   The iframe paints its own opaque widget; only the frame around it is ours. */
.captcha-frame {
  display: grid;
  place-items: center;
  min-height: 94px;
  padding: 8px;
  border-radius: var(--r-control);
  background: var(--mat-etched);
  box-shadow: var(--rim-etched);
}
.captcha-frame .h-captcha { display: block; line-height: 0; max-width: 100%; }
.captcha-frame iframe { max-width: 100%; }

/* ==========================================================================
   Flash, callouts, banners, notes
   Status is a leading glyph colour, never a border colour.
   ========================================================================== */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: var(--r-group);
  background: var(--mat-neutral);
  box-shadow: var(--glass-rim);
  font: 500 var(--step-0s)/1.5 var(--font);
  color: var(--text);
}
.flash svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.flash-success svg { color: var(--status-safe-ink); }
.flash-error svg { color: var(--field-error-ink); }
.flash-info svg { color: var(--eyebrow-ink); }

.banner, .note, .prose blockquote {
  --callout-ink: var(--eyebrow-ink);
  position: relative;
  margin: 20px 0;
  padding: 14px 18px 14px 48px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--mat-neutral);
  box-shadow: var(--glass-rim);
  font: 400 var(--step-0s)/1.6 var(--font);
  color: var(--text-soft);
}
.banner::before, .note::before, .prose blockquote::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 16px;
  width: 18px;
  height: 18px;
  background: var(--callout-ink);
  -webkit-mask: var(--callout-glyph, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 7.5v.5'/%3E%3C/svg%3E")) center / contain no-repeat;
          mask: var(--callout-glyph, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5'/%3E%3Cpath d='M12 7.5v.5'/%3E%3C/svg%3E")) center / contain no-repeat;
}
.banner strong, .note strong { color: var(--text); font-weight: 600; }
.banner > :first-child, .note > :first-child { margin-top: 0; }
.banner > :last-child, .note > :last-child { margin-bottom: 0; }
.banner-warn {
  --callout-ink: var(--status-caution-ink);
  --callout-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 4.3 2.9 17.4a2 2 0 0 0 1.7 3h14.8a2 2 0 0 0 1.7-3L13.7 4.3a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9.5v4'/%3E%3Cpath d='M12 17v.5'/%3E%3C/svg%3E");
  background: linear-gradient(color-mix(in srgb, var(--status-caution) 7%, transparent), color-mix(in srgb, var(--status-caution) 7%, transparent)), var(--mat-neutral);
}
.note.is-danger {
  --callout-ink: var(--field-error-ink);
  --callout-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5'/%3E%3Cpath d='M12 16v.5'/%3E%3C/svg%3E");
  background: linear-gradient(color-mix(in srgb, var(--status-danger) 7%, transparent), color-mix(in srgb, var(--status-danger) 7%, transparent)), var(--mat-neutral);
}
/* On glass (the auth card, an account panel) these are etched, not a
   second layer of glass. */
:is(.auth-card, .panel) :is(.flash, .banner, .note) { background: var(--mat-etched); box-shadow: var(--rim-etched); }
:is(.auth-card, .panel) .banner-warn {
  background: linear-gradient(color-mix(in srgb, var(--status-caution) 7%, transparent), color-mix(in srgb, var(--status-caution) 7%, transparent)), var(--mat-etched);
}
:is(.auth-card, .panel) .note.is-danger {
  background: linear-gradient(color-mix(in srgb, var(--status-danger) 7%, transparent), color-mix(in srgb, var(--status-danger) 7%, transparent)), var(--mat-etched);
}
/* A banner can carry its own action (the account's resend form): the text
   and the action share a row when there is room. */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.banner > p { flex: 1 1 260px; margin: 0; }
