/* ---------- Tokens ---------- */
@property --angle-1 { syntax: "<angle>"; inherits: false; initial-value: -75deg; }
@property --angle-2 { syntax: "<angle>"; inherits: false; initial-value: -45deg; }

:root {
  --ink: #0c0f16;          /* page base under the glow */
  --text: #f2f4f8;
  --muted: #a3abbd;
  --error: #ff8f80;
  --success: #86e0b0;

  /* Neutral glass */
  --glass-fill: rgba(255, 255, 255, 0.07);
  --glass-fill-strong: rgba(255, 255, 255, 0.16);
  --glass-edge: rgba(255, 255, 255, 0.5);
  --glass-edge-soft: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.65);

  /* Background glow, taken from the logos */
  --glow-blue: #2f7bff;
  --glow-violet: #7a5cff;
  --glow-cyan: #22c3e6;
  --glow-green: #3fd47a;
  --glow-gold: #e0a84a;

  --font-display: "Marcellus", "Cinzel", Georgia, serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-3: clamp(1.75rem, 1.35rem + 2vw, 2.45rem);

  --radius-card: 28px;
  --radius-plate: 16px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --gutter: 16px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

img { display: block; max-width: 100%; height: auto; }

a { color: var(--text); text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.4); }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.page {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 32px max(var(--gutter), env(safe-area-inset-left));
}

.site-footer {
  padding: 0 var(--gutter) max(24px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------- Glowing background ---------- */
.glow-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}

.glow--1 {
  width: 62vmax; height: 40vmax;
  left: -18vmax; bottom: -16vmax;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--glow-blue), var(--glow-violet));
  transform: rotate(-30deg);
  animation: float-1 20s ease-in-out infinite;
}

.glow--2 {
  width: 42vmax; height: 34vmax;
  right: -10vmax; top: -8vmax;
  border-radius: 30%;
  background: linear-gradient(135deg, var(--glow-cyan), var(--glow-green));
  opacity: 0.45;
  animation: float-1 20s ease-in-out infinite reverse;
}

.glow--3 {
  width: 34vmax; height: 34vmax;
  right: -8vmax; bottom: -12vmax;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-gold), rgba(224, 168, 74, 0.2) 70%);
  opacity: 0.4;
  animation: float-2 25s ease-in-out infinite;
}

.glow--4 {
  width: 30vmax; height: 20vmax;
  left: -6vmax; top: 4vmax;
  border-radius: 50%;
  background: var(--glow-violet);
  opacity: 0.35;
  animation: float-2 25s ease-in-out infinite reverse;
}

@keyframes float-1 {
  50% { translate: -3vmax 2vmax; }
}

@keyframes float-2 {
  50% { translate: 3vmax -2vmax; }
}

@media (max-width: 759px) {
  .glow { filter: blur(48px); }
  .glow--4 { display: none; }
}

/* ---------- Glass card ---------- */
.glass-card {
  position: relative;
  border-radius: var(--radius-card);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03));
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* 1px light edge, brighter at the top-left and bottom-right */
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.06) 40%, rgba(255, 255, 255, 0.03) 60%, rgba(255, 255, 255, 0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* ---------- Logo plates ---------- */
.plate {
  background: var(--plate, #000);
  border-radius: var(--radius-plate);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.plate img {
  width: 100%;
  height: 84px;
  object-fit: contain;
}

/* ---------- Type ---------- */
.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin: 0;
}

.lede {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 52ch;
}

/* ---------- Load and step reveal ---------- */
.reveal {
  animation: reveal 0.5s ease-out both;
  animation-delay: calc(0.04s + var(--i, 0) * 0.15s);
}

@keyframes reveal {
  from { opacity: 0; filter: blur(6px); transform: translateY(6px); }
  to   { opacity: 1; filter: none; transform: none; }
}

/* ---------- Form ---------- */
.auth-form { display: grid; gap: 18px; perspective: 800px; }

.field { display: grid; gap: 7px; }

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 0 18px;
}

.field > label { padding: 0 18px; }

.field label {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.field-row a { font-size: var(--step--1); }

.hint {
  margin: 0;
  padding: 0 18px;
  color: var(--muted);
  font-size: var(--step--1);
}

.error {
  margin: 0;
  padding: 0 18px;
  color: var(--error);
  font-size: var(--step--1);
  line-height: 1.4;
}

.error:empty { display: none; }

/* ---------- Glass input ---------- */
.glass-input {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  border-radius: 999px;
  background: linear-gradient(-75deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.05),
    inset 0 -2px 2px rgba(0, 0, 0, 0.25),
    0 4px 2px -2px rgba(0, 0, 0, 0.25);
  transition: box-shadow 0.4s var(--ease);
}

/* Shiny edge; it turns when the field is focused */
.glass-input::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background:
    conic-gradient(from var(--angle-1) at 50% 50%, var(--glass-edge) 0%, transparent 5% 40%, var(--glass-edge) 50%, transparent 60% 95%, var(--glass-edge) 100%),
    linear-gradient(var(--glass-edge-soft), var(--glass-edge-soft));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: --angle-1 0.5s ease;
  pointer-events: none;
}

.glass-input:focus-within {
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.05),
    inset 0 -2px 2px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(255, 255, 255, 0.06);
}

.glass-input:focus-within::after { --angle-1: -125deg; }

.glass-input.is-invalid::after {
  background:
    conic-gradient(from var(--angle-1) at 50% 50%, var(--error) 0%, transparent 5% 40%, var(--error) 50%, transparent 60% 95%, var(--error) 100%),
    linear-gradient(rgba(255, 143, 128, 0.35), rgba(255, 143, 128, 0.35));
}

.glass-input .lead {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: 18px;
  color: rgba(242, 244, 248, 0.75);
}

.glass-input input {
  flex: 1;
  width: 0; /* let flex size it, not the input's built-in ~20 characters */
  min-width: 0;
  height: 52px;
  padding: 0 14px 0 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
  outline: none;
}

.glass-input input::placeholder { color: rgba(242, 244, 248, 0.5); }

/* Keep browser autofill from painting a solid box over the glass */
.glass-input input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 40px transparent inset;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--text);
}

input[type="password"]::-ms-reveal { display: none; }

/* Round buttons that live inside a field: the eye and the arrow */
.in-field {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: 4px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(242, 244, 248, 0.75);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.in-field:hover, .eye[aria-pressed="true"] { color: var(--text); }

.in-field svg { width: 22px; height: 22px; }
.eye .icon-hide { display: none; }
.eye[aria-pressed="true"] .icon-show { display: none; }
.eye[aria-pressed="true"] .icon-hide { display: block; }

/* The arrow slides in once the field has text */
.arrow-slot {
  flex: none;
  width: 0;
  overflow: hidden;
  transition: width 0.3s var(--ease);
}

.glass-input.has-value .arrow-slot { width: 48px; }

.arrow {
  background: linear-gradient(-75deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 2px 4px rgba(0, 0, 0, 0.3);
  color: var(--text);
}

/* ---------- Glass button ---------- */
.glass-button-wrap {
  display: block;
  transition: transform 0.4s var(--ease);
}

.glass-button-wrap:has(.glass-button:active) { transform: rotateX(25deg); }

.glass-button {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(-75deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.12),
    inset 0 -2px 2px rgba(0, 0, 0, 0.25),
    0 6px 14px -6px rgba(0, 0, 0, 0.5),
    0 0 1.5px 4px inset rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 1.0625rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.glass-button:hover { transform: scale(0.975); }

.glass-button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  background:
    conic-gradient(from var(--angle-1) at 50% 50%, rgba(255, 255, 255, 0.6) 0%, transparent 5% 40%, rgba(255, 255, 255, 0.6) 50%, transparent 60% 95%, rgba(255, 255, 255, 0.6) 100%),
    linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: --angle-1 0.5s ease;
  pointer-events: none;
}

.glass-button:hover::after { --angle-1: -125deg; }

.glass-button-text {
  position: relative;
  display: block;
  padding: 14px 24px;
  border-radius: inherit;
  overflow: hidden;
  text-shadow: 0 2px 1px rgba(0, 0, 0, 0.25);
}

/* Light sheen that slides across on hover */
.glass-button-text::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--angle-2), transparent 0%, rgba(255, 255, 255, 0.28) 40% 50%, transparent 55%);
  background-size: 200% 200%;
  background-position: 0% 50%;
  mix-blend-mode: screen;
  transition: background-position 0.5s var(--ease), --angle-2 0.5s var(--ease);
  pointer-events: none;
}

.glass-button:hover .glass-button-text::after { background-position: 25% 50%; }
.glass-button:active .glass-button-text::after { background-position: 50% 15%; --angle-2: -15deg; }

.glass-button[aria-busy="true"] { cursor: progress; opacity: 0.8; }

@media (hover: none) and (pointer: coarse) {
  .glass-button:hover { transform: none; }
  .glass-button:hover::after { --angle-1: -75deg; }
}

.form-status {
  margin: 0;
  font-size: var(--step--1);
  color: var(--success);
  text-align: center;
}

.form-status:empty { display: none; }

/* ---------- One field at a time ---------- */
/* auth.js sets data-step. Until it does (or with no JS), both fields show as a normal form. */
.steps { display: grid; gap: 18px; }

.step {
  display: grid;
  gap: 18px;
  align-content: start;
}

.auth-form[data-step] .step { grid-area: 1 / 1; }

.auth-form[data-step] .step:not(.is-active) { display: none; }

.auth-form:not([data-step]) .who { display: none; }

.step:not(.is-active) .reveal { animation: none; }

.who {
  margin: 0;
  padding: 0 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  color: var(--muted);
  font-size: var(--step--1);
}

.who strong {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--step--1);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button svg { width: 16px; height: 16px; }
.link-button:hover { text-decoration-color: currentColor; }

/* ---------- Page 1: single login ---------- */
.single {
  max-width: 980px;
  display: grid;
  align-content: center;
}

.single .glass-card {
  display: grid;
  overflow: hidden;
}

.cover {
  background: #000;
  display: grid;
  place-items: center;
  padding: 20px 20px 4px;
}

/* The logo's glow runs to its edges; fade them so no square shows on the black */
.cover img {
  width: min(180px, 52vw);
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}

.single .panel {
  padding: 24px 20px 28px;
  display: grid;
  gap: 24px;
}

.single .plate img { height: 64px; }

@media (min-width: 860px) {
  .single .glass-card { grid-template-columns: 1.05fr 1fr; }
  .cover { padding: 40px; }
  .cover img { width: min(420px, 100%); }
  .single .panel { padding: 48px 44px 44px; align-content: center; }
  .single .plate img { height: 78px; }
}

/* ---------- Forgot password ---------- */
.narrow {
  max-width: 480px;
  display: grid;
  align-content: center;
}

.narrow .glass-card {
  padding: 22px 20px 28px;
  display: grid;
  gap: 24px;
}

.narrow .plate img { height: 76px; }

.back-link {
  justify-self: center;
  font-size: var(--step--1);
}

.sent { display: grid; gap: 14px; }
.sent p { margin: 0; color: var(--muted); }
.sent strong { color: var(--text); font-weight: 600; word-break: break-all; }
.sent .title:focus { outline: none; }

@media (min-width: 560px) {
  .narrow .glass-card { padding: 32px 36px 36px; }
}

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
