/* Endless Maze — cinematic title screen.
 * Hero painting + live ember/light atmosphere (title-fx.js) + a glowing brass
 * wordmark that resolves through light + the DESCEND ceremony. Loaded after
 * maze.css; overrides the plain title. Reduced-motion freezes to a static
 * torchlit poster. Zero dependencies.
 */

#title-screen {
  background: #050406;
  overflow: hidden;
  /* slower, richer exit than the old 0.7s fade */
  transition: opacity 1s ease, visibility 0s 1s;
}
#title-screen::after { display: none; }            /* replaced by #title-scrim */

/* ---- the hero painting (parallax transform driven by title-fx.js) ---- */
#title-art {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  transform: scale(1.06);
  transform-origin: center 46%;
  z-index: 0;
  will-change: transform, opacity;
  animation: heroIn 1.8s ease 0.1s forwards;
}
@keyframes heroIn { to { opacity: 0.94; } }

/* ---- vignette + center scrim + drifting fog ---- */
#title-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(58% 42% at 50% 47%, rgba(5,4,6,0.62), rgba(5,4,6,0) 72%),
    radial-gradient(125% 95% at 50% 36%, rgba(5,4,6,0) 26%, rgba(5,4,6,0.5) 70%, rgba(5,4,6,0.93) 100%),
    linear-gradient(180deg, rgba(5,4,6,0.66) 0%, rgba(5,4,6,0) 20%, rgba(5,4,6,0) 58%, rgba(5,4,6,0.88) 100%);
}
#title-scrim::before, #title-scrim::after {
  content: ''; position: absolute; inset: -25%;
  background: radial-gradient(38% 50% at 50% 50%, rgba(150,140,180,0.05), rgba(150,140,180,0) 70%);
  mix-blend-mode: screen;
  will-change: transform;
}
#title-scrim::before { animation: fogA 26s linear infinite; }
#title-scrim::after  { animation: fogB 34s linear infinite; opacity: 0.7; }
@keyframes fogA { from { transform: translate3d(-6%, 2%, 0); } 50% { transform: translate3d(7%, -3%, 0); } to { transform: translate3d(-6%, 2%, 0); } }
@keyframes fogB { from { transform: translate3d(5%, -2%, 0); } 50% { transform: translate3d(-7%, 3%, 0); } to { transform: translate3d(5%, -2%, 0); } }

/* ---- the live atmosphere canvas (embers + lantern light), screen-blended ---- */
#title-fx {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
}

.title-inner { position: relative; z-index: 3; padding: 0 22px; }

/* ---- the wordmark: engraved brass, resolves through light ---- */
.title-word {
  display: flex; flex-direction: column; align-items: center;
  margin: 0 0 2px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: clamp(46px, 8.6vw, 132px);
  line-height: 0.9;
  text-transform: uppercase;
}
.title-word span {
  display: block;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fdecc0 0%, #ecc468 32%, #b9882b 62%, #6f4d16 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.85)) drop-shadow(0 0 26px rgba(228,172,84,0.32));
  opacity: 0;
  animation: wordIn 1.5s cubic-bezier(.2,.7,.2,1) 0.45s forwards;
}
.title-word span:nth-child(2) { animation-delay: 0.62s; }
@keyframes wordIn {
  0%   { opacity: 0; letter-spacing: 0.4em;
         filter: blur(16px) brightness(1.7) drop-shadow(0 0 42px rgba(255,222,150,0.6)); }
  55%  { opacity: 1; }
  100% { opacity: 1; letter-spacing: 0.1em;
         filter: blur(0) brightness(1) drop-shadow(0 2px 3px rgba(0,0,0,0.85)) drop-shadow(0 0 26px rgba(228,172,84,0.32)); }
}

/* the maze emblem crowns the wordmark; a terse tagline replaces the old lore */
.title-emblem {
  display: block; width: clamp(38px, 4.4vw, 58px); height: auto;
  margin: 0 auto 12px;
  opacity: 0; transform: translateY(8px);
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.7)) drop-shadow(0 0 14px rgba(228,172,84,0.3));
  animation: riseIn 1.1s ease 0.2s forwards;
}
.title-tag {
  margin: 7px 0 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: clamp(10px, 1.02vw, 13px);
  font-weight: 600;
  letter-spacing: 0.3em;
  line-height: 1.7;
  text-transform: uppercase;
  color: color-mix(in srgb, #e0b44e 62%, #8d8576);
  text-shadow: 0 1px 9px rgba(0,0,0,0.92);
  opacity: 0; animation: riseIn 1.1s ease 1.5s forwards;
}
#onboard { opacity: 0; animation: riseIn 1.1s ease 1.95s forwards; }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.resume-line { text-shadow: 0 1px 10px rgba(0,0,0,0.9); }
.resume-line b { color: #ecc468; }

/* ---- labelled, framed sign-in fields ---- */
.ob-field { display: block; width: 100%; text-align: left; margin-bottom: 13px; }
.ob-label {
  display: block; margin: 0 0 5px 3px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase;
  color: #8a7434;
}
#ob-user, #ob-pass {
  width: 100%;
  background: rgba(8,7,6,0.6);
  border: 1px solid #39394a;
  border-radius: 5px;
  color: var(--parchment);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px; text-align: left;
  padding: 10px 13px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
#ob-user:focus, #ob-pass:focus {
  border-color: #e0b44e;
  background: rgba(13,10,8,0.7);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 0 0 1px rgba(224,180,78,0.28), 0 12px 28px -14px rgba(224,166,78,0.6);
  outline: none;
}
#ob-user::placeholder, #ob-pass::placeholder { color: #5a5446; font-style: italic; }

/* ---- DESCEND / CONTINUE: a heavy brass plaque that warms on hover ---- */
.title-actions button {
  position: relative;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(13px, 1.3vw, 16px);
  letter-spacing: 4px;
  color: #f1dca0;
  background: linear-gradient(180deg, rgba(46,38,24,0.7), rgba(20,16,11,0.7));
  border: 1px solid #7a5e22;
  border-radius: 4px;
  padding: 13px 40px;
  box-shadow: inset 0 1px 0 rgba(255,220,150,0.18), inset 0 -10px 18px rgba(0,0,0,0.5), 0 10px 26px -14px rgba(224,166,78,0.5);
  transition: color 0.2s, border-color 0.2s, box-shadow 0.25s, background 0.25s, transform 0.08s;
}
.title-actions button::after {                 /* an amber glow that breathes on hover */
  content: ''; position: absolute; inset: -2px; border-radius: 5px;
  box-shadow: 0 0 0 0 rgba(228,172,84,0);
  transition: box-shadow 0.3s; pointer-events: none;
}
.title-actions button:hover, .title-actions button:focus-visible {
  color: #fff1cf; border-color: #e0b44e;
  background: linear-gradient(180deg, rgba(60,48,28,0.8), rgba(26,20,13,0.8));
  box-shadow: inset 0 1px 0 rgba(255,230,170,0.28), inset 0 -10px 18px rgba(0,0,0,0.45), 0 14px 34px -12px rgba(228,172,84,0.7);
  outline: none;
}
.title-actions button:hover::after, .title-actions button:focus-visible::after { box-shadow: 0 0 28px 2px rgba(228,172,84,0.35); }
.title-actions button:active { transform: translateY(1px); }
#btn-switch:hover { color: #ecc468; }

/* ---- the DESCEND ceremony: bg lunges forward, the page recedes ---- */
#title-screen.gone #title-art {
  transform: scale(1.2) !important;
  transition: transform 1.05s cubic-bezier(.4,0,.2,1);
  opacity: 0.6;
}
#title-screen.gone .title-inner {
  opacity: 0;
  transform: translateY(-10px) scale(1.03);
  transition: opacity 0.5s ease, transform 0.95s ease;
}

/* ---- reduced motion: a still torchlit poster, no flicker, no rush ---- */
@media (prefers-reduced-motion: reduce) {
  #title-art { animation: none; opacity: 0.94; transform: scale(1.04); }
  #title-scrim::before, #title-scrim::after { animation: none; }
  .title-word span, .title-emblem, .title-tag, #onboard { animation: none; opacity: 1; transform: none; }
  .title-word span { letter-spacing: 0.1em; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.85)) drop-shadow(0 0 22px rgba(228,172,84,0.28)); }
  #title-screen.gone #title-art { transition: opacity 0.4s ease; transform: scale(1.04) !important; }
}

@media (max-width: 560px) {
  .title-word { font-size: clamp(40px, 15vw, 70px); }
  .title-lore { font-size: 12px; }
}
