/* neanet-labs report design system — "measured instrument"
   Signature: the neanet green bar as a left-margin measure/spine with section ticks.
   Type: Space Grotesk (display) · Source Serif 4 (body) · IBM Plex Mono (data/labels). */

:root {
  --ink: #141414;
  --ink-soft: #33383400;      /* placeholder, overridden below */
  --paper: #fbfbf9;
  --paper-alt: #f2f3ef;
  --green: #0b7a44;
  --green-deep: #063d22;
  --green-wash: #e7f1ea;
  --amber: #b9741a;           /* data-only: the "gap/waste" hue */
  --muted: #5b625d;
  --line: #e2e6df;
  --line-strong: #c8cec6;

  --measure: 66ch;
  --font-display: "Space Grotesk", "Inter Tight", system-ui, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1.06rem, 1.01rem + 0.25vw, 1.19rem);
  --step-1: clamp(1.27rem, 1.18rem + 0.45vw, 1.55rem);
  --step-2: clamp(1.52rem, 1.36rem + 0.8vw, 2.05rem);
  --step-3: clamp(1.83rem, 1.55rem + 1.4vw, 2.7rem);
  --step-4: clamp(2.2rem, 1.7rem + 2.5vw, 3.75rem);
}

:root { --ink-soft: #3a403b; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eceee9;
    --ink-soft: #b7bdb6;
    --paper: #10120f;
    --paper-alt: #1a1d19;
    --green: #48c07e;
    --green-deep: #9fe3bd;
    --green-wash: #16241c;
    --amber: #d99a4a;
    --muted: #97a09a;
    --line: #262a24;
    --line-strong: #3a3f38;
  }
}
:root[data-theme="dark"] {
  --ink: #eceee9; --ink-soft: #b7bdb6; --paper: #10120f; --paper-alt: #1a1d19;
  --green: #48c07e; --green-deep: #9fe3bd; --green-wash: #16241c; --amber: #d99a4a;
  --muted: #97a09a; --line: #262a24; --line-strong: #3a3f38;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.62;
  font-feature-settings: "onum" 1, "liga" 1;
  text-rendering: optimizeLegibility;
}

/* ---- wordmark + green bar ---- */
.wordmark { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  text-transform: lowercase; color: var(--ink); text-decoration: none; font-size: var(--step-1); }
.wordmark::after { content: ""; display: block; height: 5px; background: var(--green);
  margin-top: 3px; width: 100%; }

/* ---- layout shell ---- */
.page { max-width: 78rem; margin: 0 auto; padding: 0 clamp(1.1rem, 4vw, 3rem); }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  padding: 1.4rem 0 1.1rem; border-bottom: 1px solid var(--line); }
.topbar .brand { display: inline-block; }
.topbar nav { font-family: var(--font-mono); font-size: var(--step--1); text-transform: lowercase; }
.topbar nav a { color: var(--muted); text-decoration: none; margin-left: 1.1rem; }
.topbar nav a:hover { color: var(--green); }
.langswitch { display: inline-flex; margin-left: 1.1rem; border: 1px solid var(--line-strong);
  border-radius: 4px; overflow: hidden; vertical-align: middle; }
.langswitch button { font-family: var(--font-mono); font-size: var(--step--1); text-transform: lowercase;
  background: transparent; color: var(--muted); border: 0; padding: 0.1rem 0.5rem; cursor: pointer; line-height: 1.55; }
.langswitch button + button { border-left: 1px solid var(--line-strong); }
.langswitch button[aria-pressed="true"] { background: var(--green); color: var(--paper); }

/* ---- hero ---- */
.hero { padding: clamp(2.4rem, 6vw, 4.6rem) 0 clamp(1.8rem, 4vw, 3rem); max-width: 54rem; }
.kicker { font-family: var(--font-mono); text-transform: lowercase; letter-spacing: 0.02em;
  font-size: var(--step--1); color: var(--green); margin: 0 0 1.1rem; display: flex;
  align-items: center; gap: 0.7rem; }
.kicker::before { content: ""; width: 2.6rem; height: 4px; background: var(--green);
  display: inline-block; transform-origin: left; animation: measure 0.8s cubic-bezier(.2,.7,.2,1) both; }
@keyframes measure { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .kicker::before { animation: none; } }
.hero h1 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.025em;
  font-size: var(--step-4); line-height: 1.04; margin: 0 0 0.9rem; }
.hero .standfirst { font-size: var(--step-1); line-height: 1.44; color: var(--ink-soft);
  font-weight: 400; margin: 0 0 1.6rem; }
.meta { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.3rem; border-top: 1px solid var(--line);
  padding-top: 1rem; text-transform: lowercase; }
.meta b { color: var(--ink); font-weight: 500; }
.meta .status { color: var(--green); }

/* ---- article + the measure spine ---- */
.article { position: relative; max-width: var(--measure); margin: clamp(1.5rem,4vw,3rem) 0 4rem;
  padding-left: clamp(0.9rem, 3vw, 2.2rem); border-left: 2px solid var(--line); }
.article > h2 { position: relative; }
.article > h2::before { content: ""; position: absolute; left: calc(-1 * clamp(0.9rem,3vw,2.2rem) - 2px);
  top: 0.62em; width: clamp(0.6rem,2vw,1.3rem); height: 3px; background: var(--green); }

.article h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em;
  font-size: var(--step-2); line-height: 1.12; margin: 2.6rem 0 0.9rem; }
.article h3 { font-family: var(--font-display); font-weight: 500; font-size: var(--step-1);
  letter-spacing: -0.01em; margin: 2rem 0 0.6rem; }
.article h4 { font-family: var(--font-mono); text-transform: lowercase; letter-spacing: 0.01em;
  font-size: var(--step-0); color: var(--muted); margin: 1.6rem 0 0.5rem; }
.article p { margin: 0 0 1.1rem; }
.article a { color: var(--green); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.article a:hover { border-bottom-color: var(--green); }
.article strong { font-weight: 600; }
.article ul, .article ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.article li { margin: 0.35rem 0; }
.article blockquote { margin: 1.4rem 0; padding: 0.4rem 0 0.4rem 1.2rem; border-left: 3px solid var(--green);
  color: var(--ink-soft); font-style: italic; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 2.4rem 0; }

/* numbers, standards, code inline */
.article code { font-family: var(--font-mono); font-size: 0.88em; background: var(--paper-alt);
  padding: 0.08em 0.35em; border-radius: 3px; }
.article pre { background: var(--paper-alt); border: 1px solid var(--line); border-radius: 6px;
  padding: 1rem 1.1rem; overflow-x: auto; font-size: var(--step--1); }
.article pre code { background: none; padding: 0; }

/* ---- tables ---- */
.table-figure { margin: 1.5rem 0; max-width: 100%; }
.table-wrap { overflow-x: auto; width: fit-content; max-width: 100%;
  border: 1px solid var(--line); border-radius: 6px; }
.table-figure > .table-wrap { margin: 0; }
table { border-collapse: collapse; width: auto; max-width: 100%; font-size: var(--step--1); }
.table-figure > figcaption { text-align: left; margin-top: 0.55rem; max-width: 46rem; }
thead th { font-family: var(--font-mono); text-transform: lowercase; letter-spacing: 0.01em;
  text-align: left; color: var(--ink); background: var(--green-wash); padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--green); white-space: nowrap; }
tbody td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--paper-alt); }
table td:not(:first-child), table th:not(:first-child) { font-variant-numeric: tabular-nums; }

/* ---- key-figure callout ---- */
.keyfig { display: flex; gap: 1rem; align-items: baseline; margin: 1.6rem 0; padding: 1rem 1.2rem;
  background: var(--green-wash); border-left: 4px solid var(--green); border-radius: 0 6px 6px 0; }
.keyfig .num { font-family: var(--font-mono); font-size: var(--step-3); font-weight: 600;
  color: var(--green-deep); line-height: 1; }
.keyfig .lbl { color: var(--ink-soft); font-size: var(--step--1); }

/* ---- figures / charts ---- */
figure { margin: 1.8rem 0; }
figure canvas { max-width: 100%; }
figcaption { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted);
  margin-top: 0.6rem; text-transform: none; }
figcaption .cap-n { color: var(--green); font-weight: 600; }

/* ---- footnotes / references ---- */
.footnote-ref, sup a { font-family: var(--font-mono); font-size: 0.72em; color: var(--green);
  text-decoration: none; padding: 0 0.1em; }
.references { max-width: var(--measure); margin: 2rem 0 4rem; padding-left: clamp(0.9rem,3vw,2.2rem); }
.references h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1);
  margin: 0 0 1rem; }
.references ol { font-family: var(--font-mono); font-size: var(--step--1); line-height: 1.5;
  color: var(--ink-soft); padding-left: 1.4rem; }
.references li { margin: 0.5rem 0; }
.references a { color: var(--green); word-break: break-word; }

/* ---- footer ---- */
.sitefoot { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.6rem 0 3rem;
  font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted);
  text-transform: lowercase; display: flex; flex-direction: column; gap: 0.5rem; }
.sitefoot .sf-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.35rem 1.2rem; }
.sitefoot .sf-sub { font-size: 0.92em; opacity: 0.85; }
.sitefoot a { color: var(--green); text-decoration: none; }
.sitefoot a:hover { text-decoration: underline; }

/* ---- landing / contents ---- */
.lede { max-width: 40rem; font-size: var(--step-1); color: var(--ink-soft); margin: 2rem 0 2.6rem; }
.report-list { list-style: none; padding: 0; margin: 0 0 3rem; border-top: 1px solid var(--line); }
.report-list li { border-bottom: 1px solid var(--line); }
.report-list a { display: grid; grid-template-columns: 3ch 1fr auto; gap: 0 1.2rem; align-items: baseline;
  padding: 1.15rem 0.2rem; text-decoration: none; color: var(--ink); transition: background 0.15s; }
.report-list a:hover { background: var(--green-wash); }
.report-list .idx { font-family: var(--font-mono); color: var(--green); font-size: var(--step--1); }
.report-list .t { font-family: var(--font-display); font-weight: 500; font-size: var(--step-1);
  letter-spacing: -0.01em; }
.report-list .t small { display: block; font-family: var(--font-body); font-weight: 400;
  font-size: var(--step--1); color: var(--muted); letter-spacing: 0; margin-top: 0.15rem; }
.report-list .rt { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted);
  text-transform: lowercase; white-space: nowrap; }
.report-list .rt .st { color: var(--green); }

@media (max-width: 600px) {
  .report-list a { grid-template-columns: 2ch 1fr; }
  .report-list .rt { grid-column: 2; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 2px; }

/* ---- charts (server-side SVG) ---- */
:root {
  --cs1: #0b7a44; --cs2: #b9741a; --cs3: #3a6ea5;
  --cs4: #6b746d; --cs5: #075130; --cs6: #9c6b3f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cs1: #48c07e; --cs2: #d99a4a; --cs3: #6ea3d6;
    --cs4: #9aa39c; --cs5: #9fe3bd; --cs6: #c79a6a;
  }
}
:root[data-theme="dark"] {
  --cs1: #48c07e; --cs2: #d99a4a; --cs3: #6ea3d6;
  --cs4: #9aa39c; --cs5: #9fe3bd; --cs6: #c79a6a;
}
figure.chart { margin: 1.8rem 0; }
figure.chart svg { width: 100%; height: auto; max-width: 100%; display: block; }
.cw-donut { max-width: 300px; margin: 0 auto; }
.cs1 { fill: var(--cs1); } .cs2 { fill: var(--cs2); } .cs3 { fill: var(--cs3); }
.cs4 { fill: var(--cs4); } .cs5 { fill: var(--cs5); } .cs6 { fill: var(--cs6); }
.cl1 { stroke: var(--cs1); } .cl2 { stroke: var(--cs2); } .cl3 { stroke: var(--cs3); }
.cl4 { stroke: var(--cs4); } .cl5 { stroke: var(--cs5); } .cl6 { stroke: var(--cs6); }
.cw-line { stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.cw-grid { stroke: var(--line); stroke-width: 1; }
.cw-xlabel, .cw-ylabel { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.cw-barval { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-soft); }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem;
  padding: 0; margin: 0.7rem 0 0; font-family: var(--font-mono); font-size: var(--step--1);
  color: var(--ink-soft); justify-content: center; }
.chart-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend .swatch { width: 0.75rem; height: 0.75rem; border-radius: 2px; display: inline-block; }
.swatch.cs1 { background: var(--cs1); } .swatch.cs2 { background: var(--cs2); }
.swatch.cs3 { background: var(--cs3); } .swatch.cs4 { background: var(--cs4); }
.swatch.cs5 { background: var(--cs5); } .swatch.cs6 { background: var(--cs6); }
figure.chart figcaption { text-align: center; }

/* Print: A4 page geometry (Swedish printers). Chrome's printToPDF also sets
   paper size explicitly; this @page keeps browser Ctrl-P and any paged-media
   engine on A4 too. */
@page { size: A4; }
@media print {
  /* Print density: the fluid clamp() type scale resolves its vw term against
     the full A4 width, forcing every size to its upper bound — huge in print.
     Pin the scale to fixed, smaller values and tighten spacing so a report
     prints in ~half the pages without touching the on-screen design. */
  :root {
    --step--1: 8pt; --step-0: 9.5pt; --step-1: 11pt;
    --step-2: 13.5pt; --step-3: 16pt; --step-4: 20pt;
    --measure: none;
  }
  html { font-size: 10pt; }
  body { background: #fff; color: #000; }
  .page { max-width: none; padding: 0; }
  .topbar, .langswitch, .sitefoot { display: none; }
  a { color: inherit; text-decoration: none; }

  .hero { padding: 0 0 0.5rem; max-width: none; }
  .hero h1 { margin: 0 0 0.4rem; line-height: 1.05; }
  .hero .standfirst { line-height: 1.3; }
  .meta { margin: 0.5rem 0 0; }

  .article { max-width: none; margin: 0.6rem 0 0.8rem; line-height: 1.34; }
  .article p { margin: 0 0 0.55rem; }
  .article h2 { margin: 1rem 0 0.45rem; line-height: 1.1; }
  .article h3 { margin: 0.8rem 0 0.35rem; }
  .article h2::before { display: none; }   /* drop the hanging green tick indent */
  .article ul, .article ol { margin: 0 0 0.55rem; padding-left: 1.4em; }
  .article li { margin: 0 0 0.2rem; }
  table { font-size: 8.5pt; }
  th, td { padding: 3pt 6pt; }
  .table-figure { margin: 0.7rem 0; break-inside: avoid; }
  .table-wrap { overflow: visible; margin: 0; }  /* no scrollbar in PDF */
  .table-figure > figcaption { font-size: 8pt; margin-top: 0.3rem; }

  /* Charts: cap height so a donut/bar never eats a whole page, and centre. */
  figure.chart { margin: 0.7rem 0; text-align: center; break-inside: avoid; }
  figure.chart svg { width: auto; max-width: 100%; max-height: 58mm; }
  .cw-donut { max-width: 52mm; }
  .chart-legend { font-size: 8pt; margin-top: 0.4rem; }
  figure.chart figcaption { font-size: 8pt; }

  /* References: dense list, small type — it was very spacious. */
  .references { max-width: none; margin: 0.8rem 0 0; padding-left: 1.2em; }
  .references h2 { margin: 0.8rem 0 0.4rem; }
  .references li, .references ol { font-size: 8pt; line-height: 1.3; margin: 0 0 0.15rem; }

  table, pre, .table-figure, figure.chart { break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; break-inside: avoid; }
  p, li { orphans: 2; widows: 2; }
}
