/* tammi.cc — one sheet. Colours are custom properties: the page, the inline
   SVG and the module's canvases all resolve the same names. */

:root {
  --ground: #f3f0e8;
  --ink: #1d1c19;
  --muted: #69655b;
  --faint: #d9d3c5;
  --accent: #3e6a47;
  --warn: #a8552f;
  --good: #3e6a47;
  --panel: #ebe6da;
  --measure: 40rem;
  --wide: 62rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #151513;
    --ink: #e9e4d8;
    --muted: #9c968a;
    --faint: #34322d;
    --accent: #8db78f;
    --warn: #d98b63;
    --good: #8db78f;
    --panel: #1d1d1a;
  }
}

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

html { background: var(--ground); color: var(--ink); }

body {
  margin: 0;
  font: 1.0625rem/1.6 var(--serif);
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}

main > * { max-width: var(--measure); }
main > section, main > .intro { max-width: none; }
section > p, section > h2, section > figure.reference { max-width: var(--measure); }

h1, h2, h3 { font-family: var(--sans); font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.6rem; margin: 3.5rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.35rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
code, output, dd, .metrics, .samples, .tape, .runtime, figcaption { font-family: var(--mono); font-size: 0.85em; }
em { font-style: italic; }

/* Introduction: words on one side, the oak on the other. */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  grid-template-areas: "text oak";
  gap: 0 clamp(1rem, 4vw, 3rem);
  align-items: center;
  min-height: min(88vh, 52rem);
}
.intro > :not(.hero-oak) { grid-column: 1; }
.intro > .hero-oak { grid-area: 1 / 2 / span 6 / 3; margin: 0; }
.intro nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-family: var(--sans); margin: 0.5rem 0 1.25rem; }
.runtime { color: var(--muted); border-left: 2px solid var(--accent); padding-left: 0.75rem; }
.hero-oak svg { width: 100%; height: auto; display: block; }
.hero-oak figcaption { color: var(--muted); text-align: center; margin-top: 0.5rem; }

@media (max-width: 52rem) {
  .intro { grid-template-columns: 1fr; grid-template-areas: none; min-height: 0; }
  .intro > .hero-oak { grid-area: auto; order: -1; max-width: 30rem; justify-self: center; width: 100%; }
}

/* The oak's strands: ink over ground-coloured gaps. */
.oak-ink { stroke: var(--ink); }
.oak-gap { stroke: var(--ground); }

/* Work. */
#work { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
#work > h2, #work > p { grid-column: 1 / -1; }
.work { background: var(--panel); border-radius: 0.5rem; padding: 1.1rem 1.25rem; }
.work p { margin: 0 0 0.5rem; }
.status { color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }

/* Laboratories. */
.lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
  gap: 1rem 1.5rem;
  align-items: start;
  margin: 1.5rem 0;
}
.lab > figure, .lab > .controls, .lab > .status, .lab > .samples { grid-column: 1; }
.lab > .sliders, .lab > .metrics, .lab > .tape { grid-column: 2; }
.oak-lab > figure { grid-row: 2 / span 3; }
.gpt-lab > .metrics { grid-row: 1 / span 3; }

@media (max-width: 48rem) {
  .lab { grid-template-columns: 1fr; }
  .lab > * { grid-column: 1 !important; grid-row: auto !important; }
}

.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
button {
  font: 500 0.9rem/1 var(--sans);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--faint);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sliders { display: grid; gap: 0.6rem; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.5rem; font: 0.85rem var(--sans); }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.controls .slider { min-width: 11rem; }

.metrics { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; margin: 0; }
.metrics dt { color: var(--muted); font-family: var(--sans); font-size: 0.8rem; }
.metrics dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

figure { margin: 0; }
figcaption { color: var(--muted); font-size: 0.78rem; margin-top: 0.4rem; }

canvas {
  display: block;
  width: 100%;
  --paint-ink: var(--ink);
  --paint-muted: var(--muted);
  --paint-faint: var(--faint);
  --paint-accent: var(--accent);
  --paint-ground: var(--ground);
  --paint-warn: var(--warn);
  --paint-good: var(--good);
  --paint-font: 11px ui-monospace, Menlo, Consolas, monospace;
}
.oak-canvas { aspect-ratio: 640 / 560; }
.gpt-lab canvas.chart { height: 16rem; }
.gpt-lab figure:nth-of-type(2) canvas { height: 22rem; }
.gpt-lab figure:nth-of-type(3) canvas { height: 12rem; }
canvas > svg { width: 100%; height: 100%; }

/* SVG rendered from canvas commands (static page, reference chart). */
.stroke-ink { stroke: var(--ink); } .fill-ink { fill: var(--ink); }
.stroke-muted { stroke: var(--muted); } .fill-muted { fill: var(--muted); }
.stroke-faint { stroke: var(--faint); } .fill-faint { fill: var(--faint); }
.stroke-accent { stroke: var(--accent); } .fill-accent { fill: var(--accent); }
.stroke-ground { stroke: var(--ground); } .fill-ground { fill: var(--ground); }
.stroke-warn { stroke: var(--warn); } .fill-warn { fill: var(--warn); }
.stroke-good { stroke: var(--good); } .fill-good { fill: var(--good); }
svg text { font: 11px var(--mono); stroke: none; }
.chart-svg svg { width: 100%; height: auto; display: block; }

.reference { margin: 1.5rem 0; padding: 1rem; background: var(--panel); border-radius: 0.5rem; }

.samples { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; list-style: none; padding: 0; margin: 0; }
.samples li { background: var(--panel); border-radius: 0.3rem; padding: 0.15rem 0.5rem; }
.samples li[hidden] { display: none; }

.tape { border-collapse: collapse; width: 100%; }
.tape > caption { text-align: left;  display: block; color: var(--muted); font-family: var(--sans); font-size: 0.8rem; margin-bottom: 0.3rem; }
.tape th { text-align: left; font-weight: 400; color: var(--muted); padding: 0.1rem 0; }
.tape td { text-align: right; font-variant-numeric: tabular-nums; }

footer { margin-top: 4rem; padding-top: 1.25rem; border-top: 1px solid var(--faint); color: var(--muted); font-family: var(--sans); font-size: 0.9rem; }
footer strong { color: var(--ink); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }
