/* Variables */
:root {
  --bg: #fdfdfc;
  --fg: #1c1e21;
  --muted: #5c6470;
  --accent: #3D6AC9;
  --accent-soft: #e6ecfa;
  --eclass: #16B0A6;
  --eclass-soft: #ddf4f2;
  --eclass-line: #0e8a82;
  --border: #e3e5e8;
  --band-alt: #f4f5f3;
  --wip: #92600a;
  --wip-bg: #fdf1da;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --fg: #e8eaed;
    --muted: #9aa3af;
    --accent: #7CA0E4;
    --accent-soft: #1c2740;
    --eclass: #3FCFC3;
    --eclass-soft: #0e302e;
    --eclass-line: #5cd8ce;
    --border: #31353c;
    --band-alt: #1b1e23;
    --wip: #ecc06a;
    --wip-bg: #3a2e14;
  }
}

/* Base */
* { box-sizing: border-box; }
html { scroll-padding-top: 2rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main { padding: 0; }

/* Bands: full-bleed horizontal strips, each centring its own content.
   The page is a stack of them, separated by hairlines and alternating tint. */
.band {
  position: relative;
  padding: 3.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.band-alt { background: var(--band-alt); }
/* The footer draws its own top rule, so the last band must not add a second. */
main .band:last-child { border-bottom: none; }
.band-inner {
  position: relative;
  z-index: 1;
  max-width: 66rem;
  margin: 0 auto;
}
/* Prose reads badly at band width, so subpages narrow their inner column. */
.band-inner.narrow { max-width: 46rem; }

/* Section headings are numbered rules rather than underlined titles. */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.section-num::after {
  content: "/";
  margin-left: 0.6rem;
  color: var(--border);
}
/* Trailing rule runs out to the edge of the band's content column. */
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.82em;
  background: rgba(127, 131, 139, 0.15);
  padding: 0.08em 0.35em;
  border-radius: 5px;
}
p { margin: 0 0 1rem; }
.lead { font-size: 1.06rem; font-weight: 600; color: var(--fg); text-align: justify; }
.inline-logo { height: 1.1em; vertical-align: -0.05em; margin-right: 0.2em; }
/* Highlighted terms are underlined rather than pilled: no capsule and no padding,
   so the line of prose keeps its rhythm. .keyword-alt marks the second family of
   terms in the e-graph colour. */
.keyword,
.keyword-alt {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
  text-decoration-skip-ink: auto;
}
.keyword-alt { color: var(--eclass); }

/* Work-in-progress badge, inline in the top bar. Amber is used here and nowhere
   else, so it reads as a notice rather than as part of the palette. */
.wip {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wip);
  background: var(--wip-bg);
  border: 1px solid var(--wip);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  white-space: nowrap;
}

/* Top bar: static, transparent, riding on the hero band and scrolling away
   with it. There is no fixed chrome anywhere on the page. */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 66rem;
  margin: 0 auto 2.75rem;
}
.topbar-brand { display: inline-flex; align-items: center; }
.topbar-logo {
  height: 1.8rem;
  width: auto;
  display: block;
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 500;
}
.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid transparent;
}
.topbar-nav a:hover {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
@media (max-width: 34rem) {
  .topbar-nav { margin-left: 0; gap: 1rem; font-size: 0.85rem; }
}

/* Hero band: full-bleed, no card frame. Tinted so it reads as the page's opening
   plate rather than as another boxed section. */
.band-hero {
  padding: 1.6rem 1.5rem 4rem;
  background: linear-gradient(180deg, var(--accent-soft), var(--bg) 78%);
}
.hero { text-align: center; }
.hero .lead { max-width: 42rem; margin-inline: auto; }
/* The hero logo is a static image; only its box is styled here. */
.hero-logo {
  display: block;
  width: min(100%, 34rem);
  height: auto;
  margin: 0 auto 1.25rem;
}

.tagline {
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
  letter-spacing: -0.015em;
  margin: 0 auto;
  max-width: 34rem;
}
.hero hr {
  border: none;
  width: 3.5rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin: 1.75rem auto 1.75rem;
}

/* Figures */
.fig-run {
  margin: 0.5rem auto 1.75rem;
  max-width: 27rem;
}
.fig-run img {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}
.fig-run figcaption { display: none; }
.fig-run.fig-wide { max-width: 42rem; }

/* Diagrams (SVG illustrations and animations) */
@keyframes march {
  to { stroke-dashoffset: -15.5; }
}
@keyframes flow {
  to { stroke-dashoffset: -100; }
}
.diagram .packet path {
  fill: none;
  stroke: var(--eclass);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 12 88;
  animation: flow 1.2s linear infinite;
  animation-play-state: paused;
  visibility: hidden;
}
.entry:hover .packet path {
  animation-play-state: running;
  visibility: visible;
}
.entry:hover .eclass {
  animation: march 1.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .diagram .packet { display: none; }
  .entry:hover .eclass { animation: none; }
}
.diagram .eclass {
  fill: none;
  stroke: var(--eclass);
  stroke-width: 2.5;
  stroke-dasharray: 5 4;
  stroke-dashoffset: 2.5;
  stroke-linecap: round;
}
.diagram .enode { fill: var(--eclass); }
.diagram .edge { stroke: var(--muted); stroke-width: 2.5; fill: none; }
.diagram .vbox {
  fill: var(--eclass-soft);
  stroke: var(--eclass-line);
  stroke-width: 2;
}
.diagram .vlabel {
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  fill: var(--fg);
}

/* Library index: numbered rows, no boxes. A left rail carries the index numeral
   and a vertical rule; hairlines separate the rows and cross the rail. */
.entries {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  border-top: 1px solid var(--border);
}
.entry {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 16rem;
  column-gap: 2rem;
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--border);
}
.entry-num {
  align-self: stretch;
  border-right: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--accent);
}
.entry-title {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.entry-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
/* Status sits at the foot of the prose instead of in a button row. */
.entry-status {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
a.entry-status {
  color: var(--accent);
  text-decoration: none;
}
a.entry-status:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.entry-figure { align-self: center; }
.entry-figure svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Below band width the figure drops under the prose, still inside the rail. */
@media (max-width: 52rem) {
  .entry {
    grid-template-columns: 3rem minmax(0, 1fr);
    row-gap: 1.5rem;
  }
  .entry-figure {
    grid-column: 2;
    max-width: 20rem;
  }
}
/* On phones the rail folds away and the numeral leads the title. */
@media (max-width: 34rem) {
  .entry {
    grid-template-columns: 1fr;
    row-gap: 1rem;
    padding: 1.75rem 0;
  }
  .entry-num {
    border-right: none;
    margin-bottom: -0.5rem;
  }
  .entry-figure { grid-column: 1; }
}

/* Publications */
/* Placeholder for a section with nothing in it yet */
.empty-note {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.35rem;
  margin-bottom: 1rem;
}

/* Read-more button (links to the background subpage) */
.readmore-wrap {
  text-align: center;
  margin: 0 0 2.5rem;
}
.readmore-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.35rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.readmore-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Subpage helpers */
.backlink { font-size: 0.92rem; }
.page-title {
  font-size: 1.7rem;
  margin: 0.5rem 0 1rem;
  letter-spacing: -0.01em;
}

/* Credits logos */
.credit-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0.5rem;
}
.credit-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.credit-logo:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.credit-logo img {
  display: block;
  height: 40px;
  width: auto;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(to top, rgba(127, 131, 139, 0.04), rgba(127, 131, 139, 0) 55%);
  color: var(--muted);
  font-size: 0.88rem;
  padding: 1.5rem;
  text-align: center;
}
footer a { color: var(--muted); }
