/* EMERGENT STUDIOS — STYLE GUIDE
   Tokyo Night palette · Glassmorphism · Monospace · Compact · Adaptive
   ──────────────────────────────────────────────────────────────────── */

/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:     #13141f;
  --panel:  rgba(26, 27, 46, 0.85);
  --text:   #9ece6a;
  --muted:  #565f89;
  --cyan:   #7dcfff;
  --lime:   #9ece6a;
  --yellow: #e0af68;
  --pink:   #f7768e;
  --purple: #bb9af7;
  --orange: #ff9e64;

  --border: rgba(100, 110, 180, 0.25);
  --radius: 3px;

  --font:      ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'Fira Code',
               Menlo, Monaco, 'Courier New', monospace;
  --font-size: 0.875rem;
  --line-h:    1.65;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:     #d5d6db;
    --panel:  rgba(233, 233, 236, 0.85);
    --text:   #343b58;
    --muted:  #8990b3;
    --cyan:   #0f4b6e;
    --lime:   #485e30;
    --yellow: #8f5e15;
    --pink:   #8c4351;
    --purple: #5a4a78;
    --border: rgba(52, 59, 88, 0.20);
  }
}

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

/* ── Page ────────────────────────────────────────────────────────── */
html {
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 10%  5%,  rgba(26,  27,  46, 0.90) 0%, transparent 100%),
    radial-gradient(ellipse 50% 60% at 90% 40%,  rgba(15,  16,  25, 0.80) 0%, transparent 100%),
    radial-gradient(ellipse 40% 30% at 50% 95%,  rgba(114,135, 253, 0.06) 0%, transparent 100%);
  min-height: 100vh;
}

@media (prefers-color-scheme: light) {
  html {
    background-image:
      radial-gradient(ellipse 60% 40% at 10%  5%,  rgba(200,201,210, 0.60) 0%, transparent 100%),
      radial-gradient(ellipse 50% 60% at 90% 40%,  rgba(220,221,226, 0.50) 0%, transparent 100%),
      radial-gradient(ellipse 40% 30% at 50% 95%,  rgba( 90,74, 120, 0.04) 0%, transparent 100%);
  }
}

body {
  margin: 0 auto;
  max-width: 640px;
  padding: 2rem;
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: var(--line-h);
  hyphens: auto;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

/* ── Headings ────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--lime);
  margin-top: 1.4em;
  font-weight: 600;
}

h1 {
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

h5, h6 {
  font-size: 0.875rem;
  font-style: italic;
}

h6 { font-weight: normal; }

/* ── Text ────────────────────────────────────────────────────────── */
p { margin: 0.75em 0; }

a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:visited             { color: var(--purple); }
a:hover, a:focus      { color: var(--lime); outline: none; }

strong { color: var(--lime); }
em     { color: var(--muted); font-style: italic; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}

/* ── Glass surface ───────────────────────────────────────────────── */
/* Applied to raised/inset surfaces: blockquotes, code blocks, tables */
blockquote,
pre,
table,
.panel {
  background:
    radial-gradient(ellipse at bottom right, rgba(114,135,253, 0.10) 0%, transparent 65%),
    linear-gradient(135deg, rgba(255,255,255, 0.10) 0%, rgba(255,255,255, 0.03) 50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255, 0.10),
          0 1px 24px rgba(0,0,0, 0.40);
  border-radius: var(--radius);
}

/* ── Blockquote ──────────────────────────────────────────────────── */
blockquote {
  margin: 1em 0;
  padding: 0.75em 1em;
  color: var(--muted);
  border-left: 2px solid var(--cyan);
}

/* ── Code ────────────────────────────────────────────────────────── */
code {
  font-family: var(--font);
  font-size: 0.9em;
  color: var(--lime);
  background: rgba(154, 206, 106, 0.08);
  padding: 0.1em 0.3em;
  border-radius: var(--radius);
  hyphens: manual;
}

pre {
  margin: 1em 0;
  padding: 1em;
  overflow: auto;
}

pre code {
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: var(--font-size);
  overflow-wrap: normal;
}

/* ── Tables ──────────────────────────────────────────────────────── */
table {
  margin: 1em 0;
  border-collapse: collapse;
  width: 100%;
  overflow-x: auto;
  display: block;
  font-variant-numeric: lining-nums tabular-nums;
}

th {
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

td {
  padding: 0.375em 0.75em;
  border-bottom: 1px solid rgba(100,110,180, 0.10);
}

tbody tr:last-child td { border-bottom: none; }

/* ── Lists ───────────────────────────────────────────────────────── */
ol, ul {
  padding-left: 1.5em;
  margin-top: 0.75em;
}

li > ol, li > ul { margin-top: 0; }

/* ── Images / Media ──────────────────────────────────────────────── */
img { max-width: 100%; border-radius: var(--radius); }
svg { height: auto; max-width: 100%; }

/* ── Pandoc: header block ────────────────────────────────────────── */
header {
  margin-bottom: 3em;
  padding-bottom: 1em;
  border-bottom: 1px solid var(--border);
}

/* ── Pandoc: TOC ─────────────────────────────────────────────────── */
#TOC {
  padding: 1em;
  margin-bottom: 2em;
}

#TOC li            { list-style: none; }
#TOC ul            { padding-left: 1.2em; }
#TOC > ul          { padding-left: 0; }
#TOC a:not(:hover) { text-decoration: none; }

/* ── Pandoc: task lists ──────────────────────────────────────────── */
ul.task-list[class] { list-style: none; }

ul.task-list li input[type="checkbox"] {
  font-size: inherit;
  width: 0.8em;
  margin: 0 0.8em 0.2em -1.6em;
  vertical-align: middle;
  accent-color: var(--cyan);
}

/* ── Pandoc: math / columns / small-caps ─────────────────────────── */
.display.math       { display: block; text-align: center; margin: 0.5rem auto; }
span.smallcaps      { font-variant: small-caps; }
div.columns         { display: flex; gap: min(4vw, 1.5em); }
div.column          { flex: auto; overflow-x: auto; }
div.hanging-indent  { margin-left: 1.5em; text-indent: -1.5em; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 1rem; font-size: 0.8rem; }
  h1   { font-size: 1.3rem; }
}

/* ── Graph view ──────────────────────────────────────────────────── */
/* Full-viewport canvas; breaks out of the centered body layout */
#graph {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

body:has(#graph) {
  overflow: hidden;
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  html { background: white; background-image: none; }
  body { color: black; font-size: 12pt; }

  blockquote, pre, table, .panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #f5f5f5;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  a { color: black; }

  p, h2, h3  { orphans: 3; widows: 3; }
  h2, h3, h4 { page-break-after: avoid; }
}
