/* Premium split-screen auth — tokens from site.css. Presentation only. */

@view-transition { navigation: auto; }

html:has(body.auth-page) {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
}
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface-paper);
}
.auth-page .header .lang-switch,
.auth-page .header .lang { display: inline-flex; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "brand"
    "main"
    "footer";
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-page .header { grid-area: header; }
.auth-page main { grid-area: main; min-width: 0; }
.auth-footer { grid-area: footer; }
.auth-brand {
  grid-area: brand;
  view-transition-name: sxf-auth-brand;
}
.form-card { view-transition-name: sxf-auth-form; }

::view-transition-group(sxf-auth-brand),
::view-transition-group(sxf-auth-form) {
  animation-duration: 200ms;
  animation-timing-function: var(--ease-signal);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 200ms;
  animation-timing-function: var(--ease-signal);
}

/* --- Header lives in the form pane, not over the brand panel --- */
.auth-page .header {
  position: sticky;
  top: 0;
  inset: auto;
  z-index: 20;
  background-color: color-mix(in srgb, var(--surface-paper) 88%, transparent);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
}
.auth-page .auth-nav {
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 4rem;
}
.auth-page .auth-nav__actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.auth-page .lang {
  border: 1px solid var(--line);
  background: var(--surface-paper-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 13px;
  min-height: 2rem;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.auth-page .lang:hover { border-color: var(--signal-blue); color: var(--signal-blue-text); }

/* --- Brand panel: compact strip below 54rem, full pane at/above --- */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 3.25rem;
  padding: var(--space-2) var(--gutter);
  background: var(--ink-navy);
  color: var(--text-on-dark);
}
.auth-brand::before {
  content: "";
  width: 2.5rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--signal-blue), var(--signal-cyan));
  flex: none;
}
.auth-brand__visual {
  display: none;
  position: absolute;
  inset: 0;
  color: var(--signal-cyan);
  pointer-events: none;
  container-type: size;
}
/* Meet-box for the 480×720 viewBox so glass % and SVG radii share
   one coordinate system. Without this, glass is 56% of the *panel*
   while rings scale with the shorter SVG side — a ring can sit on
   the plate/glass edge when the pane is wide and short. */
.auth-brand__stage {
  position: relative;
  aspect-ratio: 480 / 720;
  width: min(100cqi, calc(100cqb * 480 / 720));
  height: auto;
}
.auth-brand__svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 480 / 720;
  max-width: none;
}
/* Frosted disc behind the mark. HTML layer supplies backdrop-filter
   (blurs the navy + radar field); the SVG plate is the mix-blend
   target so lighten can lift the PNG’s black field. Centre stays
   (240, 280) → 50% / 38.8889% of the 480×720 stage. Plate r=128
   is 53.33% of stage width; glass is 56% so the frost rim shows. */
.auth-brand__logo-glass {
  position: absolute;
  left: 50%;
  top: 38.8889%;
  /* Same diameter as SVG plate r=128 (256/480) — a larger disc plus
     a 1px border was reading as a ring sitting on the plate edge. */
  width: calc(256 / 480 * 100%);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: color-mix(in srgb, var(--text-on-dark) 20%, transparent);
  border: 0;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.auth-brand__logo-plate {
  fill: color-mix(in srgb, var(--text-on-dark) 34%, transparent);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth-brand__logo-glass {
    background: color-mix(in srgb, var(--text-on-dark) 32%, transparent);
  }
}
.auth-brand__ring {
  fill: none;
  stroke: var(--signal-blue);
  stroke-width: 1.1;
  opacity: .38;
}
.auth-brand__ring--faint { opacity: .2; }
.auth-brand__axis {
  stroke: var(--signal-blue);
  stroke-width: .7;
  opacity: .18;
}
.auth-brand__node {
  fill: var(--signal-cyan);
  transform-box: fill-box;
  transform-origin: center;
  animation: authNode 18s var(--ease-signal) infinite;
}
.auth-brand__node:nth-child(even) { animation-delay: -6s; }
.auth-brand__scan {
  animation: authScan 18s linear infinite;
}
/* Centre (240, 280). Logo 168×112 on plate r=128. Glow percentages
   are measured against this box (not the old 96×64 / hex keep). */
.auth-brand__logo {
  mix-blend-mode: lighten;
  opacity: .94;
  pointer-events: none;
  animation: authLogoMark 18s linear infinite;
}
.auth-brand__logo-glow {
  opacity: 0;
  pointer-events: none;
  animation: authLogoGlow 18s linear infinite;
}
.auth-brand__tag {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--signal-cyan);
  white-space: nowrap;
}

.auth-wrap {
  width: min(28rem, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: var(--space-5) 0 var(--space-6);
  flex: 1;
}
.auth-wrap .form-card {
  width: 100%;
  background: var(--surface-paper-2);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-1);
}
.auth-wrap h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink-navy);
}
.auth-wrap .lede {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
}

.auth-status {
  display: grid;
  grid-template-columns: 0fr 1fr;
  align-items: start;
  gap: 0;
  max-height: 0;
  margin: 0;
  padding: 0 14px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: 1.6;
  transition:
    max-height var(--motion-micro) var(--ease-signal),
    opacity var(--motion-micro) var(--ease-signal),
    transform var(--motion-micro) var(--ease-signal),
    margin var(--motion-micro) var(--ease-signal),
    padding var(--motion-micro) var(--ease-signal),
    grid-template-columns var(--motion-micro) var(--ease-signal),
    gap var(--motion-micro) var(--ease-signal);
}
.auth-status.is-visible {
  grid-template-columns: auto 1fr;
  gap: 8px;
  max-height: 8rem;
  margin: var(--space-3) 0 0;
  padding: 12px 14px;
  opacity: 1;
  transform: none;
}
.auth-status.is-visible::before {
  content: "";
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M8 5v4.2M8 11.2h.01' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M8 5v4.2M8 11.2h.01' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-status.is-ok::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M5 8.2 7.1 10.3 11.2 5.8' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M5 8.2 7.1 10.3 11.2 5.8' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-status.is-err {
  background: #FCEBEA;
  border: 1px solid #E7B7B1;
  color: var(--state-error);
}
.auth-status.is-ok {
  background: color-mix(in srgb, var(--signal-cyan) 16%, white);
  border: 1px solid color-mix(in srgb, var(--signal-cyan) 40%, transparent);
  color: #0F6E86;
}

.auth-wrap .form-grid { margin-top: var(--space-3); }

.auth-wrap .field__error {
  display: grid;
  grid-template-columns: 0fr 1fr;
  gap: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  color: var(--state-error);
  font-size: var(--fs-xs);
  line-height: 1.45;
  transition:
    max-height var(--motion-micro) var(--ease-signal),
    opacity var(--motion-micro) var(--ease-signal),
    transform var(--motion-micro) var(--ease-signal),
    grid-template-columns var(--motion-micro) var(--ease-signal),
    gap var(--motion-micro) var(--ease-signal);
}
.auth-wrap .field.is-invalid .field__error:not(:empty),
.auth-wrap .consent.is-invalid .field__error:not(:empty) {
  grid-template-columns: auto 1fr;
  gap: 6px;
  max-height: 4rem;
  opacity: 1;
  transform: none;
  margin-top: 4px;
}
.auth-wrap .field.is-invalid .field__error:not(:empty)::before,
.auth-wrap .consent.is-invalid .field__error:not(:empty)::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-top: 1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M8 5v4.2M8 11.2h.01' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M8 5v4.2M8 11.2h.01' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-wrap .field.is-invalid input,
.auth-wrap .field.is-invalid textarea,
.auth-wrap .consent.is-invalid input[type="checkbox"] {
  border-color: var(--state-error);
}

.turnstile-slot {
  min-height: 65px;
  margin-top: 2px;
  max-width: 100%;
}
.turnstile-slot iframe {
  display: block;
  max-width: 100%;
}

.auth-wrap .form-foot { margin-top: var(--space-3); }
.auth-wrap .btn { position: relative; overflow: hidden; }
.auth-wrap .btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}
.auth-wrap .btn.is-loading,
.auth-wrap .btn.is-success { opacity: 1; }
.auth-wrap .btn__spin,
.auth-wrap .btn__check {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
}
.auth-wrap .btn.is-loading .btn__spin {
  display: block;
  border: 2px solid color-mix(in srgb, var(--signal-cyan) 35%, transparent);
  border-top-color: var(--signal-cyan);
  border-radius: 50%;
  animation: authSpin .7s linear infinite;
}
.auth-wrap .btn.is-success .btn__check {
  display: block;
  background: var(--signal-cyan);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.4 11.3 12.8 4.6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.2 6.4 11.3 12.8 4.6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth-wrap .btn.is-loading [data-label],
.auth-wrap .btn.is-success [data-label] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.pw-meter {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.pw-meter[hidden] { display: none !important; }
.pw-meter__track {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.pw-meter__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--state-error);
  transition: width var(--motion-micro) var(--ease-signal), background-color var(--motion-micro) var(--ease-signal);
}
.pw-meter.is-weak .pw-meter__bar { width: 33%; background: var(--state-error); }
.pw-meter.is-medium .pw-meter__bar { width: 66%; background: var(--signal-blue); }
.pw-meter.is-strong .pw-meter__bar { width: 100%; background: var(--signal-cyan); }
.pw-meter__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
}
.pw-meter.is-weak .pw-meter__label { color: var(--state-error); }
.pw-meter.is-medium .pw-meter__label { color: var(--signal-blue-text); }
.pw-meter.is-strong .pw-meter__label { color: #0F6E86; }

.auth-switch {
  margin-top: var(--space-3);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.auth-switch a { color: var(--signal-blue-text); font-weight: 700; }
.auth-switch a:hover { text-decoration: underline; text-underline-offset: .2em; }
.auth-page .lang:focus-visible,
.auth-switch a:focus-visible,
.auth-footer a:focus-visible {
  outline: 2px solid var(--signal-blue-text);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

.auth-google { margin: var(--space-3) 0 0; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-google .btn {
  text-align: center;
  text-decoration: none;
}
.auth-google__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  background: #fff;
}
.auth-google__mark svg {
  display: block;
  width: 20px;
  height: 20px;
}

.auth-page [hidden] { display: none !important; }
.auth-success { text-align: center; padding: var(--space-2) 0; }
.auth-success h2 { font-size: 1.25rem; margin-top: var(--space-2); color: var(--ink-navy); }
.auth-success p { margin-top: .75rem; color: var(--text-muted); line-height: 1.7; }

.auth-footer {
  margin-top: auto;
  padding: var(--space-3) var(--gutter);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.auth-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  align-items: center;
  max-width: 28rem;
  margin: 0 auto;
}
.auth-footer a { color: var(--signal-blue-text); }

@keyframes authSpin {
  to { transform: rotate(360deg); }
}
@keyframes authScan {
  from { transform: translateY(-30%); }
  to { transform: translateY(780%); }
}
@keyframes authNode {
  0%, 100% { opacity: .45; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes authLogoGlow {
  0%, 4.6%, 8.1%, 100% {
    filter: drop-shadow(0 0 0 rgba(32, 203, 237, 0));
    opacity: 0;
  }
  4.8% {
    filter: drop-shadow(0 0 8px rgba(32, 203, 237, .28));
    opacity: .45;
  }
  6.3% {
    filter: drop-shadow(0 0 16px rgba(32, 203, 237, .7));
    opacity: 1;
  }
  7.9% {
    filter: drop-shadow(0 0 8px rgba(32, 203, 237, .28));
    opacity: .45;
  }
}
@keyframes authLogoMark {
  0%, 4.6%, 8.1%, 100% {
    filter: drop-shadow(0 0 0 rgba(32, 203, 237, 0));
    opacity: .94;
  }
  4.8% {
    filter: drop-shadow(0 0 8px rgba(32, 203, 237, .35));
    opacity: .97;
  }
  6.3% {
    filter: drop-shadow(0 0 16px rgba(32, 203, 237, .7));
    opacity: 1;
  }
  7.9% {
    filter: drop-shadow(0 0 8px rgba(32, 203, 237, .35));
    opacity: .97;
  }
}

@media (min-width: 54rem) {
  .auth-shell {
    grid-template-columns: minmax(24rem, 1fr) minmax(20rem, 1.05fr);
    grid-template-areas:
      "header brand"
      "main brand"
      "footer brand";
    grid-template-rows: auto 1fr auto;
  }
  .auth-brand {
    order: 0;
    /* Stretch with the grid (header+main+footer) so the navy pane
       covers the full page. Artwork stays in a sticky 100dvh layer
       so rings/plate do not letterbox into the extra height. */
    min-height: 100vh;
    min-height: 100dvh;
    align-self: stretch;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: var(--space-6);
    padding-block-end: 0;
    gap: 0;
  }
  .auth-brand::before { display: none; }
  .auth-brand__visual {
    display: grid;
    place-items: center;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: calc(100% + 2 * var(--space-6));
    margin-inline: calc(-1 * var(--space-6));
    margin-block-start: calc(-1 * var(--space-6));
    flex: none;
  }
  /* Out of flow so the tagline does not add a second
     100dvh+line of height on top of the sticky visual.
     Sits on the first viewport; radar stays sticky. */
  .auth-brand__tag {
    position: absolute;
    inset-inline-start: var(--space-6);
    top: calc(100dvh - 2.75rem);
    z-index: 2;
    font-size: var(--fs-sm);
    letter-spacing: .06em;
  }
  .auth-wrap { padding-top: var(--space-6); }
}

@media (max-width: 359px) {
  /* Turnstile's widget is 300px. Below 360px the default wrap
     (100% - 2*gutter) plus card padding leaves <300px inner width,
     which overflowed the viewport by ~13px at 320px. Fill the
     viewport and keep card padding small enough that inner ≥ 300px
     (at 318px: 318 - 16 pad - 2 border = 300). */
  .auth-wrap {
    width: 100%;
    max-width: 100%;
    padding-inline: 0;
    padding-top: var(--space-3);
  }
  .auth-wrap .form-card { padding: 0.5rem; }
  .auth-brand__tag { letter-spacing: 0; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .auth-status,
  .auth-wrap .field__error,
  .pw-meter__bar {
    transition: none;
  }
  .auth-brand__scan,
  .auth-brand__node,
  .auth-brand__logo,
  .auth-brand__logo-glow,
  .auth-wrap .btn__spin {
    animation: none !important;
  }
  .auth-brand__scan { transform: translateY(220%); opacity: .45; }
  .auth-brand__node { opacity: .85; transform: none; }
  .auth-brand__logo { filter: none; opacity: .96; }
  .auth-brand__logo-glow { opacity: 0; filter: none; }
  .auth-status.is-visible,
  .auth-wrap .field.is-invalid .field__error:not(:empty) {
    transform: none;
  }
}
