/* ============================================
   monopole.news — Victorian HUD Stylesheet
   ============================================ */

:root {
  --primary-bg: #0A0A12;
  --secondary-bg: #151520;
  --ornament-gold: #B8860B;
  --accent-gold: #D4AF37;
  --cyan: #00BCD4;
  --deep-violet: #2D1B4E;
  --cream: #F5E6D0;
  --crimson: #8B0000;
  --cell-dark: #0D0D14;

  --hex-clip: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  --spring-ease: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --shake-ease: cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--primary-bg);
  color: var(--cream);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---- CRT Scan Line Overlay ---- */
#scan-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 188, 212, 0.03) 2px,
    rgba(0, 188, 212, 0.03) 3px
  );
}

/* ---- Persistent Header ---- */
.persistent-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  background: rgba(10, 10, 18, 0.92);
  border-bottom: 1px solid rgba(184, 134, 11, 0.3);
  z-index: 1000;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.persistent-header.hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.persistent-header.visible {
  opacity: 1;
  transform: translateY(0);
}

.header-hex-icon {
  flex-shrink: 0;
}

.header-title {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

/* ---- Typography ---- */
h1, .hero-title {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: clamp(3rem, 8vw, 6.5rem);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cream);
  line-height: 1.1;
}

h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  color: var(--cream);
  line-height: 1.3;
}

h3, .hex-headline {
  font-family: 'Jost', sans-serif;
  font-weight: 500;
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cream);
  line-height: 1.3;
}

p {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.72;
  color: var(--cream);
}

/* ---- Hero Section ---- */
.hero-section {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  overflow: hidden;
}

.hero-lattice-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at center, rgba(45, 27, 78, 0.2) 0%, transparent 70%),
    linear-gradient(135deg, var(--primary-bg) 0%, rgba(45, 27, 78, 0.15) 50%, var(--primary-bg) 100%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50vw;
  max-width: 500px;
  aspect-ratio: 600 / 520;
}

.hero-hex-svg {
  position: absolute;
  width: 100%;
  height: 100%;
}

.hero-hex-border {
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
}

.hero-hex-border.animate-in {
  animation: drawHexBorder 1.5s ease-out forwards;
}

@keyframes drawHexBorder {
  to {
    stroke-dashoffset: 0;
  }
}

.hero-hex-fill.animate-in {
  animation: fadeInFill 0.8s ease-out 1.2s forwards;
}

@keyframes fadeInFill {
  to {
    opacity: 1;
  }
}

.hero-title-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.hero-title {
  overflow: hidden;
  white-space: nowrap;
}

.hero-title .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
}

.hero-title .char.visible {
  animation: charReveal 0.3s ease-out forwards;
}

@keyframes charReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: clamp(0.9rem, 1.5vw, 1.2rem);
  letter-spacing: 0.08em;
  color: var(--cyan);
  opacity: 0;
}

.hero-subtitle.visible {
  animation: subtitleReveal 0.5s ease-out forwards;
}

@keyframes subtitleReveal {
  to {
    opacity: 1;
  }
}

.hero-subtitle .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.hex-ornament.animate-in {
  animation: ornamentDraw 0.8s ease-out forwards;
}

@keyframes ornamentDraw {
  to {
    opacity: 1;
  }
}

.targeting-reticle {
  transform-origin: 300px 260px;
}

.targeting-reticle.animate-in {
  animation: reticleReveal 1s ease-out forwards, reticleSpin 50s linear infinite;
}

@keyframes reticleReveal {
  to {
    opacity: 0.7;
  }
}

@keyframes reticleSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Honeycomb Grid ---- */
.honeycomb-row {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 20px 40px;
  flex-wrap: wrap;
}

.honeycomb-row-offset {
  padding-left: calc(140px + 40px);
  padding-right: calc(140px + 40px);
}

.hex-cell {
  position: relative;
  width: 280px;
  height: 320px;
  clip-path: var(--hex-clip);
  background: var(--cell-dark);
  flex-shrink: 0;
  margin: -20px 4px;
  opacity: 0;
  transform: scale(0.85);
  transition: none;
}

.hex-cell.animate-in {
  animation: hexCellEnter 0.7s var(--spring-ease) forwards;
}

@keyframes hexCellEnter {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.hex-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: var(--hex-clip);
  border: 1px solid var(--ornament-gold);
  pointer-events: none;
  z-index: 2;
}

.hex-cell::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60%;
  height: 60%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(0, 188, 212, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hex-cell[data-urgent="true"].animate-in {
  animation: hexCellEnter 0.7s var(--spring-ease) forwards, hexShake 0.3s var(--shake-ease) 0.7s;
}

.hex-cell[data-urgent="true"].shake-flash::before {
  border-color: var(--crimson);
  transition: border-color 0.15s;
}

.hex-cell[data-urgent="true"].shake-done::before {
  border-color: var(--ornament-gold);
  transition: border-color 0.6s ease-out;
}

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

.hex-coord {
  position: absolute;
  top: 12%;
  left: 18%;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.08em;
  color: var(--cyan);
  z-index: 3;
  background: rgba(10, 10, 18, 0.6);
  padding: 2px 6px;
  line-height: 1;
}

.hex-cell-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 30px 40px;
  height: 100%;
  gap: 10px;
  opacity: 0;
}

.hex-cell.animate-in .hex-cell-inner {
  animation: hexContentFade 0.3s ease-out 0.45s forwards;
}

@keyframes hexContentFade {
  to {
    opacity: 1;
  }
}

.hex-headline {
  font-size: clamp(0.8rem, 1.4vw, 1.1rem);
  letter-spacing: 0.12em;
}

.hex-abstract {
  font-size: clamp(0.75rem, 1vw, 0.9rem);
  line-height: 1.5;
  color: rgba(245, 230, 208, 0.75);
}

.hex-corner-ornament {
  position: absolute;
  bottom: 18%;
  right: 22%;
  z-index: 3;
  opacity: 0.5;
}

.hex-cell:hover .hex-corner-ornament path {
  stroke: var(--accent-gold);
  transition: stroke 0.4s ease;
}

/* ---- Hex Cell Hover ---- */
.hex-cell:hover::before {
  border-color: var(--accent-gold);
  transition: border-color 0.3s ease;
}

/* ---- Dispatch Panels ---- */
.dispatch-panel {
  position: relative;
  width: 100%;
  padding: 60px 0 40px;
  background: var(--secondary-bg);
  border-top: none;
  border-bottom: none;
  opacity: 0;
  transform: translateY(20px);
}

.dispatch-panel.animate-in {
  animation: dispatchSlide 0.6s ease-out forwards;
}

@keyframes dispatchSlide {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dispatch-divider-top {
  display: block;
  width: 80%;
  max-width: 700px;
  margin: 0 auto 30px;
  height: 40px;
  opacity: 0;
}

.dispatch-panel.animate-in .dispatch-divider-top {
  animation: dividerDraw 0.6s ease-out 0.1s forwards;
}

@keyframes dividerDraw {
  to {
    opacity: 1;
  }
}

.dispatch-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 32px;
  opacity: 0;
  transform: scale(0.98);
}

.dispatch-panel.animate-in .dispatch-content {
  animation: dispatchContentReveal 0.5s ease-out 0.3s forwards;
}

@keyframes dispatchContentReveal {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.dispatch-label {
  display: block;
  font-family: 'Jost', sans-serif;
  font-weight: 500;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ornament-gold);
  margin-bottom: 16px;
}

.dispatch-headline {
  margin-bottom: 20px;
}

.dispatch-body {
  margin-bottom: 24px;
  color: var(--cream);
}

.dispatch-quote {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.5;
  color: var(--accent-gold);
  border-left: 2px solid var(--ornament-gold);
  padding-left: 20px;
  margin: 24px 0;
}

/* ---- Data Ticker ---- */
.dispatch-ticker {
  width: 100%;
  overflow: hidden;
  margin-top: 30px;
  padding: 8px 0;
  background: rgba(10, 10, 18, 0.5);
  border-top: 1px solid rgba(184, 134, 11, 0.2);
}

.ticker-content {
  display: inline-block;
  white-space: nowrap;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: clamp(0.65rem, 0.9vw, 0.8rem);
  letter-spacing: 0.08em;
  color: var(--cyan);
  animation: tickerScroll 30s linear infinite;
  padding-left: 100%;
}

.dispatch-ticker.paused .ticker-content {
  animation-play-state: paused;
}

@keyframes tickerScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* ---- Terminal Section ---- */
.terminal-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  padding: 60px 20px;
}

.terminal-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60vw;
  max-width: 600px;
  aspect-ratio: 700 / 608;
}

.terminal-hex-svg {
  position: absolute;
  width: 100%;
  height: 100%;
}

#terminal-hex-border {
  transition: fill-opacity 0.1s;
}

.terminal-ornaments {
  transition: opacity 0.3s;
}

.terminal-ornaments path,
.terminal-ornaments circle {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}

.terminal-ornaments.animate-in path,
.terminal-ornaments.animate-in circle {
  animation: ornamentStrokeDraw 2s ease-out forwards;
}

.terminal-ornaments.animate-in {
  opacity: 1 !important;
}

@keyframes ornamentStrokeDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.terminal-text {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20% 15%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
}

.terminal-text.animate-in {
  animation: terminalTextReveal 0.8s ease-out 0.4s forwards;
}

@keyframes terminalTextReveal {
  to {
    opacity: 1;
  }
}

.terminal-headline {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  font-size: clamp(1.8rem, 4vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cream);
}

.terminal-body {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.9rem, 1.3vw, 1.15rem);
  line-height: 1.72;
  color: rgba(245, 230, 208, 0.85);
}

.terminal-signature {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-top: 8px;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .hero-content {
    width: 60vw;
    max-width: 420px;
  }

  .hex-cell {
    width: 220px;
    height: 252px;
  }

  .hex-cell-inner {
    padding: 50px 22px 35px;
  }

  .honeycomb-row-offset {
    padding-left: calc(110px + 30px);
    padding-right: calc(110px + 30px);
  }
}

@media (max-width: 768px) {
  .hero-content {
    width: 70vw;
    max-width: 350px;
  }

  .honeycomb-row,
  .honeycomb-row-offset {
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
  }

  .honeycomb-row-offset {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hex-cell {
    width: 280px;
    height: 320px;
    margin: -15px 0;
  }

  .terminal-content {
    width: 80vw;
    max-width: 500px;
  }
}

@media (max-width: 480px) {
  .hero-content {
    width: 85vw;
    max-width: none;
  }

  .hex-cell {
    width: 90vw;
    height: calc(90vw * 1.14);
    margin: -10px 0;
  }

  .hex-cell-inner {
    padding: 22% 12% 15%;
  }

  .terminal-content {
    width: 90vw;
    max-width: none;
  }

  .dispatch-quote {
    font-size: clamp(1.1rem, 4vw, 1.4rem);
  }
}
