/* eucite.com — minimal, fast, no framework. One web font (Manrope, display
   weight only, already preconnected in base.html) for headings; everything
   else is the system stack so there's no extra render-blocking request on
   body text. Theme: black/white/gray throughout, with EU blue reserved for
   the "eu" in the [eu]cite logo — nowhere else. */

:root {
  --text: #0a0a0a;
  --muted: #565d6b;
  --faint: #8a90a0;
  --bg: #ffffff;
  --bg-alt: #fafafb;
  --line: #e4e7ec;
  --line-soft: #eef0f4;
  --accent: #0a0a0a;
  --accent-ink: #0a0a0a;
  --accent-bg: #eef0f3;
  --unindexed: #9a6b00;
  --unindexed-bg: #fff8e6;
  --card-bg: #ffffff;
  --eu-blue: #003399;
  --radius: 8px;
  --maxw: 980px;
  --sidebar-w: 320px;
  --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* This site is pinned to the black/white theme regardless of the visitor's
   OS/browser dark-mode setting — no separate dark palette, so pages never
   drift from the [eu]cite brand look. */

* { box-sizing: border-box; }
html { color-scheme: light; }

body {
  margin: 0;
  padding: 0 20px 80px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
}

a { color: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- header ---------- */

header.site {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.site-header-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

a.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.brand-eu { color: var(--eu-blue); }
.brand-bracket { color: var(--text); }

form.search {
  position: relative;
  flex-grow: 1;
  max-width: 420px;
}

form.search input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 0.95rem;
}
form.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(20, 30, 60, 0.14);
  max-height: 360px;
  overflow-y: auto;
  z-index: 30;
}
#search-results a {
  display: block;
  padding: 9px 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
}
#search-results a:last-child { border-bottom: none; }
#search-results a:hover, #search-results a.active { background: var(--accent-bg); }
#search-results .sr-title { font-weight: 600; }
#search-results .sr-meta { color: var(--muted); font-size: 0.8rem; display: block; }

.header-nav { white-space: nowrap; font-size: 0.92rem; }
.header-nav a { text-decoration: none; }

/* ---------- layout shell ---------- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
}

h1 { font-size: 1.7rem; margin: 1em 0 0.4em; }
h2 { font-size: 1.2rem; margin: 1.8em 0 0.6em; }
h3 { font-size: 1rem; margin: 1.4em 0 0.5em; }

.meta { color: var(--muted); font-size: 0.92rem; }

.breadcrumb { color: var(--muted); font-size: 0.85rem; margin: 1.2em 0 0.6em; }
.breadcrumb a { text-decoration: none; }
.breadcrumb .sep { padding: 0 4px; color: var(--line); }

.chapter-head { margin-top: 1.8em; }
.chapter-head-title { color: var(--muted); font-weight: 500; }
.section-head { margin: 1em 0 0.3em; font-size: 0.88rem; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.section-head-title { text-transform: none; letter-spacing: 0; }

/* ================= HOMEPAGE: hero + mind-map ================= */

.hero-light {
  position: relative;
  overflow: hidden;
  margin: 0 -20px;
  padding: 0 20px;
  background: #ffffff;
  color: #0a0a0a;
  background-image: radial-gradient(rgba(10,10,10,.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -2px -2px;
  border-bottom: 1px solid #111;
}
.hero-inner { position: relative; max-width: 1280px; margin: 0 auto; padding: 48px 4px 44px; }
.eyebrow {
  font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: #0a0a0a; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.eyebrow .pulse { width: 6px; height: 6px; border-radius: 50%; background: #0a0a0a; box-shadow: 0 0 0 3px rgba(10,10,10,.14); }
.hero-light h1 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.04; letter-spacing: -.025em; margin: 16px 0 18px; max-width: 16ch; color: #0a0a0a;
}
.hero-light h1 em {
  font-style: normal; color: #0a0a0a;
  text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; text-decoration-color: #0a0a0a;
}
.hero-light p.lede { color: #40434c; font-size: 1.05rem; max-width: 56ch; margin: 0 0 28px; }

.graph-panel { position: relative; border: 1.5px solid #111; border-radius: 2px; background: #fff; }
.graph-panel .hint {
  position: absolute; left: 14px; top: 12px; font-size: 11px; color: #5b5f6b; text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: center; gap: 7px; pointer-events: none; z-index: 2; font-weight: 600;
}
.graph-panel .hint .dot { width: 5px; height: 5px; border-radius: 50%; background: #0a0a0a; }
#graph { display: block; width: 100%; height: min(58vh, 520px); cursor: grab; touch-action: none; }
.graph-panel .caption {
  position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; font-size: 11.5px; color: #5b5f6b; border-top: 1.5px solid #111;
}
.legend { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 8px; height: 8px; border-radius: 50%; background: #0a0a0a; }

.tooltip {
  position: absolute; pointer-events: none; background: #0a0a0a; color: #fff;
  font-size: 12.5px; line-height: 1.4; padding: 9px 12px; border-radius: 3px; max-width: 230px;
  transform: translate(-50%, -118%); opacity: 0; transition: opacity .12s ease; z-index: 5;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.tooltip b { display: block; font-weight: 700; margin-bottom: 2px; }
.tooltip .n { color: #b8bac2; }

.home-below {
  max-width: 1280px; margin: 0 auto; padding: 40px 0 8px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.stat {
  position: relative; border: 1.5px solid #111; border-radius: 2px; padding: 20px 20px 18px;
  background: #ffffff; overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #0a0a0a; }
.stat .num { font-family: var(--font-display); font-weight: 800; font-size: 2.1rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #0a0a0a; }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

.categories { margin-top: 2.2em; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.tile:hover { border-color: var(--accent); background: var(--accent-bg); }
.tile-count { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); font-size: 0.8rem; font-weight: 400; }

.row-list { list-style: none; margin: 0.4em 0; padding: 0; max-width: 720px; }
.row-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.row-list a { text-decoration: none; color: var(--text); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.row-name { font-weight: 600; }
.row-detail { color: var(--muted); font-size: 0.85rem; }
.row-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.cat-group { margin-top: 0.5em; }
.cat-group-count { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

.act-list, .article-list {
  list-style: none;
  margin: 0.6em 0;
  padding: 0;
}

.act-list li, .article-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.act-list a, .article-list a {
  text-decoration: none;
  font-weight: 600;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge.indexed { background: var(--accent-bg); color: var(--accent); }
.badge.unindexed { background: var(--unindexed-bg); color: var(--unindexed); }

/* ================= ARTICLE PAGE: sidebar + main ================= */

.article-shell {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: var(--sidebar-w) 1fr; gap: 34px; align-items: start;
}
.crumb { font-size: 12.5px; color: var(--faint); margin: 1.2em 0 1em; grid-column: 1 / -1; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb .sep { padding: 0 6px; }

.toc {
  position: sticky; top: 16px; max-height: calc(100vh - 32px);
  background: var(--card-bg); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,23,31,.05), 0 12px 28px -18px rgba(20,23,31,.18);
}
.toc-head { padding: 15px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.toc-head .act-name { font-weight: 700; font-size: .95rem; }
.toc-head .act-meta { color: var(--faint); font-size: 11.5px; margin-top: 3px; }
.toc-scroll { overflow-y: auto; padding: 8px; }

.toc-chapter { margin-bottom: 2px; }
.toc-chapter > summary {
  list-style: none; cursor: pointer; padding: 9px 8px; border-radius: 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.toc-chapter > summary::-webkit-details-marker { display: none; }
.toc-chapter > summary:hover { background: var(--line-soft); }
.toc-chapter .clabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 800; }
.toc-chapter .ctitle { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.toc-chapter .chev { color: var(--faint); font-size: 10px; transition: transform .15s; flex: 0 0 auto; }
.toc-chapter[open] > summary .chev { transform: rotate(90deg); }
.toc-section { margin: 2px 0 6px 10px; position: relative; }
.toc-section::before { content: ''; position: absolute; left: -2px; top: 2px; bottom: 6px; width: 1.5px; background: var(--line); }
.toc-section .stitle {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint);
  padding: 6px 8px 2px 12px; font-weight: 700;
}
.toc-art {
  display: flex; gap: 9px; padding: 7px 8px 7px 12px; border-radius: 8px; text-decoration: none; color: var(--text);
  font-size: 13px; align-items: baseline; position: relative;
}
.toc-art:hover { background: var(--line-soft); }
.toc-art .an { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11.5px; flex: 0 0 auto; min-width: 2.3em; }
.toc-art .at { flex: 1; }
.toc-art.current { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.toc-art.current::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: var(--accent); }
.toc-art.current .an { color: var(--accent); }
.toc-art-flat { padding-left: 8px; }

.art-main { min-width: 0; }
.art-kicker { color: var(--faint); font-size: 12.5px; margin: 1.4em 0 8px; }
.art-kicker b { color: var(--accent); }
h1.art-title { font-family: var(--font-display); font-weight: 800; font-size: 1.75rem; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 22px; }
article.art-body { color: var(--text); font-size: 15.5px; }
article.art-body p { margin: 0 0 1.1em; }

.art-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--line);
}
.art-nav a {
  display: flex; flex-direction: column; gap: 5px; text-decoration: none; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px; transition: .15s;
}
.art-nav a:hover { border-color: var(--accent); background: var(--accent-bg); }
.art-nav a.next { text-align: right; align-items: flex-end; }
.art-nav .dir { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; }
.art-nav .ttl { font-weight: 700; font-size: .92rem; }
.art-nav .num { color: var(--muted); font-size: 12px; }

.keyhint { display: inline-flex; gap: 6px; align-items: center; margin-top: 20px; color: var(--faint); font-size: 11.5px; }
kbd {
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px;
  font: 11px -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; background: var(--bg-alt);
}

/* Cross-reference hover/tap links */
a.ref {
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  color: var(--text);
  cursor: help;
  position: relative;
}
a.ref.ref-unindexed { border-bottom-color: var(--unindexed); }
a.ref:hover, a.ref:focus { background: var(--accent-bg); }
a.ref.ref-unindexed:hover, a.ref.ref-unindexed:focus { background: var(--unindexed-bg); }

#ref-tooltip {
  position: fixed;
  max-width: 420px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 10px 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  z-index: 1000;
  display: none;
  pointer-events: auto;
}
#ref-tooltip .ref-tooltip-title { font-weight: 700; margin-bottom: 4px; display: block; }
#ref-tooltip .ref-tooltip-note { color: var(--unindexed); font-size: 0.78rem; display: block; margin-top: 4px; }
#ref-tooltip .ref-tooltip-hint { color: var(--muted); font-size: 0.76rem; display: block; margin-top: 6px; }

footer.site {
  max-width: 1280px;
  margin: 3em auto 0;
  padding-top: 1em;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- tablet ---------- */
@media (max-width: 900px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-shell { grid-template-columns: 1fr; gap: 16px; }
  .toc { position: static; max-height: none; }
  .toc-scroll { max-height: 300px; }
  .home-below { grid-template-columns: 1fr; }
  :root { --maxw: 100%; }
}

/* ---------- phone ---------- */
@media (max-width: 560px) {
  body { padding: 0 14px 60px; font-size: 15.5px; }
  .hero-light { margin: 0 -14px; padding: 0 14px; }
  .hero-inner { padding: 32px 2px 30px; }
  .site-header-row { flex-wrap: wrap; }
  form.search { order: 3; flex-basis: 100%; max-width: none; }
  .header-nav { margin-left: auto; }
  .hero-light h1 { font-size: 1.9rem; }
  #graph { height: min(52vh, 420px); }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 12px; font-size: 0.85rem; }
  .row-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .art-nav { grid-template-columns: 1fr; }
  .art-nav a.next { text-align: left; align-items: flex-start; }
  #ref-tooltip { left: 12px !important; right: 12px; max-width: none; width: auto; }
}
