@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=JetBrains+Mono:wght@300;400&display=swap');

/* =====================
   TOKENS
   ===================== */
:root {
  --bg-deep: #101010;
  --text-primary: #c8c0b0;
  --text-dim: #5a5549;
  --text-faint: #3a4550;
  --text-ghost: #222830;
  --accent: #8b7355;
  --accent-dim: #3d3228;
  --scaffold-color: #2a2520;
  --scaffold-highlight: #3d3632;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg-deep); overflow-x: hidden; }
body { background: var(--bg-deep); color: var(--text-primary); font-family: 'Cormorant Garamond', serif; overflow-x: hidden; }
::selection { background: var(--accent-dim); color: var(--text-primary); }
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--scaffold-highlight); }

/* =====================
   ENTRY
   ===================== */
#entry { height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; z-index: 10; }
#entry h1 { font-weight: 600; font-size: clamp(1.2rem, 3vw, 2rem); letter-spacing: 0.4em; text-transform: uppercase; color: var(--text-dim); transition: color 2s ease; }
#entry:hover h1 { color: var(--text-primary); }
#entry .subtitle { font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; color: var(--text-faint); letter-spacing: 0.2em; margin-top: 1.5rem; transition: color 4s ease; }
#entry:hover .subtitle { color: var(--text-dim); }
#descend-btn:hover { color: var(--accent) !important; }
.scroll-hint { position: absolute; bottom: 3rem; font-family: 'JetBrains Mono', monospace; font-size: 0.55rem; color: var(--text-faint); letter-spacing: 0.15em; animation: pulse 4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.4; } }

/* =====================
   PARALLAX
   ===================== */
.parallax-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#layer-bg { z-index: 1; }
#layer-mid { z-index: 2; }
#layer-fg { z-index: 3; }
.parallax-element { position: absolute; opacity: 0; transition: opacity 0.8s ease; }
.parallax-element.visible { opacity: 1; }
#layer-bg .parallax-element { filter: blur(2px); }
#layer-bg .parallax-element.visible { opacity: 0.7; }
#layer-mid .parallax-element { filter: none; }
#layer-mid .parallax-element.visible { opacity: 1; }
#layer-fg .parallax-element { filter: blur(1px); }
#layer-fg .parallax-element.visible { opacity: 0.9; }
.scaffold-beam { background: var(--scaffold-color); border: 1px solid var(--scaffold-highlight); }
.scaffold-beam.vertical { width: 3px; } .scaffold-beam.horizontal { height: 2px; } .scaffold-beam.diagonal { width: 2px; transform-origin: top left; }
.rope { width: 1px; border-left: 1px dashed var(--scaffold-highlight); }
.odd-little-man { width: 12px; height: 20px; position: relative; }
.odd-little-man::before { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--scaffold-highlight); margin: 0 auto; }
.odd-little-man::after { content: ''; display: block; width: 4px; height: 12px; background: var(--scaffold-highlight); margin: 2px auto 0; border-radius: 1px; }
.odd-little-man.with-hat::before { box-shadow: 0 -4px 0 0 var(--scaffold-highlight); }

/* =====================
   SHAFT
   ===================== */
#shaft { position: relative; width: 100%; z-index: 5; }
.shaft-void { height: 50vh; } .shaft-void.short { height: 25vh; } .shaft-void.deep { height: 80vh; }
.floor-marker { width: 100%; display: flex; justify-content: center; padding: 1rem 0; }
.floor-number { font-family: 'JetBrains Mono', monospace; font-size: 0.45rem; color: var(--text-faint); letter-spacing: 0.3em; }

/* =====================
   COLLECTION PLATFORMS
   ===================== */
.collection-platform {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 2rem;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.collection-platform.revealed { opacity: 1; transform: translateY(0); }

.platform-exterior {
  padding: 3rem 0;
  border-left: 2px solid transparent;
  padding-left: 1.5rem;
  transition: border-color 0.6s ease;
}

.collection-platform.canon .platform-exterior { border-left-color: var(--accent-dim); }
.collection-platform.construction .platform-exterior { border-left-color: var(--text-faint); }

.platform-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.45rem;
  letter-spacing: 0.15em;
  margin-bottom: 0.8rem;
  display: block;
  text-transform: uppercase;
}

.collection-platform.canon .platform-status { display: none; }
.collection-platform.construction .platform-status { color: var(--text-faint); }

.platform-image {
  max-width: 280px;
  margin-bottom: 1.5rem;
  opacity: 0.85;
  transform-origin: left bottom;
  transition: opacity 0.15s ease, transform 0.15s ease;
  will-change: opacity, transform;
  display: block;
  position: relative;
  z-index: 1;
}
.collection-platform.construction .platform-image { opacity: 0.4; }

.platform-title {
  font-weight: 600;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  margin-bottom: 0.8rem;
  transition: color 0.4s ease;
  position: relative;
  z-index: 2;
  background: var(--bg-deep);
  padding-top: 0.5rem;
}

.collection-platform.canon .platform-title { color: var(--text-primary); }
.collection-platform.construction .platform-title { color: var(--text-dim); font-weight: 600; }

.platform-excerpt {
  font-weight: 600;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.8;
  max-width: 500px;
  margin-bottom: 1rem;
}

.collection-platform.canon .platform-excerpt { color: var(--text-dim); }
.collection-platform.construction .platform-excerpt { color: var(--text-faint); }

.platform-description {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.9;
  max-width: 500px;
  color: var(--text-dim);
  opacity: 0.8;
  margin-bottom: 1rem;
}

.platform-links { margin-top: 1rem; }
.platform-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-decoration: none;
  margin-right: 2rem;
  transition: color 0.4s ease;
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 0.2rem;
}

.platform-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Divider line after collection header before its stories */
.collection-divider {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 1px;
}

.collection-divider::after {
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: var(--accent-dim);
  margin-left: 1.5rem;
}

/* =====================
   STORY DOORS
   ===================== */
.story-door { max-width: 640px; margin: 0 auto; padding: 0 2rem; opacity: 0; transform: translateY(15px); transition: opacity 1s ease, transform 1s ease; }
.story-door.revealed { opacity: 1; transform: translateY(0); }
.door-exterior { padding: 2.5rem 0; cursor: pointer; border-left: 1px solid transparent; padding-left: 1.5rem; transition: border-color 0.6s ease; }
.door-status { font-family: 'JetBrains Mono', monospace; font-size: 0.45rem; letter-spacing: 0.15em; margin-bottom: 0.5rem; display: block; }
.door-title { font-weight: 600; font-size: clamp(1.3rem, 2.2vw, 1.7rem); letter-spacing: 0.05em; margin-bottom: 0.6rem; transition: color 0.4s ease; }
.door-excerpt { font-weight: 600; font-size: 0.95rem; font-style: italic; line-height: 1.8; max-width: 500px; }
.door-note { font-family: 'JetBrains Mono', monospace; font-size: 0.45rem; letter-spacing: 0.1em; margin-top: 0.8rem; font-style: italic; }
.door-toggle { font-family: 'JetBrains Mono', monospace; font-size: 0.5rem; color: var(--text-dim); letter-spacing: 0.2em; margin-top: 1rem; transition: color 0.4s ease; display: block; }
.door-exterior:hover .door-toggle { color: var(--accent); }
.door-image { max-width: 100%; margin-bottom: 1.5rem; opacity: 0.8; transform-origin: left bottom; transition: opacity 0.15s ease, transform 0.15s ease; will-change: opacity, transform; position: relative; z-index: 1; }
.door-title { position: relative; z-index: 2; background: var(--bg-deep); }
.door-links { margin-top: 1.2rem; }
.door-links a { font-family: 'JetBrains Mono', monospace; font-size: 0.5rem; color: var(--text-dim); letter-spacing: 0.15em; text-decoration: none; margin-right: 1.5rem; transition: color 0.4s ease; }
.door-links a:hover { color: var(--accent); }

.story-door.canon .door-status { display: none; }
.story-door.canon .door-title { color: var(--text-primary); }
.story-door.canon .door-excerpt { color: var(--text-dim); }
.story-door.canon .door-note { display: none; }
.story-door.canon .door-exterior:hover { border-left-color: var(--accent); }
.story-door.construction .door-status { color: var(--text-faint); }
.story-door.construction .door-title { color: var(--text-dim); font-weight: 300; }
.story-door.construction .door-excerpt { color: var(--text-faint); }
.story-door.construction .door-exterior:hover { border-left-color: var(--text-faint); }
.story-door.apocrypha .door-status { color: #6b4a3a; }
.story-door.apocrypha .door-title { color: var(--text-dim); font-weight: 300; font-style: italic; }
.story-door.apocrypha .door-excerpt { color: var(--text-dim); }
.story-door.apocrypha .door-note { color: #6b4a3a; font-style: italic; }
.story-door.apocrypha .door-exterior:hover { border-left-color: #6b4a3a; }
.story-door.apocrypha .door-exterior:hover .door-title { color: var(--text-primary); }
.story-door.apocrypha .door-exterior:hover .door-excerpt { color: var(--text-dim); }

.door-interior { max-height: 0; overflow: hidden; transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease; opacity: 0; }
.story-door.open .door-interior { max-height: 80000px; opacity: 1; }
.story-door.open .door-toggle { display: none; }
.story-content { padding: 2rem 0 3rem 0; border-left: 1px solid var(--accent-dim); padding-left: 1.5rem; }
.story-door.construction.open .story-content { border-left-color: var(--text-faint); }
.story-door.apocrypha.open .story-content { border-left-color: #6b4a3a; }
.story-content p { font-weight: 300; font-size: 1.05rem; line-height: 2; color: var(--text-primary); opacity: 0.85; margin-bottom: 1.4em; }
.story-content em { color: var(--accent); }
.story-content .section-break { text-align: center; color: var(--text-faint); font-size: 0.8rem; padding: 1.5rem 0; letter-spacing: 0.5em; }
.door-close { font-family: 'JetBrains Mono', monospace; font-size: 0.5rem; color: var(--text-faint); letter-spacing: 0.2em; cursor: pointer; padding: 1rem 0; transition: color 0.4s ease; }
.door-close:hover { color: var(--text-dim); }

/* =====================
   THE VOID
   ===================== */
#the-void { position: relative; z-index: 5; }
.void-infinity { text-align: center; padding: 3rem; cursor: pointer; }
.void-infinity span { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; color: var(--text-dim); letter-spacing: 0.3em; transition: color 0.6s ease; }
.void-infinity:hover span { color: var(--accent); }
.void-infinity.dropped { cursor: default; }
.void-infinity.dropped span { font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; color: var(--text-faint); letter-spacing: 0.2em; }
.void-shaft { height: 0; transition: height 3s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; }
.void-shaft.dropped { height: 10000vh; }
.tavern-door { text-align: center; padding: 4rem 2rem; opacity: 0; margin-bottom: 100px; transition: opacity 3s ease; }
.tavern-door.visible { opacity: 1; }
.tavern-door a { border: 2px solid; padding: 10px; font-family: 'Cormorant Garamond', serif; font-weight: 400; font-style: italic; font-size: 1.2rem; color: var(--text-dim); text-decoration: none; letter-spacing: 0.15em; transition: color 1s ease; }
.tavern-door a:hover { color: var(--accent); border-color: var(--accent); }

/* =====================
   FIXED UI
   ===================== */
#ascend { position: fixed; left: 2rem; bottom: 2rem; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-dim); cursor: pointer; z-index: 100; opacity: 0; transition: opacity 0.6s ease, color 0.4s ease; pointer-events: none; }
#ascend.visible { opacity: 1; pointer-events: auto; }
#ascend:hover { color: var(--accent); }
#depth-counter { position: fixed; right: 2rem; bottom: 2rem; font-family: 'JetBrains Mono', monospace; font-size: 0.55rem; color: var(--text-faint); z-index: 100; letter-spacing: 0.1em; transition: color 2s ease; }
#depth-counter.deep { color: var(--text-dim); } #depth-counter.deeper { color: var(--accent-dim); }
.invisible-text { color: var(--bg-deep); font-size: 0.5rem; user-select: text; position: absolute; font-family: 'JetBrains Mono', monospace; }

/* =====================
   MIDNIGHT / MOBILE
   ===================== */
body.midnight { --text-primary: #b0a898; --accent: #6b5a45; --text-faint: #2a3540; }
body.midnight #entry h1 { text-shadow: 0 0 40px rgba(139, 115, 85, 0.08); }

@media (max-width: 768px) {
  .story-door, .collection-platform { padding-left: 1.5rem; padding-right: 1.5rem; }
  #depth-counter { right: 1rem; bottom: 1rem; font-size: 0.6rem; }
  #ascend { left: 1rem; bottom: 1rem; font-size: 0.8rem; }
  .platform-image { max-width: 200px; }

  /* Bump text sizes for mobile readability */
  .door-title { font-size: 1.4rem; }
  .door-excerpt { font-size: 1rem; }
  .door-status { font-size: 0.55rem; }
  .door-toggle { font-size: 0.6rem; }
  .door-note { font-size: 0.55rem; }
  .door-close { font-size: 0.6rem; }
  .door-links a { font-size: 0.6rem; }
  .story-content p { font-size: 1.1rem; line-height: 1.9; }
  .platform-title { font-size: 1.6rem; }
  .platform-excerpt { font-size: 1.05rem; }
  .platform-description { font-size: 1rem; }
  .platform-links a { font-size: 0.6rem; }
  .platform-status { font-size: 0.55rem; }
  .collection-title { font-size: 0.6rem; }
  .floor-number { font-size: 0.5rem; }
  .void-infinity span { font-size: 1.8rem; }
  .tavern-door a { font-size: 1.3rem; }
  .scroll-hint { font-size: 0.65rem; }

  /* Brighten colors for mobile screens which tend to be dimmer */
  :root {
    --text-dim: #7a7569;
    --text-faint: #4a5560;
  }
}
