/* Adv. EHR case study — styles
   Light/dark tokens, editorial type, progressive-enhancement components. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1b2430;
  --text-2: #4a5565;
  --border: #cdd3dc;
  --border-strong: #6b7685;
  --accent: #1f5fad;
  --accent-ink: #ffffff;
  --accent-soft: #eaf1fa;
  --link: #1f5fad;
  --focus: #174ea6;
  --kicker: #1f5fad;
  --designed-fg: #1f5fad;  --designed-bg: #eaf1fa;
  --checked-fg: #17663a;   --checked-bg: #e5f4ea;
  --proposed-fg: #3e4a59;  --proposed-bg: #eef1f5;
  --validate-fg: #8a4600;  --validate-bg: #fff2db;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 12px;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1722; --surface: #16212f; --surface-2: #1d2a3a; --text: #e8edf3; --text-2: #b3bdca;
    --border: #344255; --border-strong: #8794a6; --accent: #9cc2f0; --accent-ink: #0f1722; --accent-soft: #1e3150;
    --link: #a9cbf5; --focus: #c4dcfa; --kicker: #9cc2f0;
    --designed-fg: #a9cbf5; --designed-bg: #1e3150; --checked-fg: #8fdcae; --checked-bg: #173326;
    --proposed-fg: #ccd3dd; --proposed-bg: #263345; --validate-fg: #f3c27a; --validate-bg: #3a2a12;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1722; --surface: #16212f; --surface-2: #1d2a3a; --text: #e8edf3; --text-2: #b3bdca;
  --border: #344255; --border-strong: #8794a6; --accent: #9cc2f0; --accent-ink: #0f1722; --accent-soft: #1e3150;
  --link: #a9cbf5; --focus: #c4dcfa; --kicker: #9cc2f0;
  --designed-fg: #a9cbf5; --designed-bg: #1e3150; --checked-fg: #8fdcae; --checked-bg: #173326;
  --proposed-fg: #ccd3dd; --proposed-bg: #263345; --validate-fg: #f3c27a; --validate-bg: #3a2a12;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.65 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }
abbr[title] { text-decoration: none; font-weight: 700; }
.small { font-size: .9rem; color: var(--text-2); }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 1rem; }

/* Reading progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; display: none; }
.js .progress { display: block; }
.progress__bar { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.site-header__inner { max-width: 80rem; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 700; min-height: 44px; }
.brand__sub { font-weight: 400; color: var(--text-2); margin-left: .3rem; }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.header-link { padding: .55rem .75rem; min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px; }
.theme-toggle { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .45rem .8rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 8px; font: inherit; font-size: .95rem; cursor: pointer; }
.theme-toggle .icon-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .icon-light { display: none; } :root:not([data-theme="light"]) .theme-toggle .icon-dark { display: block; } }

/* Layout */
.layout { max-width: 80rem; margin: 0 auto; padding: 0 1rem; display: grid; grid-template-columns: 1fr; }
@media (min-width: 72rem) { .layout { grid-template-columns: 14rem minmax(0, 1fr); gap: 3rem; } }
main { min-width: 0; padding-bottom: 4rem; }
main > section { padding: 4.5rem 0 1rem; border-bottom: 1px solid var(--border); scroll-margin-top: 4.5rem; }
main > section:last-of-type { border-bottom: 0; }
section > p, section > ul, section > ol, .lede { max-width: var(--measure); }

/* TOC */
.toc { padding-top: 1rem; }
.toc__details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toc__summary { cursor: pointer; padding: .75rem 1rem; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.toc__list { list-style: none; margin: 0; padding: 0 .5rem .75rem; counter-reset: toc; }
.toc__list a { display: flex; gap: .5rem; padding: .4rem .6rem; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: .95rem; line-height: 1.35; min-height: 32px; align-items: center; border-left: 3px solid transparent; }
.toc__list a::before { counter-increment: toc; content: counter(toc, decimal-leading-zero); font-variant-numeric: tabular-nums; color: var(--text-2); font-size: .8rem; }
.toc__list a:hover { background: var(--surface-2); color: var(--text); }
.toc__list a[aria-current="true"] { color: var(--text); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
@media (min-width: 72rem) {
  .toc { position: sticky; top: 4.25rem; align-self: start; max-height: calc(100vh - 5rem); overflow: auto; padding-top: 2rem; }
  .toc__details { border: 0; background: transparent; }
  .toc__summary { padding: 0 .6rem .5rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); list-style: none; cursor: default; min-height: 0; }
  .toc__summary::-webkit-details-marker { display: none; }
}

/* Type */
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .75rem; }
h1 { font-family: var(--serif); font-size: clamp(2.8rem, 7vw, 4.75rem); letter-spacing: -.02em; font-weight: 700; }
h2 { font-family: var(--serif); font-size: clamp(1.8rem, 3.6vw, 2.6rem); letter-spacing: -.01em; max-width: 40rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
.kicker { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 700; color: var(--kicker); margin: 0 0 .5rem; }
.lede { font-size: 1.15rem; color: var(--text-2); margin: 0 0 2rem; }
p { margin: 0 0 1rem; }

/* Status labels */
.status { display: inline-flex; align-items: center; gap: .25rem; font-size: .85rem; font-weight: 600; line-height: 1.3; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.status--designed { color: var(--designed-fg); background: var(--designed-bg); border-color: color-mix(in srgb, var(--designed-fg) 30%, transparent); }
.status--checked { color: var(--checked-fg); background: var(--checked-bg); border-color: color-mix(in srgb, var(--checked-fg) 30%, transparent); }
.status--proposed { color: var(--proposed-fg); background: var(--proposed-bg); border-color: color-mix(in srgb, var(--proposed-fg) 30%, transparent); }
.status--validate { color: var(--validate-fg); background: var(--validate-bg); border-color: color-mix(in srgb, var(--validate-fg) 30%, transparent); }

/* Hero */
.hero { padding-top: 3.5rem !important; }
.hero__headline { font-family: var(--serif); font-size: clamp(1.35rem, 2.6vw, 1.85rem); line-height: 1.35; max-width: 44rem; margin-bottom: 1.25rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0; margin: 1.5rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.facts div { padding: .9rem 1rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: -0 -1px -1px 0; }
.facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); font-weight: 700; }
.facts dd { margin: .2rem 0 0; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 2rem; }
.button { display: inline-flex; align-items: center; gap: .4rem; min-height: 48px; padding: .7rem 1.2rem; border-radius: 10px; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.button--primary { background: var(--accent); color: var(--accent-ink); }
.button--secondary { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
.button__note { font-weight: 400; color: var(--text-2); font-size: .9rem; }
.legend { margin-top: 2rem; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.legend__title { font-family: var(--sans); font-size: 1rem; margin-bottom: .6rem; }
.legend ul { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

/* Screenshots */
.shot { margin: 0 0 1.5rem; }
.shot__link { position: relative; display: block; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #f5f7fa; box-shadow: var(--shadow); }
.shot__link img { width: 100%; }
.shot__expand { position: absolute; right: .6rem; bottom: .6rem; background: rgba(15, 23, 34, .86); color: #fff; font-size: .85rem; font-weight: 600; padding: .35rem .7rem; border-radius: 8px; }
.shot__link:hover .shot__expand, .shot__link:focus-visible .shot__expand { background: #1f5fad; }
.shot figcaption { font-size: .95rem; color: var(--text-2); margin-top: .6rem; max-width: var(--measure); }
.shot figcaption strong { color: var(--text); }
.shot--hero { margin-top: 1rem; }

/* Glance */
.glance { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.glance__item { background: var(--surface); padding: 1.25rem; }
.glance__item h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--kicker); }
.glance__item p { margin: 0; }

/* Chain */
.chain { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); max-width: none; counter-reset: none; }
.chain__step { position: relative; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: 10px; padding: .9rem; }
.chain__step h3 { font-size: 1rem; margin: .35rem 0 .3rem; }
.chain__step p { font-size: .9rem; color: var(--text-2); margin: 0; }
.chain__n { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent-soft); color: var(--kicker); font-weight: 700; font-size: .85rem; }

.split { display: grid; gap: 2rem; grid-template-columns: 1fr; margin-bottom: 1.5rem; }
@media (min-width: 56rem) { .split { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.checklist { padding-left: 1.2rem; }
.checklist li { margin-bottom: .6rem; }

/* Disclosures */
.evidence { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 0 1.1rem; margin: 1.5rem 0; max-width: var(--measure); }
.evidence > summary { cursor: pointer; font-weight: 700; padding: .85rem 0; min-height: 44px; }
.evidence[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: .9rem; }
.evidence > :last-child { margin-bottom: 1rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.data-table { border-collapse: collapse; width: 100%; min-width: 40rem; font-size: .95rem; }
.data-table caption { text-align: left; padding: .85rem 1rem; font-weight: 700; caption-side: top; border-bottom: 1px solid var(--border-strong); }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: .75rem 1rem; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.data-table th:last-child, .data-table td:last-child { border-right: 0; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table thead th { background: var(--surface-2); font-size: .85rem; letter-spacing: .02em; border-bottom: 1px solid var(--border-strong); }
.data-table tbody th { font-weight: 700; background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.label-row { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .95rem; color: var(--text-2); max-width: none !important; }
.label-row abbr { color: var(--text); margin-right: .3rem; }

/* IA */
.ia-map { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 2rem; }
@media (min-width: 56rem) { .ia-map { grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; } }
.ia-map__col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.ia-map__col ul { padding-left: 1.1rem; margin: .4rem 0 0; }
.ia-map__arrow { align-self: center; justify-self: center; font-size: 1.6rem; color: var(--text-2); }
@media (max-width: 55.99rem) { .ia-map__arrow { transform: rotate(90deg); } }
.pill-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; max-width: none; }
.pill-list li { border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: .2rem .75rem; font-size: .92rem; }

/* Tabs (progressive enhancement). Without JS: nav is a list of links, every panel is visible. */
.tabs { margin: 0 0 2rem; }
.tabs__heading { margin-bottom: .5rem; }
.tabs__nav { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; max-width: none !important; }
.tabs__nav a, .tabs__nav [role="tab"] { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .5rem .9rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; text-align: left; }
.tabs__nav [role="tab"][aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tabs__nav [role="tab"]:hover:not([aria-selected="true"]) { background: var(--surface-2); }
.tabs__panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.tabs__panel:focus-visible { outline-offset: 2px; }
.tabs__panel-title { font-size: 1.15rem; }
.tabs__controls { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.tabs__controls button { min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.tabs__controls button[disabled] { opacity: .45; cursor: not-allowed; }
.tabs__status { font-size: .9rem; color: var(--text-2); align-self: center; }

/* Journey */
.journey__n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid currentColor; font-size: .8rem; }
.journey__body { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 60rem) { .journey__body { grid-template-columns: 1.15fr 1fr; align-items: start; } }
.journey__body .shot { margin: 0; }
.journey__facts { margin: 0; display: grid; gap: .9rem; }
.journey__facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--kicker); }
.journey__facts dd { margin: .15rem 0 0; }

/* Decisions */
.decision { border-top: 1px solid var(--border); padding: 1.5rem 0; }
.decision h3 { font-family: var(--serif); font-size: 1.45rem; display: flex; gap: .75rem; align-items: baseline; }
.decision__n { font-family: var(--sans); font-size: .9rem; color: var(--kicker); font-weight: 700; }
.decision__grid { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin: 0; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.decision__grid div { background: var(--surface); padding: .9rem 1rem; }
.decision__grid dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--kicker); }
.decision__grid dd { margin: .25rem 0 0; font-size: .97rem; }

/* Gallery */
.gallery { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) { .gallery { grid-template-columns: 1fr 1fr; } }
.gallery .shot { margin: 0; }

/* Findings */
@media (min-width: 60rem) {
  .js .findings.is-enhanced { display: grid; grid-template-columns: 16rem 1fr; gap: 1.25rem; align-items: start; }
  .js .findings.is-enhanced .tabs__nav { flex-direction: column; flex-wrap: nowrap; }
  .js .findings.is-enhanced .tabs__nav [role="tab"] { width: 100%; }
}
.findings__id { font-variant-numeric: tabular-nums; font-weight: 700; border-radius: 6px; padding: 0 .35rem; background: var(--surface-2); color: var(--text); }
.tabs__nav [aria-selected="true"] .findings__id { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
.finding__grid { display: grid; gap: 1px; grid-template-columns: 1fr; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 1rem 0; }
@media (min-width: 48rem) { .finding__grid { grid-template-columns: repeat(3, 1fr); } }
.finding__grid div { background: var(--surface); padding: .85rem 1rem; }
.finding__grid dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--kicker); }
.finding__grid dd { margin: .3rem 0 0; }
.finding__observed { max-width: var(--measure); }
.finding__list { padding-left: 1.2rem; max-width: var(--measure); }
.finding__shots { display: flex; flex-wrap: wrap; gap: .75rem; }
.thumb { display: block; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f5f7fa; width: min(15rem, 100%); }
.thumb img { width: 100%; height: 13rem; object-fit: cover; object-position: top; }

/* Diagram */
.diagram { margin: 0 0 1.5rem; }
.diagram__scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 1rem; }
.arch { min-width: 44rem; width: 100%; height: auto; font-family: var(--sans); }
.arch text { fill: var(--text); font-size: 14px; text-anchor: middle; font-weight: 600; }
.arch .arch__label text { text-anchor: start; font-size: 12px; letter-spacing: .1em; fill: var(--text-2); font-weight: 700; }
.arch .arch__sub { font-size: 12px; font-weight: 400; fill: var(--text-2); }
.arch__ui rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.arch__boundary rect { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 6 4; }
.arch__svc rect { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.arch__data rect { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; }
.arch__opt rect { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 3 4; }
.arch__opt text { font-weight: 400; fill: var(--text-2); }
.arch__line path { stroke: var(--border-strong); stroke-width: 2; fill: none; marker-end: none; }
.diagram figcaption { font-size: .95rem; color: var(--text-2); margin-top: .6rem; max-width: var(--measure); }

/* Lessons */
.lessons { padding-left: 1.4rem; }
.lessons li { margin-bottom: .9rem; }
.next-list { list-style: none; padding: 0; }
.next-list li { margin-bottom: .6rem; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }

/* Closing */
.closing { margin-top: 2.5rem; padding: 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); max-width: var(--measure); }
.closing__cta { font-family: var(--serif); font-size: 1.35rem; margin: 0; }

/* Footer & back to top */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 1rem; max-width: 80rem; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--text-2); font-size: .95rem; }
.site-footer p { margin: 0; }
.to-top { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .55rem .9rem; border-radius: 999px; background: #1f5fad; color: #fff; text-decoration: none; font-weight: 600; box-shadow: var(--shadow); }
.to-top[hidden] { display: none; }
.to-top:focus-visible { outline-color: var(--focus); }

.no-js-only { display: inline; }
.js .no-js-only { display: none; }

/* Lightbox */
.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--text); }
.lightbox::backdrop { background: rgba(8, 12, 18, .7); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lightbox__bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.lightbox__title { font-family: var(--sans); font-size: 1rem; margin: 0; flex: 1 1 14rem; }
.lightbox__views { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.lightbox__view { min-height: 44px; padding: .45rem .8rem; border: 0; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.lightbox__view[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.lightbox__view[hidden] { display: none; }
.lightbox__open { min-height: 44px; display: inline-flex; align-items: center; }
.lightbox__close { min-height: 44px; padding: .45rem .9rem; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.lightbox__stage { overflow: auto; padding: 1rem; display: grid; place-items: start center; }
.lightbox__img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: #f5f7fa; }
.lightbox__img.is-detail { max-width: none; }
.lightbox__caption { margin: 0; padding: .6rem 1rem; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .95rem; }

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  main > section { padding-top: 3rem; }
  .brand__sub { display: none; }
  .header-link { display: none; }
}
@media (max-width: 40rem) {
  .to-top { padding: .55rem; width: 44px; justify-content: center; }
  .to-top__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media print {
  .site-header, .toc, .to-top, .progress, .lightbox { display: none !important; }
  .tabs__panel[hidden] { display: block !important; }
}
