/* Inter provides consistent heading metrics across devices. */
@font-face {
  font-family: Inter;
  src: url("../fonts/inter/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("../fonts/inter/InterVariable-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}

/* Locally hosted Source Sans 3, SIL Open Font License 1.1. */
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3/SourceSans3VF-Upright.ttf.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3/SourceSans3VF-Italic.ttf.woff2") format("woff2");
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
}

/* All rem typography is 50% larger, without compounding nested font sizes. */
html { font-size: 110%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Alessandro Miele / developer's lab. The original Vesuvio asset stays intact. */
:root {
  color-scheme: dark;
  --site-ink: #e6edf6;
  --site-muted: #b4c1d1;
  --site-surface: #090f18;
  --site-surface-soft: #101b29;
  --site-card-surface: #0e1825;
  --site-nav-surface: #0d1622;
  --site-accent: #67e8f9;
  --site-accent-strong: #a5f3fc;
  --site-nav-accent: #22d3ee;
  --site-accent-soft: #163541;
  --site-border: #263649;
  --site-border-strong: #30475e;
  --site-focus-ring: #22d3ee65;
  --site-shadow: 0 12px 30px #00000020;
  --site-shadow-strong: 0 18px 42px #00000040;
  --site-nav-shadow: 0 8px 28px #00000030;
  --site-radius: .6rem;
  --site-font-heading: Inter, ui-sans-serif, system-ui, sans-serif;
  --site-font-body: Inter, ui-sans-serif, system-ui, sans-serif;
  --article-reading-size: 1.1875rem;
  --article-reading-width: 65ch;
  --site-font-reading: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --lab-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --site-heading-1: clamp(2.5rem, 7.95vw, 4.8rem);
  --site-heading-2: clamp(1.8rem, 4.5vw, 2.5rem);
  --site-heading-3: clamp(1.25rem, 3vw, 1.65rem);
  --bs-body-bg: var(--site-surface);
  --bs-body-color: var(--site-ink);
  --bs-secondary-color: var(--site-muted);
  --bs-border-color: var(--site-border);
  --bs-link-color: var(--site-accent);
}
:root[data-theme="light"] {
  color-scheme: light;
  --site-ink: #142339;
  --site-muted: #4c6075;
  --site-surface: #f4f7fa;
  --site-surface-soft: #e8eff5;
  --site-card-surface: #ffffff;
  --site-nav-surface: #f8fbff;
  --site-accent: #076c80;
  --site-accent-strong: #07566a;
  --site-nav-accent: #087f96;
  --site-accent-soft: #dff3f6;
  --site-border: #cbd7e2;
  --site-border-strong: #acbdcd;
  --site-shadow: 0 12px 30px #18375008;
  --site-nav-shadow: 0 8px 28px #18375010;
}
body {
  background-image: radial-gradient(ellipse at 85% 5%, color-mix(in srgb, var(--site-accent) 7%, transparent), transparent 40rem);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #22d3ee55; color: var(--site-ink); }
.site-main h1, .site-main h2, .site-main h3,
.site-main h4, .site-main h5, .site-main h6 { font-weight: 650; letter-spacing: -.035em; line-height: 1.16; }
.site-main { max-width: 74rem; padding-top: 2.5rem; }
/* Override the base floating-header spacing in both sticky states. */
.site-header,
.site-header.site-header-scrolled {
  top: 0;
  padding: 0;
  background: var(--site-nav-surface);
  transition: none;
}
.site-navbar { width: 100%; border: 0; border-bottom: 1px solid var(--site-border); border-radius: 0; box-shadow: none; padding: 1rem 0 .65rem; }
.site-navbar > .container { flex-wrap: wrap; gap: .7rem; }
.site-navbar .navbar-brand { font-family: var(--site-font-body); font-size: 1.05rem; font-weight: 650; letter-spacing: -.04em; gap: .8rem; margin-right: auto; }
/* The uploaded image determines the dimensions; its alpha channel defines the mark. */
.site-brand-logo-accent {
  display: inline-flex;
  flex-shrink: 0;
  background-color: var(--site-accent);
  -webkit-mask: var(--header-logo-mask) center / contain no-repeat;
  mask: var(--header-logo-mask) center / contain no-repeat;
}
.site-brand-logo-accent .site-brand-logo { opacity: 0; }
@media (forced-colors: active) {
  .site-brand-logo-accent { background-color: LinkText; forced-color-adjust: none; }
}
.lab-brand-symbol { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--site-nav-accent); border-radius: .35rem; color: var(--site-accent); font: .8rem var(--lab-mono); letter-spacing: -.08em; }
.site-navbar .navbar-collapse { order: 3; flex-basis: 100%; flex-direction: column; align-items: stretch; }
.site-navbar .navbar-nav { margin-left: 0 !important; gap: .2rem 1rem; flex-wrap: wrap; }
.site-navbar .nav-link { font-family: var(--lab-mono); font-size: .75rem; padding: .35rem 0; }
.site-navbar .navbar-toggler { order: 2; border-color: var(--site-border); }
.lab-theme-toggle { border: 1px solid var(--site-border); color: var(--site-ink); background: var(--site-surface-soft); border-radius: .35rem; padding: .45rem .7rem; font: .7rem var(--lab-mono); white-space: nowrap; }
.lab-theme-toggle:hover { border-color: var(--site-accent); color: var(--site-accent); }
.lab-theme-toggle:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 3px; }
.site-main a:focus-visible, .site-footer a:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 4px; box-shadow: none; }
.page-breadcrumb, .article-date, .publication-date, .article-card-type, .page-kicker, .article-share h2 { font-family: var(--lab-mono); }
.page-breadcrumb { font-size: .75rem; }
.lab-intro { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; align-items: start; gap: 1.4rem clamp(1.5rem, 3vw, 3rem); text-align: left; padding: 3rem 0 4.5rem; margin-bottom: 3rem; border-bottom: 1px solid var(--site-border); }
.lab-intro::before { position: absolute; inset: -2rem 0 0; z-index: -1; content: ""; pointer-events: none; background-image: linear-gradient(var(--site-border) 1px, transparent 1px), linear-gradient(90deg, var(--site-border) 1px, transparent 1px); background-size: 48px 48px; opacity: .15; mask-image: linear-gradient(90deg, transparent 30%, #000); }
.lab-eyebrow { grid-column: 1; margin: 0; color: var(--site-accent); font: .7rem var(--lab-mono); letter-spacing: .12em; text-transform: uppercase; }
.lab-eyebrow::before { content: "// "; opacity: .6; }
.lab-intro .page-heading-row { grid-column: 1; min-width: 0; margin: 0; justify-content: flex-start; }
.lab-intro h1 { max-width: 100%; margin: 0; font-size: clamp(2.25rem, 1.5rem + 3.6vw, 4rem); font-weight: 650; line-height: 1.12; letter-spacing: -.035em; text-wrap: balance; overflow-wrap: break-word; }
.lab-intro-copy { grid-column: 1; min-width: 0; }
.lab-intro-copy > p { max-width: none; margin-bottom: 1.2em; color: var(--site-muted); font: 400 1.1875rem/1.7 var(--site-font-reading); }
.lab-topics { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.5rem 0 2rem; list-style: none; }
.lab-topics li { padding: .3rem .55rem; color: var(--site-muted); border: 1px solid var(--site-border); border-radius: .25rem; font: .65rem var(--lab-mono); }
.lab-intro-actions { margin-top: 1.5rem; display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.lab-intro-actions a { text-decoration: none; font: .75rem var(--lab-mono); }
.lab-intro-actions .lab-primary-link { padding: .8rem 1rem; background: var(--site-accent); color: var(--site-surface); font-weight: 700; border-radius: .25rem; }
.lab-primary-link:hover { filter: brightness(1.12); }
.lab-terminal { grid-column: 2; grid-row: 1 / 4; align-self: center; min-width: 0; transform: rotate(1deg); background: var(--site-card-surface); border: 1px solid var(--site-border-strong); border-radius: .6rem; box-shadow: 12px 12px 0 color-mix(in srgb, var(--site-accent) 4%, transparent); overflow: hidden; }
.lab-terminal-header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--site-border); color: var(--site-muted); font: .65rem var(--lab-mono); }
.lab-terminal-dots { letter-spacing: .25rem; color: var(--site-muted); }
.lab-terminal-body { padding: clamp(1rem, 2.5vw, 2rem); font: .78rem/2 var(--lab-mono); text-align: left; }
.lab-terminal-body p { margin: 0; }
.lab-terminal-body .lab-code-comment { margin-bottom: 1rem; }
.lab-terminal-body .lab-approach-code { display: block; padding: 0; border: 0; background: none; color: var(--site-ink); font: inherit; text-align: left; white-space: normal; overflow-wrap: anywhere; }
/* Page descriptions are plain text; paragraph and single-line breaks are retained. */
.lab-intro-copy > p { white-space: pre-line; overflow-wrap: anywhere; }
.lab-page-intro h1 { max-width: none; }
.lab-terminal-path { min-width: 0; overflow-wrap: anywhere; text-align: right; }
.lab-article-index-list { list-style: none; margin: 0; padding: 0; }
.lab-article-index-list li + li { margin-top: .6rem; }
.lab-article-index-list a { display: flex; align-items: baseline; gap: .7rem; color: var(--site-accent); text-decoration: none; }
.lab-article-index-list a > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.lab-article-index-prompt { flex-shrink: 0; color: var(--site-muted); }
.lab-article-index-list a:hover { text-decoration: underline; text-underline-offset: .2em; }
.lab-article-index-status { display: block; margin-left: 1.4rem; color: var(--site-muted); }
.lab-code-comment { color: var(--site-muted); }
.lab-code-key { color: var(--site-accent); }
.lab-code-string { color: #a9dfaf; }
[data-theme="light"] .lab-code-string { color: #326c39; }
.lab-terminal-output { margin-top: 1.5rem !important; padding-top: 1rem; border-top: 1px dashed var(--site-border); color: var(--site-muted); }
.lab-terminal-output span { color: var(--site-accent); }
.lab-section-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 1rem; margin: 0 0 1.8rem; }
.lab-section-heading h2 { margin: 0; font-size: 1.4rem; }
.lab-section-heading p { margin: 0; color: var(--site-muted); font: .65rem var(--lab-mono); }
.lab-section-heading h2::before { content: "01 / "; color: var(--site-accent); font: .8rem var(--lab-mono); }
.article-card { box-shadow: none; }
.article-card:hover { box-shadow: none; }
.article-card-heading { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: .75rem; width: 100%; text-align: left; }
.article-title, .site-main h2.article-title, .full-article .page-heading h1 { font-family: var(--site-font-body); font-size: clamp(1.75rem, 4.5vw, 2.5rem); font-weight: 650; text-align: left; letter-spacing: -.025em; line-height: 1.22; width: 100%; max-width: none; text-wrap: wrap; overflow-wrap: break-word; }
.article-heading-with-status { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; width: 100%; }
.article-card-body { padding: 1.6rem; }
.article-card-cover { aspect-ratio: 16 / 9; background: #e6edf6; }
.article-card-cover img { object-fit: contain; padding: 1rem; }
.article-card .article-card-type { font-size: .62rem; color: var(--site-accent); font-weight: 400; }
.article-card-excerpt { font-size: .9rem; line-height: 1.8; }
.read-more { font-family: var(--lab-mono); font-size: .7rem; text-decoration: none; }
.read-more::after { content: " ↗"; }
.article-content { white-space: normal; font-family: var(--site-font-reading); font-size: var(--article-reading-size); line-height: 1.6; font-weight: 400; text-align: start; letter-spacing: normal; text-wrap: pretty; }
/* Narrow prose, wide media: tune this measure independently of the article box. */
.article-content > :is(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6) {
  width: 100%;
  max-width: var(--article-reading-width);
  margin-inline: auto;
  box-sizing: border-box;
}
.article-content p { margin-block: 0 1.15em; }
/* Grid tracks measure the reading column at body size, independent of heading size. */
.article-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(100%, var(--article-reading-width)) minmax(0, 1fr);
}
.article-content > * { grid-column: 2; min-width: 0; }
.article-content > :is(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6) {
  max-width: none;
  margin-inline: 0;
}
.article-content :is(h1, h2, h3, h4, h5, h6) { text-align: left; text-wrap: wrap; }
.article-content > :is(.article-image, .article-video, pre) { grid-column: 1 / -1; }
.article-content--image-inline > .article-image { grid-column: 2; }
.article-reading-header {
  width: 100%;
  max-width: var(--article-reading-width);
  margin-inline: auto;
  font-family: var(--site-font-reading);
  font-size: var(--article-reading-size);
  text-align: left;
}
.article-reading-header .article-publication-date { font-family: var(--site-font-body); }
.article-content :is(ul, ol) { margin-block: .35em 1.1em; padding-inline-start: 1.4em; }
.article-content li + li { margin-top: .35em; }
.article-content li > p { margin-bottom: .45em; }
.article-content > :last-child { margin-bottom: 0; }
.full-article { max-width: 54rem; box-shadow: none; }
.full-article > .page-heading { text-align: left; }
/* Article titles remain below page titles; section headings step down at every level.
   Listings shift Markdown headings down one semantic level beneath the article title. */
.site-main .article-content h2 { font-size: clamp(1.9rem, 4.8vw, 2.8rem); }
.site-main .article-content h3 { font-size: clamp(1.55rem, 3.75vw, 2.15rem); }
.site-main .article-content h4 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
.site-main .article-content h5 { font-size: clamp(1.2rem, 2.55vw, 1.45rem); }
.site-main .article-content h6 { font-size: clamp(1.1rem, 2.1vw, 1.25rem); }
.article-content :is(h2, h3, h4, h5, h6) { margin-top: 1.7em; margin-bottom: .55em; letter-spacing: -.02em; line-height: 1.25; text-wrap: wrap; overflow-wrap: break-word; }
.article-content > :is(h2, h3, h4, h5, h6):first-child { margin-top: 0; }
.article-content :is(h2, h3, h4, h5) + :is(h3, h4, h5, h6) { margin-top: .9em; }
.article-content code, .article-content pre { font-family: var(--lab-mono); }
.article-content code { color: var(--site-accent); }
.article-content pre { padding: 1.5rem; background: var(--site-surface); border: 1px solid var(--site-border); border-radius: .4rem; overflow-x: auto; }
.section-navigation-panel, .mega-menu-panel, .mega-menu-content { background: var(--site-card-surface); }
.section-navigation-panel h2 { font: .75rem var(--lab-mono); letter-spacing: 0; }
.form-control, .form-select { color: var(--site-ink); background-color: var(--site-card-surface); }
.form-control::placeholder { color: var(--site-muted); opacity: 1; }
.form-control:focus, .form-select:focus { color: var(--site-ink); background-color: var(--site-card-surface); }
.text-muted { color: var(--site-muted) !important; }
.markdown-diagnostics { color: #fff0c3; background: #332b14; border-color: #89703a; }
/* The horizon and footer follow the explicit site theme, including manual toggles. */
.site-footer {
  --horizon-surface: #090f18;
  --horizon-fade: #090f182b;
  --horizon-grid: #67e8f906;
  --horizon-heading: #e6edf6;
  --horizon-label: #9caec3;
  --horizon-credit: #b4c7d8;
  --footer-ink: #a0aec0;
  padding: 0; background: var(--horizon-surface); color: var(--footer-ink); border: 0;
}
:root[data-theme="light"] .site-footer {
  --horizon-surface: #f4f7fa;
  --horizon-fade: #f4f7fa2b;
  --horizon-grid: #076c8008;
  --horizon-heading: #142339;
  --horizon-label: #4c6075;
  --horizon-credit: #4c6075;
  --footer-ink: #4c6075;
}
.lab-horizon { position: relative; isolation: isolate; overflow: hidden; min-height: 19rem; background: var(--horizon-surface); border-top: 1px solid var(--site-border-strong); }
.lab-horizon-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 49%; filter: none; opacity: 1; z-index: -3; }
.lab-horizon-image--light { display: none; }
:root[data-theme="light"] .lab-horizon-image--dark { display: none; }
:root[data-theme="light"] .lab-horizon-image--light { display: block; }
.lab-horizon::before { content: ""; position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, transparent 40%, var(--horizon-fade) 65%, var(--horizon-surface) 100%); }
.lab-horizon::after { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(var(--horizon-grid) 1px, transparent 1px), linear-gradient(90deg, var(--horizon-grid) 1px, transparent 1px); background-size: 40px 40px; }
.lab-horizon-content { padding-block: 3rem; position: relative; display: flex; justify-content: flex-end; }
.lab-horizon-copy { width: min(25rem, 48%); }
.lab-horizon-copy p { color: var(--horizon-label); margin-bottom: 1rem; font: .62rem var(--lab-mono); letter-spacing: .12em; }
.lab-horizon-copy h2 { color: var(--horizon-heading); font: 600 clamp(1.6rem, 4.5vw, 2.6rem)/1.2 var(--site-font-body); letter-spacing: -.04em; }
.lab-horizon-copy small { display: block; color: var(--horizon-credit); max-width: 28ch; margin-top: 1rem; font-size: .8rem; line-height: 1.7; }
.site-footer-content { padding-block: 1.6rem; font-family: var(--lab-mono); font-size: .65rem; }
.site-footer a, .site-footer .btn-link, .site-footer.text-muted { color: var(--footer-ink) !important; }
.site-footer a:hover { color: var(--site-accent) !important; }
@media (max-width: 991px) {
  .lab-intro { gap: 1.5rem; padding-top: 2rem; }
  .lab-terminal-body { font-size: .67rem; padding: 1rem; }
}
@media (max-width: 767px) {
  :root { --article-reading-size: 1.125rem; }
  .article-content, .lab-intro-copy > p { font-size: 1.125rem; }
  .lab-intro { grid-template-columns: 1fr; padding: 1rem 0 2.5rem; gap: 1.2rem; }
  .lab-intro h1 { font-size: clamp(2.25rem, 1.5rem + 3.6vw, 4rem); }
  .lab-terminal { grid-column: 1; grid-row: auto; width: 100%; margin-top: 1rem; transform: none; }
  .lab-terminal-body { font-size: .75rem; padding: 1.4rem; }
  .lab-intro::before { inset-inline: 0; }
  .site-main { padding-top: 1.5rem; }
  .lab-horizon { min-height: 22rem; }
  .lab-horizon-image { inset: auto auto 0 0; width: 100%; height: auto; object-fit: contain; object-position: left bottom; }
  .lab-horizon::before { background: linear-gradient(180deg, var(--horizon-surface) 0%, transparent 50%); }
  .lab-horizon-copy { width: 65%; }
  .lab-horizon-content { padding-top: 2.4rem; }
}
@media (max-width: 575px) {
  .site-navbar .navbar-nav { flex-direction: column; gap: .3rem; padding-block: .5rem; }
  .site-navbar .navbar-brand { font-size: .9rem; gap: .4rem; margin-right: 0; }
  .lab-theme-toggle { margin-left: auto; padding: .4rem; font-size: .6rem; }
  .lab-brand-symbol { width: 1.7rem; height: 1.7rem; font-size: .7rem; }
  .site-navbar .navbar-toggler { padding: .25rem; }
  .site-navbar > .container { gap: .4rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Child sections share the entire row below the primary navigation. */
.site-navbar .mega-menu-panels { width: 100%; min-width: 0; }
.site-navbar .mega-menu-panel {
  position: static;
  inset: auto;
  z-index: auto;
  width: 100%;
  margin: .75rem 0 0;
  border: 0;
  border-top: 1px solid var(--site-border);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.site-navbar .mega-menu-content {
  padding: 1.25rem 0 .5rem;
  max-height: min(60vh, 36rem);
  max-height: min(60dvh, 36rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: transparent;
}
.mega-menu-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.mega-menu-section-title { margin: 0; font: .75rem var(--lab-mono); }
.mega-menu-section-title a { color: var(--site-accent); text-decoration: none; }
.mega-menu-close { flex-shrink: 0; padding: .35rem .5rem; background: transparent; border: 1px solid var(--site-border); border-radius: .25rem; color: var(--site-muted); font: .7rem var(--lab-mono); }
.mega-menu-close:hover { color: var(--site-ink); border-color: var(--site-accent); }
.mega-menu-close:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 3px; }
.mega-menu-content > .mega-menu-tree { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); align-items: start; gap: 1rem 2rem; }
.mega-menu-content > .mega-menu-tree > li { min-width: 0; }
.mega-menu-link { overflow-wrap: anywhere; }
.mega-menu-content .mega-menu-tree .mega-menu-tree { margin-top: .4rem; }
@media (max-width: 991.98px) {
  .site-navbar #page-navigation { max-height: calc(100vh - 5rem); max-height: calc(100dvh - 5rem); overflow-y: auto; overscroll-behavior: contain; }
  .site-navbar .mega-menu-content { padding-top: 1rem; max-height: none; overflow: visible; }
  .mega-menu-content > .mega-menu-tree { grid-template-columns: 1fr; }
}

/* Keep header controls before the expanding navigation in flex order. */
.site-navbar .navbar-brand { order: 0; }
.site-navbar .lab-theme-toggle { order: 1; }
@media (max-width: 991.98px) {
  .site-navbar .mega-menu-root > .mega-menu-panel { margin: .35rem 0 .75rem; border-top: 0; }
  .site-navbar .mega-menu-root > .mega-menu-panel .mega-menu-content { padding: .6rem .75rem .5rem; }
  .site-navbar .mega-menu-root > .mega-menu-panel .mega-menu-section-heading { display: none; }
}

/* Native article anchors keep the reader on the current page. */
.articles-section > article[id] { scroll-margin-top: var(--article-anchor-offset, 10rem); }
.articles-section > article[id]:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 4px; }


/* Article spacing and borders. Hover highlights keep the boxes stationary. */
:root {
  --article-padding: clamp(1.5rem, 3vw, 2.5rem);
}
.site-main-container {
  /* Page-edge space; independent of the navigation container. */
  --page-gutter: clamp(1.25rem, 4vw, 4rem);
  max-width: 88rem;
  padding-inline: var(--page-gutter);
}
.site-main { max-width: 82rem; min-width: 0; }
.site-navbar .navbar-brand { min-width: 0; white-space: normal; }
.site-navbar .nav-link { min-height: 2rem; display: inline-flex; align-items: center; }
.lab-theme-toggle { min-height: 2rem; }
.lab-article-index { align-self: start; }
.lab-terminal-body { line-height: 1.65; }
.lab-article-index-list li + li { margin-top: .8rem; }
.article-card, .full-article {
  padding: var(--article-padding);
  border: 1px solid var(--site-border-strong);
  border-radius: 1rem .2rem 1rem .2rem;
  box-shadow: none;
}
.article-card { margin-bottom: 2rem; }
.article-card, .full-article { transition: border-color 180ms ease; }
.article-card--grid { padding: 0; margin-bottom: 0; }
.article-card-body { padding: var(--article-padding); }
.articles-section--grid { gap: 2rem; }
.articles-section--grid[style] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(18rem, calc((100% - (var(--article-grid-columns) - 1) * 2rem) / var(--article-grid-columns)))), 1fr));
}
.full-article { max-width: none; }
.full-article > .page-heading { margin-bottom: 0; }
.full-article .article-content { max-width: none; }
.article-title, .site-main h2.article-title, .full-article .page-heading h1 { font-weight: 750; line-height: 1.16; }
.article-content p { color: var(--site-ink); }
.article-content strong {
  color: inherit;
  font-family: inherit;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: inherit;
  background: none;
}
/* Inline image spacing; the fullscreen viewer has independent, margin-free styles. */
.article-image, .article-image--normal, .article-image--wide, .article-image--full {
  --article-image-margin: clamp(.35rem, 1vw, .75rem);
  width: calc(100% - var(--article-image-margin) * 2);
  max-width: none;
  margin: 2rem var(--article-image-margin);
}
.article-image img { border-radius: .25rem; }
.article-card-cover { aspect-ratio: auto; }
.article-card-cover img { width: 100%; height: auto; padding: 0; object-fit: contain; }
.article-image figcaption { line-height: 1.45; padding-inline: .5rem; }
.article-publication-date, .publication-date { font-size: .95rem; line-height: 1.5; }
.article-publication-date { margin-bottom: 1.5rem; }
.site-footer-content { line-height: 1.7; }
@media (hover: hover) and (pointer: fine) {
  .article-card:hover, .full-article:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--site-accent-strong);
  }
}
@media (max-width: 1199.98px) {
  .lab-intro { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .lab-terminal { grid-column: 1; grid-row: auto; width: 100%; transform: none; }
}
@media (max-width: 1024px) {
  .site-main-container { width: 100%; max-width: none; }
  .site-main { width: 100%; max-width: none; }
  .page-content-layout.has-section-navigation { grid-template-columns: minmax(0, 1fr); }
  .section-navigation-panel { position: static; }
  .articles-section--grid, .articles-section--grid[style] { grid-template-columns: minmax(0, 1fr); }
  .article-card, .full-article { --article-padding: clamp(1.25rem, 3vw, 2rem); border-radius: .6rem .15rem; }
  .lab-terminal-body { font-size: .875rem; }
  .lab-intro-copy > p { line-height: 1.55; }
}
@media (max-width: 991.98px) {
  .site-navbar { padding-block: .45rem; }
  .site-navbar > .container { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; max-width: none; }
  .site-navbar .navbar-brand { grid-column: 1 / -1; grid-row: 1; margin-right: 0; font-size: 1rem; padding: 0; }
  .site-navbar .lab-theme-toggle { grid-column: 1; grid-row: 2; justify-self: start; margin-left: 0; font-size: .8rem; }
  .site-navbar .navbar-toggler { grid-column: 2; grid-row: 2; justify-self: end; min-width: 2rem; min-height: 2rem; }
  .site-navbar .navbar-collapse { grid-column: 1 / -1; }
  .site-navbar .navbar-nav { flex-direction: column; gap: .3rem; }
  .site-navbar .nav-link { font-size: .9rem; padding: .45rem 0; }
  .site-navbar #page-navigation { max-height: calc(100dvh - 8rem); }
}
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1200px) {
  .site-navbar > .container { grid-template-columns: minmax(0, 1fr) auto auto; }
  .site-navbar .navbar-brand { grid-column: 1; }
  .site-navbar .lab-theme-toggle { grid-column: 2; grid-row: 1; }
  .site-navbar .navbar-toggler { grid-column: 3; grid-row: 1; }
  .site-navbar #page-navigation { max-height: calc(100dvh - 4rem); }
}

/* The photo owns the viewport; viewer controls no longer take width away from it. */
.gallery-lightbox {
  box-sizing: border-box;
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: 100vw; max-height: 100vh; max-height: 100dvh;
  inset: 0; margin: 0; padding: 0;
  font-size: 1rem;
  background: #050a10;
}
.gallery-lightbox[open] { display: block; }
.gallery-lightbox-content { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-height: 0; margin: 0; }
.gallery-lightbox-content img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; touch-action: pan-y pinch-zoom; }
.gallery-lightbox-content figcaption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  max-height: 25vh; max-height: 25dvh;
  overflow-y: auto;
  margin: 0;
  padding: .75rem max(3rem, env(safe-area-inset-right)) 1.75rem max(3rem, env(safe-area-inset-left));
  background: linear-gradient(transparent, #050a10ed 25%);
  color: #f0f5fb;
  font-size: .9rem;
  line-height: 1.4;
}
.gallery-lightbox-close, .gallery-lightbox-previous, .gallery-lightbox-next {
  position: absolute; z-index: 2;
  width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
  padding: 0; line-height: 1;
  background: #07111ccc;
  backdrop-filter: blur(10px);
}
.gallery-lightbox-close { top: max(.4rem, env(safe-area-inset-top)); right: max(.4rem, env(safe-area-inset-right)); font-size: 1.7rem; }
.gallery-lightbox-previous { top: 50%; left: max(.3rem, env(safe-area-inset-left)); transform: translateY(-50%); font-size: 2rem; }
.gallery-lightbox-next { top: 50%; right: max(.3rem, env(safe-area-inset-right)); transform: translateY(-50%); font-size: 2rem; }
.gallery-lightbox-counter { position: absolute; z-index: 2; bottom: .25rem; left: 50%; transform: translateX(-50%); margin: 0; font-size: .8rem; color: #e6edf6; pointer-events: none; }
@media (orientation: landscape) and (max-height: 600px) {
  .gallery-lightbox-content figcaption { padding-block: .3rem 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .article-card:hover, .full-article:hover { transform: none; }
}

/* Keep the larger navigation compact without shrinking its text. */
.site-navbar, .site-header.site-header-scrolled .site-navbar { min-height: 0; }
.site-navbar > .container { max-width: 88rem; }
.site-navbar .navbar-nav { column-gap: .65rem; }
.site-navbar .site-brand-logo { height: 2rem; }

/* Touch readers should not wait for decorative blur effects to clear. */
@media (pointer: coarse) {
  .article-image .image-reveal { opacity: 1; filter: none; transform: none; transition: none; }
}

/* Article-level media layouts: content remains complete and clickable, never cropped. */
.article-content--image-inline .article-image {
  max-width: min(100%, var(--article-reading-width));
  margin-inline: auto;
}
.article-content--image-wide .article-image {
  width: 100%;
  max-width: none;
  margin: 2rem 0;
}
/* A single reading column lets text flow beside and then below the image. */
.article-introduction {
  display: flow-root;
  max-width: var(--article-reading-width);
  margin-inline: auto;
}
.article-introduction > :is(p, ul, ol, blockquote, h2, h3, h4, h5, h6),
.article-image-flow > :is(p, ul, ol, blockquote, h2, h3, h4, h5, h6) {
  width: auto;
  max-width: none;
  margin-inline: 0;
}
.article-image-flow { display: flow-root; margin-bottom: 1.15em; }
.article-image-flow:last-child { margin-bottom: 0; }
.article-introduction .article-image--wrap {
  float: right;
  clear: both;
  width: 38%;
  max-width: 20rem;
  margin: 0 0 1.15em clamp(1rem, 2vw, 1.75rem);
}
.article-introduction .article-image--wrap-left {
  float: left;
  margin: 0 clamp(1rem, 2vw, 1.75rem) 1.15em 0;
}
.article-introduction .article-image--wrap img { width: 100%; height: auto; object-fit: contain; }
.article-introduction .article-image--wrap figcaption { padding-inline: 0; text-align: left; }
/* Section headings and subsequent media begin below the floated illustration. */
.article-image-flow > :is(h2, h3, h4, h5, h6, ul, ol, blockquote, .article-video),
.article-introduction > :is(h2, h3, h4, h5, h6, ul, ol, blockquote, .article-video),
.article-introduction > .article-image:not(.article-image--wrap) { clear: both; }
/* Narrow cards and mobile keep a full-width image in normal document flow. */
.article-card--grid .article-introduction .article-image--wrap {
  float: none;
  width: 100%;
  max-width: none;
  margin: 0 0 1.15em;
}
@media (max-width: 991.98px) {
  .article-introduction .article-image--wrap {
    float: none;
    width: 100%;
    max-width: none;
    margin: 0 0 1.15em;
  }
}
