:root {
  color-scheme: dark;
  --void: #060608;
  --silver: #d7d7df;
  --muted: #6a6674;
  --violet: #8b7bff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  overflow: hidden;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: #060608;
  background: radial-gradient(120% 95% at 50% 30%, #14111c 0%, #0c0b12 30%, #07070a 64%, #040405 100%);
}
button, textarea { font: inherit; }

.stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3.2vh, 46px);
  cursor: default;
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.6'/></svg>");
  opacity: 0.04;
  mix-blend-mode: screen;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(78% 64% at 50% 40%, transparent 38%, rgba(3, 3, 4, 0.6) 100%);
}
.halo {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: min(50vw, 720px);
  height: 46vh;
  pointer-events: none;
  background: radial-gradient(50% 50% at 50% 30%, oklch(0.72 0.07 305 / 0.16) 0%, oklch(0.6 0.05 305 / 0.05) 42%, transparent 72%);
  filter: blur(6px);
  animation: halo 9s ease-in-out infinite;
  transition: top 1200ms cubic-bezier(.2,.8,.2,1), opacity 900ms ease;
}
.threshold-light {
  position: absolute;
  left: 50%;
  bottom: 17vh;
  width: min(62vw, 760px);
  height: 1px;
  transform: translateX(-50%) scaleX(0.72);
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(215, 215, 223, 0.44), transparent);
  box-shadow: 0 0 28px rgba(215, 215, 223, 0.11), 0 0 70px rgba(139, 123, 255, 0.07);
  opacity: 0;
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(.2,.8,.2,1), bottom 1100ms cubic-bezier(.2,.8,.2,1);
}
.door {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3.2vh, 46px);
  transition: transform 1200ms cubic-bezier(.2,.8,.2,1), opacity 900ms ease;
}
.lockup { position: relative; width: min(88vw, 124vh); aspect-ratio: 1170 / 587; }
.lockup img { position: absolute; display: block; filter: drop-shadow(0 8px 34px oklch(0.7 0.08 305 / 0.18)); }
.head { left: 31.6%; top: 0; width: 35.9%; }
.word { left: 0; top: 38.7%; width: 100%; }
.shine {
  position: absolute;
  left: 0;
  top: 38.7%;
  width: 100%;
  aspect-ratio: 1170 / 360;
  pointer-events: none;
  -webkit-mask: url("/daemonhall-wordmark.png") center / 100% 100% no-repeat;
  mask: url("/daemonhall-wordmark.png") center / 100% 100% no-repeat;
  background: linear-gradient(100deg, transparent 42%, rgba(255,255,255,0) 47%, rgba(244,238,255,.55) 50%, rgba(255,255,255,0) 53%, transparent 58%);
  background-size: 300% 100%;
  background-position: 135% 0;
  mix-blend-mode: screen;
  animation: shine 15s ease-in-out infinite;
}
.status {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  font-size: clamp(10px, 1.05vw, 15px);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #6a6674;
  white-space: nowrap;
  padding-left: 0.42em;
  transition: opacity 650ms ease, transform 850ms cubic-bezier(.2,.8,.2,1);
}
.dot {
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  flex: 0 0 auto;
  background: oklch(0.78 0.09 305);
  box-shadow: 0 0 12px oklch(0.78 0.12 305 / 0.6);
  animation: breathe 4.5s ease-in-out infinite;
}
.status .sep { color: #3a3742; }
.status .closed { color: #56525f; }

.threshold,
.whisper {
  position: absolute;
  z-index: 2;
  left: 50%;
  width: min(76vw, 760px);
  pointer-events: none;
}
.threshold {
  bottom: clamp(70px, 12vh, 126px);
  transform: translate(-50%, 22px);
  opacity: 0;
  transition: opacity 760ms ease 520ms, transform 1000ms cubic-bezier(.2,.8,.2,1) 520ms;
}
.terminal-shell {
  position: relative;
  padding: clamp(16px, 2.2vw, 24px) 0 0;
  border-top: 1px solid rgba(215, 215, 223, 0.34);
  color: var(--silver);
  text-align: center;
}
.terminal-shell::before,
.terminal-shell::after {
  content: "";
  position: absolute;
  top: -1px;
  width: 16%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 123, 255, 0.62));
  opacity: 0.7;
}
.terminal-shell::before { left: 0; }
.terminal-shell::after { right: 0; transform: scaleX(-1); }
.terminal-kicker {
  margin-bottom: clamp(18px, 2.8vh, 32px);
  color: #5c5862;
  font-size: clamp(9px, 0.85vw, 11px);
  letter-spacing: 0.46em;
  text-transform: uppercase;
  padding-left: 0.46em;
}
.terminal-lines {
  min-height: 7.4em;
  color: #aaa6b0;
  font-size: clamp(13px, 1.45vw, 19px);
  letter-spacing: 0.18em;
  line-height: 2.08;
  text-transform: lowercase;
}
.terminal-lines p { opacity: 0; transform: translateY(6px); }

.whisper {
  bottom: clamp(58px, 9vh, 92px);
  transform: translate(-50%, 18px);
  opacity: 0;
  transition: opacity 760ms ease, transform 980ms cubic-bezier(.2,.8,.2,1);
}
.whisper-label {
  margin-bottom: clamp(14px, 2.4vh, 24px);
  color: #74707b;
  text-align: center;
  font-size: clamp(10px, 0.95vw, 12px);
  letter-spacing: 0.22em;
  text-transform: lowercase;
}
.whisper-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: end;
  gap: 16px;
  border-bottom: 1px solid rgba(215, 215, 223, 0.38);
}
textarea {
  width: 100%;
  min-height: 38px;
  max-height: 28vh;
  resize: none;
  overflow: hidden;
  border: 0;
  outline: 0;
  padding: 0 0 12px;
  background: transparent;
  color: #d7d7df;
  font-size: clamp(13px, 1.45vw, 18px);
  line-height: 1.45;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}
textarea::placeholder { color: rgba(138, 138, 150, 0.74); }
.mic-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #928e98;
  width: 32px;
  height: 38px;
  display: grid;
  place-items: start center;
  padding: 0 0 12px;
  cursor: pointer;
  transition: color 160ms ease, transform 160ms ease;
}
.mic-button:hover,
.mic-button.listening { color: #d7d7df; }
.mic-button:active { transform: translateY(1px); }
.mic-icon {
  width: 11px;
  height: 17px;
  border: 1.3px solid currentColor;
  border-radius: 999px;
  position: relative;
  display: block;
  margin-top: 1px;
}
.mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 17px;
  height: 9px;
  translate: -50% 0;
  border: 1.3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  opacity: 0.78;
}
.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 1.3px;
  height: 5px;
  translate: -50% 0;
  background: currentColor;
  opacity: 0.78;
}
.whisper-status {
  margin-top: clamp(18px, 2.8vh, 28px);
  color: #8f8a96;
  text-align: center;
  font-size: clamp(10px, 0.92vw, 12px);
  line-height: 1.7;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}
.continue-button {
  display: block;
  margin: clamp(18px, 3vh, 30px) auto 0;
  appearance: none;
  border: 0;
  border-bottom: 1px solid rgba(139, 123, 255, 0.52);
  background: transparent;
  color: #817b8e;
  padding: 0 0 8px 0.18em;
  font-size: clamp(10px, 0.9vw, 12px);
  letter-spacing: 0.18em;
  text-transform: lowercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease, color 160ms ease, border-color 160ms ease;
}
.continue-button.ready { opacity: 1; pointer-events: auto; }
.continue-button:hover { color: #d7d7df; border-color: rgba(215,215,223,0.7); }

.stage[data-loop="threshold"] .door,
.stage[data-loop="whisper"] .door { transform: translateY(clamp(-150px, -19vh, -84px)) scale(0.74); }
.stage[data-loop="threshold"] .status,
.stage[data-loop="whisper"] .status { opacity: 0; transform: translateY(12px); }
.stage[data-loop="threshold"] .halo,
.stage[data-loop="whisper"] .halo { top: 6%; opacity: 0.68; }
.stage[data-loop="threshold"] .threshold-light,
.stage[data-loop="whisper"] .threshold-light {
  opacity: 1;
  bottom: clamp(188px, 28vh, 260px);
  transform: translateX(-50%) scaleX(1);
}
.stage[data-loop="threshold"] .threshold,
.stage[data-loop="whisper"] .threshold { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.stage[data-loop="whisper"] .threshold { opacity: 0.28; transform: translate(-50%, -92px); transition-delay: 0ms; }
.stage[data-loop="threshold"] .terminal-lines p[data-line="1"],
.stage[data-loop="whisper"] .terminal-lines p[data-line="1"] { animation: lineIn 520ms ease 980ms forwards; }
.stage[data-loop="threshold"] .terminal-lines p[data-line="2"],
.stage[data-loop="whisper"] .terminal-lines p[data-line="2"] { animation: lineIn 520ms ease 1620ms forwards; }
.stage[data-loop="threshold"] .terminal-lines p[data-line="3"],
.stage[data-loop="whisper"] .terminal-lines p[data-line="3"] { animation: lineIn 520ms ease 2260ms forwards; }
.stage[data-loop="whisper"] .whisper { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; transition-delay: 260ms; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@keyframes shine { 0% { background-position: 140% 0; } 58% { background-position: -40% 0; } 100% { background-position: -40% 0; } }
@keyframes halo { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes breathe { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes lineIn { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .shine, .halo, .dot, .terminal-lines p { animation: none !important; }
  * { transition-duration: 1ms !important; }
  .terminal-lines p { opacity: 1; transform: none; }
}
@media (max-width: 760px) {
  .lockup { width: min(112vw, 72vh); }
  .threshold, .whisper { width: calc(100vw - 42px); }
  .threshold { bottom: 70px; }
  .stage[data-loop="threshold"] .door,
  .stage[data-loop="whisper"] .door { transform: translateY(-24vh) scale(0.58); }
  .stage[data-loop="threshold"] .threshold-light,
  .stage[data-loop="whisper"] .threshold-light { bottom: 230px; }
  .stage[data-loop="whisper"] .threshold { transform: translate(-50%, -84px); }
  .terminal-lines { font-size: 12px; letter-spacing: 0.12em; }
  .terminal-kicker { letter-spacing: 0.34em; }
  textarea { font-size: 13px; letter-spacing: 0.04em; }
  .whisper-label, .whisper-status, .continue-button { font-size: 10px; letter-spacing: 0.08em; }
}

.daemon-gallery {
  position: absolute;
  z-index: 3;
  inset: auto clamp(14px, 3vw, 42px) clamp(18px, 3vh, 42px);
  max-height: min(54vh, 620px);
  overflow: auto;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid rgba(231, 215, 255, 0.14);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(10, 8, 15, 0.72), rgba(2, 2, 3, 0.88)),
    radial-gradient(80% 120% at 50% 0%, rgba(185, 145, 255, 0.11), transparent 62%);
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 244, 255, 0.06);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity 720ms ease 2850ms, transform 900ms cubic-bezier(.2,.8,.2,1) 2850ms;
  scrollbar-width: thin;
  scrollbar-color: rgba(231, 215, 255, 0.28) transparent;
}

.stage[data-loop="threshold"] .daemon-gallery {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.gallery-head {
  display: grid;
  gap: 8px;
  margin: 0 auto clamp(18px, 2.4vw, 30px);
  max-width: 780px;
  text-align: center;
}

.gallery-head h2 {
  color: #f7efff;
  font-size: clamp(18px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(231, 215, 255, 0.18);
}

.gallery-head p:last-child {
  color: #7b7488;
  font-size: clamp(10px, 1.25vw, 13px);
  letter-spacing: 0.16em;
  line-height: 1.7;
  text-transform: lowercase;
}

.daemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(14px, 1.8vw, 24px);
}

.daemon-card {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(231, 215, 255, 0.11);
  border-radius: 20px;
  background: radial-gradient(70% 70% at 50% 34%, rgba(185, 145, 255, 0.13), rgba(2, 2, 3, 0.54) 68%);
  overflow: hidden;
  transform: translateZ(0);
}

.daemon-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 42px rgba(2, 2, 3, 0.92);
  z-index: 2;
}

.daemon-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #020203;
}

.daemon-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: contrast(1.08) saturate(0.82) drop-shadow(0 0 22px rgba(231, 215, 255, 0.14));
  transition: transform 700ms cubic-bezier(.2,.8,.2,1), filter 700ms ease;
}

.daemon-card:hover .daemon-frame img {
  transform: scale(1.045);
  filter: contrast(1.18) saturate(0.92) drop-shadow(0 0 34px rgba(231, 215, 255, 0.26));
}

.daemon-static {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 244, 255, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 35%, rgba(255, 244, 255, 0.12), transparent 46%);
  background-size: 100% 7px, 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.34;
}

.daemon-label {
  display: grid;
  gap: 5px;
  padding: 12px 12px 14px;
  min-height: 86px;
  color: #8f879e;
  font-size: 9px;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-transform: uppercase;
}

.daemon-label strong {
  color: #fff4ff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.gallery-error {
  grid-column: 1 / -1;
  color: #b991ff;
  text-align: center;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  body { overflow: auto; }
  .stage { min-height: 100%; }
  .stage[data-loop="threshold"] .door {
    transform: translateY(-31vh) scale(0.48);
  }
  .stage[data-loop="threshold"] .threshold {
    opacity: 0;
    pointer-events: none;
  }
  .daemon-gallery {
    position: absolute;
    top: 28vh;
    bottom: 12px;
    left: 10px;
    right: 10px;
    max-height: none;
    border-radius: 20px;
    padding: 14px;
  }
  .daemon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .daemon-label {
    min-height: 78px;
    padding: 10px;
    font-size: 8px;
  }
}
