/* ---------- Tokens ---------- */
:root {
  --ink: #0a1426;          /* page background, like binding cloth */
  --board: #101d35;        /* card surface */
  --field: #0b1629;
  --line: #263a60;
  --text: #eef1f6;
  --muted: #9aa8c2;
  --gold: #d9ae52;
  --gold-light: #f3d58a;
  --gold-deep: #8e6420;
  --error: #ff8a7a;
  --success: #7fd6a8;

  --foil: linear-gradient(115deg, var(--gold-deep) 0%, var(--gold) 28%, #fbe7a8 46%, var(--gold) 62%, var(--gold-deep) 100%);

  --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-1: 1.25rem;
  --step-2: clamp(1.5rem, 1.2rem + 1.4vw, 1.95rem);
  --step-3: clamp(1.75rem, 1.35rem + 2vw, 2.45rem);

  --radius-card: 22px;
  --radius-plate: 14px;
  --radius-control: 12px;
  --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);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(42, 66, 112, 0.45), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  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(--gold-light); text-underline-offset: 3px; }
a:hover { color: #fff3cf; }

:focus-visible {
  outline: 2px solid var(--gold-light);
  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);
}

/* ---------- Foil frame (the hardcover) ---------- */
.foil {
  position: relative;
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  background:
    linear-gradient(var(--board), var(--board)) padding-box,
    var(--foil) border-box;
  background-size: auto, 250% 100%;
  background-position: 0 0, 0% 0;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  animation: foil-sweep 1.8s cubic-bezier(.4, 0, .2, 1) 0.15s both;
}

/* Inner stamped rule, set in from the edge like a book cover */
.foil::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(217, 174, 82, 0.22);
  border-radius: calc(var(--radius-card) - 6px);
  pointer-events: none;
}

@keyframes foil-sweep {
  from { background-position: 0 0, 100% 0; }
  to   { background-position: 0 0, 0% 0; }
}

/* ---------- Logo plates ---------- */
.plate {
  background: var(--plate, #000);
  border-radius: var(--radius-plate);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.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;
}

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

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

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

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

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

.control { position: relative; }

.control input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
  transition: border-color .15s, box-shadow .15s;
}

.control input::placeholder { color: #66779a; }

.control input:hover { border-color: #34507f; }

.control input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 174, 82, 0.22);
}

.control input[aria-invalid="true"] { border-color: var(--error); }
.control input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(255, 138, 122, 0.2); }

.control--password input { padding-right: 56px; }

.eye {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.eye 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; }

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

.error:empty { display: none; }

.button {
  position: relative;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--foil);
  background-size: 200% 100%;
  background-position: 30% 0;
  color: #1d1505;
  font: inherit;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 24px -12px rgba(217, 174, 82, 0.6);
  transition: background-position .5s ease, transform .1s;
}

.button:hover { background-position: 70% 0; }
.button:active { transform: translateY(1px); }
.button[aria-busy="true"] { cursor: progress; opacity: .85; }

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

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

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

.single .foil {
  display: grid;
  overflow: hidden;
}

.cover {
  background: #000;
  display: grid;
  place-items: center;
  padding: 20px 20px 4px;
  margin: 1px; /* keeps the foil edge visible around the black cover */
  border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 0 0;
}

/* 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 22px 28px;
  display: grid;
  gap: 24px;
}

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

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

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

.narrow .foil {
  padding: 22px 22px 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 .title:focus { outline: none; }
.sent p { margin: 0; color: var(--muted); }
.sent strong { color: var(--text); font-weight: 600; word-break: break-all; }

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

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