/* ── Sign in by email (AUTH-001) ──────────────────────────────────────
   One field and one button, then "check your email" with the code and the
   resend, and the page a link opens. Same card, same ground; every target
   is at least 44px, every input 16px so iOS does not zoom, and every step
   change moves focus to its heading. */
.auth-step { display: grid; gap: var(--sp-3); }
.auth-step[hidden] { display: none; }
.auth-form { display: grid; gap: var(--sp-3); }
.auth-form[hidden] { display: none; }
.auth-field > label { font-size: var(--size-sm); font-weight: 600; color: var(--text-muted); }
.auth-card input { font-size: 1rem; }
.auth-card input[readonly] { background: var(--surface-page); color: var(--text-muted); }
.auth-card input[aria-invalid="true"] { border-color: var(--state-danger-text); }
/* A heading takes focus on a step change so a screen reader starts there;
   it is not a control, so it draws no ring. */
.auth-card h1:focus, .auth-title:focus { outline: none; }
.auth-title { font-family: var(--font-display); font-size: var(--type-heading-section); line-height: 1.2; margin: 0; }
.auth-card-status h1 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); line-height: 1.2; }
/* Every alert in these cards is a refusal or an error. */
/* Body-colour text: the danger red on its own tint measured 4.42:1. */
.auth-card .auth-alert {
  background: var(--state-danger-fill); border: 1px solid var(--color-danger-alpha-005);
  border-left: 4px solid var(--state-danger-text); color: var(--text-primary);
}
.auth-card .auth-alert a { color: var(--text-primary); font-weight: 600; }
.auth-field-error { margin: 0; font-size: var(--size-sm); line-height: var(--leading-ratio-1_5); color: var(--state-danger-text); }
.auth-field-error[hidden], .auth-suggest[hidden], .auth-hint[hidden], .auth-mail-apps[hidden] { display: none; }
.auth-suggest { margin: 0; font-size: var(--size-sm); color: var(--text-muted); }
.auth-inline-button {
  display: inline; min-height: 0; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--brand-text); text-decoration: underline; text-underline-offset: 2px;
}
.auth-inline-button:hover { color: var(--brand-fill-hover); }
.auth-inline-button:focus-visible, .auth-secondary:focus-visible, .auth-reveal:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.auth-optional { font-weight: 400; }
.auth-address { color: var(--text-primary); overflow-wrap: anywhere; }

/* In-place busy state: the label hides, the spinner shows, the width stays. */
.auth-submit { position: relative; }
.auth-spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: authSpin 0.8s linear infinite;
}
.auth-submit .auth-spinner { position: absolute; inset: 0; margin: auto; }
.auth-submit.is-busy .auth-submit-label { visibility: hidden; }
.auth-submit.is-busy .auth-spinner { display: block; }
.auth-submit.is-busy[disabled] { opacity: 1; }
@keyframes authSpin { to { transform: rotate(360deg); } }

.auth-divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--size-xs); text-transform: uppercase; letter-spacing: 0.12em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border-subtle); }
.auth-secondary {
  width: 100%; min-height: 46px; padding: 0 var(--sp-4); cursor: pointer;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-raised);
  font: inherit; font-size: var(--size-sm); font-weight: 600; color: var(--text-primary);
  transition: border-color var(--dur-200ms) var(--ease-out), background var(--dur-200ms) var(--ease-out);
}
.auth-secondary:hover:not([disabled]) { border-color: var(--brand-text); }
.auth-secondary[disabled] { cursor: not-allowed; color: var(--text-muted); background: var(--surface-page); }
.auth-secondary.is-busy { cursor: progress; }

/* The round badge above "Check your email" and on the link page. */
.auth-badge {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  color: var(--brand-text); background: var(--cu-tint-2);
}
.auth-badge > * { grid-area: 1 / 1; }
.auth-badge .auth-check, .auth-badge .auth-cross, .auth-badge .auth-spinner { display: none; }
.auth-badge[data-tone="busy"] .auth-spinner { display: block; }
.auth-badge[data-tone="ok"] { color: var(--state-success-text); background: var(--state-success-fill); }
.auth-badge[data-tone="ok"] .auth-check { display: block; }
.auth-badge[data-tone="ok"] .auth-check path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: authDraw var(--dur-450ms) var(--ease-out) forwards; }
.auth-badge[data-tone="error"] { color: var(--state-danger-text); background: var(--state-danger-fill); }
.auth-badge[data-tone="error"] .auth-cross, .auth-badge[data-tone="info"] .auth-cross { display: block; }
.auth-spinner-lg { width: 26px; height: 26px; }
/* No flash: a fast answer replaces the spinner before it ever shows. */
.auth-badge[data-tone="busy"] .auth-spinner-lg { opacity: 0; animation: authSpin 0.8s linear infinite, authAppear var(--dur-200ms) var(--ease-out) 0.3s forwards; }
@keyframes authDraw { to { stroke-dashoffset: 0; } }
@keyframes authAppear { to { opacity: 1; } }
.auth-card-status { text-align: left; }
.auth-actions { display: grid; gap: var(--sp-3); }
.auth-actions[hidden], .auth-actions .auth-submit[hidden] { display: none; }

.auth-mail-apps { margin: 0; }
.auth-mail-app {
  width: 100%; min-height: 46px; border: 1px solid var(--border-subtle); background: var(--surface-raised);
  color: var(--text-primary); font-size: var(--size-sm);
}
.auth-mail-app:hover { border-color: var(--brand-text); }
.auth-card input.auth-code {
  font-family: var(--font-mono);
  font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums;
}
.auth-resend { display: grid; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--border-subtle); }
.auth-resend-status { margin: 0; font-size: var(--size-sm); color: var(--text-muted); min-height: 1.5em; }
.auth-countdown { font-variant-numeric: tabular-nums; }
.auth-hint { margin: 0; font-size: var(--size-sm); line-height: var(--leading-ratio-1_5); color: var(--text-muted); }
.auth-step:not([hidden]) { animation: authStep var(--dur-200ms) var(--ease-out) both; }
@keyframes authStep { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .auth-step:not([hidden]) { animation: none; }
  .auth-badge[data-tone="ok"] .auth-check path { animation: none; stroke-dashoffset: 0; }
  .auth-spinner, .auth-badge[data-tone="busy"] .auth-spinner-lg { animation-duration: 2.4s; }
}

/* AUTH-UI-001: the email journey has a compact shared shell. Artwork is
   deliberately absent until Ferhat selects a file in design/auth-image-options. */
.auth-page { background: var(--surface-page); color: var(--text-primary); }
.auth-header, .auth-layout, .auth-footer { width: min(1160px, calc(100% - var(--sp-6) * 2)); margin-inline: auto; }
.auth-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: 96px; }
.auth-brand { display: inline-flex; align-items: center; min-height: 44px; flex-shrink: 0; }
.auth-brand img { width: 173px; height: 40px; }
.auth-site-link { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; color: var(--text-muted); font-size: var(--size-sm); text-decoration: none; }
.auth-site-link:hover { color: var(--brand-text); }
.auth-layout {
  display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); min-height: 640px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: clip;
  background: var(--surface-raised); box-shadow: var(--shadow-sm);
}
.auth-intro {
  display: flex; flex-direction: column; align-items: flex-start; padding: var(--sp-7);
  color: var(--text-primary); background: radial-gradient(ellipse at bottom left, var(--cu-tint-2), transparent), var(--surface-sunken);
  border-right: 1px solid var(--border);
}
.auth-intro-kicker { color: var(--brand-text); margin: 0 0 var(--sp-6); font: 500 var(--size-xs) var(--font-mono); letter-spacing: .08em; text-transform: uppercase; line-height: 1.6; }
.auth-intro h2 { margin: 0 0 var(--sp-4); color: inherit; font: 500 clamp(1.75rem, 3vw, 2.75rem)/1.15 var(--font-display); letter-spacing: -.035em; }
.auth-intro-copy { margin: 0; max-width: 34ch; font-size: var(--size-sm); line-height: 1.7; }
.auth-benefits { display: grid; gap: var(--sp-5); list-style: none; padding: 0; margin: var(--sp-7) 0; }
.auth-benefits li { display: flex; align-items: baseline; gap: var(--sp-4); }
.auth-benefits li > span { color: var(--brand-text); font: 400 var(--size-xs) var(--font-mono); }
.auth-benefits strong { font-size: var(--size-sm); font-weight: 600; }
.auth-benefits p { color: var(--text-muted); margin: var(--sp-1) 0 0; max-width: 30ch; font-size: var(--size-sm); line-height: 1.6; }
.auth-intro-foot { margin: auto 0 0; padding-top: var(--sp-5); font: 400 var(--size-xs)/1.8 var(--font-mono); }
.auth-page .auth-shell { min-width: 0; min-height: 0; padding: var(--sp-6) var(--sp-7); background: none; }
.auth-page .auth-stack { width: min(420px, 100%); }
.auth-page .auth-card { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; animation: none; }
.auth-page .auth-card h1 { font-size: clamp(1.6rem, 2.4vw, 2rem); line-height: 1.2; letter-spacing: -.025em; }
.auth-page .auth-overline { margin-bottom: var(--sp-2); font-size: var(--size-xs); }
.auth-page .auth-field > label { display: block; margin-top: var(--sp-2); }
.auth-page .auth-card input { min-height: 48px; }
.auth-page .auth-submit { min-height: 48px; box-shadow: none; }
.auth-page .auth-secondary { min-height: 44px; }
.auth-page .auth-inline-button { min-height: 44px; }
.auth-page .auth-sub { line-height: 1.65; }
.auth-page .auth-alt { margin-top: var(--sp-1); }
.auth-page .auth-alert { overflow-wrap: anywhere; }
.auth-guest { margin: var(--sp-5) 0 0; color: var(--text-muted); font-size: var(--size-sm); line-height: 1.65; }
.auth-guest a { color: var(--brand-text); text-decoration: underline; text-underline-offset: 3px; }
.auth-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-5); padding-block: var(--sp-5); }
.auth-page:has(.consent-banner:not([hidden])) .auth-footer { padding-bottom: calc(var(--sp-8) * 2); }
.auth-footer .footer-desc { margin: 0; max-width: none; font-size: var(--size-xs); color: var(--text-muted); }
.auth-footer a { color: var(--text-muted); text-underline-offset: 3px; }
.auth-legal { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.auth-legal a { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--size-xs); }
.auth-skip { position: absolute; left: var(--sp-4); top: var(--sp-2); z-index: 100; padding: var(--sp-3); color: var(--text-primary); background: var(--surface-raised); transform: translateY(-150%); }
.auth-skip:focus { transform: none; }
.auth-header a:focus-visible, .auth-footer a:focus-visible, .auth-guest a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-radius: var(--radius-sm); }
.auth-page .auth-badge[data-tone="ok"] .auth-check path { animation-duration: var(--dur-200ms); }
@media (max-width: 860px) {
  .auth-header, .auth-layout, .auth-footer { width: min(520px, calc(100% - var(--sp-4) * 2)); }
  .auth-header { min-height: 80px; }
  .auth-layout { display: block; min-height: 0; }
  .auth-intro { display: none; }
  .auth-page .auth-shell { padding: var(--sp-6); }
  .auth-footer { display: grid; gap: var(--sp-2); }
  .auth-page:has(.consent-banner:not([hidden])) .auth-footer { padding-bottom: calc(var(--sp-8) * 3 + var(--sp-6)); }
}
@media (max-width: 420px) {
  .auth-header, .auth-layout, .auth-footer { width: calc(100% - var(--sp-3) * 2); }
  .auth-page .auth-shell { padding: var(--sp-5); }
  .auth-brand img { width: 148px; height: auto; }
  .auth-site-link { font-size: var(--size-xs); }
  .auth-legal { gap: var(--sp-3); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-page .auth-step:not([hidden]), .auth-page .auth-spinner,
  .auth-page .auth-badge[data-tone="busy"] .auth-spinner-lg { animation: none; opacity: 1; }
  .auth-page .auth-secondary { transition: none; }
}
