/* ═══════════════════════════════════════════════════
   CMQXXI / ARCHIVE — CSS DESIGN SYSTEM
   Visuals for the Playable Memory World
   ═══════════════════════════════════════════════════ */

:root {
  --bg-black: #000000;
  --text-cream: #F0EDE8;
  --text-muted: rgba(240, 237, 232, 0.4);
  --text-dim: rgba(240, 237, 232, 0.2);
  --orange-accent: #FF4F00;
  --orange-glow: rgba(255, 79, 0, 0.25);
  --border-thin: rgba(255, 255, 255, 0.06);
  --font-family: 'Space Grotesk', sans-serif;
  --ease-cinematic: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body.archive-body {
  background: var(--bg-black);
  color: var(--text-cream);
  font-family: var(--font-family);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ─── Atmospheric Preloader ─── */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg-black);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 2s var(--ease-cinematic), visibility 2s var(--ease-cinematic);
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-point {
  width: 6px;
  height: 6px;
  background: var(--orange-accent);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--orange-accent);
  animation: breathing 2s infinite ease-in-out;
}

.preloader-text {
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 300;
}

@keyframes breathing {
  0%, 100% { transform: scale(0.8); opacity: 0.3; filter: blur(1px); }
  50% { transform: scale(1.5); opacity: 1; filter: blur(0); }
}

/* ─── Header Navigation ─── */
.archive-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 6rem;
  padding: 0 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  pointer-events: none;
}

.archive-logo {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-cream);
  text-decoration: none;
  font-weight: 400;
  pointer-events: auto;
  transition: color 0.3s;
}
.archive-logo:hover {
  color: #ffffff;
}

.orange-txt {
  color: var(--orange-accent);
  font-weight: 500;
  text-shadow: 0 0 8px var(--orange-glow);
}

.header-controls {
  display: flex;
  gap: 1.5rem;
  pointer-events: auto;
}

.control-btn {
  background: none;
  border: 1px solid var(--border-thin);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s;
}
.control-btn:hover {
  border-color: var(--orange-accent);
  color: var(--orange-accent);
  box-shadow: 0 0 10px var(--orange-glow);
}

/* ─── Flashlight Mask Layer ─── */
#flashlight-mask {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: var(--bg-black);
  transition: background 1s ease;
}

/* When flashlight is active, punch a transparent hole where the cursor is */
#flashlight-mask.flashlight-active {
  background: radial-gradient(
    circle 360px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    transparent 0%,
    rgba(0, 0, 0, 0.4) 30%,
    rgba(0, 0, 0, 0.94) 75%,
    var(--bg-black) 100%
  );
}

/* Bright Light Beam Core Overlay */
#flashlight-glow {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: radial-gradient(
    circle 360px at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255, 79, 0, 0.18) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
  mix-blend-mode: screen;
  will-change: background;
}

/* ─── World Viewport & Strip ─── */
#world-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: grab;
}
#world-viewport:active {
  cursor: grabbing;
}

#world-strip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 11500px; /* Large space to fit all landscapes */
  will-change: transform;
}

/* Landscapes background architecture */
.landscape-section {
  position: absolute;
  top: 0;
  height: 100%;
  border-left: 1px solid var(--border-thin);
  display: flex;
  align-items: flex-end;
  padding-bottom: 5rem;
  padding-left: 2.5rem;
}

.landscape-label {
  font-size: 0.65rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 300;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: color 0.4s;
}

.landscape-line {
  position: absolute;
  bottom: 4rem;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--border-thin), transparent);
}

/* ─── Memory Object Node ─── */
.memory-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
}

.object-graphic {
  width: 140px;
  height: 140px;
  color: var(--text-muted);
  transition: all 0.5s var(--ease-cinematic);
  transform: scale(0.9);
  will-change: transform, color, filter;
}

.object-graphic svg {
  width: 100%;
  height: 100%;
  display: block;
}

.node-year {
  margin-top: 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  font-weight: 400;
  transition: all 0.4s;
  opacity: 0;
  transform: translateY(5px);
}

/* ─── Floating Navigation Guide ─── */
#scroll-guide {
  position: fixed;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-thin);
  border-radius: 30px;
  padding: 0.8rem 1.6rem;
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s var(--ease-cinematic), visibility 1s var(--ease-cinematic);
  pointer-events: none;
}

#scroll-guide.scroll-guide-visible {
  opacity: 1;
  visibility: visible;
}

.guide-text {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-cream);
  font-weight: 300;
}

.guide-arrow {
  color: var(--orange-accent);
  font-size: 0.85rem;
  animation: arrow-bounce 1.5s infinite ease-in-out;
}

.guide-mouse-icon {
  width: 14px;
  height: 22px;
  border: 1.5px solid var(--text-muted);
  border-radius: 8px;
  position: relative;
}

.mouse-wheel {
  width: 2px;
  height: 5px;
  background: var(--orange-accent);
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  border-radius: 1px;
  animation: mouse-scroll 1.5s infinite ease-in-out;
}

@keyframes arrow-bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@keyframes mouse-scroll {
  0% { top: 3px; opacity: 0; }
  30% { opacity: 1; }
  100% { top: 9px; opacity: 0; }
}

/* ─── Mycelium Connection Lines ─── */
.mycelium-trace {
  stroke: var(--orange-accent);
  stroke-width: 1.5px;
  stroke-dasharray: 6 3;
  opacity: 0.35;
  filter: drop-shadow(0 0 5px var(--orange-glow));
  transition: stroke 0.3s, opacity 0.3s, filter 0.3s;
}

.mycelium-trace-glow {
  stroke: var(--orange-accent);
  stroke-width: 6px;
  opacity: 0.12;
  filter: blur(4px);
}

/* Glow on proximity/hover */
.memory-node:hover .object-graphic,
.memory-node.near-light .object-graphic {
  color: var(--orange-accent);
  filter: drop-shadow(0 0 12px var(--orange-glow));
  transform: scale(1.08) translateY(-3px);
}

.memory-node:hover .node-year,
.memory-node.near-light .node-year {
  opacity: 1;
  transform: translateY(0);
  color: var(--text-cream);
}

/* ─── Terminal Checkpoint ─── */
#terminal-checkpoint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  max-width: 450px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  padding-left: 2rem;
}

#terminal-checkpoint h2 {
  font-size: 1.8rem;
  font-weight: 200;
  letter-spacing: 0.15em;
  line-height: 1.2;
}

#terminal-checkpoint p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
  font-weight: 300;
}

.terminal-ctas {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-top: 1rem;
}

.back-link {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}
.back-link:hover {
  color: #ffffff;
}

/* ─── Overlays & Modals ─── */
.overlay-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease-cinematic), visibility 0.6s var(--ease-cinematic);
  backdrop-filter: blur(15px);
}

.overlay-modal.active {
  opacity: 1;
  visibility: visible;
}

.overlay-close {
  position: absolute;
  top: 2.5rem;
  right: 3rem;
  font-size: 2.2rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.3s, transform 0.3s;
  z-index: 1100;
}
.overlay-close:hover {
  color: var(--orange-accent);
  transform: rotate(90deg);
}

/* Help Content styling */
.help-content {
  max-width: 550px;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  border: 1px solid var(--border-thin);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.8);
}

.help-content h3 {
  font-size: 1rem;
  letter-spacing: 0.25em;
  color: var(--orange-accent);
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.help-list li {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-cream);
  font-weight: 300;
  position: relative;
  padding-left: 1.5rem;
}
.help-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--orange-accent);
}

/* Buttons */
.orange-btn {
  background: var(--orange-accent);
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.9rem 2.2rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.orange-btn:hover {
  background: #ff6a22;
  box-shadow: 0 0 20px var(--orange-glow);
  transform: translateY(-1px);
}

/* ─── Cinematic Fullscreen Memory Layout ─── */
.modal-body {
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4rem;
  align-items: center;
}

.modal-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-thin);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.modal-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-media iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.2rem;
}

.modal-year {
  font-size: 2.2rem;
  font-weight: 200;
  letter-spacing: 0.05em;
  color: var(--orange-accent);
}

.modal-landscape {
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal-title {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
}

.modal-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-cream);
  font-weight: 300;
  opacity: 0.85;
  margin-bottom: 1.5rem;
}

.close-cta {
  background: none;
  border: 1px solid var(--border-thin);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
}
.close-cta:hover {
  border-color: #ffffff;
  color: #ffffff;
}

/* Responsive modal rules */
@media (max-width: 900px) {
  .modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1.2fr 1fr;
    gap: 2rem;
    height: 90vh;
    padding-top: 4rem;
  }
  .modal-media {
    height: 40vh;
  }
  .modal-details {
    gap: 0.8rem;
  }
  .modal-year {
    font-size: 1.6rem;
  }
  .modal-title {
    font-size: 1.4rem;
  }
  .modal-desc {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }
  .archive-header {
    padding: 0 1.5rem;
    height: 5rem;
  }
  .overlay-close {
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.8rem;
  }
}
