/* Shared layout for the project sites (CUDA-METRO, poissonCUDA) that sit under
   arkavo.github.io. Loaded after theme.css, which supplies the palette, type,
   nav, controls and canvas layer. Same origin, so one copy serves all of them. */

/* ---- masthead ---- */

.proj-head {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 2rem;
}

.proj-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.proj-name {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-text);
}

.proj-tagline {
  max-width: var(--measure);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ---- badges ---- */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

a.badge:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.badge b {
  color: var(--fg);
  font-weight: 600;
}

/* ---- in-page section nav ---- */

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  list-style: none;
}

.doc-nav a {
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.doc-nav a:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-text);
}

/* ---- prose ---- */

.prose {
  max-width: var(--measure);
}

.prose p,
.prose li {
  color: var(--muted);
  line-height: 1.7;
}

.prose p + p {
  margin-top: 1rem;
}

.prose ul,
.prose ol {
  margin: 1rem 0;
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose strong {
  color: var(--fg);
  font-weight: 600;
}

.prose h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.05rem;
}

.prose h3:first-child {
  margin-top: 0;
}

/* ---- code ---- */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-text);
}

.prose p code,
.prose li code,
td code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}

pre {
  margin: 1.1rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--surface);
  backdrop-filter: blur(6px);
  /* long command lines scroll rather than widening the page */
  overflow-x: auto;
}

pre code {
  color: var(--fg);
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre;
  background: none;
  border: 0;
  padding: 0;
}

pre .c {           /* comment */
  color: var(--muted);
}

pre .k {           /* keyword / emphasis */
  color: var(--accent-text);
}

/* ---- tables ---- */

.table-wrap {
  margin: 1.25rem 0;
  overflow-x: auto;   /* never let a wide table push the page sideways */
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  padding: 0.55rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
  white-space: nowrap;
}

td {
  color: var(--muted);
  line-height: 1.6;
}

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

tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

td.num {
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
}

/* ---- figures ---- */

.figure {
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  overflow: hidden;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  /* the plots are published on white; this keeps them from glaring in dark */
  background: #fff;
}

.figure figcaption {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.figure figcaption b {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- callout ---- */

.note {
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  background: var(--surface);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
}

.note b {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* ---- stat strip ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.stat {
  padding: 1rem 1.1rem;
  background: var(--bg);
}

.stat dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat dd {
  margin: 0.3rem 0 0;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-text);
}

/* ---- project sections are content-led, not screen-height ---- */

.section-doc {
  min-height: 0;
  padding-bottom: 1rem;
}

.section-doc + .section-doc {
  padding-top: 1rem;
}

@media (max-width: 640px) {
  .proj-head {
    padding-top: 1rem;
  }

  th, td {
    padding: 0.45rem 0.6rem;
  }
}

/* ---- chart ---- */

.chart {
  margin: 1.5rem 0;
  padding: 1.25rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  backdrop-filter: blur(6px);
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart .ax {                 /* axis rules */
  stroke: var(--fg);
  stroke-opacity: 0.28;
  stroke-width: 1;
}

.chart .grid {
  stroke: var(--fg);
  stroke-opacity: 0.1;
  stroke-width: 1;
}

.chart .tick {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.chart .axlabel {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart .series {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* three series, ordered by how much the story rests on them */
.chart .s30 { stroke: var(--accent); }
.chart .s20 { stroke: var(--fg); stroke-opacity: 0.55; }
.chart .s10 { stroke: var(--muted); stroke-opacity: 0.7; stroke-dasharray: 4 4; }

.chart .dot30 { fill: var(--accent); }
.chart .dot20 { fill: var(--fg); fill-opacity: 0.55; }
.chart .dot10 { fill: var(--muted); }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.chart-legend i {
  width: 0.9rem;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
}

.chart-legend .k30 { border-color: var(--accent); }
.chart-legend .k20 { border-color: var(--fg); opacity: 0.55; }
.chart-legend .k10 { border-color: var(--muted); border-top-style: dashed; }

/* ---- named equation terms ----
   Set with real <sub>/<sup> rather than Unicode modifier letters. Those are
   fixed-size characters a monospace face drops into a whole cell, so they can
   never sit at the right height against their base — the equation ends up
   reading as ASCII art. Proper markup positions against the baseline, scales
   with the type, and does not depend on the font carrying the glyph. */

.eq {
  margin: 1.4rem 0;
}

.eq-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.eq-row:first-child {
  border-top: 1px solid var(--border);
}

.eq-name {
  font-family: var(--font-math);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-text);
  white-space: nowrap;
}

.eq-name sub {
  font-size: 0.62em;
  font-weight: 400;
}

.eq-expr {
  font-family: var(--font-math);
  font-size: 0.98rem;
  line-height: 2.6;
  color: var(--fg);
  overflow-x: auto;
}

.eq-expr sub,
.eq-expr sup {
  font-size: 0.64em;
  line-height: 0;
  position: relative;
}

.eq-expr sub { bottom: -0.3em; }
.eq-expr sup { top: -0.5em; }

.eq-op {                      /* operators get air around them */
  color: var(--muted);
  padding: 0 0.15em;
}

/* summation with its limits stacked above and below the sigma */
/* An inline-flex box takes its baseline from its FIRST line, which here is the
   upper limit — so the rest of the equation aligned to the little "4" and the
   sigma dropped below the text. `middle` aligns the box centre instead. */
.sum {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1.05;
  margin: 0 0.3em;
}

.sum-sig {
  font-size: 1.4em;
}

.sum-lim {
  font-size: 0.58em;
  color: var(--muted);
  white-space: nowrap;
}

.sum-lim sub { bottom: 0; }

.eq-total {
  border-bottom: 0;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.eq-total .eq-expr {
  color: var(--fg);
}

@media (max-width: 640px) {
  .eq-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .eq-expr {
    font-size: 0.9rem;
  }
}

/* ---- chart ---- */

.chart {
  margin: 1.5rem 0;
  padding: 1.25rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  backdrop-filter: blur(6px);
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart .ax {                 /* axis rules */
  stroke: var(--fg);
  stroke-opacity: 0.28;
  stroke-width: 1;
}

.chart .grid {
  stroke: var(--fg);
  stroke-opacity: 0.1;
  stroke-width: 1;
}

.chart .tick {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.chart .axlabel {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart .series {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* three series, ordered by how much the story rests on them */
.chart .s30 { stroke: var(--accent); }
.chart .s20 { stroke: var(--fg); stroke-opacity: 0.55; }
.chart .s10 { stroke: var(--muted); stroke-opacity: 0.7; stroke-dasharray: 4 4; }

.chart .dot30 { fill: var(--accent); }
.chart .dot20 { fill: var(--fg); fill-opacity: 0.55; }
.chart .dot10 { fill: var(--muted); }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.chart-legend i {
  width: 0.9rem;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
}

.chart-legend .k30 { border-color: var(--accent); }
.chart-legend .k20 { border-color: var(--fg); opacity: 0.55; }
.chart-legend .k10 { border-color: var(--muted); border-top-style: dashed; }

/* ---- named equation terms ---- */

.eq {
  margin: 1.25rem 0;
}

.eq-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  align-items: start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.eq-row:first-child {
  border-top: 1px solid var(--border);
}

.eq-name {
  padding-top: 0.15rem;
  font-family: var(--font-math);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent-text);
  white-space: nowrap;
}

.eq-body {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  overflow-x: auto;
}

.eq-body code {
  font-family: var(--font-math);
  font-size: 0.84rem;
  line-height: 1.75;
}

/* the total restates the parts, so it carries the emphasis */
.eq-total {
  border-bottom: 0;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.eq-total .eq-body code {
  color: var(--fg);
}

.eq-note {
  margin-top: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .eq-row {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}

/* formula blocks, as opposed to shell or code samples */
.math-block code {
  font-family: var(--font-math);
  font-size: 0.84rem;
  line-height: 1.75;
}
