/* Reusable CMS layout behavior. Site colors, fonts and branding remain in site.css. */
:root {
  --article-reading-width: 65ch;
  --article-reading-size: 1.05rem;
  --site-font-reading: var(--site-font-body);
  --article-grid-gap: clamp(1rem, 2.5vw, 1.5rem);
}
.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; }
}
.page-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, .45fr); gap: 1rem 2rem; align-items: start; text-align: left; }
.page-intro .page-heading-row { grid-column: 1; justify-content: flex-start; }
.page-intro h1 { text-align: left; overflow-wrap: anywhere; }
.page-description { grid-column: 1; white-space: pre-line; }
.page-description p { margin: 0 0 1rem; }
.page-article-index { grid-column: 2; grid-row: 1 / span 2; padding: 1.25rem; border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-card-surface); }
.page-article-index-heading { font-weight: 600; margin-bottom: .75rem; }
.page-article-index-list { margin: 0; padding-inline-start: 1.25rem; }
.page-article-index-list li + li { margin-top: .55rem; }
.page-article-index-list a { overflow-wrap: anywhere; }
.page-article-index-status { display: block; color: var(--site-muted); }
.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; }
.articles-section--grid { gap: var(--article-grid-gap); }
.articles-section--grid[style] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(18rem, calc((100% - (var(--article-grid-columns) - 1) * var(--article-grid-gap)) / var(--article-grid-columns)))), 1fr));
}
.article-content {
  white-space: normal; font-family: var(--site-font-reading); font-size: var(--article-reading-size); line-height: 1.65;
  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, h2, h3, h4, h5, h6) { width: 100%; max-width: none; margin-inline: 0; }
.article-content p { margin-block: 0 1.15em; }
.article-content > :last-child { margin-bottom: 0; }
.article-content > :is(.article-image, .article-video, pre) { grid-column: 1 / -1; }
.article-content--image-inline > .article-image { grid-column: 2; }
.article-content :is(h2, h3, h4, h5, h6) { text-align: left; text-wrap: wrap; line-height: 1.25; margin-top: 1.6em; margin-bottom: .55em; overflow-wrap: break-word; }
.site-main .article-content h2 { font-size: 1.8em; }
.site-main .article-content h3 { font-size: 1.5em; }
.site-main .article-content h4 { font-size: 1.25em; }
.site-main .article-content h5 { font-size: 1.1em; }
.site-main .article-content h6 { font-size: 1em; }
.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;
}
.full-article > .page-heading { text-align: left; }
.article-reading-header .article-title, .full-article .page-heading h1 { width: 100%; max-width: none; text-align: left; text-wrap: wrap; overflow-wrap: break-word; }
.article-card-heading { justify-items: start; justify-content: flex-start; text-align: left; }
.article-publication-date { margin-bottom: 1.5rem; }
.article-image, .article-image--normal, .article-image--wide, .article-image--full { width: 100%; max-width: none; }
.full-article .article-content { max-width: none; }
.site-navbar > .container { flex-wrap: wrap; }
.site-navbar .navbar-brand { order: 0; min-width: 0; }
.site-navbar .navbar-toggler { order: 1; }
.site-navbar .navbar-collapse { order: 2; flex-basis: 100%; flex-direction: column; align-items: stretch; }
.site-navbar .navbar-nav { margin-left: 0 !important; flex-wrap: wrap; }
.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(60dvh, 36rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.mega-menu-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.mega-menu-section-title { margin: 0; font-weight: 600; }
.mega-menu-close { border: 1px solid var(--site-border); border-radius: var(--site-radius); background: var(--site-card-surface); color: var(--site-ink); padding: .3rem .6rem; }
.mega-menu-content > .mega-menu-tree { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); gap: 1rem 2rem; }
.mega-menu-link { overflow-wrap: anywhere; }
@media (max-width: 991.98px) {
  .page-intro { grid-template-columns: minmax(0, 1fr); }
  .page-article-index { grid-column: 1; grid-row: auto; }
  .site-navbar .navbar-toggler { margin-left: auto; align-self: flex-start; }
  .site-navbar .navbar-nav { flex-direction: column; }
  .site-navbar #page-navigation { max-height: calc(100dvh - 5rem); overflow-y: auto; }
  .site-navbar .mega-menu-content { max-height: none; overflow: visible; }
  .mega-menu-content > .mega-menu-tree { grid-template-columns: minmax(0, 1fr); }
  .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; }
}
@media (max-width: 575.98px) {
  .articles-section--grid, .articles-section--grid[style] { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  .article-image .image-reveal { opacity: 1; filter: none; transform: none; transition: none; }
}

/* 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; }
}

/* 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;
  }
}

/* Keep a Hero's chosen text theme from being overridden by generic page headings. */
.site-main .hero-article .hero-title { color: inherit; }

/* Hidden indexes leave neither a reserved column nor an empty landing-page header. */
.page-intro.page-intro--no-index { grid-template-columns: minmax(0, 1fr); }
.page-intro.page-intro--empty { margin: 0; padding: 0; gap: 0; }
.site-main:not(:has(> .page-breadcrumb)):has(> .page-intro--empty):has(> .page-content-layout .articles-section > .hero-article:first-child) { padding-top: 0; }
.site-main:has(> .page-intro--empty) .articles-section:has(> .hero-article:first-child) { margin-top: 0; }
