/* Deep dive (research write-up): extra styles on top of blog.css. Figures are drawn by deep.js. */
:root {
  --foreign: #c25e00;
  --icon: #0083a8;
  --ok: #1d8a4e;
  --bad: #c0392b;
  --grid: #eef0f3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --foreign: #f0a050; --icon: #52c4e6; --ok: #4fc283; --bad: #ef7d6f; --grid: #191c22; }
}
:root[data-theme="dark"] { --foreign: #f0a050; --icon: #52c4e6; --ok: #4fc283; --bad: #ef7d6f; --grid: #191c22; }

/* ------------------------------------------------------------------ paper furniture */
.paper-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 0; font: 400 13px/1.5 var(--head); color: var(--muted); }
.paper-meta b { font-weight: 500; color: var(--text-2); }
.abstract {
  margin: 0 0 28px; padding: 18px 20px 4px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 4px; background: var(--surface);
}
.abstract > p { font-size: 15.5px; line-height: 1.65; margin: 0 0 14px; }
.abstract .label { margin: 0 0 8px; }
.keywords { font: 400 12.5px/1.5 var(--mono); color: var(--muted); }
article h2 .sec-n, article h3 .sec-n { color: var(--muted); font-variant-numeric: tabular-nums; }
article h3 {
  font: 600 18px/1.35 var(--head); color: var(--text); margin: 34px 0 10px; scroll-margin-top: 80px; letter-spacing: -0.005em;
}
article h4 { font: 600 15px/1.4 var(--head); color: var(--text); margin: 22px 0 6px; }
.contrib li { margin: 8px 0; }
.note {
  margin: 0 0 18px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 4px;
  font-size: 14.5px; line-height: 1.6; color: var(--text-2); background: var(--bg);
}
.note strong { color: var(--text); }
a.xref { text-decoration: none; white-space: nowrap; }
a.xref:hover { text-decoration: underline; }
a.cite { text-decoration: none; font-variant-numeric: tabular-nums; }

/* equations (MathML) */
.eq {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  margin: 14px 0 20px; padding: 10px 0; overflow-x: auto; color: var(--text);
}
.eq math { font-size: 17px; justify-self: center; }
.eq .eq-n { font: 400 12.5px var(--mono); color: var(--muted); }
math { font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", math; color: var(--text); }

/* tables */
.fig.table figcaption { margin: 0 0 10px; }
.fig.table .table-wrap { border-top: 1px solid var(--line-strong); }
table.data td.k { white-space: nowrap; color: var(--text); }
table.data td.mono, table.data code { font-family: var(--mono); }
table.data td.mono { font-size: 12.5px; }
table.data tr.hi td { background: var(--accent-soft); }
table.data tr.group td { font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 14px; }
table.data td.pending { color: var(--muted); text-align: right; }
table.data tr.pending td { background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--grid) 6px 12px); }
table.data .sub { display: block; font-size: 12px; color: var(--muted); }
table.data.compact { font-size: 13px; }
table.data.compact td, table.data.compact th { padding-right: 10px; }
.table-note { margin: 8px 0 0; font: 400 12.5px/1.5 var(--head); color: var(--muted); }

/* figure frames for deep.js drawings */
.dfig { position: relative; }
.dfig svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; }
.dfig .readout { margin-top: 10px; font: 400 12px/1.5 var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 1.5em; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 700px) { .scroll-x > svg { min-width: 700px; } }
.scroll-hint { display: none; font: 400 11px var(--mono); color: var(--muted); margin-top: 6px; }
@media (max-width: 700px) { .scroll-hint { display: block; } }
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 12px; font: 400 12.5px var(--mono); color: var(--text-2); }
.ctl label { display: inline-flex; align-items: center; gap: 8px; }
.ctl input[type="range"] { accent-color: var(--accent); width: 180px; max-width: 46vw; }
.ctl select {
  font: 400 12.5px var(--mono); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 4px 6px; max-width: 100%;
}
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.seg button {
  font: 400 12px var(--mono); padding: 4px 10px; border: 0; background: var(--bg); color: var(--text-2); cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* SVG vocabulary (deep.js) */
.dfig .d-box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.dfig .d-box2 { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1; }
.dfig .d-hi { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.2; }
.dfig .d-vbox { fill: color-mix(in srgb, var(--vert) 12%, var(--bg)); stroke: var(--vert); stroke-width: 1.2; }
.dfig .d-dash { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.dfig .d-line { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.dfig .d-axis { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.dfig .d-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.dfig .d-arrow { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.dfig .d-arrow-a { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.dfig .d-head { fill: var(--muted); }
.dfig .d-head-a { fill: var(--accent); }
.dfig .d-ink { fill: var(--text); }
.dfig .d-accent { fill: var(--accent); }
.dfig .d-accent-s { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.dfig .d-vert { fill: var(--vert); }
.dfig .d-vert-s { fill: none; stroke: var(--vert); stroke-width: 1.5; }
.dfig .d-foreign-s { fill: none; stroke: var(--foreign); stroke-width: 1.5; }
.dfig .d-icon-s { fill: none; stroke: var(--icon); stroke-width: 1.5; }
.dfig .d-soft { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.dfig .d-soft2 { fill: color-mix(in srgb, var(--accent) 7%, transparent); }
.dfig .d-warm { fill: color-mix(in srgb, var(--foreign) 16%, transparent); }
.dfig .d-faint { fill: var(--line); }
.dfig .d-slab-f { fill: color-mix(in srgb, var(--accent) 22%, var(--bg)); stroke: var(--accent); stroke-width: 1; }
.dfig .d-slab-t { fill: color-mix(in srgb, var(--accent) 38%, var(--bg)); stroke: var(--accent); stroke-width: 1; }
.dfig .d-slab-s { fill: color-mix(in srgb, var(--accent) 10%, var(--bg)); stroke: var(--accent); stroke-width: 1; }
.dfig .d-slab-f.g, .dfig .d-slab-t.g, .dfig .d-slab-s.g { stroke: var(--muted); }
.dfig .d-slab-f.g { fill: var(--surface); }
.dfig .d-slab-t.g { fill: var(--line-strong); }
.dfig .d-slab-s.g { fill: var(--line); }
.dfig .t { font: 500 12px var(--head); fill: var(--text); }
.dfig .tb { font: 600 12.5px var(--head); fill: var(--text); }
.dfig .tm { font: 400 10.5px var(--mono); fill: var(--muted); }
.dfig .tm2 { font: 400 10.5px var(--mono); fill: var(--text-2); }
.dfig .ta { font: 500 10.5px var(--mono); fill: var(--accent); }
.dfig .tv { font: 500 10.5px var(--mono); fill: var(--vert); }
.dfig .tf { font: 500 10.5px var(--mono); fill: var(--foreign); }
.dfig .ti { font: 500 10.5px var(--mono); fill: var(--icon); }
.dfig .tk { font: 500 14px var(--kana); fill: var(--text); }
.dfig .tk-s { font: 500 12px var(--kana); fill: var(--text-2); }
.dfig .glyph-stroke { fill: none; stroke: var(--text); stroke-linecap: round; stroke-linejoin: round; }
.dfig .glyph-fill { fill: var(--text); }
.dfig .g-acc .glyph-stroke { stroke: var(--accent); }
.dfig .g-acc .glyph-fill { fill: var(--accent); }
.dfig .g-mut .glyph-stroke { stroke: var(--muted); }
.dfig .g-mut .glyph-fill { fill: var(--muted); }

/* system overview (HTML lanes) */
.lanes { display: grid; gap: 18px; }
.lane-title { margin: 0 0 8px; }
.lane { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px 0; }
.node {
  position: relative; flex: 1 1 0; min-width: 0; padding: 8px 8px 7px; border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--surface); display: grid; gap: 2px; align-content: start;
}
.node.hi { border-color: var(--accent); background: var(--accent-soft); }
.node .n-t { font: 600 13px/1.3 var(--head); color: var(--text); }
.node .n-s { font: 400 10.5px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.lane .arr { flex: 0 0 16px; display: grid; place-items: center; color: var(--muted); font: 400 13px var(--head); }
@media (max-width: 640px) {
  .lane { flex-direction: column; }
  .lane .arr { flex-basis: 16px; transform: rotate(90deg); }
  .node { min-width: 0; }
}

/* generator evolution with row labels */
.evo { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px; }
.evo-labels { position: relative; }
.evo-labels span {
  position: absolute; right: 0; transform: translateY(-50%); font: 500 11px var(--mono); color: var(--text-2);
  letter-spacing: 0.04em;
}
.evo img { width: 100%; }

/* image figures with a legend */
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; font: 400 11.5px var(--mono); color: var(--text-2); }
.legend-row i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; margin-right: 6px; vertical-align: 3px; }
.fig-media.pad { padding: 10px; background: #ebebeb; }
.fig-media.white { background: #fff; }

/* glyph panels (variants, confusions) */
.gpanel { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gcard { border: 1px solid var(--line); border-radius: 4px; padding: 10px 10px 8px; background: var(--bg); }
.gcard svg { width: 100%; height: auto; display: block; }
.gcard .c-t { font: 600 13px/1.3 var(--head); color: var(--text); }
.gcard .c-s { font: 400 11px/1.4 var(--mono); color: var(--muted); }

/* stacked timing bar */
.stack { display: flex; height: 30px; border-radius: 3px; overflow: hidden; margin: 6px 0 8px; }
.stack > div { min-width: 2px; }
.stack-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px 14px; font: 400 12px/1.4 var(--mono); color: var(--text-2); }
.stack-legend .v { display: block; padding-left: 16px; color: var(--muted); }
.stack-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.stack-legend b { font-weight: 500; color: var(--text); }

/* references and appendix */
ol.refs { padding-left: 0; list-style: none; counter-reset: ref; }
ol.refs li { counter-increment: ref; position: relative; padding-left: 38px; margin: 10px 0; font-size: 14.5px; line-height: 1.55; }
ol.refs li::before { content: "[" counter(ref) "]"; position: absolute; left: 0; top: 0; font: 400 13px/1.7 var(--mono); color: var(--muted); }
ol.refs li:target { background: var(--accent-soft); }
pre.cmd {
  margin: 0 0 18px; padding: 12px 14px; background: var(--code-bg); border: 1px solid var(--line); border-radius: 4px;
  font: 12.5px/1.6 var(--mono); color: var(--text); overflow-x: auto; white-space: pre;
}
pre.cmd .c { color: var(--muted); }

@media (max-width: 640px) {
  .eq math { font-size: 15px; }
  .abstract { padding: 14px 14px 2px; }
  .gpanel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .dfig * { transition: none !important; } }
