/* Caulobase — a phase-contrast plate: pale field, dark cells with a bright
   halo, hairline rules, one ink per regulator. See docs/art-direction.md. */

:root {
  --field: #f3f5f1;
  --ink: #141a19;
  --muted: #5a6562;
  --rule: #cdd4ce;
  --rule-strong: #9aa59f;
  --link: #0b5f59;
  --cell: #2b3431;
  --halo: #ffffff;
  --ori: #1f9d55;
  --warn: #9a4b00;
  --reg-ctra: #0b7a72;
  --reg-dnaa: #bf6a12;
  --reg-gcra: #6a4fb8;
  --reg-ccrm: #c23a58;
  --reg-scip: #2f6db3;
  --scene-cell: #27302d;
  --scene-edge: #ffffff;
  --scene-nucleoid: #3d4a46;
  --scene-nucleoid-ink: #8fa39c;
  --scene-structure: #27302d;
  --scene-arrow: #f3f5f1;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --measure: 1180px;
  --text: 100ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --field: #0d1110;
    --ink: #e4ebe7;
    --muted: #93a09b;
    --rule: #26302d;
    --rule-strong: #46524e;
    --link: #6fd1c6;
    --cell: #d9e3de;
    --halo: #4d8f86;
    --ori: #5ee08f;
    --warn: #f0a75a;
    --reg-ctra: #3cc2b6;
    --reg-dnaa: #f0a54d;
    --reg-gcra: #a891ff;
    --reg-ccrm: #ff7f9b;
    --reg-scip: #79aef5;
    --scene-cell: #1c2422;
    --scene-edge: #5f8f88;
    --scene-nucleoid: #33403c;
    --scene-structure: #9fb2ab;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --field: #0d1110;
  --ink: #e4ebe7;
  --muted: #93a09b;
  --rule: #26302d;
  --rule-strong: #46524e;
  --link: #6fd1c6;
  --cell: #d9e3de;
  --halo: #4d8f86;
  --ori: #5ee08f;
  --warn: #f0a75a;
  --reg-ctra: #3cc2b6;
  --reg-dnaa: #f0a54d;
  --reg-gcra: #a891ff;
  --reg-ccrm: #ff7f9b;
  --reg-scip: #79aef5;
  --scene-cell: #1c2422;
  --scene-edge: #5f8f88;
  --scene-nucleoid: #33403c;
  --scene-structure: #9fb2ab;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--serif);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.mono, code { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--field); padding: 6px 10px; z-index: 10; }
[hidden] { display: none !important; }

/* Masthead */
.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 18px 16px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
  border-bottom: 1px solid var(--rule);
}
.wordmark { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 1.3rem; letter-spacing: -0.01em; }
.wordmark b { font-weight: 600; }
.mark { width: 26px; height: 26px; color: var(--cell); }
.masthead nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-family: var(--mono); font-size: 0.8rem; }
.masthead nav a { color: var(--muted); text-decoration: none; padding: 2px 0; border-bottom: 1px solid transparent; }
.masthead nav a:hover, .masthead nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

main { max-width: var(--measure); margin: 0 auto; padding: 28px 16px 64px; }

.kicker { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); margin: 0 0 14px; font-weight: 400; }
h2 { font-size: 1.5rem; margin: 2.2em 0 0.6em; }
h3 { font-size: 1.12rem; margin: 1.4em 0 0.4em; }
.section-label { font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 2em 0 0.8em; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.lede { font-size: 1.2rem; line-height: 1.5; max-width: var(--text); margin: 0 0 12px; }
.page-head { padding-bottom: 18px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.page-head .aside { max-width: var(--text); color: var(--muted); font-size: 0.95rem; }
.jump { margin-top: 14px; line-height: 2; }
.downloads a { margin-right: 2px; }
.src { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.note { max-width: var(--text); }
p { max-width: var(--text); }

/* Home: the live plate */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 36px; align-items: start; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.02; }
.hero .dedication { color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 18px; }
.plate { margin: 0; }
.cycle-plate canvas { display: block; width: 100%; aspect-ratio: 16 / 10.5; touch-action: none; cursor: ew-resize; }
.cycle-plate figcaption { border-top: 1px solid var(--rule); padding-top: 10px; font-size: 0.92rem; color: var(--muted); }
.cycle-plate figcaption p { margin: 6px 0 0; }
.fig { font-family: var(--mono); font-size: 0.78rem; color: var(--ink); margin-right: 6px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.controls .hint { font-family: var(--mono); font-size: 0.72rem; }
button {
  font: 500 0.78rem var(--mono);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule-strong);
  padding: 5px 11px;
  cursor: pointer;
}
button:hover { border-color: var(--ink); }
button[aria-pressed="true"] { background: var(--ink); color: var(--field); border-color: var(--ink); }

.contents { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.contents li { border-bottom: 1px solid var(--rule); padding: 14px 0; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4px 36px; }
.contents a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-decoration: none; color: var(--ink); }
.contents .title { font-size: 1.25rem; }
.contents a:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.contents .count { color: var(--muted); white-space: nowrap; }
.contents p { margin: 0; color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 36px; margin: 0; }
.facts div { border-bottom: 1px solid var(--rule); padding: 10px 0; }
.facts dt { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 1.05rem; }

/* History */
.timeline, .timeline ol { list-style: none; margin: 0; padding: 0; }
.decade { margin-top: 28px; }
.decade-label { font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--rule-strong); padding-bottom: 6px; margin: 0; font-weight: 500; }
.milestone { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.milestone .year { padding-top: 3px; font-size: 0.9rem; }
.milestone h3 { margin: 0 0 4px; font-size: 1.15rem; }
.milestone p { margin: 0 0 4px; }
.milestone .refs { font-size: 0.88rem; }
.cites { font-size: 0.88rem; }
.cite { white-space: nowrap; }

.person { border-top: 1px solid var(--rule-strong); margin-top: 36px; padding-top: 4px; }
.person h2 { margin-top: 0.8em; font-size: 2rem; font-weight: 400; }
.person-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.portrait { margin: 0; max-width: 200px; }
.portrait img { width: 100%; height: auto; display: block; filter: grayscale(1); }
.portrait figcaption { font-size: 0.7rem; font-family: var(--mono); color: var(--muted); margin-top: 4px; }
.summary { font-size: 1.12rem; }
.contributions, .facts-list, .paper-lines { padding-left: 1.1em; max-width: var(--text); }
.contributions li, .facts-list li { margin-bottom: 8px; }
.paper-lines li { margin-bottom: 4px; }
.honors { margin: 0; max-width: var(--text); }
.honors div { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.honors dd { margin: 0; }
blockquote { margin: 20px 0; padding-left: 18px; border-left: 2px solid var(--rule-strong); font-style: italic; max-width: var(--text); }
blockquote cite { font-style: normal; }
.joint { border-top: 1px solid var(--rule-strong); margin-top: 36px; }
p.note { color: var(--muted); }

/* Papers */
.filters { display: grid; gap: 10px; margin: 18px 0 8px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.filters fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.search input { width: min(100%, 460px); font: 1rem var(--serif); color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--rule-strong); padding: 6px 2px; }
.search input:focus { outline: none; border-bottom-color: var(--ink); }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; font: 0.76rem var(--mono); padding: 4px 9px; border: 1px solid var(--rule); color: var(--muted); }
.chips input:checked + span { background: var(--ink); color: var(--field); border-color: var(--ink); }
.chips input:focus-visible + span { outline: 2px solid var(--link); outline-offset: 2px; }
.toggles label { font: 0.8rem var(--mono); color: var(--muted); margin-right: 10px; }
.count { color: var(--muted); margin: 0; }

.bibliography, .datasets { list-style: none; padding: 0; margin: 0; }
.bibliography li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.bibliography li:target { background: color-mix(in srgb, var(--reg-ctra) 10%, transparent); }
.bibliography .year { padding-top: 4px; }
.bibliography .landmark .year { color: var(--ink); font-weight: 500; }
.cite-line { margin: 0; }
.cite-line .authors { color: var(--muted); }
.cite-line .title { color: var(--ink); font-weight: 600; text-decoration: none; }
.cite-line .title:hover { text-decoration: underline; }
.entry .note { margin: 4px 0; font-size: 0.97rem; }
.ids { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }
.ids a { color: var(--muted); }
.ids a:hover { color: var(--link); }
.tag { color: var(--muted); }
.badge { color: var(--ink); border: 1px solid var(--ink); padding: 0 5px; }
.badge.warn { color: var(--warn); border-color: var(--warn); font-family: var(--mono); font-size: 0.72rem; }
.empty { color: var(--muted); }

/* Datasets */
.dataset-group h2 { border-bottom: 1px solid var(--rule-strong); padding-bottom: 6px; }
.datasets li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.datasets .name { margin: 0; font-weight: 600; }
.datasets .name a { color: var(--ink); }
.strain { color: var(--muted); font-weight: 400; margin-left: 6px; }
.status-off .name a { color: var(--muted); }

/* Network & pathways */
main.wide { max-width: 1400px; }
.phase-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 8px; }
.phase-bar .play { margin-left: auto; }
.phase-note { min-height: 3em; color: var(--muted); max-width: 100ch; }
.phase-note b { color: var(--ink); }
.phase-note .refs { display: inline; margin-left: 6px; font-size: 0.86rem; }
.network-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.graph-frame { overflow-x: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.graph-frame svg { display: block; width: 100%; min-width: 760px; height: auto; }
.inspector { border-top: 1px solid var(--ink); padding-top: 10px; font-size: 0.95rem; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.inspector h2 { margin: 0 0 6px; font-size: 1.5rem; }
.inspector h3 { margin-top: 0.4em; }
.inspector ul { padding-left: 1.1em; margin: 0; }
.inspector li { margin-bottom: 4px; }
.inspector .refs { font-size: 0.86rem; }
.legend { border: 0; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.legend legend { width: 100%; }
.legend label { display: inline-flex; align-items: center; gap: 6px; font: 0.76rem var(--mono); color: var(--muted); cursor: pointer; }
.legend-glyph { width: 40px; height: 12px; color: var(--ink); }

.graph .band-rule { stroke: var(--rule); stroke-width: 1; }
.graph .band-rule.hidden { display: none; }
.graph .band-label { font: 500 11px var(--mono); fill: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.graph .edge { --edge: var(--rule-strong); cursor: pointer; transition: opacity 0.15s; }
.graph .edge .stroke, .legend-glyph .stroke { fill: none; stroke: var(--edge, currentColor); stroke-width: 1.6; }
.graph .edge .hit { fill: none; stroke: transparent; stroke-width: 12; }
.graph .head.solid, .legend-glyph .head.solid { fill: var(--edge, currentColor); stroke: none; }
.graph .head.bar, .legend-glyph .head.bar { stroke: var(--edge, currentColor); stroke-width: 2.4; fill: none; }
.graph .head.open, .legend-glyph .head.open { stroke: var(--edge, currentColor); stroke-width: 1.6; fill: var(--field); }
.line-dashed .stroke { stroke-dasharray: 6 4; }
.line-dotted .stroke { stroke-dasharray: 1.5 4; stroke-linecap: round; stroke-width: 2 !important; }
.line-fine .stroke { stroke-dasharray: 2 3; stroke-width: 1 !important; }
.graph .edge.hidden { display: none; }
.graph.focusing .edge:not(.lit), .graph.focusing .node:not(.lit) { opacity: 0.18; }
.graph .edge.lit .stroke { stroke-width: 2.4; }

.graph .node { cursor: pointer; --node: var(--ink); }
.graph .node rect { fill: var(--field); stroke: var(--node); stroke-width: 1.3; }
.graph .node text { font: 500 13px var(--mono); fill: var(--ink); pointer-events: none; }
.graph .node.kind-gene-module text, .graph .node.kind-gene-cluster text, .graph .node.kind-dna-site text { font-style: italic; font-family: var(--serif); font-size: 14px; }
.graph .node.kind-gene-module rect, .graph .node.kind-gene-cluster rect, .graph .node.kind-dna-site rect { stroke-dasharray: 3 2; }
.graph .node.kind-second-messenger rect, .graph .node.kind-small-molecule rect { stroke-width: 0.8; }
.graph .node.selected rect { stroke-width: 3; }
.graph .node:focus-visible { outline: none; }
.graph .node:focus-visible rect { stroke-width: 3; stroke: var(--link); }

/* Phase and stage views: active parts take their ink, the rest recede. */
.graph.phased .node { opacity: 0.35; }
.graph.stepping .node { opacity: 0.5; }
.graph.phased .node.on, .graph.stepping .node.on { opacity: 1; }
.graph.phased .node.on rect, .graph.stepping .node.on rect { fill: var(--node); stroke: var(--node); }
.graph.phased .node.on text, .graph.stepping .node.on text { fill: var(--field); }
.graph.phased .node.off rect { stroke-dasharray: 2 3; }
.graph.phased .edge { opacity: 0.12; }
.graph.stepping .edge { opacity: 0.3; }
.graph.phased .edge.on, .graph.stepping .edge.on { opacity: 1; }

/* Stage figures: a dark phase-contrast cell carrying bright fluorescent foci. */
.scene-figure { margin: 12px 0 4px; }
.scene { display: block; width: 100%; height: auto; }
.scene-figure figcaption { font-size: 0.86rem; color: var(--muted); margin-top: 4px; }
.scene-figure figcaption .refs { display: inline; }
.scene .cell { fill: var(--scene-cell); }
.scene .cell-edge { fill: none; stroke: var(--scene-edge); stroke-width: 1.4; opacity: 0.85; }
.scene .nucleoid { fill: var(--scene-nucleoid); }
.scene .structure, .scene .flagellum, .scene .pilus { fill: none; stroke: var(--scene-structure); stroke-linecap: round; stroke-linejoin: round; }
.scene .flagellum { stroke-width: 1.6; }
.scene .flagellum.ejected { stroke-dasharray: 3 3; opacity: 0.6; }
.scene .pilus { stroke-width: 1; }
.scene .holdfast { fill: var(--scene-structure); }
.scene .surface { stroke: var(--muted); stroke-width: 3; stroke-dasharray: 1 3; stroke-linecap: round; }
.scene .glow { opacity: 0.3; }
.scene .focus { stroke: rgba(0, 0, 0, 0.25); stroke-width: 0.8; }
.scene .degraded { fill: none; stroke-width: 1.6; }
.scene .degraded-x { stroke-width: 1.6; }
.scene .origin { stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.2; }
.scene .ring { stroke-width: 4.5; stroke-linecap: round; }
.scene .filament { fill: none; stroke-width: 2.6; stroke-linecap: round; }
.scene .move { fill: none; stroke: var(--scene-arrow); stroke-width: 1.5; stroke-dasharray: 4 3; opacity: 0.85; }
.scene .move-head { fill: var(--scene-arrow); opacity: 0.85; }
.scene .barrier { stroke-width: 2.4; stroke-linecap: round; }
.scene .gene { fill: none; stroke-width: 1.8; stroke-linejoin: round; }
.scene .gene.off { opacity: 0.55; }
.scene .gene-off { stroke: var(--field); stroke-width: 1.6; }
.scene .membrane-mark { fill: none; stroke-width: 4.5; stroke-linecap: round; }
.scene .membrane-mark.thin { stroke-width: 3; }
.scene .leader { stroke: var(--rule-strong); stroke-width: 0.8; }
.scene .labels text { font: 500 11px var(--mono); fill: var(--ink); }

.stepper h3 { margin: 4px 0 6px; font-size: 1.2rem; }
.step-controls { display: flex; gap: 8px; margin: 10px 0 14px; }
.stepper [data-detail] { border-top: 1px solid var(--rule); padding-top: 6px; }
.stepper [data-detail] h4 { margin: 6px 0 4px; }
.pathway { border-top: 1px solid var(--rule-strong); margin-top: 40px; }
.pathway .network-body { grid-template-columns: minmax(0, 1fr) 420px; }
.pathway h2 { margin-top: 0.8em; }
details.evidence { margin-top: 14px; }
details.evidence summary { cursor: pointer; font: 0.8rem var(--mono); color: var(--muted); }
.parts { padding-left: 1.1em; max-width: 100ch; font-size: 0.95rem; }
.noscript { color: var(--muted); padding: 20px 0; }

.evidence h2 { margin-top: 2em; }
.edge-table, .node-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-top: 8px; }
.edge-table th, .node-table th { text-align: left; font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--rule-strong); padding: 6px 10px 6px 0; }
.edge-table td, .node-table td { border-bottom: 1px solid var(--rule); padding: 7px 10px 7px 0; vertical-align: top; }

.prose-block { max-width: var(--text); }

/* Open questions */
.question-group > h2 { border-bottom: 1px solid var(--rule-strong); padding-bottom: 6px; }
.question { padding: 18px 0 20px; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.question h3 { margin: 4px 0 6px; font-size: 1.3rem; }
.question .ask { font-size: 1.12rem; font-style: italic; margin: 0 0 12px; }
.question .status { margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.question .status.open { color: var(--reg-ccrm); }
.question .status.partly { color: var(--reg-dnaa); }
.question dl { margin: 0; max-width: var(--text); }
.question dl div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px; padding: 5px 0; }
.question dt { font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding-top: 4px; }
.question dd { margin: 0; }
.question .refs { font-size: 0.88rem; margin: 10px 0 0; }
.question .related { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; }
.file-list { list-style: none; padding: 0; }
.file-list li { display: grid; grid-template-columns: 220px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }

.colophon { max-width: var(--measure); margin: 0 auto; padding: 18px 16px 40px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.88rem; }

@media (max-width: 900px) {
  .hero, .contents li { grid-template-columns: 1fr; }
  .network-body, .pathway .network-body { grid-template-columns: 1fr; }
  .inspector { position: static; }
  .phase-bar .play { margin-left: 0; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .lede { font-size: 1.08rem; }
  .bibliography li, .milestone { grid-template-columns: 1fr; gap: 2px; }
  .file-list li { grid-template-columns: 1fr; gap: 2px; }
  .question dl div { grid-template-columns: 1fr; gap: 0; }
  .edge-table, .node-table { display: block; overflow-x: auto; }
  .person-head { flex-direction: column; }
  .cycle-plate canvas { aspect-ratio: 4 / 3.4; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
