/*
  Neon-terminal theme for the resource pages (/content/<id>/ only; the
  homepage and admin keep the explorer look). Loaded after each page's own
  <style> and after site-chrome.css, so it layers on top of both.

  Pieces: phosphor palette (CSS variables shared by every page variant),
  CRT scanlines + vignette, glowing mono headings with a blinking cursor,
  inverse-video links, terminal-window code blocks, ASCII rules.
  All motion is disabled under prefers-reduced-motion.
*/

/* ---------- palette: remap every page's variable names to one set ---------- */
:root:root {
  --t-bg:       #080c10;
  --t-bg-2:     #0d1419;
  --t-bg-3:     #121c22;
  --t-line:     #1b3934;
  --t-line-hi:  #2a5f55;
  --t-text:     #d6ece6;
  --t-muted:    #6f8f89;
  --t-teal:     #2bd5b3;
  --t-teal-hi:  #7dffe0;
  --t-orange:   #ffa53e;
  --t-mono:     'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --t-glow:     0 0 4px rgba(43, 213, 179, 0.65), 0 0 14px rgba(43, 213, 179, 0.35), 0 0 32px rgba(43, 213, 179, 0.15);

  /* template + bip110 */
  --bg: var(--t-bg); --bg-2: var(--t-bg-2); --bg-3: var(--t-bg-3);
  --line: var(--t-line); --text: var(--t-text); --muted: var(--t-muted);
  /* covenants / post-quantum / btc-atlas */
  --bg2: var(--t-bg-2); --bg3: var(--t-bg-3); --border: var(--t-line);
  --heading: var(--t-teal); --table-row: var(--t-bg-2); --table-row-alt: var(--t-bg-3);
  --code-bg: var(--t-bg-3);
  /* binohash / op-if-bitcoin */
  --surface: var(--t-bg-2); --surface-2: var(--t-bg-3); --text-muted: var(--t-muted);
  --border-soft: var(--t-line); --code-border: var(--t-line);
  --font-mono: var(--t-mono); --font-sans: var(--t-mono);
}

/* ---------- screen ---------- */
html { background: var(--t-bg); }
body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(43, 213, 179, 0.11), transparent 70%),
    linear-gradient(rgba(43, 213, 179, 0.028) 1px, transparent 1px) 0 0 / 100% 28px,
    var(--t-bg) !important;
  color: var(--t-text);
  font-family: var(--t-mono) !important;
}
body * { font-family: var(--t-mono) !important; }

/* CRT scanlines + slow roll bar */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, 0.22) 3px, transparent 4px);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2001;
  pointer-events: none;
  background:
    linear-gradient(to bottom, transparent 0%, rgba(43, 213, 179, 0.035) 48%, rgba(43, 213, 179, 0.06) 50%, transparent 52%) 0 0 / 100% 300%,
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  animation: t-roll 9s linear infinite;
}
@keyframes t-roll { from { background-position: 0 100%, 0 0; } to { background-position: 0 -200%, 0 0; } }

::selection { background: var(--t-teal); color: var(--t-bg); text-shadow: none; }
html { scrollbar-color: var(--t-line-hi) var(--t-bg); }

/* ---------- shared bar + footer ---------- */
.site-bar {
  background: rgba(8, 12, 16, 0.86) !important;
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--t-line-hi) !important;
  box-shadow: 0 1px 0 rgba(43, 213, 179, 0.15), 0 8px 24px -12px rgba(43, 213, 179, 0.35);
}
.site-brand { text-shadow: var(--t-glow); }
.site-brand::after {
  content: ' $';
  color: var(--t-muted);
  text-shadow: none;
}
.site-left::after {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: -0.35rem;
  background: var(--t-teal);
  box-shadow: var(--t-glow);
  vertical-align: middle;
  animation: t-blink 1.1s steps(1) infinite;
}
.site-bar .site-back::before { content: '[ '; color: var(--t-line-hi); }
.site-bar .site-back::after  { content: ' ]'; color: var(--t-line-hi); }
.site-bar .site-back:hover { color: var(--t-teal) !important; text-shadow: var(--t-glow); }
.site-logo { border-color: var(--t-line-hi) !important; box-shadow: 0 0 10px rgba(43, 213, 179, 0.25); }
/* the bar logo is the one logo on the page: larger, lit, and brighter on hover */
.site-bar { height: 60px !important; }
.site-bar .site-logo {
  width: 38px !important;
  height: 38px !important;
  border-radius: 8px;
  border: 1px solid var(--t-teal) !important;
  box-shadow: 0 0 6px rgba(43, 213, 179, 0.6), 0 0 18px rgba(43, 213, 179, 0.3);
  transition: box-shadow 0.15s, transform 0.15s;
}
.site-bar .site-logo-link:hover .site-logo {
  box-shadow: 0 0 8px rgba(43, 213, 179, 0.9), 0 0 28px rgba(43, 213, 179, 0.5);
  transform: scale(1.05);
}
.site-footer {
  background: transparent !important;
  border-top: 1px solid var(--t-line) !important;
  color: var(--t-muted) !important;
}
.site-footer::before {
  content: 'EOF';
  flex-basis: 100%;
  color: var(--t-line-hi);
  letter-spacing: 0.4em;
  font-size: 0.7rem;
}

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

/* ---------- headings ---------- */
:is(#article, main, .container, .main-content, .main, .hero) :is(h1, h2, h3, h4) {
  color: var(--t-teal) !important;
  text-shadow: var(--t-glow);
  letter-spacing: 0.01em !important;
}
:is(#article, main, .container, .hero) h1, .main h1 {
  text-transform: none;
  animation: t-type 0.9s steps(28, end) both;
}
:is(#article, main, .container, .hero) h1::after, .main h1::after {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.95em;
  margin-left: 0.25em;
  background: var(--t-teal);
  box-shadow: var(--t-glow);
  vertical-align: -0.08em;
  animation: t-blink 1.1s steps(1) infinite;
}
/* end slightly outside the box so the glow is not clipped once typing finishes */
@keyframes t-type { from { clip-path: inset(-1em 100% -1em -1em); } to { clip-path: inset(-1em -2em -1em -1em); } }

:is(#article, main, .container, .main-content, .main) h2 {
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--t-line-hi) !important;
}
:is(#article, main, .container, .main-content, .main) h3 {
  color: var(--t-orange) !important;
  text-shadow: 0 0 4px rgba(255, 165, 62, 0.45), 0 0 14px rgba(255, 165, 62, 0.18);
}
:is(#article, main, .container, .main-content, .main) h4 { color: var(--t-teal-hi) !important; text-shadow: none; }

/* the template's "// transaction detail · resource" line becomes a prompt */
.tx-header { color: var(--t-muted) !important; letter-spacing: 0.02em !important; text-transform: none !important; }
.tx-header::before { content: 'root@philly-bitdevs:~$ '; color: var(--t-teal); }

/* ---------- body text ---------- */
:is(#article, main, .container, .main-content, .main) :is(p, li, td) {
  font-size: 0.94rem;
  line-height: 1.8;
}
:is(#article, main, .container, .main-content, .main) strong { color: #ffffff; }
:is(#article, main, .container, .main-content, .main) ul > li::marker { content: '› '; color: var(--t-teal); }
:is(#article, main, .container, .main-content, .main) ol > li::marker { color: var(--t-teal); }

/* links: dashed underline, inverse video on hover */
:is(#article, main, .container, .main-content, .main) a:not(.site-logo-link) {
  color: var(--t-teal) !important;
  text-decoration: none !important;
  border-bottom: 1px dashed rgba(43, 213, 179, 0.5) !important;
  transition: background 0.12s, color 0.12s;
}
:is(#article, main, .container, .main-content, .main) a:not(.site-logo-link):hover {
  background: var(--t-teal);
  color: var(--t-bg) !important;
  border-bottom-color: transparent !important;
  text-shadow: none;
}

/* inline code + terminal-window code blocks */
:is(#article, main, .container, .main-content, .main) :not(pre) > code {
  color: var(--t-teal-hi) !important;
  background: rgba(43, 213, 179, 0.07) !important;
  border: 1px solid rgba(43, 213, 179, 0.22) !important;
  border-radius: 3px;
}
:is(#article, main, .container, .main-content, .main) pre {
  position: relative;
  background: #05080b !important;
  border: 1px solid var(--t-line-hi) !important;
  border-radius: 6px;
  padding-top: 2.4rem !important;
  box-shadow: 0 0 0 1px rgba(43, 213, 179, 0.05), 0 0 24px -6px rgba(43, 213, 179, 0.3), inset 0 0 40px rgba(43, 213, 179, 0.04);
}
:is(#article, main, .container, .main-content, .main) pre::before {
  content: '●  ●  ●   ~/scratch';
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.7rem;
  color: var(--t-muted);
  border-bottom: 1px solid var(--t-line);
  background: var(--t-bg-2);
  border-radius: 6px 6px 0 0;
}
:is(#article, main, .container, .main-content, .main) pre code { color: var(--t-text) !important; }

/* blockquotes: a lit left rail, no ">" glyph */
:is(#article, main, .container, .main-content, .main) blockquote {
  border-left: 2px solid var(--t-teal) !important;
  background: linear-gradient(90deg, rgba(43, 213, 179, 0.08), transparent 70%) !important;
  box-shadow: -6px 0 14px -8px rgba(43, 213, 179, 0.6);
}

/* ASCII rule */
:is(#article, main, .container, .main-content, .main) hr {
  border: 0 !important;
  height: auto !important;
  margin: 2.5rem 0 !important;
  overflow: hidden;
  white-space: nowrap;
  background: none !important;
  color: var(--t-line-hi);
  font-size: 0.8rem;
  line-height: 1;
}
:is(#article, main, .container, .main-content, .main) hr::before {
  content: '════════════════════════════════════════════════════════════════════════════════════════════════════════════════';
}

/* monospace runs wider than the old sans faces: let long URLs/identifiers wrap */
:is(#article, main, .container, .main-content, .main) :is(p, li, td, a) { overflow-wrap: anywhere; }

/* tables: green-screen grid; wide ones scroll inside their own box at any width,
   as the markdown template already does */
:is(#article, main, .container, .main-content, .main) table {
  border: 1px solid var(--t-line) !important;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
:is(#article, main, .container, .main-content, .main) th {
  color: var(--t-teal) !important;
  background: var(--t-bg-2) !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem !important;
  border-bottom: 1px solid var(--t-line-hi) !important;
}
:is(#article, main, .container, .main-content, .main) td { border-color: var(--t-line) !important; }
:is(#article, main, .container, .main-content, .main) tr:hover td { background: rgba(43, 213, 179, 0.05) !important; }

/* images and charts get a phosphor frame */
:is(#article, main, .container, .main-content, .main) img:not(.site-logo) {
  border: 1px solid var(--t-line-hi);
  box-shadow: 0 0 24px -8px rgba(43, 213, 179, 0.35);
}

/* citations */
#article sup.cite a { border-bottom: 0 !important; }

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  body::after, .site-left::after,
  :is(#article, main, .container, .hero) h1, .main h1,
  :is(#article, main, .container, .hero) h1::after, .main h1::after { animation: none !important; }
}
@media print {
  body::before, body::after { display: none; }
  * { text-shadow: none !important; box-shadow: none !important; }
}
