/* === The door (/request-access/) ===========================================
   Marian palette (canon + sign-in). Holman Hunt is the stage; the form is the
   porter's desk. Three-way theme via theme.js.
   ========================================================================= */

:root {
  color-scheme: light dark;
  --bg: #faf9f5; --panel: #ffffff; --panel-soft: #f3f2ec;
  --rule: #e2e1d8; --rule-strong: #c6c5b6;
  --ink: #232a3d; --ink-muted: #46506a; --ink-subtle: #6a718a; --ink-ghost: #6b7085;
  --marian: #27447e; --marian-deep: #1b3160;
  --gold: #a8862f; --gold-deep: #7d6420; --alert: #8c1515;
  --field-focus: rgba(39, 68, 126, 0.28); --shadow: rgba(35, 42, 61, 0.12);
  --sight-veil: linear-gradient(90deg, transparent 55%, rgba(250, 249, 245, 0.55) 88%, var(--panel) 100%);
  --sight-floor: linear-gradient(180deg, transparent 35%, rgba(15, 20, 32, 0.35) 70%, var(--panel) 100%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b101a; --panel: #121827; --panel-soft: #192134;
    --rule: #26304a; --rule-strong: #394668;
    --ink: #e7e4d8; --ink-muted: #b6b8c8; --ink-subtle: #9298b0; --ink-ghost: #7d8299;
    --marian: #8fb0e8; --marian-deep: #a9c2ee;
    --gold: #d8ba6a; --gold-deep: #b39440; --alert: #e2a3a3;
    --field-focus: rgba(143, 176, 232, 0.35); --shadow: rgba(0, 0, 0, 0.45);
    --sight-veil: linear-gradient(90deg, transparent 50%, rgba(18, 24, 39, 0.55) 82%, var(--panel) 100%);
    --sight-floor: linear-gradient(180deg, transparent 30%, rgba(11, 16, 26, 0.55) 68%, var(--panel) 100%);
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b101a; --panel: #121827; --panel-soft: #192134;
  --rule: #26304a; --rule-strong: #394668;
  --ink: #e7e4d8; --ink-muted: #b6b8c8; --ink-subtle: #9298b0; --ink-ghost: #7d8299;
  --marian: #8fb0e8; --marian-deep: #a9c2ee;
  --gold: #d8ba6a; --gold-deep: #b39440; --alert: #e2a3a3;
  --field-focus: rgba(143, 176, 232, 0.35); --shadow: rgba(0, 0, 0, 0.45);
  --sight-veil: linear-gradient(90deg, transparent 50%, rgba(18, 24, 39, 0.55) 82%, var(--panel) 100%);
  --sight-floor: linear-gradient(180deg, transparent 30%, rgba(11, 16, 26, 0.55) 68%, var(--panel) 100%);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f5; --panel: #ffffff; --panel-soft: #f3f2ec;
  --rule: #e2e1d8; --rule-strong: #c6c5b6;
  --ink: #232a3d; --ink-muted: #46506a; --ink-subtle: #6a718a; --ink-ghost: #6b7085;
  --marian: #27447e; --marian-deep: #1b3160;
  --gold: #a8862f; --gold-deep: #7d6420; --alert: #8c1515;
  --field-focus: rgba(39, 68, 126, 0.28); --shadow: rgba(35, 42, 61, 0.12);
  --sight-veil: linear-gradient(90deg, transparent 55%, rgba(250, 249, 245, 0.55) 88%, var(--panel) 100%);
  --sight-floor: linear-gradient(180deg, transparent 35%, rgba(250, 249, 245, 0.45) 70%, var(--panel) 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
::selection { background: var(--marian); color: #fff; }

html, body {
  background: var(--bg); color: var(--ink);
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 18px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
}
body.door {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}

.stage {
  flex: 1; display: grid; grid-template-columns: 1fr;
  width: 100%; min-height: 100dvh;
}

.sight {
  position: relative; margin: 0;
  min-height: clamp(16rem, 42vh, 24rem);
  overflow: hidden; background: #0a0e16; isolation: isolate;
}
.sight-img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: 44% 38%;
  position: absolute; inset: 0; transform: scale(1.03);
}
.sight::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(ellipse 55% 45% at 42% 38%, rgba(255, 196, 90, 0.18), transparent 70%),
    var(--sight-floor);
}
.sight-cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 1.1rem 1.25rem 1rem;
  font-size: 0.72rem; line-height: 1.45;
  color: rgba(231, 228, 216, 0.78); text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.sight-cap i { font-style: italic; }

.desk {
  display: flex; flex-direction: column; justify-content: center;
  background: var(--panel);
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.25rem, 4vw, 2.75rem) 2rem;
  position: relative;
}
.desk-inner { width: 100%; max-width: 26rem; margin: 0 auto; }

.jmj {
  position: absolute; top: 0.85rem; left: 0; right: 0; z-index: 3;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.64rem; font-weight: 500; letter-spacing: 0.6em;
  font-variant: small-caps; color: rgba(231, 228, 216, 0.72);
  text-align: center; line-height: 1; pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.ident { text-align: center; margin-bottom: 1rem; }
.ident-rose {
  width: 52px; height: 52px; margin: 0 auto 0.7rem;
  display: block; color: var(--gold); opacity: 0.92;
}
.wordmark {
  font-family: "Cinzel", Georgia, serif; font-weight: 700;
  font-size: 0.88rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--marian); line-height: 1.3; margin-bottom: 0.3rem;
}
.wordmark a {
  color: inherit; text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
}
.wordmark a:hover { color: var(--gold-deep); }
.wordmark-sub {
  font-family: "Cinzel", Georgia, serif; font-weight: 500;
  font-size: 0.62rem; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 1.15rem;
}
.rule {
  width: 64px; height: 1px; background: var(--gold);
  margin: 0 auto; position: relative;
}
.rule::after {
  content: "\2720"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); background: var(--panel);
  padding: 0 0.55rem; color: var(--gold); font-size: 0.55rem; line-height: 1;
}

h1 {
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic; font-weight: 400;
  font-size: clamp(1.55rem, 3vw, 2.05rem); line-height: 1.12;
  color: var(--ink); text-align: center;
  margin: 1.1rem 0 0.55rem; letter-spacing: -0.01em;
}
.lede, .arrival {
  font-size: clamp(0.95rem, 1.3vw, 1.05rem); line-height: 1.5;
  color: var(--ink-muted); text-align: center;
  max-width: 28rem; margin: 0 auto 1.1rem;
}
.arrival { text-wrap: pretty; }

form { display: grid; gap: 0.8rem; }
.row label {
  display: block; font-family: "Cinzel", Georgia, serif;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-muted); margin-bottom: 0.28rem;
}
.row input, .row textarea {
  width: 100%; min-height: 44px; padding: 0.65rem 0.8rem;
  border: 1px solid var(--rule); background: var(--panel-soft);
  border-radius: 2px; font-family: inherit; font-size: 1rem; color: var(--ink);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.row textarea::placeholder, .row input::placeholder { color: var(--ink-ghost); opacity: 1; }
.row input:focus, .row textarea:focus {
  outline: none; border-color: var(--gold); background: var(--panel);
  box-shadow: 0 0 0 3px var(--field-focus);
}
.row input.prefilled { border-left: 2px solid var(--gold); }
.row textarea { min-height: 92px; resize: vertical; }
.row.hp { position: absolute; left: -9999px; visibility: hidden; }

button.primary {
  margin-top: 0.2rem; width: 100%; min-height: 48px; appearance: none;
  background: var(--marian); color: #fff; border: 1px solid var(--marian-deep);
  border-radius: 2px; padding: 0.85rem 1.5rem;
  font-family: "Cinzel", Georgia, serif; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase; cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
}
button.primary:hover { background: var(--marian-deep); border-color: var(--gold-deep); }
button.primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--field-focus); }
button.primary[disabled] { cursor: wait; opacity: 0.55; }

/* Dark: ghost CTA like sign-in (filled Marian washes out on the mantle). */
@media (prefers-color-scheme: dark) {
  button.primary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
  button.primary:hover { border-color: var(--gold); color: var(--gold); background: var(--panel-soft); }
}
html[data-theme="dark"] button.primary {
  background: transparent; color: var(--ink); border-color: var(--rule-strong);
}
html[data-theme="dark"] button.primary:hover {
  border-color: var(--gold); color: var(--gold); background: var(--panel-soft);
}
html[data-theme="light"] button.primary {
  background: var(--marian); color: #fff; border-color: var(--marian-deep);
}
html[data-theme="light"] button.primary:hover {
  background: var(--marian-deep); border-color: var(--gold-deep); color: #fff;
}

.reassure {
  font-size: 0.82rem; line-height: 1.5; color: var(--ink-ghost);
  text-align: center; margin-top: 0.15rem;
}
.wire-back { margin: 0.85rem 0 0; font-size: 0.95rem; text-align: center; }
.wire-back a {
  color: var(--gold-deep); text-decoration: none; border-bottom: 1px solid var(--rule);
  display: inline-flex; align-items: center; min-height: 44px;
}
.wire-back a:hover { border-bottom-color: var(--gold); }

.status {
  padding: 0.85rem 0.95rem; border-radius: 2px;
  font-size: 0.95rem; line-height: 1.5; margin-top: 0.85rem; text-align: center;
}
.status.ok {
  background: var(--panel-soft); border: 1px solid var(--rule);
  border-left: 3px solid var(--gold); color: var(--ink); font-style: italic;
}
.status.err {
  background: var(--panel-soft); border: 1px solid var(--rule);
  border-left: 3px solid var(--alert); color: var(--alert);
}
.status a { color: var(--gold-deep); }

.desk-foot {
  margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--rule);
  text-align: center; font-size: 0.75rem; line-height: 1.6; color: var(--ink-ghost);
}
.laudetur {
  display: block; font-size: 0.95rem; line-height: 1.5;
  color: var(--gold-deep); letter-spacing: 0.04em; margin-bottom: 0.55rem;
}
.desk-foot a {
  color: var(--gold-deep); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.15rem;
}
.desk-foot a:hover { color: var(--gold); }
.theme-toggle {
  background: none; border: 0; padding: 0 0.15rem; cursor: pointer;
  font-family: inherit; font-size: inherit; font-style: italic; color: var(--ink-muted);
  display: inline-flex; align-items: center; min-height: 44px;
}
.theme-toggle:hover { color: var(--marian); }
.theme-toggle:focus-visible {
  outline: none; color: var(--marian);
  box-shadow: 0 0 0 3px var(--field-focus); border-radius: 2px;
}
.foot-row {
  margin-top: 0.35rem; display: inline-flex; align-items: center;
  justify-content: center; flex-wrap: wrap; gap: 0.35rem;
}

@media (min-width: 900px) {
  body.door { overflow: hidden; height: 100dvh; }
  .stage {
    grid-template-columns: minmax(0, 1.2fr) minmax(22rem, 0.9fr);
    height: 100dvh; min-height: 0;
  }
  .jmj {
    position: fixed; top: 1rem;
    color: var(--ink-ghost); text-shadow: none;
  }
  .sight {
    min-height: 0; height: 100%; position: relative;
  }
  .sight::after {
    background:
      radial-gradient(ellipse 50% 42% at 40% 36%, rgba(255, 196, 90, 0.22), transparent 68%),
      var(--sight-veil),
      linear-gradient(180deg, rgba(10, 14, 22, 0.18) 0%, transparent 28%, transparent 70%, rgba(10, 14, 22, 0.35) 100%);
  }
  .sight-cap { text-align: left; padding: 1.25rem 1.5rem; max-width: 22rem; }
  .desk {
    height: 100%; min-height: 0; overflow-y: auto;
    padding: clamp(1.25rem, 3.5vh, 2.5rem) clamp(1.5rem, 3vw, 2.75rem);
    box-shadow: -12px 0 40px var(--shadow);
    justify-content: safe center;
  }
  .desk-inner { margin: 0; max-width: 26rem; }
  .desk-foot { margin-top: 1.25rem; padding-top: 1rem; }
}

@keyframes door-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes door-glow {
  from { opacity: 0.65; }
  to { opacity: 1; }
}
@keyframes door-settle {
  from { transform: scale(1.05); }
  to { transform: scale(1.03); }
}

.sight-img { animation: door-settle 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.sight::after { animation: door-glow 2.8s ease-in-out infinite alternate; }
.ident-rose { animation: door-rise 550ms cubic-bezier(0.2, 0.7, 0.2, 1) 60ms both; }
.wordmark { animation: door-rise 550ms cubic-bezier(0.2, 0.7, 0.2, 1) 120ms both; }
.wordmark-sub { animation: door-rise 550ms cubic-bezier(0.2, 0.7, 0.2, 1) 170ms both; }
.rule { animation: door-rise 550ms cubic-bezier(0.2, 0.7, 0.2, 1) 210ms both; }
h1 { animation: door-rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) 260ms both; }
.arrival, .lede { animation: door-rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) 320ms both; }
form { animation: door-rise 600ms cubic-bezier(0.2, 0.7, 0.2, 1) 380ms both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .sight-img { transform: scale(1.01); }
}
