/* STAR TREK — CHRONOLOGICAL ARCHIVE Design System */

:root {
  --space-black: #020712;
  --deep-blue: #071B33;
  --warp-blue: #1B8CFF;
  --light-blue: #7FD6FF;
  --tech-white: #F3F7FA;
  --amber: #FF9B3D;
  --alert-red: #C94A3C;
  --box-bg: rgba(2, 7, 18, 0.65);
  --box-blur: 18px;
  --box-border: 1px rgba(127, 214, 255, 0.25);
  --box-border-hover: 1px rgba(127, 214, 255, 0.5);
  
  --font-title: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-tech: 'Space Grotesk', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset and Core Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--space-black);
  color: var(--tech-white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--space-black);
}
::-webkit-scrollbar-thumb {
  background: rgba(27, 140, 255, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--warp-blue);
}

/* Base Typographies */
h1, h2, h3, h4, h5 {
  font-family: var(--font-title);
  letter-spacing: 0.1em;
}

.text-tech {
  font-family: var(--font-tech);
  letter-spacing: 0.05em;
}

/* Scanning Line Overlay for HUD Effect */
.hud-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 4px, 6px 100%;
  opacity: 0.45;
}

/* Immersive Space Noise */
.space-noise {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Container Sticky styles */
.canvas-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  overflow: hidden;
  background-color: var(--space-black);
}

.canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.5s ease;
}

/* Background overlay gradient for canvas to ensure legibility */
.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(2, 7, 18, 0.1) 0%, rgba(2, 7, 18, 0.6) 80%, rgba(2, 7, 18, 0.95) 100%);
  pointer-events: none;
  z-index: 2;
}

/* Global Content Container layout */
.content-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
}

/* Layout cards and sections */
.section-full {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.section-full-timeline {
  min-height: 120vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10vh 8%;
  position: relative;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .section-full-timeline {
    padding: 10vh 5%;
    justify-content: center;
  }
}

/* HUD Glass Box */
.hud-box {
  background: var(--box-bg);
  backdrop-filter: blur(var(--box-blur));
  -webkit-backdrop-filter: blur(var(--box-blur));
  border: var(--box-border);
  border-radius: 6px;
  padding: 2.2rem;
  max-width: 580px;
  width: 100%;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hud-box:hover {
  border: var(--box-border-hover);
  box-shadow: 0 20px 45px rgba(27, 140, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Left Accent Line */
.hud-box::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 15%;
  height: 70%;
  width: 3px;
  background-color: var(--warp-blue);
  box-shadow: 0 0 10px var(--warp-blue);
  border-radius: 3px;
  transition: all 0.4s ease;
}

.hud-box:hover::before {
  height: 85%;
  top: 7.5%;
  background-color: var(--light-blue);
  box-shadow: 0 0 15px var(--light-blue);
}

/* Red Altered reality border for Kelvin Timeline */
.hud-box.kelvin-box {
  border: 1px rgba(201, 74, 60, 0.25);
}
.hud-box.kelvin-box:hover {
  border: 1px rgba(201, 74, 60, 0.5);
  box-shadow: 0 20px 45px rgba(201, 74, 60, 0.15);
}
.hud-box.kelvin-box::before {
  background-color: var(--alert-red);
  box-shadow: 0 0 10px var(--alert-red);
}
.hud-box.kelvin-box:hover::before {
  background-color: #ff5e4d;
  box-shadow: 0 0 15px #ff5e4d;
}

/* Tech Microcopy */
.hud-metadata {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--light-blue);
  opacity: 0.8;
  margin-bottom: 1.2rem;
  text-transform: uppercase;
}

.hud-metadata-red {
  color: #ff8e82;
}

.hud-era-number {
  color: var(--amber);
  font-weight: 700;
}

.hud-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tech-white);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hud-period {
  display: inline-block;
  font-family: var(--font-tech);
  font-size: 0.85rem;
  color: var(--amber);
  margin-bottom: 1rem;
  border-bottom: 1px dashed rgba(255, 155, 61, 0.3);
  padding-bottom: 0.2rem;
}

.hud-text {
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(243, 247, 250, 0.85);
  margin-bottom: 0px;
}

/* Animations for Fade-in Slide-in Scroll */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(5px);
  transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease;
}

.reveal-on-scroll.active {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Loading HUD Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  background-color: var(--space-black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
}

.loading-overlay.loaded {
  opacity: 0;
  visibility: hidden;
}

.loading-hud {
  max-width: 450px;
  width: 90%;
  border: 1px rgba(27, 140, 255, 0.2);
  border-radius: 4px;
  padding: 2rem;
  background: rgba(7, 27, 51, 0.4);
  backdrop-filter: blur(10px);
  text-align: center;
}

.loading-bar-container {
  width: 100%;
  height: 2px;
  background: rgba(27, 140, 255, 0.1);
  margin: 1.5rem 0;
  overflow: hidden;
  position: relative;
}

.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--warp-blue), var(--light-blue));
  box-shadow: 0 0 8px var(--light-blue);
  width: 0%;
  transition: width 0.1s ease;
}

/* Technical Details and Grid Lines inside boxes */
.hud-corner-tl, .hud-corner-tr, .hud-corner-bl, .hud-corner-br {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--light-blue);
  border-style: solid;
  opacity: 0.4;
  pointer-events: none;
}
.hud-corner-tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.hud-corner-tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.hud-corner-bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.hud-corner-br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.kelvin-box .hud-corner-tl, .kelvin-box .hud-corner-tr, .kelvin-box .hud-corner-bl, .kelvin-box .hud-corner-br {
  border-color: var(--alert-red);
}

/* Blink animations */
@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.blink-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--light-blue);
  margin-right: 8px;
  animation: blink 2s infinite;
}

.blink-dot-red {
  background-color: var(--alert-red);
  box-shadow: 0 0 4px var(--alert-red);
}

/* Reduced Motion fallback */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
