/* ============================================================
   DDAC Members Door — the logged-out pages of the members area:
   sign in, forgot / welcome / reset / change password, the member
   error pages and the Wrapped "coming soon" card.

   Loads AFTER ddac_tokens.css (fonts, palette, the solid page
   background Safari 26 needs). Members design system only: never
   loaded by the admin or quiz apps (see brain: Three Separate
   Design Systems).

   Sizing: everything inside a card is in em, and the card's own
   font-size is derived from the viewport, so a short phone screen
   (an iPhone SE under Safari's bars) shrinks the whole card a little
   and it stays in one screen with real margins on every side, no
   scrolling; a tall phone or a laptop gets the full size back.
   ============================================================ */

/* ---------- Page shell ---------- */
.door-page,
.door-page *,
.door-page *::before,
.door-page *::after { box-sizing: border-box; }

body.door-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;   /* tracks Safari's collapsing bars instead of the fixed 100vh */
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

.door {
  flex: 1 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* real breathing room around the card, plus the safe area on notched phones */
  padding:
    max(var(--sp-6), env(safe-area-inset-top))
    max(var(--sp-6), env(safe-area-inset-right))
    max(var(--sp-6), env(safe-area-inset-bottom))
    max(var(--sp-6), env(safe-area-inset-left));
}

/* ---------- The card ----------
   1em = 16px on a roomy screen. On a short viewport the em shrinks so
   that (card height + page padding) <= the visible height; on a narrow
   one it shrinks so the card keeps its side margins. The two divisors
   are the card's height and width measured in em (see the test).     */
.door-card {
  --door-card-h: 30;     /* forgot-password, error pages */
  --door-card-w: 20;
  --door-em: clamp(
    11px,
    min(calc((100dvh - 3rem) / var(--door-card-h)),
        calc((100vw - 2rem) / var(--door-card-w))),
    16px
  );
  font-size: var(--door-em);
  position: relative;
  width: 100%;
  max-width: 400px;
  min-width: 0;          /* a flex item never grows past its container because of its content */
  padding: 1.875em 2.25em 1.75em;
  text-align: center;
  background: linear-gradient(145deg, rgba(30, 58, 58, 0.9) 0%, rgba(42, 74, 74, 0.85) 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--r-8);
  box-shadow: var(--shadow-modal), var(--inset-hairline);
}
.door-card--tall { --door-card-h: 39; }   /* sign in, set / change password: two or three inputs (which never drop below 16px text, hence the headroom) */
.door-card--wide { max-width: 480px; --door-card-h: 28; }

/* Gold accent bar across the top edge */
.gold-accent-bar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-500) 20%, var(--gold-600) 50%, var(--gold-500) 80%, transparent);
  border-radius: 0 0 4px 4px;
}

/* HUD corner brackets */
.door-card .hud-corner {
  position: absolute;
  width: 1.75em;
  height: 1.75em;
  border-color: rgba(78, 204, 163, 0.5);
  border-style: solid;
  transition: all var(--dur-std) var(--ease-hud);
}
.door-card .hud-corner-tl { top: -1px; left: -1px;  border-width: 2px 0 0 2px; border-radius: var(--r-8) 0 0 0; }
.door-card .hud-corner-tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; border-radius: 0 var(--r-8) 0 0; }
.door-card .hud-corner-bl { bottom: -1px; left: -1px;  border-width: 0 0 2px 2px; border-radius: 0 0 0 var(--r-8); }
.door-card .hud-corner-br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-radius: 0 0 var(--r-8) 0; }
.door-card:hover .hud-corner {
  border-color: rgba(78, 204, 163, 0.8);
  filter: drop-shadow(0 0 4px rgba(78, 204, 163, 0.4));
}

/* ---------- Card content ---------- */
.login-logo { margin-bottom: 1.25em; line-height: 0; }
.login-logo img { height: 3.5em; width: auto; max-width: 100%; }

.login-title {
  font-size: 1.5em;
  font-weight: var(--fw-medium);
  color: var(--fg-1);
  letter-spacing: 0.5px;
  line-height: 1.2;
  margin: 0 0 0.5em;
}
.login-subtitle {
  font-size: 0.875em;
  color: rgba(168, 192, 192, 0.8);
  line-height: 1.6;
  margin: 0 0 1.375em;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  width: 100%;
  padding: 0.8125em 2em;
  background: var(--discord);
  color: #ffffff;
  border: none;
  border-radius: var(--r-6);
  font-size: 0.9375em;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-discord);
  transition: all var(--dur-fast) ease;
}
.discord-btn:hover {
  background: var(--discord-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(88, 101, 242, 0.4);
}
.discord-btn svg { width: 1.5em; height: 1.5em; flex: none; }

/* The sign-in card: the password form sits directly under the title (no
   subtitle), and the Discord route comes last, introduced by a small label
   where the choice is made ("DDA Gold member? Sign in with Discord"). */
.login-title + .auth-form,
.login-title + .login-flash { margin-top: 1.25em; }
.door-alt {
  margin: 1.5em 0 0.625em;
  font-size: 0.6875em;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(168, 192, 192, 0.8);
  line-height: 1.5;
}

/* ---------- Password door form ---------- */
.auth-form { text-align: left; }
.auth-label {
  display: block;
  font-size: 0.6875em;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(168, 192, 192, 0.8);
  margin: 0 0 0.4375em;
}
.auth-input {
  display: block;
  width: 100%;
  padding: 0.6875em 0.875em;
  margin: 0 0 0.75em;
  background: rgba(14, 26, 26, 0.75);
  border: 1px solid rgba(78, 204, 163, 0.25);
  border-radius: var(--r-6);
  color: var(--fg-1);
  font-family: inherit;
  /* never below 16px: iOS Safari zooms the page into any smaller input on focus */
  font-size: max(0.9375em, 16px);
  line-height: 1.25;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.auth-input:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(212, 168, 85, 0.15);
}
.auth-submit {
  display: block;
  width: 100%;
  padding: 0.8125em 1.5em;
  margin-top: 0.125em;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: #16130a;
  border: none;
  border-radius: var(--r-6);
  font-family: inherit;
  font-size: 0.9375em;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.5px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 168, 85, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.auth-submit:hover {
  color: #16130a;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 168, 85, 0.35);
}
.auth-submit + .auth-submit { margin-top: 0.75em; }
.auth-input:disabled,
.auth-submit:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.auth-links { margin: 0.75em 0 0; text-align: center; font-size: 0.8125em; }
.auth-links a, .login-footer a { color: var(--gold-500); }
.auth-links a:hover, .login-footer a:hover { color: var(--teal-500); }
.auth-note { margin: 0.875em 0 0; font-size: 0.8125em; line-height: 1.6; color: #e8a9a9; }

/* ---------- Flash messages ---------- */
.login-flash {
  margin: 0 0 1.5em;
  padding: 0.875em 1.125em;
  border-radius: var(--r-6);
  font-size: 0.8125em;
  text-align: left;
}
.login-flash.danger  { background: rgba(231, 76, 60, 0.15);  border: 1px solid rgba(231, 76, 60, 0.3);  color: var(--danger); }
.login-flash.warning { background: rgba(201, 162, 39, 0.15); border: 1px solid rgba(201, 162, 39, 0.3); color: var(--gold-400); }
.login-flash.info    { background: rgba(78, 204, 163, 0.15); border: 1px solid rgba(78, 204, 163, 0.3); color: var(--teal-500); }
.login-flash.success { background: rgba(78, 204, 163, 0.1);  border: 1px solid rgba(78, 204, 163, 0.4); color: var(--teal-300); }

/* ---------- Footer ---------- */
.login-footer {
  margin-top: 1.25em;
  padding-top: 1em;
  border-top: 1px solid rgba(78, 204, 163, 0.1);
}
.login-footer p { margin: 0; font-size: 0.75em; color: var(--fg-muted); }

/* ---------- Wrapped "coming soon" ---------- */
.coming-soon-card { padding: 3em 2.5em; }
.coming-soon-icon { font-size: 4em; line-height: 1; margin-bottom: 0.375em; }
.coming-soon-title {
  font-size: 1.5em;
  font-weight: var(--fw-medium);
  color: var(--fg-1);
  line-height: 1.25;
  margin: 0 0 0.6667em;
}
.coming-soon-text {
  font-size: 0.875em;
  color: rgba(168, 192, 192, 0.8);
  line-height: 1.7;
  margin: 0 0 2.25em;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.875em 1.75em;
  background: transparent;
  color: var(--gold-400);
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: var(--r-6);
  font-size: 0.8125em;
  font-weight: var(--fw-medium);
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: all var(--dur-fast) ease;
}
.back-btn:hover {
  background: rgba(201, 162, 39, 0.1);
  border-color: rgba(201, 162, 39, 0.6);
  color: var(--gold-300);
}

/* ---------- Phones ---------- */
@media (max-width: 480px) {
  .door-card { padding: 1.75em 1.5em 1.5em; border-radius: var(--r-6); }
  .door-card .hud-corner { width: 1.25em; height: 1.25em; }
  .gold-accent-bar { width: 60%; }
  .coming-soon-card { padding: 2.25em 1.5em; }
}
