/*
Theme Name: Jaqqardak
Theme URI: https://jaqqardak.com
Author: Jaqqardak
Description: Interactive data archive for the Memorandax. CRT / cassette futurism aesthetic.
Version: 6.23
License: GNU General Public License v2 or later
Text Domain: jaqqardak
*/

/* --------------------------------------------------------------------------
   0. Font + tokens
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'JaqqardakSysText';
  src: url('JaqqardakSysText.woff2') format('woff2'),
       url('JaqqardakSysText.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --safety-orange: #FF7900;
  --polar-bear: #F8F6F0;
  --deep-black: #000000;
  --banner-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --chrome-h: calc(var(--banner-h) + var(--safe-bottom));
}

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

/* --------------------------------------------------------------------------
   1. Page chrome — black stage, grain, scanlines
   -------------------------------------------------------------------------- */
html {
  background: #000;
  height: 100%;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: #c45f00 #000;
}

body {
  font-family: 'JaqqardakSysText', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #000000;
  color: var(--safety-orange);
  line-height: 1.55;
  font-size: 34px;
  position: relative;
  height: 100%;
  overflow: hidden;
}

/* Animated coarse grain. Oversized + stepped translate so the tile
   never looks locked to the viewport. pointer-events:none so it can't
   steal clicks from nodes / windows underneath. */
body::before {
  content: "";
  position: fixed;
  inset: -60%;
  width: 220%;
  height: 220%;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.46;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 96px 96px;
  animation: grainMove 0.28s steps(4) infinite;
  mix-blend-mode: overlay;
}

/* Static scan bars + a second fine grain pass. Both sit above the
   banner (z 100) and below terminals (z 10000). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8999;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 3px,
      rgba(0, 0, 0, 0.55) 3px,
      rgba(0, 0, 0, 0.55) 6px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 80, 0, 0.04) 0px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0.08) 3px,
      rgba(0, 0, 0, 0) 5px
    ),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: auto, auto, 72px 72px;
  opacity: 0.62;
  mix-blend-mode: multiply;
}

@keyframes grainMove {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -2%); }
  60%  { transform: translate(-1%, 3%); }
  80%  { transform: translate(3%, -1%); }
  100% { transform: translate(0, 0); }
}

a {
  color: var(--safety-orange);
  text-decoration: none;
  transition: color 0.2s ease;
  text-shadow: 0 0 6px rgba(255, 121, 0, 0.45);
}

a:hover {
  color: #ff9a33;
  text-shadow: 0 0 10px rgba(255, 154, 51, 0.7);
}

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

/* --------------------------------------------------------------------------
   2. Shell layout — .site fills the viewport; footer is a fixed banner
   -------------------------------------------------------------------------- */
.site {
  height: 100%;
  min-height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #000000;
  position: relative;
  z-index: 1;
  padding-bottom: var(--chrome-h);
  overflow: hidden;
  filter: contrast(1.08) brightness(1.02) saturate(1.04);
}

.site-content {
  flex: 1;
  width: 100%;
  margin: 0;
  /* Top padding clears the DATA ARCHIVE label that sits above the border. */
  padding: 44px 18px 16px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  min-height: 0;
  overflow: visible;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  margin: 0;
  padding: 0;
  padding-bottom: var(--safe-bottom);
  background: var(--safety-orange);
  color: #000000;
  box-shadow: 0 0 18px rgba(255, 121, 0, 0.3);
  overflow: hidden;
}

.site-footer-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  height: var(--banner-h);
  padding: 0 16px;
  box-sizing: border-box;
}

.site-footer-label {
  grid-column: 2;
  margin: 0;
  border: 0;
  padding: 0;
  font-family: 'JaqqardakSysText', sans-serif;
  font-size: clamp(1.45rem, 4.2vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
  color: #000000;
  white-space: nowrap;
  pointer-events: none;
}

/* Read / unread legend — left cell, vertically centred with the wordmark. */
.node-key {
  grid-column: 1;
  justify-self: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  min-width: 0;
}

.node-key-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.node-key-swatch {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  display: block;
}

.node-key-swatch-read {
  background: var(--polar-bear);
}

.node-key-swatch-unread {
  background: var(--safety-orange);
  outline: 1px solid #000000;
  outline-offset: 0;
}

.node-key-text {
  font-family: 'JaqqardakSysText', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #000000;
  white-space: nowrap;
  text-transform: uppercase;
}

/* Two-stage control: click once to reveal the label, click again to wipe
   localStorage read-state. Armed state is driven by timeline.js.
   Confirm copy overlays left so it cannot shove the wordmark. */
.clear-history {
  grid-column: 3;
  justify-self: end;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 40px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #000000;
  cursor: pointer;
  font-family: 'JaqqardakSysText', sans-serif;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
}

.clear-history-x {
  display: block;
  font-size: 2rem;
  line-height: 1;
  width: 1em;
  text-align: center;
}

.clear-history-text {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  pointer-events: none;
  transition: max-width 0.3s ease, opacity 0.25s ease;
}

.clear-history.is-armed .clear-history-text {
  max-width: 180px;
  opacity: 1;
}

.clear-history:hover,
.clear-history:focus-visible {
  outline: none;
}

/* --------------------------------------------------------------------------
   3. Single / fallback post pages
   -------------------------------------------------------------------------- */
.entry-header {
  margin-bottom: 36px;
  text-align: center;
  padding-top: 28px;
}

.entry-title {
  font-size: 3.2rem;
  color: var(--polar-bear);
  margin-bottom: 12px;
  line-height: 1.25;
  text-shadow: 0 0 12px rgba(248, 246, 240, 0.35);
}

.entry-meta {
  font-size: 1.5rem;
  color: #c45f00;
}

.entry-content {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 50px;
  color: var(--polar-bear);
  font-size: 1.05em;
}

.entry-content p {
  margin-bottom: 1.4em;
}

.entry-content h1,
.entry-content h2,
.entry-content h3 {
  color: var(--polar-bear);
}

.back-to-timeline {
  display: inline-block;
  margin: 36px 0 60px;
  padding: 14px 28px;
  background: var(--safety-orange);
  color: #000000 !important;
  border-radius: 0;
  font-weight: 500;
  font-size: 1.1em;
  text-shadow: none;
  transition: background 0.2s ease, box-shadow 0.2s;
  box-shadow: 0 0 16px rgba(255, 121, 0, 0.4);
}

.back-to-timeline:hover {
  background: #ff9a33;
  color: #000000 !important;
  box-shadow: 0 0 24px rgba(255, 154, 51, 0.6);
}

/* --------------------------------------------------------------------------
   4. Phosphor glow — orange / white elements only
   -------------------------------------------------------------------------- */
/* Glow alpha stays inside 30–70%. Blur radius is half the old reach so
   the pulse does not wash neighbouring nodes. Opacity is left alone —
   dimming whole windows/labels read as flicker, not phosphor. */
@keyframes crtGlowPulse {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 2px rgba(255,121,0,0.50)); }
  40%      { filter: brightness(1.10) drop-shadow(0 0 4px rgba(255,121,0,0.70)); }
  55%      { filter: brightness(0.94) drop-shadow(0 0 1px rgba(255,121,0,0.30)); }
  70%      { filter: brightness(1.06) drop-shadow(0 0 3px rgba(255,121,0,0.50)); }
}

.site-footer-label,
.float-square,
.float-title,
.jaqqardak-window,
.jaqqardak-window .term-title-bar,
.jaqqardak-window .terminal-output,
.jaqqardak-window .terminal-cursor,
.dock-tab,
.map-node-dot,
.map-readout,
.panel-label.is-active {
  animation: crtGlowPulse 5.5s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   5. Section panels
   -------------------------------------------------------------------------- */
.panel {
  position: relative;
  border: 3px solid var(--safety-orange);
  box-sizing: border-box;
  background: transparent;
  min-height: 0;
  overflow: visible;
}

.panel-tabs {
  position: absolute;
  top: 0;
  left: 10px;
  transform: translateY(calc(-100% - 1px));
  z-index: 6;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.panel-label {
  position: static;
  transform: none;
  z-index: 6;
  background: var(--safety-orange);
  color: #000000;
  font-family: 'JaqqardakSysText', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  padding: 8px 14px 7px;
  border: 3px solid var(--safety-orange);
  pointer-events: auto;
  white-space: nowrap;
  cursor: pointer;
}

.panel-label:not(.is-active) {
  background: #000000;
  color: var(--safety-orange);
}

.panel-label:focus-visible {
  outline: 2px solid var(--polar-bear);
  outline-offset: 2px;
}

.panel-archive {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  z-index: 2;
  margin: 0;
  overflow: visible;
}

/* --------------------------------------------------------------------------
   6. Data-archive floats
   -------------------------------------------------------------------------- */
.float-field {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.float-node {
  position: absolute;
  left: var(--fx, 20%);
  top: var(--fy, 20%);
  pointer-events: auto;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  transform: translate(-50%, -50%);
}

/* Physics nodes are moved via transform from 0,0 (see timeline.js). */
.float-node.float-physics {
  left: 0;
  top: 0;
  will-change: transform;
}

/* CSS drift is the fallback when JS physics is off (reduced motion). */
.float-node:not(.float-physics) {
  animation: floatDrift var(--fd, 22s) ease-in-out infinite alternate;
  animation-delay: var(--fdelay, 0s);
}

.float-square {
  width: 10px;
  height: 10px;
  background: var(--safety-orange);
  box-shadow: 0 0 6px rgba(255, 121, 0, 0.55);
  flex-shrink: 0;
  display: block;
  position: relative;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

/* Invisible slop around the 10px square so a moving node is easier to hit.
   Does not change the painted size or the physics radius. */
.float-square::after {
  content: "";
  position: absolute;
  inset: -14px;
}

.float-node.is-read .float-square {
  background: var(--polar-bear);
  box-shadow: 0 0 6px rgba(248, 246, 240, 0.45);
}

/* Brief phosphor tick when two squares are in contact. */
.float-node.is-colliding .float-square {
  box-shadow: 0 0 10px rgba(255, 121, 0, 0.95), 0 0 18px rgba(255, 121, 0, 0.45);
  transform: scale(1.35);
}

.float-node.is-read.is-colliding .float-square {
  box-shadow: 0 0 10px rgba(248, 246, 240, 0.9), 0 0 18px rgba(248, 246, 240, 0.4);
}

.float-title {
  color: var(--polar-bear);
  font-family: 'JaqqardakSysText', monospace;
  font-size: 13px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.35s ease, opacity 0.25s ease, margin 0.25s ease, font-size 0.25s ease;
  margin-left: 0;
  text-shadow: 0 0 6px rgba(248, 246, 240, 0.45);
  transform-origin: left center;
}

.float-node:hover .float-title,
.float-node:focus .float-title {
  max-width: 280px;
  opacity: 1;
  margin-left: 4px;
  font-size: 18px;
}

@keyframes floatDrift {
  0%   { transform: translate(-50%, -50%) translate(0, 0); }
  20%  { transform: translate(-50%, -50%) translate(42px, -28px); }
  40%  { transform: translate(-50%, -50%) translate(-36px, 34px); }
  60%  { transform: translate(-50%, -50%) translate(50px, 18px); }
  80%  { transform: translate(-50%, -50%) translate(-28px, -40px); }
  100% { transform: translate(-50%, -50%) translate(20px, 24px); }
}

/* --------------------------------------------------------------------------
   6b. Region map
   -------------------------------------------------------------------------- */
.map-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  background: #000;
}

.map-stage[hidden] {
  display: none !important;
}

.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-viewport.is-panning {
  cursor: grabbing;
}

.map-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 3200px;
  height: 2400px;
  transform-origin: 0 0;
  will-change: transform;
}

.map-base {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  image-rendering: auto;
}

.map-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-node-dot {
  display: block;
  flex-shrink: 0;
  border-radius: 50%;
  box-sizing: border-box;
  position: relative;
}

.map-node-dot::after {
  content: "";
  position: absolute;
  inset: -18px;
}

.map-node-minor .map-node-dot {
  width: 12px;
  height: 12px;
  background: var(--safety-orange);
  box-shadow: 0 0 6px rgba(255, 121, 0, 0.55);
}

.map-node-major .map-node-dot {
  width: 20px;
  height: 20px;
  background: var(--safety-orange);
  border: 2px solid #000;
  box-shadow: 0 0 0 1px var(--safety-orange), 0 0 8px rgba(255, 121, 0, 0.55);
}

.map-node.is-read .map-node-dot {
  background: var(--polar-bear);
  box-shadow: 0 0 6px rgba(248, 246, 240, 0.45);
}

.map-node.is-read.map-node-major .map-node-dot {
  border-color: #000;
  box-shadow: 0 0 0 1px var(--polar-bear), 0 0 8px rgba(248, 246, 240, 0.5);
}

.map-node.is-active .map-node-dot {
  box-shadow: 0 0 0 2px var(--safety-orange), 0 0 10px rgba(255, 121, 0, 0.8);
}

.map-node.is-read.is-active .map-node-dot {
  box-shadow: 0 0 0 2px var(--polar-bear), 0 0 10px rgba(248, 246, 240, 0.7);
}

.map-node-title {
  color: var(--polar-bear);
  font-family: 'JaqqardakSysText', monospace;
  font-size: 13px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  text-shadow: 0 0 6px rgba(248, 246, 240, 0.45);
  transition: max-width 0.35s ease, opacity 0.25s ease, margin 0.25s ease, font-size 0.25s ease;
}

.map-node:hover .map-node-title,
.map-node:focus .map-node-title,
.map-node.is-active .map-node-title {
  max-width: 280px;
  opacity: 1;
  margin-left: 2px;
  font-size: 16px;
}

.map-readout {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 5;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.78);
  border: 2px solid var(--safety-orange);
  color: var(--safety-orange);
  font-family: 'JaqqardakSysText', monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 6px 8px 5px;
  text-shadow: 0 0 6px rgba(255, 121, 0, 0.4);
  user-select: none;
}

.map-readout.is-idle {
  visibility: hidden;
}

.map-readout.is-copied {
  color: var(--polar-bear);
  border-color: var(--polar-bear);
}

.map-tether {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9990;
  overflow: visible;
}

.map-tether line {
  stroke: var(--safety-orange);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  fill: none;
}

.jaqqardak-window .term-jack {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  background: var(--safety-orange);
  box-shadow: 0 0 6px rgba(255, 121, 0, 0.55);
  margin-right: 6px;
}

.jaqqardak-window.is-tab-hidden,
.jaqqardak-image-float.is-tab-hidden,
.dock-tab.is-tab-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   7. Draggable terminal windows
   -------------------------------------------------------------------------- */
.jaqqardak-window {
  position: fixed;
  width: min(620px, 92vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  border: 3px solid var(--safety-orange);
  background: #050505;
  box-shadow:
    0 0 0 1px #2a1500,
    0 10px 32px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(255, 121, 0, 0.15),
    inset 0 0 30px rgba(0, 0, 0, 0.65);
  border-radius: 0;
  z-index: 10000;
  user-select: none;
  touch-action: none;
}

.jaqqardak-window.dragging {
  opacity: 0.92;
  cursor: grabbing;
}

.jaqqardak-window .terminal-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #0e0e0e;
  border-bottom: 3px solid var(--safety-orange);
  padding: 8px 12px;
  cursor: grab;
  flex-shrink: 0;
}

.jaqqardak-window.dragging .terminal-chrome {
  cursor: grabbing;
}

.jaqqardak-window .term-title-bar {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--polar-bear);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(248, 246, 240, 0.4);
  pointer-events: none;
}

.jaqqardak-window .term-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.jaqqardak-window .term-btn {
  background: transparent;
  border: 2px solid var(--polar-bear);
  color: var(--polar-bear);
  width: 34px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  padding: 0;
}

.jaqqardak-window .term-btn:hover:not(:disabled) {
  background: var(--polar-bear);
  color: #000;
}

.jaqqardak-window .term-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.jaqqardak-window .term-close {
  font-weight: 700;
}

.jaqqardak-window .terminal-body {
  width: 100%;
  min-height: 280px;
  max-height: calc(78vh - 52px);
  background: #050505;
  color: var(--polar-bear);
  padding: 18px 20px 22px;
  overflow-y: auto;
  font-family: 'JaqqardakSysText', monospace;
  font-size: 16px;
  line-height: 1.55;
  position: relative;
  border-radius: 0;
  text-shadow: none;
  user-select: text;
  cursor: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--safety-orange) #0a0a0a;
}

.jaqqardak-window .terminal-output {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
  color: var(--safety-orange);
  text-shadow: 0 0 4px rgba(255, 121, 0, 0.35);
}

.jaqqardak-window .terminal-output .term-title {
  color: var(--polar-bear);
  font-size: 1.15em;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
  text-shadow: 0 0 10px rgba(248, 246, 240, 0.45);
}

.jaqqardak-window .terminal-output .ref-link {
  color: var(--polar-bear);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s, text-shadow 0.15s;
  font-weight: 400;
  font-style: italic;
  text-shadow: 0 0 8px rgba(248, 246, 240, 0.45);
}

.jaqqardak-window .terminal-output .ref-link:hover {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(248, 246, 240, 0.75);
}

.jaqqardak-window .term-article {
  white-space: normal;
  margin-top: 0.6em;
}

.jaqqardak-window .term-article p,
.jaqqardak-window .term-article div {
  margin: 0 0 1em;
}

.jaqqardak-window .term-article h1,
.jaqqardak-window .term-article h2,
.jaqqardak-window .term-article h3 {
  color: var(--polar-bear);
  margin: 0 0 0.5em;
  line-height: 1.25;
}

.jaqqardak-window .term-article ul,
.jaqqardak-window .term-article ol {
  margin: 0 0 1em 1.2em;
}

.jaqqardak-window .term-article blockquote {
  margin: 0 0 1em;
  padding-left: 0.8em;
  border-left: 2px solid var(--safety-orange);
}

.jaqqardak-window .term-article .has-text-align-left,
.jaqqardak-window .term-article [align="left"] { text-align: left; }
.jaqqardak-window .term-article .has-text-align-center,
.jaqqardak-window .term-article [align="center"] { text-align: center; }
.jaqqardak-window .term-article .has-text-align-right,
.jaqqardak-window .term-article [align="right"] { text-align: right; }
.jaqqardak-window .term-article .has-text-align-justify,
.jaqqardak-window .term-article [align="justify"] { text-align: justify; }

.jaqqardak-window .terminal-cursor {
  display: inline;
  animation: blink 1.05s step-end infinite;
  color: var(--safety-orange);
  text-shadow: 0 0 8px rgba(255, 121, 0, 0.7);
}

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

.jaqqardak-window .progress-bar {
  display: none;
  width: 100%;
  height: 7px;
  background: #1a1a1a;
  border: 2px solid #333;
  margin-top: 14px;
  overflow: hidden;
}

.jaqqardak-window .progress-fill {
  height: 100%;
  width: 0%;
  background: var(--polar-bear);
  transition: width 0.04s linear;
  box-shadow: 0 0 10px rgba(248, 246, 240, 0.5);
}

.jaqqardak-image-float {
  position: fixed;
  max-width: min(280px, 42vw);
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: grab;
  z-index: 10000;
  user-select: none;
  touch-action: none;
}

.jaqqardak-image-float.dragging {
  cursor: grabbing;
  opacity: 0.92;
}

.jaqqardak-image-float.minimised {
  display: none !important;
}

.jaqqardak-image-float .dialup-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(280px, 42vw);
  max-height: 50vh;
  object-fit: contain;
  border: none;
  background: transparent;
  image-rendering: pixelated;
  pointer-events: none;
}

.jaqqardak-image-float .dialup-image[hidden] {
  display: none !important;
}

.jaqqardak-image-float .dialup-image.loaded {
  image-rendering: auto;
}

.jaqqardak-window.minimised {
  display: none !important;
}

.jaqqardak-dock {
  position: fixed;
  bottom: calc(var(--chrome-h) + 6px);
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 6px;
  pointer-events: none;
}

.dock-tab {
  pointer-events: auto;
  display: none;
  align-items: center;
  justify-content: center;
  max-width: 200px;
  padding: 6px 14px;
  background: #0a0a0a;
  border: 2px solid var(--safety-orange);
  color: var(--safety-orange);
  font-family: 'JaqqardakSysText', monospace;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(255, 121, 0, 0.2);
  transition: background 0.15s, color 0.15s;
}

.dock-tab:hover {
  background: var(--safety-orange);
  color: #000;
}

/* --------------------------------------------------------------------------
   8. Scrollbars
   -------------------------------------------------------------------------- */
.jaqqardak-window .terminal-body::-webkit-scrollbar {
  width: 10px;
}
.jaqqardak-window .terminal-body::-webkit-scrollbar-track {
  background: #0a0a0a;
  border-left: 1px solid #331a00;
}
.jaqqardak-window .terminal-body::-webkit-scrollbar-thumb {
  background: var(--safety-orange);
  border: 2px solid #0a0a0a;
  box-shadow: 0 0 6px rgba(255, 121, 0, 0.4);
}
.jaqqardak-window .terminal-body::-webkit-scrollbar-thumb:hover {
  background: #ff9a33;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #000;
}
::-webkit-scrollbar-thumb {
  background: #c45f00;
  border: 2px solid #000;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--safety-orange);
}

/* --------------------------------------------------------------------------
   9. CRT vignette overlay
      Background-image is injected from functions.php with a filemtime
      query string so the SVG cache-busts the same way style.css does.
   -------------------------------------------------------------------------- */
.site::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8998;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

/* --------------------------------------------------------------------------
   10. Read-state pulse (polar-bear after a terminal finishes typing)
   -------------------------------------------------------------------------- */
@keyframes readPulse {
  0%, 100% {
    background: var(--polar-bear);
    box-shadow: 0 0 4px rgba(248, 246, 240, 0.35);
    opacity: 1;
  }
  50% {
    background: #ffffff;
    box-shadow: 0 0 12px rgba(248, 246, 240, 0.7);
    opacity: 0.7;
  }
}

.float-node.is-read .float-square,
.map-node.is-read .map-node-dot {
  background: var(--polar-bear);
  box-shadow: 0 0 4px rgba(248, 246, 240, 0.35);
  animation: readPulse 4.8s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   11. Reduced motion — kill the continuous compositor work
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .site-footer-label,
  .float-square,
  .float-title,
  .jaqqardak-window,
  .jaqqardak-window .term-title-bar,
  .jaqqardak-window .terminal-output,
  .jaqqardak-window .terminal-cursor,
  .dock-tab,
  .float-node:not(.float-physics),
  .float-node.is-read .float-square,
  .map-node.is-read .map-node-dot,
  .map-node-dot,
  .map-readout,
  .panel-label.is-active {
    animation: none !important;
  }
}

/* Hard swap — no transition. JS never applies this under reduced motion. */
.glitch-char {
  color: #ff0000;
  text-shadow: 0 0 6px rgba(255, 0, 0, 0.85), 0 0 14px rgba(255, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   12. Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 700px) {
  :root {
    --banner-h: 48px;
  }

  body {
    font-size: 26px;
  }

  .site-content {
    flex-direction: column;
    align-items: stretch;
    padding: 36px 10px 10px;
    gap: 0;
  }

  .site-footer-bar {
    padding: 0 10px;
    column-gap: 6px;
  }

  .site-footer-label {
    font-size: clamp(1.05rem, 5.6vw, 1.5rem);
    letter-spacing: 0.04em;
  }

  .node-key {
    gap: 4px;
  }

  .node-key-swatch {
    width: 8px;
    height: 8px;
  }

  .node-key-text {
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .clear-history {
    height: 36px;
    min-width: 36px;
  }

  .clear-history-x {
    font-size: 1.65rem;
  }

  .clear-history-text {
    font-size: 0.72rem;
    right: calc(100% + 4px);
  }

  .node-key-lead,
  .node-key-rest {
    display: none;
  }

  .panel-label {
    font-size: 13px;
    padding: 6px 9px 5px;
    letter-spacing: 0.06em;
  }

  .map-readout {
    font-size: 11px;
    right: 6px;
    bottom: 6px;
  }

  .panel-archive {
    flex: 1 1 auto;
    min-height: 180px;
  }

  .float-field {
    position: absolute;
    inset: 0;
  }

  .jaqqardak-dock {
    bottom: calc(var(--chrome-h) + 6px);
  }

  .dock-tab {
    font-size: 12px;
    max-width: 140px;
    padding: 5px 10px;
  }

  .jaqqardak-window {
    width: 94vw;
    max-height: 70vh;
  }

  .jaqqardak-window .terminal-body {
    min-height: 220px;
    max-height: calc(70vh - 48px);
    font-size: 14px;
    padding: 14px 12px 18px;
  }

  .jaqqardak-image-float {
    max-width: min(220px, 70vw);
  }

  .entry-title {
    font-size: 2.2rem;
  }
}
