
/* Thumbfing — one markup, two styles.
   The style follows data-theme: sheet-* is the drawing sheet, docs-* is the editorial page.
   Components read only the --tf-* roles below, so switching data-theme re-renders them. */

:root, [data-theme^="sheet"] {
  --tf-font-display: var(--font-sheet-sans);
  --tf-font-body: var(--font-sheet-sans);
  --tf-font-label: var(--font-sheet-mono);
  --tf-font-data: var(--font-sheet-mono);
  --tf-font-caption: var(--font-sheet-mono);
  --tf-label-case: uppercase;
  --tf-kicker-size: 12px; --tf-kicker-leading: 16px; --tf-kicker-tracking: 1.7px;
  --tf-title-size: 38px; --tf-title-leading: 44px; --tf-title-weight: 600; --tf-title-tracking: -0.38px;
  --tf-lead-size: 17px; --tf-lead-leading: 26px;
  --tf-section-size: 13px; --tf-section-tracking: 1.5px; --tf-section-font: var(--font-sheet-mono);
  --tf-body-size: 14px; --tf-body-leading: 20px;
  --tf-caption-size: 12px; --tf-caption-leading: 16px; --tf-caption-style: normal; --tf-caption-colour: var(--muted);
  --tf-page-pad: var(--frame-inset);
  --tf-frame-pad: var(--frame-pad);
  --tf-frame-border: var(--rule-heavy) solid var(--rule);
  --tf-figure-rule: var(--rule-light) solid var(--rule); --tf-figure-pad: 12px;
  --tf-stat-font: var(--font-sheet-mono); --tf-stat-size: 34px; --tf-stat-leading: 40px; --tf-stat-weight: 600;
  --tf-legend-size: 14px; --tf-legend-leading: 20px; --tf-legend-gap: 24px;
}

[data-theme^="docs"] {
  --tf-font-display: var(--font-docs-serif);
  --tf-font-body: var(--font-docs-sans);
  --tf-font-label: var(--font-docs-sans);
  --tf-font-data: var(--font-sheet-mono);
  --tf-font-caption: var(--font-docs-serif);
  --tf-label-case: none;
  --tf-kicker-size: 13px; --tf-kicker-leading: 18px; --tf-kicker-tracking: 0.78px;
  --tf-title-size: 56px; --tf-title-leading: 60px; --tf-title-weight: 400; --tf-title-tracking: -1.12px;
  --tf-lead-size: 17px; --tf-lead-leading: 27px;
  --tf-section-size: 13px; --tf-section-tracking: 0.78px; --tf-section-font: var(--font-docs-sans);
  --tf-body-size: 15px; --tf-body-leading: 23px;
  --tf-caption-size: 17px; --tf-caption-leading: 24px; --tf-caption-style: italic; --tf-caption-colour: var(--ink);
  --tf-page-pad: var(--sheet-margin);
  --tf-frame-pad: 0px;
  --tf-frame-border: 0 none;
  --tf-figure-rule: 0 none; --tf-figure-pad: 0px;
  --tf-stat-font: var(--font-docs-serif); --tf-stat-size: 44px; --tf-stat-leading: 48px; --tf-stat-weight: 400;
  --tf-legend-size: 13px; --tf-legend-leading: 18px; --tf-legend-gap: 28px;
}

/* Record-only content (stage ids, status, hashes, file names, DOES NOT PROVE) never reaches the website.
   The nearest data-theme wins, so a sheet wrapper inside an editorial page (or the reverse) still works. */
[data-theme^="docs"] .tf-internal:not([data-theme^="docs"] [data-theme^="sheet"] .tf-internal) { display: none !important; }
[data-theme^="sheet"] .tf-public:not([data-theme^="sheet"] [data-theme^="docs"] .tf-public),
:root:not([data-theme]) .tf-public:not([data-theme^="docs"] .tf-public) { display: none !important; }

/* Sheet: the page, its ruled frame (sheet) or open column (editorial). */
.tf-sheet { background: var(--background); color: var(--ink); font-family: var(--tf-font-body); padding: var(--tf-page-pad); box-sizing: border-box; }
.tf-sheet a { color: var(--link); }
.tf-frame { border: var(--tf-frame-border); padding: var(--tf-frame-pad); display: flex; flex-direction: column; gap: var(--gap-section); border-radius: var(--radius-sheet); }

/* Header: kicker, title, lead, and the status on the right. */
.tf-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap-column); }
.tf-header__text { display: flex; flex-direction: column; gap: var(--gap-list); max-width: 66ch; min-width: 0; }
.tf-kicker { font-family: var(--tf-font-label); font-size: var(--tf-kicker-size); line-height: var(--tf-kicker-leading); letter-spacing: var(--tf-kicker-tracking); text-transform: var(--tf-label-case); color: var(--muted); }
.tf-title { margin: 0; font-family: var(--tf-font-display); font-size: var(--tf-title-size); line-height: var(--tf-title-leading); font-weight: var(--tf-title-weight); letter-spacing: var(--tf-title-tracking); text-wrap: balance; }
.tf-lead { margin: 0; font-size: var(--tf-lead-size); line-height: var(--tf-lead-leading); color: var(--muted); }
.tf-section-head { font-family: var(--tf-section-font); font-size: var(--tf-section-size); line-height: 18px; font-weight: 600; letter-spacing: var(--tf-section-tracking); text-transform: var(--tf-label-case); color: var(--ink); }
.tf-body { font-size: var(--tf-body-size); line-height: var(--tf-body-leading); }
.tf-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: var(--gap-tight); font-size: var(--tf-body-size); line-height: var(--tf-body-leading); }

/* Rules and panels. */
.tf-rule { border: 0; border-top: var(--rule-heavy) solid var(--rule); margin: 0; }
.tf-rule--faint { border-top: var(--rule-light) solid var(--faint-rule); }
.tf-panel { background: var(--panel); border: var(--rule-light) solid var(--faint-rule); border-radius: var(--radius-sheet); padding: var(--cell-pad); }
.tf-panel--highlight { border: var(--rule-heavy) solid var(--ink); }

/* Status: green disc with a tick and the word Passed; failed uses warning and a cross. */
.tf-status { display: inline-flex; align-items: center; gap: var(--gap-list); font-family: var(--font-sheet-sans); font-size: 17px; line-height: 24px; font-weight: 600; color: var(--passed); flex-shrink: 0; }
.tf-status svg { width: 32px; height: 32px; flex-shrink: 0; }
.tf-status .tf-disc { fill: var(--passed); }
.tf-status .tf-mark { fill: none; stroke: var(--passed-on); stroke-width: var(--tick-stroke); stroke-linecap: round; stroke-linejoin: round; }
.tf-status--failed { color: var(--warning); }
.tf-status--failed .tf-disc { fill: var(--warning); }

/* Check: one acceptance check. */
.tf-check { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 12px; row-gap: 4px; align-items: start; }
.tf-check svg { width: 20px; height: 20px; grid-row: span 2; }
.tf-check .tf-disc { fill: var(--passed); }
.tf-check .tf-mark { fill: none; stroke: var(--passed-on); stroke-width: 2.2px; stroke-linecap: round; stroke-linejoin: round; }
.tf-check--failed .tf-disc { fill: var(--warning); }
.tf-check__title { font-size: 15px; line-height: 20px; font-weight: 600; }
.tf-check__detail { font-size: 13px; line-height: 18px; color: var(--muted); }

/* Stat: a large figure over its label. */
.tf-stat { display: flex; flex-direction: column; gap: 4px; }
.tf-stat__value { font-family: var(--tf-stat-font); font-size: var(--tf-stat-size); line-height: var(--tf-stat-leading); font-weight: var(--tf-stat-weight); font-variant-numeric: tabular-nums; }
.tf-stat__label { font-size: 14px; line-height: 20px; color: var(--muted); }

/* Tag: a small square label such as SELECTED. */
.tf-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; box-sizing: border-box; border: 1.2px solid var(--ink); background: var(--ink); color: var(--background); border-radius: var(--radius-sheet); font-family: var(--font-sheet-mono); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.tf-tag--outline { background: var(--background); color: var(--ink); }

/* Passenger chip: a wire on the bus, coloured by its purpose. Same colours in every theme. */
.tf-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 50px; height: 28px; padding: 0 6px; box-sizing: border-box; border-radius: var(--radius-chip); border: var(--chip-border) solid; font-family: var(--font-sheet-mono); font-size: 11px; font-weight: 600; }
.tf-chip--rgb { background: var(--passenger-rgb); color: var(--passenger-rgb-text); border-color: var(--passenger-rgb-border); }
.tf-chip--ground { background: var(--passenger-ground); color: var(--passenger-ground-text); border-color: var(--passenger-ground-border); }
.tf-chip--supply { background: var(--passenger-supply); color: var(--passenger-supply-text); border-color: var(--passenger-supply-border); }
.tf-chip--battery { background: var(--passenger-battery); color: var(--passenger-battery-text); border-color: var(--passenger-battery-border); }
.tf-chip--switch { background: var(--passenger-switch); color: var(--passenger-switch-text); border-color: var(--passenger-switch-border); }
.tf-chip--pending { background: var(--background); border-style: dashed; }
.tf-chip--pending.tf-chip--rgb { color: var(--passenger-rgb-border); }
.tf-chip--pending.tf-chip--ground { color: var(--passenger-ground-border); }
.tf-chip--pending.tf-chip--supply { color: var(--passenger-supply-border); }
.tf-chip--pending.tf-chip--battery { color: var(--passenger-battery-border); }
.tf-chip--pending.tf-chip--switch { color: var(--ink); border-color: var(--ink); }

/* Legend: board layers. */
.tf-legend { display: flex; flex-wrap: wrap; gap: var(--gap-list) var(--tf-legend-gap); font-size: var(--tf-legend-size); line-height: var(--tf-legend-leading); }
.tf-legend__item { display: inline-flex; align-items: center; gap: var(--gap-tight); }
.tf-swatch { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 14px; border-radius: var(--radius-sheet); flex-shrink: 0; }
.tf-swatch--board { background: var(--board); }
.tf-swatch--front-copper { background: var(--board); }
.tf-swatch--front-copper::after { content: ""; width: 20px; height: 5px; background: var(--front-copper); }
.tf-swatch--back-copper { height: 5px; background: var(--back-copper); }
.tf-swatch--silkscreen { background: var(--board); }
.tf-swatch--silkscreen::after { content: ""; width: 18px; height: 2px; background: var(--silkscreen); }

/* Figure and caption. */
.tf-figure { margin: 0; display: flex; flex-direction: column; gap: var(--gap-tight); border-top: var(--tf-figure-rule); padding-top: var(--tf-figure-pad); }
.tf-caption { font-family: var(--tf-font-caption); font-size: var(--tf-caption-size); line-height: var(--tf-caption-leading); font-style: var(--tf-caption-style); color: var(--tf-caption-colour); }

/* Title block: the boxed strip at the foot of a drawing sheet. Internal only. */
.tf-title-block { display: flex; flex-wrap: wrap; border: var(--rule-heavy) solid var(--rule); border-radius: var(--radius-sheet); }
.tf-title-block__cell { padding: 10px var(--cell-pad); display: flex; flex-direction: column; gap: 6px; border-right: var(--rule-light) solid var(--rule); min-width: 0; }
.tf-title-block__cell:last-child { border-right: 0; flex: 1 1 260px; }
.tf-title-block__label { font-family: var(--font-sheet-mono); font-size: 11px; line-height: 14px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.tf-title-block__label--warning { color: var(--warning); }
.tf-title-block__value { font-family: var(--font-sheet-mono); font-size: 14px; line-height: 18px; font-weight: 500; overflow-wrap: anywhere; }
.tf-title-block__value--stage { font-size: 24px; line-height: 28px; }
.tf-title-block__value--prose { font-family: var(--font-sheet-sans); font-size: 13px; line-height: 18px; font-weight: 400; }

/* Note: the editorial counterpart of DOES NOT PROVE. */
.tf-note { font-size: var(--tf-body-size); line-height: var(--tf-body-leading); }
.tf-note strong { font-weight: 600; }
.tf-note span { color: var(--muted); }

/* Board drawing classes for inline SVG. */
.tf-fill-board { fill: var(--board); }
.tf-stroke-front { fill: none; stroke: var(--front-copper); }
.tf-stroke-back { fill: none; stroke: var(--back-copper); }
.tf-stroke-silk { fill: none; stroke: var(--silkscreen); }
