/* ============================================
   HAWKINS — The Gate
   Pure CSS — no frameworks
   ============================================ */

:root {
  --void: #050508;
  --abyss: #0a0a12;
  --fog: #16161f;
  --ash: #b8b8c0;
  --ash-dim: #555560;
  --blood: #8b0000;
  --ember: #cc2200;
  --vine: #1c2a1c;
  --glow: #ffcc44;
  --shadow: rgba(139, 0, 0, 0.8);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--void);
  color: var(--ash);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: 'Special Elite', 'Courier New', monospace;
  min-height: 100vh;
  line-height: 1.5;
}

/* --- Fonts --- */
.font-wall { font-family: 'Special Elite', 'Courier New', monospace; }
.font-title { font-family: 'Cinzel', serif; }
.font-mono-vintage { font-family: 'Cutive Mono', 'Courier New', monospace; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--abyss); }
::-webkit-scrollbar-thumb { background: var(--blood); }

/* ============================================
   BACKDROP & OVERLAYS
   ============================================ */

.world-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(120, 18, 8, 0.3) 0%, transparent 45%),
    linear-gradient(180deg, rgba(2,2,5,0.45) 0%, rgba(5,5,8,0.7) 48%, rgba(2,2,4,0.96) 100%);
  background-position: center top;
  background-size: cover;
  filter: saturate(0.85) contrast(1.1);
}

#ashCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.04;
  mix-blend-mode: overlay;
  animation: noise-flicker 0.15s infinite;
}

@keyframes noise-flicker {
  0% { opacity: 0.03; }
  50% { opacity: 0.06; }
  100% { opacity: 0.03; }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.7) 100%);
}

.mist {
  position: fixed;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 2;
  animation: mist-drift 20s ease-in-out infinite alternate;
}

.mist-1 {
  top: 33%;
  height: 128px;
  background: radial-gradient(ellipse, rgba(30,30,40,0.15), transparent 70%);
}

.mist-2 {
  top: 66%;
  height: 160px;
  background: radial-gradient(ellipse, rgba(20,20,30,0.12), transparent 70%);
  animation-delay: 5s;
}

@keyframes mist-drift {
  0% { transform: translateX(-10%) translateY(0); opacity: 0.15; }
  50% { opacity: 0.08; }
  100% { transform: translateX(10%) translateY(-20px); opacity: 0.15; }
}

/* ============================================
   LAYOUT
   ============================================ */

.section {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 16px;
}

.section-inner {
  width: 100%;
  max-width: 768px;
}

/* ============================================
   HERO
   ============================================ */

.hero-section { text-align: center; }

.site-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--ember);
  text-shadow: 0 0 4px var(--shadow), 0 0 20px rgba(139,0,0,0.4);
  animation: text-glitch 5s infinite;
}

.site-subtitle {
  font-size: clamp(0.7rem, 2vw, 1rem);
  color: var(--ash-dim);
  letter-spacing: 0.4em;
  margin-top: 1rem;
}

@keyframes text-glitch {
  0%, 100% { text-shadow: 0 0 4px var(--shadow), 0 0 20px rgba(139,0,0,0.4); transform: translate(0); }
  20% { text-shadow: -2px 0 rgba(204,34,0,0.7), 2px 0 rgba(0,100,150,0.4); transform: translate(1px,-1px); }
  40% { text-shadow: 2px 0 rgba(204,34,0,0.7), -2px 0 rgba(0,100,150,0.4); transform: translate(-1px,1px); }
  60% { text-shadow: 0 0 4px var(--shadow), 0 0 30px rgba(139,0,0,0.6); transform: translate(0); }
}

.hero-hint {
  font-size: 0.8rem;
  color: #333;
  letter-spacing: 0.2em;
  max-width: 420px;
  margin: 4rem auto 0;
  line-height: 1.8;
}

.scroll-prompt {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: bounce 2s infinite;
}

.scroll-icon { font-size: 1.2rem; color: #333; }
.scroll-text { font-size: 0.7rem; color: #333; letter-spacing: 0.3em; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ============================================
   COUNTDOWN
   ============================================ */

.countdown { text-align: center; margin-top: 3rem; }

.countdown-header {
  font-family: 'Cutive Mono', 'Courier New', monospace;
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  letter-spacing: 0.15em;
  color: var(--ember);
  text-shadow: 0 0 20px var(--shadow), 0 0 40px rgba(139,0,0,0.4), 0 0 80px rgba(139,0,0,0.2);
  margin-bottom: 1.5rem;
  transition: opacity 0.08s;
}

.countdown-header.flickering {
  color: rgba(204,34,0,0.3);
  text-shadow: 0 0 10px rgba(204,34,0,0.3);
}

.countdown-units {
  display: flex;
  gap: clamp(0.5rem, 3vw, 1.5rem);
  align-items: flex-end;
  justify-content: center;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cd-value {
  font-family: 'Cutive Mono', 'Courier New', monospace;
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: bold;
  color: var(--ember);
  text-shadow: 0 0 15px rgba(204,34,0,0.6), 0 0 30px rgba(139,0,0,0.3);
  transition: opacity 0.08s;
  font-variant-numeric: tabular-nums;
}

.cd-value.flickering { opacity: 0.3; }

.cd-label {
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 0.3em;
  margin-top: 0.5rem;
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header { text-align: center; margin-bottom: 3rem; }

.seal-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1rem;
}

.seal-line {
  height: 1px;
  width: 48px;
  background: rgba(139,0,0,0.4);
}

.seal-roman {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 3vw, 1.5rem);
  letter-spacing: 0.3em;
  color: var(--ash-dim);
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: bold;
  letter-spacing: 0.05em;
  color: #aaa;
}

.section-desc {
  font-size: 0.7rem;
  color: #444;
  letter-spacing: 0.1em;
  margin-top: 0.75rem;
}

/* ============================================
   PUZZLE BOX
   ============================================ */

.puzzle-box {
  border: 1px solid rgba(40,40,50,0.5);
  background: rgba(0,0,0,0.35);
  padding: 2.5rem 1.5rem;
  border-radius: 2px;
  animation: pulse-red 4s infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 20px rgba(139,0,0,0.3), inset 0 0 40px rgba(139,0,0,0.1); }
  50% { box-shadow: 0 0 40px rgba(204,34,0,0.5), inset 0 0 60px rgba(139,0,0,0.2); }
}

.puzzle-clue {
  font-size: 0.8rem;
  color: #555;
  letter-spacing: 0.05em;
  max-width: 420px;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.puzzle-status {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #444;
  letter-spacing: 0.2em;
  margin-top: 1.5rem;
  text-align: center;
}

.puzzle-status.success {
  color: var(--glow);
  font-size: 1rem;
  letter-spacing: 0.15em;
  animation: reveal-glow 3s ease-out forwards;
}

.puzzle-status.error {
  color: #8b0000;
  animation: shake 0.5s;
}

@keyframes reveal-glow {
  0% { opacity: 0; text-shadow: 0 0 0 transparent; transform: scale(0.95); }
  50% { opacity: 0.5; }
  100% { opacity: 1; text-shadow: 0 0 20px rgba(204,34,0,0.8), 0 0 60px rgba(139,0,0,0.5); transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ============================================
   ALPHABET WALL
   ============================================ */

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .alphabet-grid { gap: 12px; max-width: 520px; }
}

.alpha-letter {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.9rem, 3vw, 1.25rem);
  border: 1px solid rgba(40,40,50,0.5);
  background: rgba(5,5,10,0.3);
  color: #666;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s;
  opacity: 0.5;
}

.alpha-letter:hover {
  transform: scale(1.15);
  border-color: rgba(139,0,0,0.4);
  color: var(--ember);
}

.alpha-letter.selected {
  border-color: rgba(255,204,68,0.6);
  background: rgba(80,60,10,0.2);
  color: var(--glow);
  text-shadow: 0 0 10px var(--glow), 0 0 20px rgba(255,204,68,0.5);
  opacity: 1;
}

.alpha-letter.solved-target {
  border-color: rgba(255,180,60,0.4);
  background: rgba(60,40,5,0.1);
  opacity: 0.9;
}

.alpha-letter.error-state {
  border-color: rgba(139,0,0,0.3);
  background: rgba(40,0,0,0.1);
  color: #555;
}

.alpha-letter:disabled, .alpha-letter.solved {
  cursor: default;
}

/* ============================================
   WALL SCRAWL
   ============================================ */

.scrawl-text {
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: #aaa;
  letter-spacing: 0.3em;
  text-align: center;
  transform: scaleX(-1);
  text-shadow: 0 0 8px rgba(139,0,0,0.3);
  user-select: none;
  margin: 1rem 0;
}

.puzzle-hint-italic {
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 0.1em;
  font-style: italic;
  text-align: center;
}

.scrawl-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 280px;
  margin: 1.5rem auto 0;
}

.void-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(10,10,18,0.8);
  border: 1px solid rgba(139,0,0,0.3);
  color: var(--ash);
  font-family: 'Cutive Mono', 'Courier New', monospace;
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  border-radius: 2px;
  outline: none;
  transition: all 0.3s;
}

.void-input::placeholder {
  color: rgba(184,184,192,0.2);
  letter-spacing: 0.2em;
}

.void-input:focus {
  border-color: var(--ember);
  box-shadow: 0 0 15px rgba(204,34,0,0.3);
}

.void-input.shake { animation: shake 0.5s; border-color: #aa0000; }

.void-button {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: #666;
  border: 1px solid #333;
  background: transparent;
  padding: 8px 24px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s;
}

.void-button:hover {
  color: var(--glow);
  border-color: rgba(180,120,20,0.5);
}

.void-button:disabled {
  cursor: default;
  opacity: 0.5;
}

/* ============================================
   CIPHER
   ============================================ */

.cipher-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .cipher-grid { gap: 16px; }
}

.cipher-symbol {
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(40,40,50,0.4);
  background: rgba(5,5,10,0.3);
  border-radius: 2px;
  transition: all 0.5s;
  cursor: pointer;
}

@media (min-width: 640px) {
  .cipher-symbol { width: 80px; height: 80px; }
}

.cipher-symbol.shown { opacity: 1; transform: scale(1); }
.cipher-symbol.hidden { opacity: 0; transform: scale(0.5); }

.cipher-symbol.hovered {
  border-color: rgba(170,30,10,0.5);
  background: rgba(40,5,5,0.2);
}

.cipher-symbol.decoded {
  border-color: rgba(200,150,40,0.5);
  background: rgba(60,40,5,0.1);
}

.cipher-glyph {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: #888;
  text-shadow: 0 0 6px rgba(139,0,0,0.3);
  transition: color 0.3s, text-shadow 0.3s;
}

.cipher-glyph.hovered-glyph {
  color: var(--ember);
}

.cipher-glyph.decoded-glyph {
  color: var(--glow);
  text-shadow: 0 0 12px rgba(255,204,68,0.6);
}

.cipher-letter {
  font-size: 0.7rem;
  color: rgba(255,204,68,0.7);
  margin-top: 4px;
}

/* ============================================
   CHRISTMAS LIGHTS
   ============================================ */

.lights-bar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 48px;
  z-index: 50;
  pointer-events: none;
}

.lights-bar svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 40px;
  pointer-events: none;
}

.bulb {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  transform: translateX(-50%);
}

.bulb-body {
  width: 10px;
  height: 14px;
  border-radius: 50% 50% 40% 40%;
  opacity: 0.4;
  transition: all 0.3s;
}

.bulb-body.lit {
  opacity: 1;
  border-radius: 50% 50% 40% 40%;
}

.bulb-base {
  width: 4px;
  height: 4px;
  background: rgba(80,80,90,0.6);
  margin: 0 auto;
  border-radius: 0 0 2px 2px;
}

/* ============================================
   SEAL TRACKER
   ============================================ */

.seal-tracker {
  position: fixed;
  top: 64px;
  left: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seal-tracker-title {
  font-size: 0.65rem;
  color: #333;
  letter-spacing: 0.3em;
}

.seal-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seal-icon {
  font-size: 0.75rem;
  color: #333;
}

.seal-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: #333;
}

.seal-item.unlocked .seal-icon { color: var(--glow); }
.seal-item.unlocked .seal-label { color: #aa6600; }

/* ============================================
   LIGHT INDICATOR
   ============================================ */

.light-indicator {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: 'Cutive Mono', 'Courier New', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.4em;
}

.light-indicator-letters span {
  display: inline-block;
  margin: 0 4px;
  color: #886600;
  transition: all 0.3s;
}

.light-indicator-letters span.complete {
  color: var(--glow);
  text-shadow: 0 0 10px rgba(255,204,68,0.6);
}

.light-whisper {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.65rem;
  color: rgba(200,140,40,0.7);
  letter-spacing: 0.2em;
  font-style: italic;
  animation: fade-in-up 1.2s ease-out forwards;
}

/* ============================================
   FINAL REVEAL
   ============================================ */

.final-locked { text-align: center; max-width: 420px; }
.final-lock-icon { font-size: 2rem; color: #222; margin-bottom: 1rem; }
.final-locked-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.2rem, 4vw, 2.5rem);
  letter-spacing: 0.15em;
  color: #222;
}
.final-locked-text {
  font-size: 0.75rem;
  color: #222;
  letter-spacing: 0.1em;
  margin-top: 1rem;
  line-height: 1.8;
}

.final-reveal { text-align: center; max-width: 560px; padding: 2rem 0; }

.final-stage {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s, transform 1s;
}

.final-stage.visible {
  opacity: 1;
  transform: translateY(0);
}

.final-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--ember);
  background: rgba(10,0,0,0.6);
  border: 1px solid rgba(139,0,0,0.3);
  padding: 1.5rem 2rem;
  border-radius: 2px;
  animation: pulse-red 4s infinite;
}

.final-text {
  font-size: 1.1rem;
  color: #aaa;
  letter-spacing: 0.05em;
  line-height: 1.8;
}

.final-text-italic {
  font-size: 1rem;
  color: #777;
  font-style: italic;
  line-height: 1.8;
}

.final-highlight { color: rgba(255,204,68,0.8); font-style: normal; }

.final-closing {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.2rem, 4vw, 2.5rem);
  letter-spacing: 0.15em;
  color: var(--ember);
  animation: text-glitch 5s infinite;
  padding: 1rem 0;
}

.final-closing-sub {
  font-size: 0.85rem;
  color: #555;
  letter-spacing: 0.1em;
  margin-top: 1rem;
  line-height: 1.8;
}

.final-run {
  font-size: 0.7rem;
  color: #222;
  letter-spacing: 0.4em;
  margin-top: 2rem;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  position: relative;
  z-index: 5;
  padding: 2rem;
  text-align: center;
}

.site-footer p {
  font-size: 0.65rem;
  color: #111;
  letter-spacing: 0.3em;
}

.site-footer p + p { margin-top: 4px; color: #0a0a0a; }

/* ============================================
   ANIMATION HELPERS
   ============================================ */

@keyframes flicker {
  0%,100% { opacity: 1; }
  41% { opacity: 1; } 42% { opacity: 0.3; } 43% { opacity: 1; }
  45% { opacity: 0.4; } 46% { opacity: 1; }
  80% { opacity: 1; } 81% { opacity: 0.2; } 82% { opacity: 1; }
  83% { opacity: 0.6; } 84% { opacity: 1; }
}
.flicker { animation: flicker 4s infinite; }

@keyframes flicker-slow {
  0%,100% { opacity: 0.9; }
  50% { opacity: 0.5; } 55% { opacity: 0.85; }
  56% { opacity: 0.3; } 57% { opacity: 0.9; }
}
.flicker-slow { animation: flicker-slow 6s infinite; }

@keyframes fade-in-up {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fade-in-up 1.2s ease-out forwards; opacity: 0; }
.delay-1 { animation-delay: 0.3s; animation-fill-mode: both; }
.delay-2 { animation-delay: 0.8s; animation-fill-mode: both; }
.delay-3 { animation-delay: 1.5s; animation-fill-mode: both; }

.scroll-hidden { opacity: 0; transform: translateY(40px); transition: opacity 1s ease-out, transform 1s ease-out; }
.scroll-visible { opacity: 1; transform: translateY(0); }

@keyframes bulb-flicker {
  0%,100% { opacity: 1; filter: brightness(1.2); }
  43% { opacity: 1; } 44% { opacity: 0.15; } 45% { opacity: 1; }
  47% { opacity: 0.2; } 48% { opacity: 1; }
  68% { opacity: 1; } 69% { opacity: 0.1; } 70% { opacity: 1; }
  71% { opacity: 0.4; } 72% { opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  .alphabet-grid { gap: 4px; }
  .cipher-grid { gap: 6px; }
  .cipher-symbol { width: 52px; height: 52px; }
  .seal-tracker { top: 58px; left: 8px; }
  .light-indicator { top: 58px; right: 8px; }
  .puzzle-box { padding: 1.5rem 1rem; }
}
