/* =========================================================
   NEO DOMINION — Public Civic Access Terminal
   Corporate dystopia. Neon rot. Civic compliance.
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap");

/* =========================================================
   Reset + Variables
   ========================================================= */

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

:root {
  /* Core colors */
  --bg-deep: #030306;
  --bg-dark: #070009;
  --bg-mid: #120018;
  --bg-panel: rgba(4, 4, 10, 0.78);

  --text-main: #f4f4f6;
  --text-dim: #c9c5d8;
  --text-muted: #858095;

  --neon-red: #ff003c;
  --neon-purple: #7a00ff;
  --neon-blue: #00d9ff;
  --neon-pink: #ff4fd8;
  --warning-yellow: #ffd166;

  --danger: #ff003c;
  --warning: #ffd166;
  --watch: #00d9ff;

  /* Glow */
  --glow-red: rgba(255, 0, 60, 0.45);
  --glow-purple: rgba(122, 0, 255, 0.35);
  --glow-blue: rgba(0, 217, 255, 0.28);

  /* Surfaces */
  --panel-border: rgba(255, 255, 255, 0.2);
  --panel-border-hot: rgba(255, 0, 60, 0.45);
  --glass-highlight: rgba(255, 255, 255, 0.06);

  /* Type */
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", Courier, monospace;

  /* Layout */
  --ticker-height: 2.4rem;
  --radius-sharp: 0;
  --radius-soft: 0.85rem;

  /* Motion */
  --ease-snap: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* =========================================================
   Base Page
   ========================================================= */

html {
  min-height: 100%;
  background: var(--bg-deep);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-main);
  font-family: var(--font-mono);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 0, 60, 0.2), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(0, 217, 255, 0.12), transparent 24%),
    radial-gradient(circle at 50% 40%, rgba(122, 0, 255, 0.34), transparent 44%),
    linear-gradient(135deg, var(--bg-dark), var(--bg-mid) 46%, var(--bg-deep));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  z-index: 0;
  height: 40vh;
  pointer-events: none;
  background: linear-gradient(to top, rgba(255, 0, 60, 0.13), transparent);
}

::selection {
  color: #000;
  background: var(--neon-red);
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* =========================================================
   Accessibility
   ========================================================= */

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 999;
  padding: 0.75rem 1rem;
  background: var(--neon-red);
  color: #000;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--neon-blue);
  outline-offset: 3px;
}

/* =========================================================
   Structural Layout
   ========================================================= */

.terminal {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: clamp(1.25rem, 5vw, 4rem);
  padding-bottom: calc(var(--ticker-height) + clamp(2.5rem, 6vw, 4rem));
}

.landing {
  width: min(1220px, 100%);
  animation: landing-in 0.7s var(--ease-snap) both;
}

@keyframes landing-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    filter: blur(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* =========================================================
   Boot Screen
   ========================================================= */

.boot-screen {
  width: min(760px, 100%);
  color: var(--text-dim);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  line-height: 1.85;
  text-shadow: 0 0 10px var(--glow-purple);
}

.boot-screen::before {
  content: "NEO DOMINION PUBLIC OS v.7.12";
  display: block;
  width: fit-content;
  margin-bottom: 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 0, 60, 0.45);
  color: var(--neon-red);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(255, 0, 60, 0.18);
}

.boot-screen p {
  position: relative;
  margin: 0.25rem 0;
  opacity: 0;
  transform: translateY(3px);
  animation: boot-line 0.35s var(--ease-snap) forwards;
}

.boot-screen p::before {
  content: "> ";
  color: var(--neon-blue);
}

.boot-screen p:nth-child(1) { animation-delay: 0s; }
.boot-screen p:nth-child(2) { animation-delay: 0.35s; }
.boot-screen p:nth-child(3) { animation-delay: 0.7s; }
.boot-screen p:nth-child(4) { animation-delay: 1.05s; }
.boot-screen p:nth-child(5) { animation-delay: 1.4s; }
.boot-screen p:nth-child(6) {
  animation-delay: 1.8s;
  color: var(--text-main);
  text-shadow: 0 0 12px var(--glow-red);
}

@keyframes boot-line {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cursor {
  display: inline-block;
  width: 0.58em;
  height: 1em;
  margin-left: 0.3em;
  background: var(--neon-red);
  vertical-align: -0.14em;
  box-shadow: 0 0 12px var(--neon-red);
  animation: cursor-blink 1s steps(1) infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

/* =========================================================
   Hero Typography
   ========================================================= */

.hero {
  position: relative;
  margin-bottom: clamp(1.4rem, 3vw, 2.4rem);
}

.system-label,
.panel-kicker {
  margin: 0 0 0.7rem;
  color: var(--neon-red);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-shadow: 0 0 12px var(--glow-red);
}

h1 {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 8.8rem);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  text-shadow:
    3px 0 var(--neon-red),
    -3px 0 var(--neon-purple),
    0 0 28px rgba(255, 255, 255, 0.28),
    0 0 48px rgba(255, 0, 60, 0.12);
}

h1::selection {
  background: var(--neon-blue);
}

h1.glitch::before,
h1.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
}

h1.glitch::before {
  color: var(--neon-blue);
  text-shadow: -2px 0 var(--neon-blue);
  animation: glitch-shift-1 2.35s var(--ease-snap) 1;
  mix-blend-mode: screen;
}

h1.glitch::after {
  color: var(--neon-red);
  text-shadow: 2px 0 var(--neon-red);
  animation: glitch-shift-2 2.35s var(--ease-snap) 1;
  mix-blend-mode: screen;
}

@keyframes glitch-shift-1 {
  0% { clip-path: inset(0 0 0 0); transform: translate(0, 0); opacity: 0.95; }
  6% { clip-path: inset(8% 0 62% 0); transform: translate(-7px, -1px); opacity: 0.9; }
  12% { clip-path: inset(72% 0 6% 0); transform: translate(5px, 1px); }
  18% { clip-path: inset(32% 0 42% 0); transform: translate(-4px, 0); }
  26% { clip-path: inset(48% 0 26% 0); transform: translate(8px, 0); }
  34%, 100% { clip-path: inset(0 0 100% 0); transform: translate(0, 0); opacity: 0; }
}

@keyframes glitch-shift-2 {
  0% { clip-path: inset(0 0 0 0); transform: translate(0, 0); opacity: 0.85; }
  8% { clip-path: inset(58% 0 18% 0); transform: translate(6px, 0); }
  15% { clip-path: inset(6% 0 76% 0); transform: translate(-5px, -1px); }
  24% { clip-path: inset(40% 0 28% 0); transform: translate(4px, 1px); }
  31% { clip-path: inset(12% 0 58% 0); transform: translate(-9px, 0); }
  38%, 100% { clip-path: inset(0 0 100% 0); transform: translate(0, 0); opacity: 0; }
}

.slogan {
  max-width: 760px;
  margin: 1rem 0 0;
  color: var(--text-dim);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-style: italic;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
}

.terminal-notice {
  max-width: 800px;
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* =========================================================
   Alert Banner
   ========================================================= */

.alert-banner {
  position: relative;
  width: min(1220px, 100%);
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 0, 60, 0.52);
  background:
    linear-gradient(90deg, rgba(255, 0, 60, 0.14), rgba(0, 0, 0, 0.4)),
    rgba(0, 0, 0, 0.5);
  box-shadow:
    0 0 26px rgba(255, 0, 60, 0.18),
    inset 0 0 22px rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.alert-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 0, 60, 0.18) 0 8px,
    transparent 8px 16px
  );
  opacity: 0.15;
  pointer-events: none;
}

.alert-banner p {
  position: relative;
  margin: 0;
  padding: 0.95rem 1rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.alert-banner strong {
  color: var(--neon-red);
  text-shadow: 0 0 10px var(--glow-red);
}

/* =========================================================
   Dashboard Grid
   ========================================================= */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  width: min(1220px, 100%);
}

.panel {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sharp);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), transparent 38%),
    var(--bg-panel);
  padding: clamp(1rem, 2vw, 1.35rem);
  box-shadow:
    0 0 24px var(--glow-purple),
    inset 0 0 24px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(8px);
  isolation: isolate;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-125%);
  pointer-events: none;
}

.panel::after {
  content: "";
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--neon-red);
  box-shadow: 0 0 12px var(--neon-red);
  opacity: 0.75;
}

.panel:hover::before,
.panel:focus-within::before {
  animation: panel-sweep 1.35s ease;
}

@keyframes panel-sweep {
  to {
    transform: translateX(125%);
  }
}

.panel h2 {
  margin: 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed rgba(255, 0, 60, 0.42);
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel-kicker {
  color: var(--neon-blue);
  font-size: 0.66rem;
  text-shadow: 0 0 10px var(--glow-blue);
}

.transmission {
  width: min(1220px, 100%);
  margin-top: 1.25rem;
  min-height: auto;
}

.transmission p:not(.panel-kicker) {
  max-width: 850px;
  color: var(--text-dim);
  line-height: 1.7;
}

.transmission p:last-child {
  color: var(--neon-red);
  text-shadow: 0 0 10px var(--glow-red);
}

/* =========================================================
   Terminal Lists
   ========================================================= */

.terminal-list,
.panel ul {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
}

.terminal-list li,
.panel li {
  position: relative;
}

.terminal-list li + li,
.panel li + li {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.panel a,
.locked {
  display: block;
  padding: 0.72rem 0.35rem;
  color: var(--text-main);
  font-size: 0.92rem;
  line-height: 1.4;
  text-decoration: none;
}

.panel a {
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
}

.panel a::before {
  content: ">";
  margin-right: 0.55rem;
  color: var(--neon-blue);
  opacity: 0.65;
}

.panel a span {
  display: block;
  margin-top: 0.16rem;
  margin-left: 1.28rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: lowercase;
}

.panel a:hover,
.panel a:focus-visible {
  color: var(--neon-red);
  background: rgba(255, 0, 60, 0.075);
  text-shadow: 0 0 10px var(--glow-red);
  transform: translateX(0.25rem);
}

.panel a:hover span,
.panel a:focus-visible span {
  color: var(--text-dim);
}

/* Bug fix: disabled state now also targets the role="link" spans used for
   non-navigable items (previously this rule only matched <a aria-disabled>,
   so disabled list items rendered with full active-link styling and the
   "#" placeholders caused an unwanted jump-to-top on click). */
.panel a[aria-disabled="true"],
.panel [role="link"][aria-disabled="true"] {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.65;
}

.panel a[aria-disabled="true"]:hover,
.panel a[aria-disabled="true"]:focus-visible,
.panel [role="link"][aria-disabled="true"]:hover,
.panel [role="link"][aria-disabled="true"]:focus-visible {
  color: var(--text-muted);
  background: transparent;
  text-shadow: none;
  transform: none;
}

/* =========================================================
   Restricted State
   ========================================================= */

.restricted {
  border-color: var(--panel-border-hot);
  box-shadow:
    0 0 28px rgba(255, 0, 60, 0.18),
    inset 0 0 22px rgba(255, 0, 60, 0.035);
}

.restricted h2 {
  color: var(--neon-red);
  text-shadow: 0 0 10px var(--glow-red);
}

.restricted h2::after {
  content: "🔒";
  float: right;
  font-size: 0.84em;
}

.locked {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.locked::before {
  content: "▣ ";
  color: var(--neon-red);
}

.locked::after {
  content: " // ACCESS DENIED";
  color: #686071;
  font-size: 0.72rem;
}

/* Plot-event state: add class="locked breached" when something gets hacked */
.breached {
  color: var(--neon-red);
  opacity: 1;
  text-shadow: 0 0 10px var(--glow-red);
  animation: breach-flicker 2.4s ease-in-out infinite;
}

.breached.locked {
  cursor: default;
}

.breached.locked::after {
  content: " // BREACHED";
  color: var(--neon-red);
}

@keyframes breach-flicker {
  0%, 88%, 100% { opacity: 1; }
  90% { opacity: 0.38; }
  92% { opacity: 1; }
  95% { opacity: 0.55; }
  97% { opacity: 1; }
}

/* =========================================================
   Status Data
   ========================================================= */

.status-list,
.status dl {
  display: flex;
  flex-direction: column;
  gap: 0.68rem;
  margin: 0.9rem 0 0;
}

.status-list div,
.status div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.52rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.status-list dt,
.status dt {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.status-list dd,
.status dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

/* Bug fix: the original ".status dd, .status .danger" rule made every dd
   red by default (since plain ".status dd" already matches all of them),
   which then fought with the more specific .warning/.watch rules purely on
   source order. Scoped the base color to dd elements without a status
   modifier class so warning/watch states aren't relying on cascade order. */
.status dd {
  font-weight: 700;
}

.status dd:not(.warning):not(.watch),
.status .danger {
  color: var(--danger);
  text-shadow: 0 0 9px var(--glow-red);
}

.status .warning {
  color: var(--warning);
  text-shadow: 0 0 9px rgba(255, 209, 102, 0.25);
}

.status .watch {
  color: var(--watch);
  text-shadow: 0 0 9px var(--glow-blue);
}

.fine-print {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.55;
}

/* =========================================================
   Atmospheric Filters
   ========================================================= */

.scanlines,
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.scanlines {
  z-index: 10;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.045),
    rgba(255, 255, 255, 0.045) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: soft-light;
}

.noise {
  z-index: 11;
  opacity: 0.12;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.22), transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.16), transparent 1px),
    radial-gradient(circle at 45% 55%, rgba(255, 255, 255, 0.12), transparent 1px);
  background-size: 90px 90px, 130px 130px, 70px 70px;
  animation: noise-drift 1.4s steps(2) infinite;
}

@keyframes noise-drift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1%, 1%); }
  50% { transform: translate(1%, -1%); }
  75% { transform: translate(1%, 1%); }
  100% { transform: translate(0, 0); }
}

/* =========================================================
   News Ticker
   ========================================================= */

.ticker {
  position: fixed;
  inset: auto 0 0;
  z-index: 12;
  height: var(--ticker-height);
  display: flex;
  align-items: center;
  overflow: hidden;
  border-top: 1px solid var(--neon-red);
  background:
    linear-gradient(90deg, rgba(255, 0, 60, 0.16), transparent 18%, transparent 82%, rgba(255, 0, 60, 0.16)),
    var(--bg-deep);
  box-shadow: 0 -8px 24px rgba(255, 0, 60, 0.14);
}

.ticker p {
  display: inline-block;
  margin: 0;
  padding-left: 100%;
  color: var(--neon-red);
  font-size: 0.82rem;
  white-space: nowrap;
  text-shadow: 0 0 8px var(--glow-red);
  animation: ticker 36s linear infinite;
}

.ticker:hover p,
.ticker:focus-within p {
  animation-play-state: paused;
}

@keyframes ticker {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-100%, 0, 0);
  }
}

/* =========================================================
   Scrollbars
   ========================================================= */

::-webkit-scrollbar {
  width: 0.8rem;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 0, 60, 0.55);
  border: 2px solid var(--bg-deep);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neon-red);
}

/* =========================================================
   Medium Screens
   ========================================================= */

@media (max-width: 980px) {
  .terminal {
    align-items: start;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  body {
    overflow-y: auto;
  }
}

/* =========================================================
   Small Screens
   ========================================================= */

@media (max-width: 560px) {
  :root {
    --ticker-height: 3rem;
  }

  .terminal {
    padding-inline: 1rem;
  }

  h1 {
    font-size: clamp(2.75rem, 18vw, 4.8rem);
    line-height: 0.9;
  }

  .system-label {
    letter-spacing: 0.16em;
  }

  .panel {
    padding: 1rem;
  }

  .panel h2 {
    font-size: 0.9rem;
    letter-spacing: 0.12em;
  }

  .locked::after,
  .breached.locked::after {
    display: block;
    margin-top: 0.16rem;
  }

  .status-list div,
  .status div {
    align-items: flex-start;
  }

  .ticker p {
    font-size: 0.74rem;
  }
}

/* =========================================================
   Motion Safety
   ========================================================= */

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

  .boot-screen p {
    opacity: 1;
    transform: none;
  }

  .landing {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .ticker {
    height: auto;
    min-height: var(--ticker-height);
  }

  .ticker p {
    padding: 0.5rem 1rem;
    white-space: normal;
    animation: none;
  }

  .noise {
    display: none;
  }

  h1.glitch::before,
  h1.glitch::after {
    content: none;
  }
}