/* AMP Mawar Lab — site stylesheet. Dark publication theme derived from the previous
   portfolio tokens (near-black background, blue accent, mono metadata, thin section lines). */

:root {
  --bg: #0A0A0A;
  --bg-elev: #101010;
  --card: #161616;
  --card-hover: #1A1A1A;
  --border: #262626;
  --border-strong: #363636;
  --ink: #FAFAFA;
  --ink-soft: #BDBDBD;
  --muted: #8C8C8C;
  --accent: #60A5FA;
  --accent-strong: #3B82F6;
  --accent-ink: #0A0A0A;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-text: #93C5FD;
  --cyan: #22D3EE;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --warn: #FBBF24;
  --good: #34D399;
  --poor: #F87171;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --measure: 72ch;
  --wide: 1080px;
  --narrow: 760px;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main { flex: 1 0 auto; }

img, svg { max-width: 100%; height: auto; display: block; }
svg { overflow: visible; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-text); }

code, kbd, samp, pre, .mono { font-family: var(--mono); }
code {
  font-size: 0.88em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.4em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 20px 0;
  tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); color: var(--accent-text); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* === LAYOUT === */
.container {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 24px;
}
.container--narrow { max-width: var(--narrow); }

/* === NAV === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.logo {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  white-space: nowrap;
}
.logo:hover { color: var(--ink); }
.logo-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
  flex: none;
}
.logo-sub {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 2px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.nav-toggle {
  display: none;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  align-items: center;
  gap: 8px;
}
.nav-toggle .bars { display: inline-block; width: 16px; height: 2px; background: currentColor; position: relative; }
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: currentColor; }
.nav-toggle .bars::before { top: -5px; }
.nav-toggle .bars::after { top: 5px; }
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  align-items: center;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--card); }
.nav-links a[aria-current="page"] { color: var(--accent); }
.nav-links a.nav-cta {
  border: 1px solid var(--border-strong);
  color: var(--ink);
  margin-left: 6px;
}
.nav-links a.nav-cta:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 16px 14px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .nav-links a { min-height: 46px; font-size: 15px; }
  .nav-links a.nav-cta { margin: 6px 0 0; justify-content: center; }
  .site-header.is-open .nav-links { display: flex; }
  .logo-sub { display: none; }
}

/* === TYPOGRAPHY SCALE === */
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.2rem + 3vw, 3rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.75rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; }
p, li { max-width: var(--measure); }
.lede { font-size: 1.125rem; color: var(--ink-soft); line-height: 1.6; }

/* === HERO === */
.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 20px;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }
.hero h1 { margin-bottom: 20px; max-width: 14ch; }
.hero h1 .accent { color: var(--accent); }
.hero .lede { max-width: 54ch; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { min-width: 0; }
.hero-art svg { width: 100%; height: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-text); color: var(--accent-ink); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--border); font-weight: 500; }
.btn-ghost:hover { color: var(--ink); border-color: var(--border-strong); }

/* === SECTIONS === */
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.section-number {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.section-title { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem); }
.section-divider { flex: 1; height: 1px; background: var(--border); min-width: 24px; }
.section-link { font-size: 14px; font-weight: 500; white-space: nowrap; }
.section-intro { color: var(--ink-soft); margin-bottom: 28px; max-width: 64ch; }

/* === CARDS === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  min-width: 0;
}
a.card:hover { border-color: var(--accent); background: var(--card-hover); transform: translateY(-2px); color: inherit; }
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.card-tag {
  padding: 3px 9px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  font-family: var(--sans);
}
.card-tag--cyan { background: var(--cyan-soft); color: var(--cyan); }
.card h3 { font-size: 1.05rem; }
.card p { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.55; }
.card .card-arrow { margin-top: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }
a.card:hover .card-arrow { color: var(--accent); }

.topic-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.topic-list li {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}

/* === PILLARS (homepage) === */
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.pillar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-elev) 100%);
  min-width: 0;
}
.pillar h3 { margin-bottom: 6px; font-size: 1.05rem; }
.pillar h3 a { color: var(--ink); text-decoration: none; }
.pillar h3 a:hover { color: var(--accent); }
.pillar p { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 12px; }
.pillar ul { list-style: none; display: grid; gap: 4px; }
.pillar li { font-size: 0.86rem; color: var(--muted); font-family: var(--mono); padding-left: 14px; position: relative; }
.pillar li::before { content: "–"; position: absolute; left: 0; color: var(--accent); }

/* === LISTS === */
.updates { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--border); }
.updates li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  max-width: none;
}
.updates time { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding-top: 3px; }
.updates a { color: var(--ink); text-decoration: none; font-weight: 500; }
.updates a:hover { color: var(--accent); }
.updates span { display: block; color: var(--muted); font-size: 0.88rem; }

/* === ARTICLE === */
.article-header { padding: 56px 0 32px; border-bottom: 1px solid var(--border); }
.breadcrumb { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 22px; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.article-header h1 { margin-bottom: 18px; max-width: 20ch; }
.article-header .lede { max-width: 60ch; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 22px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.article-meta b { color: var(--ink-soft); font-weight: 500; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 56px;
  padding: 40px 0 64px;
  align-items: start;
}
.article-body { min-width: 0; }
.toc {
  position: sticky;
  top: 84px;
  border-left: 1px solid var(--border);
  padding-left: 18px;
  font-size: 13.5px;
}
.toc h2 { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.toc ol { list-style: none; display: grid; gap: 2px; }
.toc a { color: var(--ink-soft); text-decoration: none; display: block; padding: 5px 0; line-height: 1.35; }
.toc a:hover { color: var(--accent); }

.article-body > * + * { margin-top: 1.1em; }
.article-body h2 { margin-top: 2.4em; padding-top: 1.2em; border-top: 1px solid var(--border); scroll-margin-top: 90px; }
.article-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.article-body h3 { margin-top: 1.8em; }
.article-body h4 { margin-top: 1.4em; }
.article-body p, .article-body li { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.7; }
.article-body li { margin-top: 0.4em; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body strong { color: var(--ink); font-weight: 600; }
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.article-body blockquote { border-left: 2px solid var(--accent); padding: 4px 0 4px 18px; color: var(--ink-soft); }

.note, .example, .warning {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 0.95rem;
}
.note > :first-child, .example > :first-child, .warning > :first-child { margin-top: 0; }
.note .label, .example .label, .warning .label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 6px;
}
.example { border-left-color: var(--cyan); }
.example .label { color: var(--cyan); }
.warning { border-left-color: var(--warn); }
.warning .label { color: var(--warn); }
.note p, .example p, .warning p { font-size: 0.95rem; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; min-width: 480px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--bg-elev); }
tbody tr:last-child td { border-bottom: 0; }
td { color: var(--ink-soft); }
td code { white-space: nowrap; }
.metric-good { color: var(--good); font-family: var(--mono); font-size: 0.9em; }
.metric-ni { color: var(--warn); font-family: var(--mono); font-size: 0.9em; }
.metric-poor { color: var(--poor); font-family: var(--mono); font-size: 0.9em; }

/* definition lists (glossary) */
.glossary { display: grid; gap: 0; }
.glossary-group { margin-top: 2em; }
.glossary-group h2 { border-top: 0; padding-top: 0; margin-top: 0; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.term { padding: 18px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 90px; }
.term dt { font-weight: 700; color: var(--ink); font-size: 1.05rem; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.term dt .abbr { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }
.term dd { color: var(--ink-soft); margin-top: 6px; max-width: var(--measure); }
.term dd a { font-size: 0.92em; }

/* === DIAGRAMS === */
.diagram {
  margin: 28px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: radial-gradient(1200px 300px at 50% 0%, rgba(96, 165, 250, 0.06), transparent 70%), var(--bg-elev);
  padding: 20px;
}
.diagram svg { width: 100%; height: auto; font-family: var(--mono); }
.diagram figcaption {
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.5;
}
.diagram figcaption b { color: var(--ink-soft); font-weight: 500; }
.d-box { fill: var(--card); stroke: var(--border-strong); stroke-width: 1; }
.d-box-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; }
.d-box-cyan { fill: var(--cyan-soft); stroke: var(--cyan); stroke-width: 1; }
.d-box-muted { fill: var(--bg); stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 3; }
.d-text { fill: var(--ink); font-size: 13px; font-family: var(--sans); font-weight: 600; }
.d-sub { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.d-label { fill: var(--accent-text); font-size: 11px; font-family: var(--mono); letter-spacing: 0.06em; }
.d-cyan { fill: var(--cyan); }
.d-line { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.d-line-accent { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.d-line-cyan { stroke: var(--cyan); stroke-width: 1.5; fill: none; }
.d-dash { stroke-dasharray: 5 4; }
.d-fill-accent { fill: var(--accent); }
.d-fill-cyan { fill: var(--cyan); }
.d-fill-good { fill: var(--good); }
.d-fill-warn { fill: var(--warn); }
.d-fill-poor { fill: var(--poor); }
.d-fill-muted { fill: var(--border-strong); }
.d-bar { stroke: var(--bg); stroke-width: 1; }
.d-pipe-line { stroke: var(--accent); stroke-width: 2; }

/* === SOURCES / RELATED === */
.sources { margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--border); }
.sources h2 { border-top: 0; padding-top: 0; margin-top: 0; font-size: 1.1rem; }
.sources ol { padding-left: 1.3em; font-size: 0.92rem; }
.sources li { margin-top: 0.4em; font-size: 0.92rem; overflow-wrap: anywhere; }
.sources li span { color: var(--muted); font-family: var(--mono); font-size: 0.86em; }
.related { padding: 40px 0 64px; border-top: 1px solid var(--border); }
.related h2 { font-size: 1.1rem; margin-bottom: 18px; }

/* === PAGE (non-article) === */
.page-header { padding: 56px 0 28px; }
.page-header h1 { margin-bottom: 14px; }
.page-header .lede { max-width: 60ch; }
.page-body { padding: 28px 0 64px; }
.page-body > * + * { margin-top: 1.1em; }
.page-body h2 { margin-top: 2em; }
.page-body p, .page-body li { color: var(--ink-soft); }
.page-body ul, .page-body ol { padding-left: 1.4em; }
.page-body li { margin-top: 0.35em; }
.page-body strong { color: var(--ink); }

/* === CHECKLIST TOOL === */
.tool-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px 22px;
  position: sticky;
  top: 72px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin: 0 0 28px;
}
.progress-text { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.progress-text .pt-num { color: var(--accent); }
.progress-bar { flex: 1 1 200px; height: 8px; border-radius: 100px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.progress-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-strong), var(--cyan)); transition: width 0.25s ease; }
.tool-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-actions .btn { min-height: 38px; padding: 6px 14px; font-size: 13px; }
.tool-status { font-size: 12.5px; color: var(--muted); font-family: var(--mono); flex-basis: 100%; }

.check-section { margin-top: 36px; }
.check-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.check-section-head h2 { margin: 0; padding: 0; border: 0; font-size: 1.25rem; }
.check-count { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.check-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.check-list li { margin: 0; max-width: none; }
.check-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.check-item:hover { border-color: var(--border-strong); }
.check-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check-item:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 2px; }
.check-item input {
  width: 22px; height: 22px;
  margin-top: 2px;
  accent-color: var(--accent-strong);
  cursor: pointer;
}
.check-item .ci-title { color: var(--ink); font-weight: 600; font-size: 0.98rem; display: block; }
.check-item .ci-why { color: var(--ink-soft); font-size: 0.88rem; line-height: 1.5; display: block; margin-top: 3px; }
.check-item .ci-why a { font-size: inherit; }
.check-item:has(input:checked) .ci-title { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--ink-soft); }

/* === LAB (calculator) === */
.lab-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 24px; }
.lab-form, .lab-result { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 22px; min-width: 0; }
.lab-form h2, .lab-result h2 { font-size: 1.05rem; margin: 0 0 16px; padding: 0; border: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.9rem; color: var(--ink-soft); font-weight: 500; }
.field .hint { font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }
.field input[type="number"], .field select {
  width: 100%;
  min-height: 44px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font: inherit;
  font-family: var(--mono);
  font-size: 15px;
}
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-big { font-family: var(--mono); font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); font-weight: 600; color: var(--ink); line-height: 1.1; }
.result-big small { font-size: 0.5em; color: var(--muted); font-weight: 500; margin-left: 6px; }
.result-sub { color: var(--muted); font-family: var(--mono); font-size: 12.5px; margin-top: 6px; }
.result-rows { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 0; border-top: 1px solid var(--border); }
.result-rows li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; margin: 0; max-width: none; }
.result-rows li span:first-child { color: var(--ink-soft); }
.result-rows li span:last-child { font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.stack-bar { display: flex; height: 14px; border-radius: 100px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); margin-top: 16px; }
.stack-bar span { display: block; height: 100%; min-width: 0; transition: width 0.25s ease; }
.stack-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.stack-legend li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.stack-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.c-html { background: var(--ink-soft); } .c-css { background: var(--cyan); } .c-js { background: var(--accent); } .c-img { background: var(--good); } .c-font { background: var(--warn); }

/* === RESOURCES PAGE === */
.resource-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.resource-list li { margin: 0; max-width: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--card); }
.resource-list a { font-weight: 600; color: var(--ink); text-decoration: none; }
.resource-list a:hover { color: var(--accent); }
.resource-list .src { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.resource-list p { font-size: 0.9rem; margin-top: 6px; color: var(--ink-soft); }

/* === 404 === */
.notfound { padding: 96px 0; text-align: left; }
.notfound .code { font-family: var(--mono); font-size: 13px; color: var(--cyan); letter-spacing: 0.08em; margin-bottom: 14px; }

/* === FOOTER === */
.site-footer { border-top: 1px solid var(--border); padding: 44px 0 32px; margin-top: 24px; background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer-brand p { color: var(--muted); font-size: 0.88rem; max-width: 36ch; margin-top: 10px; }
.footer-col h2 { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.footer-col ul { list-style: none; display: grid; gap: 2px; }
.footer-col a { color: var(--ink-soft); text-decoration: none; font-size: 14px; display: inline-block; padding: 5px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  font-family: var(--mono);
}

/* === RESPONSIVE === */
@media (max-width: 960px) {
  .article-layout { grid-template-columns: 1fr; gap: 24px; }
  .toc { position: static; border-left: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
  .toc ol { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-art { max-width: 560px; }
  .hero { padding: 48px 0 40px; }
  .lab-grid { grid-template-columns: 1fr; }
  .tool-panel { position: static; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .section { padding: 40px 0; }
  .article-header { padding: 36px 0 24px; }
  .article-layout { padding: 28px 0 48px; }
  .article-body p, .article-body li { font-size: 1rem; }
  .updates li { grid-template-columns: 1fr; gap: 4px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .diagram { padding: 14px; }
  .field-row { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
  .card { padding: 18px; }
  pre { font-size: 0.8rem; padding: 12px 14px; }
}
@media (max-width: 360px) {
  .logo { font-size: 15px; }
  .btn { width: 100%; }
  .tool-actions { width: 100%; }
}

@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; }
}

@media print {
  .site-header, .site-footer, .toc, .related, .tool-actions, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}

/* wide diagrams scroll inside the figure on narrow screens instead of shrinking */
.diagram-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.diagram--wide svg { min-width: 560px; }
.diagram--wide .diagram-scroll { scrollbar-width: thin; }
@media (max-width: 600px) {
  .diagram--wide figcaption::after { content: " Scroll the diagram sideways on narrow screens."; }
}

@media (max-width: 600px) {
  .section-header { flex-wrap: wrap; }
  .section-link { flex-basis: 100%; white-space: normal; order: 10; }
}
