/* =========================================
   NEO DOMINION // LOG SYSTEM v3.1
   Refined, modular, cinematic
========================================= */

:root {
  /* Core palette */
  --bg: #020308;
  --bg-elevated: rgba(8, 12, 18, 0.78);
  --panel: rgba(5, 7, 12, 0.92);
  --panel-border: rgba(0, 245, 255, 0.2);
  --ink: #d7f7ff;
  --ink-soft: rgba(215, 247, 255, 0.78);
  --white-soft: rgba(255, 255, 255, 0.9);

  /* Neon accents */
  --neon-cyan: #00f5ff;
  --neon-purple: #b300ff;
  --neon-red: #ff2a6d;
  --neon-warn: #ffcc00;
  --neon-lilac: #c77dff;
  --neon-otis: #ffd6f7;

  /* Shared effects */
  --scanline: rgba(18, 16, 16, 0.15);
  --glass: blur(8px);
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 18px;

  --shadow-cyan-sm: 0 0 8px rgba(0, 245, 255, 0.22);
  --shadow-cyan-md: 0 0 16px rgba(0, 245, 255, 0.18);
  --shadow-red-sm: 0 0 8px rgba(255, 42, 109, 0.28);
  --shadow-purple-sm: 0 0 8px rgba(179, 0, 255, 0.28);

  --crt-glow:
    0 0 15px rgba(0, 245, 255, 0.15),
    0 0 30px rgba(0, 245, 255, 0.05);

  --shell-shadow:
    0 0 24px rgba(0, 245, 255, 0.08),
    0 0 60px rgba(0, 0, 0, 0.35),
    inset 0 0 60px rgba(0, 0, 0, 0.7);

  --transition-fast: 180ms ease;
  --transition-med: 320ms ease;
  --transition-slow: 600ms cubic-bezier(0.2, 0.8, 0.2, 1);

  --content-width: 850px;
  --body-padding: clamp(14px, 3vw, 40px);
  --shell-padding: clamp(22px, 4vw, 60px);

  /* Speaker tokens */
  --speaker-starscream: var(--neon-red);
  --speaker-megatron: var(--neon-purple);
  --speaker-otis: var(--neon-otis);
  --speaker-skywarp: #d5a6ff;
  --speaker-thundercracker: var(--neon-cyan);
  --speaker-human: var(--neon-warn);
  --speaker-offliner: var(--neon-warn);
  --speaker-soundwave: var(--neon-cyan);
  --speaker-shockwave: #d6a3ff;
  --speaker-optimus: #4da3ff;
  --speaker-elita: #ff6fb5;
  --speaker-steve: #7ae7ff;
}

/* -------------------------
   RESET / BASE
------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: var(--body-padding);
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(2, 3, 8, 0.85), rgba(2, 3, 8, 0.95)),
    url("/NeoDominion/images/3155.jpg") center / cover no-repeat fixed;
  font-family: "JetBrains Mono", "Share Tech Mono", monospace;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-cyan) var(--bg);
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--neon-cyan);
  color: #000;
  text-shadow: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(0, 245, 255, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 245, 255, 0.75);
}

/* -------------------------
   ACCESSIBILITY
------------------------- */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 10000;
  padding: 0.65rem 0.9rem;
  border-radius: 4px;
  background: var(--neon-cyan);
  color: #000;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* -------------------------
   ATMOSPHERE LAYERS
------------------------- */
.terminal-overlay,
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.55;
  background:
    linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0,
      rgba(255, 255, 255, 0) 50%,
      rgba(0, 0, 0, 0.2) 50%,
      rgba(0, 0, 0, 0.2) 100%
    );
  background-size: 100% 4px;
  animation: scanline-scroll 0.55s linear infinite;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 245, 255, 0.06), transparent 30%),
    radial-gradient(circle at 80% 25%, rgba(179, 0, 255, 0.05), transparent 28%),
    radial-gradient(circle at 50% 85%, rgba(255, 42, 109, 0.05), transparent 30%);
}

/* -------------------------
   MAIN SHELL
------------------------- */
.log-shell {
  position: relative;
  isolation: isolate;
  width: min(100%, var(--content-width));
  margin: 40px auto;
  padding: var(--shell-padding);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.015),
      rgba(255, 255, 255, 0)
    ),
    var(--panel);
  box-shadow: var(--shell-shadow);
  backdrop-filter: var(--glass);
}

.log-shell::before,
.log-shell::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid var(--neon-cyan);
  opacity: 0.9;
  transition:
    width var(--transition-med),
    height var(--transition-med),
    opacity var(--transition-med);
}

.log-shell::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.log-shell::after {
  right: -1px;
  bottom: -1px;
  border-top: 0;
  border-left: 0;
}

.log-shell:hover::before,
.log-shell:hover::after {
  width: 100%;
  height: 100%;
  opacity: 0.08;
}

/* -------------------------
   HEADER / METADATA
------------------------- */
.log-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 245, 255, 0.16);
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.file-path,
.timestamp {
  margin: 0.3rem 0;
  opacity: 0.9;
}

.highlight {
  color: var(--neon-cyan);
  text-shadow: var(--shadow-cyan-sm);
}

.status-badge,
.open {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-sm);
  color: #000;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.25);
  font-weight: 700;
}

.blink-cursor,
.blink {
  animation: alert-pulse 1.1s steps(2, start) infinite;
}

/* -------------------------
   HEADINGS / STRUCTURE
------------------------- */
.log-content h1 {
  position: relative;
  display: inline-block;
  margin: 0 0 40px;
  color: var(--ink);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-shadow:
    2px 0 var(--neon-cyan),
    -2px 0 var(--neon-red),
    0 0 18px rgba(255, 255, 255, 0.06);
}

.entry-marker {
  margin-bottom: 1.2rem;
  color: var(--neon-cyan);
  font-family: "Orbitron", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
}

.chapter-stamp {
  margin: 2rem 0 2.5rem;
  color: var(--white-soft);
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
}

/* -------------------------
   BODY COPY / NARRATIVE
------------------------- */
.terminal-text p {
  margin: 0 0 1.5em;
  opacity: 0.92;
}

.character-name {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.15);
}

.location {
  color: var(--neon-cyan);
  text-shadow: 0 0 6px rgba(0, 245, 255, 0.25);
}

/* -------------------------
   DIALOGUE SYSTEM
------------------------- */
blockquote.dialogue {
  --dialogue-accent: rgba(255, 255, 255, 0.4);
  --dialogue-text: var(--ink);

  position: relative;
  margin: 30px 0;
  padding: 16px 22px 16px 24px;
  border-left: 3px solid var(--dialogue-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0.015) 30%,
      rgba(0, 0, 0, 0) 100%
    );
  color: var(--dialogue-text);
  will-change: opacity, transform;
  transition:
    transform var(--transition-med),
    box-shadow var(--transition-med),
    border-color var(--transition-med),
    background var(--transition-med);
}

blockquote.dialogue:hover {
  transform: translateX(3px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    0 0 0 1px rgba(255, 255, 255, 0.02);
}

blockquote.dialogue:focus-visible {
  outline: 2px solid var(--dialogue-accent);
  outline-offset: 4px;
}

.speaker-id {
  display: block;
  margin-bottom: 8px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--dialogue-accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--dialogue-accent) 45%, transparent);
  opacity: 0.95;
}

/* Dialogue variants */
.mimic {
  border-left-style: dashed;
  font-style: italic;
  opacity: 0.82;
}

.dialogue.urgent {
  animation: urgent-flicker 0.8s linear 2;
}

/* Speaker mapping */
.dialogue.starscream {
  --dialogue-accent: var(--speaker-starscream);
  --dialogue-text: #ffe0e0;
}

.dialogue.megatron {
  --dialogue-accent: var(--speaker-megatron);
  --dialogue-text: #f3e0ff;
}

.dialogue.otis {
  --dialogue-accent: var(--speaker-otis);
  --dialogue-text: #ffd6f7;
}

.dialogue.sky,
.dialogue.skywarp {
  --dialogue-accent: var(--speaker-skywarp);
  --dialogue-text: #ecd9ff;
}

.dialogue.thundercracker,
.dialogue.thundercracker-awakening {
  --dialogue-accent: var(--speaker-thundercracker);
  --dialogue-text: #dffbff;
}

.dialogue.skywarp-awakening {
  --dialogue-accent: var(--neon-lilac);
  --dialogue-text: #f0e0ff;
}

.dialogue.human,
.dialogue.offliner {
  --dialogue-accent: var(--speaker-human);
  --dialogue-text: #fff3c4;
}

.dialogue.soundwave {
  --dialogue-accent: var(--speaker-soundwave);
  --dialogue-text: #d7f7ff;
}

.dialogue.shockwave {
  --dialogue-accent: var(--speaker-shockwave);
  --dialogue-text: #eddcff;
}

.dialogue.optimus {
  --dialogue-accent: var(--speaker-optimus);
  --dialogue-text: #e3f1ff;
}

.dialogue.elita {
  --dialogue-accent: var(--speaker-elita);
  --dialogue-text: #ffe3f1;
}

.dialogue.steve {
  --dialogue-accent: var(--speaker-steve);
  --dialogue-text: #e4fbff;
}

/* -------------------------
   INLINE / EMPHASIS
------------------------- */
.accent-violet {
  color: var(--neon-purple);
  text-shadow: 0 0 5px var(--neon-purple);
}

.accent-red {
  color: var(--neon-red);
  text-shadow: 0 0 5px var(--neon-red);
}

.accent-blue {
  color: var(--neon-cyan);
  text-shadow: 0 0 5px var(--neon-cyan);
}

.vehicle {
  color: var(--neon-warn);
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.organization {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 3px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.alert {
  color: var(--neon-warn);
  font-weight: 700;
  animation: alert-pulse 2s infinite;
}

.mutter-text {
  display: inline-block;
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.6;
}

/* -------------------------
   STORY BEATS
------------------------- */
.micro-beat {
  margin: 0.8rem 0;
  font-style: italic;
  opacity: 0.8;
}

.action-beat {
  margin: 1.8rem 0;
  color: var(--neon-red);
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 42, 109, 0.28);
}

.awareness-line {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.trine-line {
  margin: 2rem 0 1rem;
  color: var(--neon-red);
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.12em;
  text-shadow: 0 0 10px rgba(255, 42, 109, 0.35);
}

.destiny-line {
  text-align: center;
  font-style: italic;
  opacity: 0.82;
  letter-spacing: 0.04em;
}

/* -------------------------
   SCENE BREAKS / FX
------------------------- */
.system-break {
  margin: 40px 0;
  color: rgba(0, 245, 255, 0.3);
  text-align: center;
  font-weight: 700;
  letter-spacing: 10px;
  text-shadow: 0 0 5px rgba(0, 245, 255, 0.2);
}

.sound-effect {
  margin: 30px 0;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 5px;
}

.flashback-hook {
  margin-top: 50px;
  color: var(--ink-soft);
  text-align: center;
  font-style: italic;
  opacity: 0.72;
  cursor: default;
  transition:
    color 1.2s ease,
    letter-spacing 1.2s ease,
    text-shadow 1.2s ease,
    opacity 1.2s ease;
}

.flashback-hook:hover {
  color: #deb887;
  letter-spacing: 3px;
  text-shadow: 0 0 10px #deb887;
}

/* -------------------------
   FOOTER / NAV
------------------------- */
.log-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 245, 255, 0.18);
}

.file-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.2rem;
  font-size: 0.85rem;
}

.nav-link {
  color: var(--neon-cyan);
  text-decoration: none;
  letter-spacing: 0.08em;
  opacity: 0.9;
  transition:
    opacity var(--transition-fast),
    text-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.nav-link:hover,
.nav-link:focus-visible {
  opacity: 1;
  transform: translateX(2px);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.35);
}

.locked-tag {
  color: var(--neon-warn);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.next-file {
  opacity: 0.85;
}

/* -------------------------
   OTIS WIDGET
------------------------- */
.otis-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.otis-bubble {
  max-width: 200px;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(0, 245, 255, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(5, 7, 12, 0.92);
  color: var(--ink);
  box-shadow: var(--crt-glow);
  font-size: 0.75rem;
  text-align: center;
}

#otis {
  width: 72px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(0, 245, 255, 0.18));
  transition:
    transform var(--transition-fast),
    filter var(--transition-fast);
}

#otis:hover {
  transform: translateY(-2px) scale(1.02);
}

/* -------------------------
   ACTIVE / VISIBLE STATES
------------------------- */
.awareness-line,
.trine-line,
.flashback-hook,
.dialogue,
.action-beat,
.sound-effect {
  transition:
    opacity var(--transition-med),
    transform var(--transition-med),
    text-shadow var(--transition-med),
    box-shadow var(--transition-med),
    filter var(--transition-med);
}

.awareness-line,
.trine-line,
.flashback-hook {
  opacity: 0.65;
}

.visible-beat {
  opacity: 1;
  transform: translateX(2px);
}

.awareness-line.visible-beat {
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.3),
    0 0 18px rgba(255, 255, 255, 0.12);
}

.trine-line.visible-beat {
  text-shadow:
    0 0 18px rgba(255, 60, 120, 0.35),
    0 0 30px rgba(255, 60, 120, 0.18);
}

.flashback-hook.visible-beat {
  letter-spacing: 0.08em;
}

.dialogue.active,
.dialogue.visible-beat {
  transform: translateX(4px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 18px rgba(255, 255, 255, 0.02);
}

.dialogue.active {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--dialogue-accent) 12%, transparent) 0%,
      rgba(255, 255, 255, 0.02) 38%,
      rgba(0, 0, 0, 0) 100%
    );
}

/* -------------------------
   BODY MOOD STATES
------------------------- */
.memory-flare .log-shell {
  box-shadow:
    0 0 24px rgba(255, 42, 109, 0.25),
    0 0 40px rgba(179, 0, 255, 0.12),
    inset 0 0 70px rgba(255, 42, 109, 0.08);
  transition: box-shadow 0.35s ease;
}

.power-surge .log-shell {
  box-shadow:
    0 0 24px rgba(0, 245, 255, 0.22),
    0 0 42px rgba(255, 42, 109, 0.16),
    inset 0 0 80px rgba(255, 255, 255, 0.04);
  transition: box-shadow 0.35s ease;
}

.name-reveal {
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.2),
    0 0 18px rgba(255, 42, 109, 0.16);
}

.impact-pulse {
  animation: impact-pulse 0.6s ease;
}

/* Speaker mood wash */
body.speaker-starscream .log-shell {
  border-color: rgba(255, 42, 109, 0.28);
}

body.speaker-megatron .log-shell {
  border-color: rgba(179, 0, 255, 0.28);
}

body.speaker-otis .log-shell {
  border-color: rgba(255, 214, 247, 0.28);
}

body.speaker-thundercracker .log-shell,
body.speaker-soundwave .log-shell,
body.speaker-shockwave .log-shell {
  border-color: rgba(0, 245, 255, 0.22);
}

body.speaker-skywarp .log-shell {
  border-color: rgba(199, 125, 255, 0.28);
}

body.speaker-offliner .log-shell,
body.speaker-human .log-shell {
  border-color: rgba(255, 204, 0, 0.24);
}

body.speaker-optimus .log-shell {
  border-color: rgba(77, 163, 255, 0.24);
}

body.speaker-elita .log-shell {
  border-color: rgba(255, 111, 181, 0.24);
}

body.speaker-steve .log-shell {
  border-color: rgba(122, 231, 255, 0.2);
}

/* -------------------------
   KEYFRAMES
------------------------- */
@keyframes scanline-scroll {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 100%;
  }
}

@keyframes alert-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes urgent-flicker {
  0%,
  100% {
    opacity: 1;
  }
  20% {
    opacity: 0.55;
  }
  40% {
    opacity: 1;
  }
  60% {
    opacity: 0.65;
  }
  80% {
    opacity: 1;
  }
}

@keyframes impact-pulse {
  0% {
    transform: scale(0.98);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.03);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* -------------------------
   REDUCED MOTION
------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .terminal-overlay,
  .scanlines {
    animation: none;
    opacity: 0.18;
  }
}

/* -------------------------
   MOBILE
------------------------- */
@media (max-width: 700px) {
  .log-shell {
    margin: 20px auto;
  }

  .log-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .file-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .sound-effect,
  .trine-line {
    letter-spacing: 0.08em;
  }

  blockquote.dialogue {
    padding: 14px 16px 14px 18px;
  }

  .otis-container {
    right: 12px;
    bottom: 12px;
  }

  #otis {
    width: 60px;
  }

  .otis-bubble {
    max-width: 160px;
  }
}