/* Stroke Innovation Lab — Particle.ai-inspired design system.
   Tokens sampled from particle.ai (Oct 2026 blog):
   paper #f7f5e4, sand #eeecd4, ink #171715, voltage #f4c900,
   ember #f07700, pulse #e980cd, sky #5dc4de, stone #c9c7b8.
   Type: Rza-like serif display / Saans-like sans body / mono tags.
   Fonts are system stacks (no webfont downloads) — see README. */

/* Tokyo Night-shifted Particle palette. Light = Tokyo Night Light
   surfaces (cooler/darker than Particle's #f7f5e4); Dark = Tokyo Night
   (#1a1b26 / #c0caf5 / #7aa2f7 family) with Particle-warm accents. */
:root {
  color-scheme: light;
  --paper: #e4e5ee;
  --sand: #d6d8e4;
  --ink: #16161e;
  --ink-soft: #2a2e44;
  --muted: #494f6e;
  --faint: #6a7194;
  --voltage: #e8b10e;
  --voltage-deep: #c99700;
  --ember: #dd6a1f;
  --ember-deep: #b95412;
  --pulse: #d97bb8;
  --sky: #5aa9e6;
  --sky-deep: #1f5f99;
  --stone: #aeb2c6;
  --stone-light: #c6c9da;
  --line: #16161e;
  --line-soft: #b4b8cc;
  --focus: #c41e3a;
  --on-accent: #16161e;

  --font-display: "Rza", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Saans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Md Thermochrome", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --max: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius-card: 6px;
  --radius-frame: 10px;
}

/* Light is the site-wide default. Dark applies only after explicit toggle. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1a1b26;
  --sand: #1f2335;
  --ink: #c0caf5;
  --ink-soft: #a9b1d6;
  --muted: #8f97bd;
  --faint: #6d7599;
  --voltage: #e0af68;
  --voltage-deep: #c9974f;
  --ember: #ff9e64;
  --ember-deep: #e07b3f;
  --pulse: #bb9af7;
  --sky: #7dcfff;
  --sky-deep: #7aa2f7;
  --stone: #7a82a6;
  --stone-light: #2a2f4a;
  --line: #c0caf5;
  --line-soft: #333a5c;
  --focus: #ff7a93;
  --on-accent: #16161e;
}
/* No system-dark override: first paint is light unless the visitor
   explicitly chooses dark with the header toggle. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--voltage); color: var(--on-accent); }

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

img { max-width: 100%; height: auto; }

a { color: var(--ink); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 0 0 6px 6px;
}
.skip-link:focus { top: 0; color: var(--paper); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-mark {
  width: 2rem; height: 2rem;
  flex: none;
}
.brand small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.site-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
}
.site-nav a:hover { background: var(--sand); }
.site-nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}
.site-nav a.nav-cta {
  background: var(--voltage);
  color: var(--on-accent);
  border: 1px solid var(--ink);
  font-weight: 600;
  margin-left: 0.4rem;
}
.site-nav a.nav-cta:hover { background: var(--voltage-deep); }

/* ---------- Typography & editorial ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); margin: 0 0 1.2rem; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin: 0 0 1rem; }
h3 { font-size: 1.3rem; margin: 0 0 0.5rem; }
p { margin: 0 0 1.1rem; }
.lede { font-size: clamp(1.15rem, 2vw, 1.35rem); line-height: 1.55; color: var(--ink-soft); max-width: 42rem; }
.mono-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  margin-bottom: 1.8rem;
}
.section-head .no {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.section-head h2 { margin: 0; }
section.block { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
section.block.alt { background: var(--sand); border-block: 1px solid var(--line-soft); }
section.block.ink { background: var(--ink); color: var(--paper); }
section.block.ink a { color: var(--paper); }
section.block.ink .section-head { border-top-color: var(--paper); }
section.block.ink .section-head .no { color: var(--stone); }
.two-col { display: grid; gap: 2.5rem; }
@media (min-width: 56rem) { .two-col { grid-template-columns: 1.15fr 0.85fr; } }
.prose { max-width: 44rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.55rem; }

/* ---------- Local blog articles ---------- */
.blog-article {
  max-width: 47rem;
  margin-inline: auto;
}
.blog-article h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
  margin: 2.4rem 0 0.8rem;
}
.blog-article h3 { margin-top: 2rem; }
.blog-article blockquote {
  margin: 1.6rem 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line-soft);
  background: var(--sand);
}
.blog-article blockquote p:last-child { margin-bottom: 0; }
.blog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  color: var(--muted);
}
.blog-meta time { font-weight: 700; color: var(--ink); }
.blog-source {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 1.2rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.blog-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: space-between;
  margin-top: 2rem;
}
.contact-address {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  border: 1px solid var(--line);
  background: var(--sand);
  padding: 0.7rem 0.9rem;
  user-select: all;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  background: var(--voltage);
  color: var(--on-accent);
}
.btn:hover { background: var(--voltage-deep); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: var(--ink-soft); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--sand); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.6rem; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 5vw, 3.5rem); }
.hero-grid { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 62rem) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; } }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
}
.hero-logo {
  display: block;
  width: min(30rem, 100%);
  margin-bottom: 1.6rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-card);
  background: #fff;
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  margin-top: 2rem;
}
.stat-strip > div { padding: 1rem 1.1rem; }
.stat-strip > div + div { border-left: 1px solid var(--line); }
.stat-strip strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1;
}
.stat-strip span { font-size: 0.85rem; color: var(--muted); }
@media (max-width: 36rem) {
  .stat-strip { grid-template-columns: 1fr; }
  .stat-strip > div + div { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- HTML-in-Canvas frames ---------- */
.canvas-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius-frame);
  background: var(--sand);
  overflow: hidden;
}
.canvas-frame figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.88rem;
}
figure.canvas-frame { margin: 0; }
canvas.specimen {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3.1;
}
canvas.mix-chart {
  display: block;
  width: min(26rem, 100%);
  aspect-ratio: 1;
  margin-inline: auto;
}
.status-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: var(--paper);
  white-space: nowrap;
}
.status-pill.live { background: var(--voltage); color: var(--on-accent); }
.canvas-note { font-size: 0.85rem; color: var(--muted); margin-top: 0.7rem; }

/* Drawable HTML chips rendered INTO canvas via drawElementImage.
   In browsers without HTML-in-Canvas these stay hidden fallback
   content; equivalent text is always present in normal HTML. */
.chip {
  width: 13.5rem;
  padding: 0.65rem 0.8rem;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.35;
}
.chip strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.chip em { font-family: var(--font-display); font-size: 0.95rem; }
.chip.yellow { background: var(--voltage); }
.chip.dark { background: var(--ink); color: var(--paper); }
.pie-label {
  width: 7.5rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--ink);
}
.pie-label strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
}
.pie-label:focus-visible { outline: 3px solid var(--focus); }

.legend { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.legend li {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.95rem;
}
.swatch { width: 0.9rem; height: 0.9rem; flex: none; border: 1px solid var(--ink); align-self: center; }
.swatch.voltage { background: var(--voltage); }
.swatch.sky { background: var(--sky); }
.swatch.pulse { background: var(--pulse); }
.swatch.stone { background: var(--stone); }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- Research foci (editorial rows) ---------- */
.foci { border-bottom: 1px solid var(--line); }
.focus-row {
  display: grid;
  gap: 0.6rem 2rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 56rem) {
  .focus-row { grid-template-columns: 4rem 16rem 1fr; }
}
.focus-row .idx {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 0.35rem;
}
.focus-row h3 { font-size: 1.45rem; }
.focus-row p { margin: 0; color: var(--ink-soft); max-width: 40rem; }
.focus-row .tags { margin-top: 0.6rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  background: var(--paper);
}
.tag.fill-y { background: var(--voltage); color: var(--on-accent); }
.tag.fill-p { background: var(--pulse); color: var(--on-accent); }
.tag.fill-s { background: var(--sky); color: var(--on-accent); }

/* ---------- Bars (Particle-style metrics) ---------- */
.bars { display: grid; gap: 2rem; }
@media (min-width: 56rem) { .bars { grid-template-columns: repeat(3, 1fr); } }
.bar-group h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; }
.bar-group .sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.bar-cols {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
  height: 11rem;
  border-bottom: 1px solid var(--line);
}
.bar-cols li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.bar { width: 100%; border: 1px solid var(--ink); border-bottom: 0; min-height: 4px; }
.bar.voltage { background: var(--voltage); }
.bar.sky { background: var(--sky); }
.bar.stone { background: var(--stone); }
.bar.h100 { height: 100%; } .bar.h85 { height: 85%; } .bar.h70 { height: 70%; }
.bar.h55 { height: 55%; } .bar.h40 { height: 40%; } .bar.h30 { height: 30%; }
.bar-labels { display: flex; gap: 0.8rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted); }
.bar-labels span { flex: 1; text-align: center; }

/* ---------- Lists, tables, pubs ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { padding: 1rem 0; border-top: 1px solid var(--line-soft); }
.rows li:first-child { border-top: 0; }
.rows .when {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.25rem;
}
.pub-list { list-style: none; margin: 0; padding: 0; counter-reset: pub; }
.pub-list li {
  padding: 1.1rem 0 1.1rem 3.2rem;
  border-top: 1px solid var(--line-soft);
  position: relative;
}
.pub-list li::before {
  counter-increment: pub;
  content: counter(pub, decimal-leading-zero);
  position: absolute;
  left: 0; top: 1.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.pub-list .pub-date { font-size: 0.85rem; color: var(--muted); }
table.people { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.people th, table.people td {
  text-align: left;
  padding: 0.65rem 0.8rem 0.65rem 0;
  border-top: 1px solid var(--line-soft);
  vertical-align: top;
}
table.people th { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); border-top: 0; }
.table-scroll { overflow-x: auto; }
.callout {
  border: 1px solid var(--ink);
  border-radius: var(--radius-card);
  padding: 1.4rem 1.5rem;
  background: var(--paper);
}
.callout.yellow { background: var(--voltage); color: var(--on-accent); }
.callout.yellow a { color: var(--on-accent); }
.callout p:last-child { margin-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; gap: 0.3rem 1.5rem; padding: 1.1rem 0; border-top: 1px solid var(--line-soft); }
@media (min-width: 48rem) { .timeline li { grid-template-columns: 9rem 1fr; } }
.timeline time { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); padding-top: 0.2rem; }

/* ---------- Page intro / footer ---------- */
.page-intro { padding-block: clamp(2.5rem, 6vw, 4rem) 1rem; }
.page-intro .lede { margin-bottom: 0; }
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding-block: 2.5rem 2rem;
  margin-top: 0;
}
.footer-grid { display: grid; gap: 2rem; }
@media (min-width: 56rem) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer-grid h3 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.45rem; font-size: 0.95rem; }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
.footer-base {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.disclaimer { font-size: 0.82rem; color: var(--muted); max-width: 52rem; }

@media (max-width: 44rem) {
  .header-bar { flex-wrap: wrap; padding-block: 0.6rem; min-height: 0; }
  .site-nav a { padding: 0.35rem 0.55rem; font-size: 0.9rem; }
  body { font-size: 1rem; }
}

@media print {
  .site-header, .site-footer, .btn-row, canvas { display: none !important; }
  body { background: #fff; }
}


/* ---------- Theme toggle & generated art ---------- */
.theme-toggle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  margin-left: 0.4rem;
  white-space: nowrap;
}
.theme-toggle:hover { background: var(--sand); }
section.block.ink .btn.ghost { color: var(--paper); border-color: var(--paper); }
section.block.ink .btn.ghost:hover { background: transparent; text-decoration: underline; }
.art-figure { margin: 0; }
.art-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-frame);
}
.art-figure figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }
.art-wide { margin-top: 2.5rem; }

/* ---------- Timeline thumbnail + native dialog pop-up ---------- */
.timeline-figure { margin: 1.8rem 0 0; }
.timeline-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.timeline-thumb img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-frame);
  background: var(--paper);
}
.timeline-dialog {
  width: min(122rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: clamp(1rem, 2.5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-frame);
  background: var(--paper);
  color: var(--ink);
}
.timeline-dialog::backdrop { background: rgba(22, 22, 30, 0.78); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.dialog-head h2 { margin-bottom: 0.3rem; }
.dialog-head p { margin: 0; color: var(--muted); }
.timeline-dialog img {
  display: block;
  width: 100%;
  min-width: min(72rem, 100%);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-frame) - 2px);
}
.timeline-scroll { overflow-x: auto; }
