/*
  Faithful redesign of the original WordPress site (mshroncova.cz, 2021 theme).
  Same two-tone yellow/gold identity, the same circular mascot strip, the same
  chunky pill navigation, the same black-underlined page title — modernized
  only where the original wasn't actually usable: real focus states, a mobile
  layout that stacks instead of overflowing, reduced-motion respect.

  Tokens
  ------
  Color:  --gold (#E8AE29, page frame + nav pills), --yellow (#FFF829, header
          band), --ink (#000), --paper (#fff) — sampled directly from the
          live site's computed styles, not approximated.
  Type:   one system-ui sans stack, matching the original exactly — this is a
          continuity choice, not a default; introducing a second typeface
          here would be the thing that breaks recognition.
  Layout: a single centered card (the "site" look of the original's WP
          theme) framed by the gold background showing through as a margin,
          a yellow header band (logo, building photo, mascot strip, nav),
          and a white body for actual page content.
*/

:root {
  --gold: #e8ae29;
  --yellow: #fff829;
  --ink: #1a1400;
  --paper: #fff;
  --cream: #fff1b8;
  --focus: #1d4ed8;
  --font: -apple-system, "system-ui", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
    Cantarell, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--gold);
}

body {
  margin: 0;
  padding: 1.25rem;
  font-family: var(--font);
  color: var(--ink);
  background: var(--gold);
  line-height: 1.5;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site {
  max-width: 69.5rem;
  margin: 0 auto;
  background: var(--cream);
  border-radius: 0.625rem;
  overflow: hidden;
}

/* Header: logo + building photo + mascot strip + nav, all on the bright
   yellow band — this is the part everyone will recognize at a glance. */
.site-header {
  background: var(--yellow);
  padding: 1.5rem 1.5rem 1rem;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

.logo-link {
  flex: 0 0 auto;
}

/* Logo and building photo share one height, set here once — both images
   scale from it keeping their own proportions, nothing is cropped. */
.logo-link img,
.building-photo img {
  width: auto;
  height: 12rem;
}

.building-photo {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
}

.building-photo img {
  /* The decorative frame and speech bubble are baked into this image
     (mshroncova.cz's own composited asset) — no CSS border here, it would
     just duplicate the one already drawn in the file. */
  max-width: 100%;
}

/* Mascot strip: the circular character badges, same scale and spacing as
   the original, just not hard-pinned to seven specific files — however
   many mascot images a page provides, this lays them out the same way. */
.mascot-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin: 1.25rem 0;
  padding: 0;
  list-style: none;
}

.mascot-strip img {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  object-fit: cover;
}

/* Compact header (every page except the homepage): no yellow band, no
   building photo — just the logo and a smaller mascot row sitting directly
   on the gold page background, matching every inner page on the original
   site (e.g. mshroncova.cz/aktuality/). */
.site-header--compact {
  padding: 1.25rem 1.5rem 0.75rem;
}

.site-header--compact .header-top {
  align-items: center;
}

.site-header--compact .header-top {
  flex-wrap: nowrap;
}

.site-header--compact .mascot-strip {
  flex: 1 1 0;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0;
}

.site-header--compact .mascot-strip li {
  flex: 0 1 7rem;
  min-width: 0;
}

.site-header--compact .mascot-strip img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

/* Nav: chunky pill buttons in the same gold as the outer frame, so they
   read as "buttons sitting on the yellow band" exactly like the original. */
.site-nav > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  position: relative;
}

.nav-pill {
  display: flex;
  align-items: stretch;
  border-radius: 0.4rem;
  overflow: hidden;
}

.site-nav a {
  display: block;
  padding: 0.9rem 0.6rem;
  background: var(--gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.2rem;
}

.site-nav a:hover {
  background: #d49a1c;
}

.site-nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}

.nav-pill:has(a[aria-current="page"]) .sub-menu-toggle {
  background: var(--ink);
}

/* Expandable sub-menu: hover (or keyboard focus) over the pill reveals that
   section's own pages — both the label and the "+" are plain links to the
   same destination, so a click always navigates there regardless of which
   part was clicked. No JS: the reveal is pure CSS (:hover / :focus-within). */
.sub-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  background: var(--gold);
}

.nav-pill:hover .sub-menu-toggle,
.nav-pill:hover a {
  background: #d49a1c;
}

.nav-pill:has(a[aria-current="page"]):hover .sub-menu-toggle {
  background: #d49a1c;
}

.icon-plus {
  display: inline-block;
  position: relative;
  width: 0.8rem;
  height: 0.8rem;
}

.icon-plus::before,
.icon-plus::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.nav-pill:has(a[aria-current="page"]) .icon-plus::before,
.nav-pill:has(a[aria-current="page"]) .icon-plus::after {
  background: var(--paper);
}

.icon-plus::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.icon-plus::after {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  transition: transform 0.1s ease;
}

.has-children:hover .icon-plus::after,
.has-children:focus-within .icon-plus::after {
  transform: translateX(-50%) scaleY(0);
}

.sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 100%;
  list-style: none;
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: var(--gold);
  border-radius: 0 0 0.4rem 0.4rem;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.has-children:hover > .sub-menu,
.has-children:focus-within > .sub-menu {
  display: block;
}

.sub-menu li {
  display: block;
  border-radius: 0;
}

.sub-menu a {
  display: block;
  padding: 0.4rem 0;
  background: transparent;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: underline;
}

.sub-menu a:hover {
  background: transparent;
  text-decoration: none;
}

/* Body: plain white page content, matching the original's inner pages. */
.site-main {
  padding: 2rem 1.5rem 3rem;
}

.page-title {
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--ink);
  font-size: 2.5rem;
  font-weight: 400;
}

.site-main :is(h2, h3) {
  font-weight: 600;
}

.site-main :is(p, ul, ol) {
  max-width: 44rem;
}

.site-footer {
  background: var(--yellow);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.partner-logos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.partner-logos img {
  max-height: 3rem;
  width: auto;
}

/* Classes list: each class as its own mascot + name, same idea as the
   mascot strip but as a real link list, not decoration. */
.classes {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.classes li {
  text-align: center;
}

.classes a {
  text-decoration: none;
  font-weight: 600;
}

.classes img {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.mascot {
  width: 10rem;
  border-radius: 50%;
  object-fit: cover;
}

/* Gallery list: album "polaroid" cards — a cover photo, a title strip below
   it, and a photo-count badge, matching the original's album grid. */
.gallery-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.gallery-card {
  display: block;
  position: relative;
  width: 14rem;
  padding: 0.6rem 0.6rem 0;
  background: #fff;
  border: 1px solid #e2d8bf;
  border-radius: 0.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: inherit;
}

.gallery-card img {
  width: 100%;
  height: 10rem;
  object-fit: cover;
  border-radius: 0.1rem;
}

.gallery-card-title {
  display: block;
  padding: 0.6rem 0;
  font-weight: 600;
}

.gallery-card-count {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.1rem 0.6rem;
  background: rgba(0, 0, 0, 0.65);
  color: var(--paper);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 1rem;
}

/* Gallery single / album photos: white-framed thumbnails; the lightbox
   (static/js/gallery.js) opens them full size. */
.photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.photo-thumb {
  display: block;
  padding: 0.6rem;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-thumb:hover,
.photo-thumb:focus-visible {
  transform: scale(1.04);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

.photo-thumb img {
  display: block;
  width: 9.5rem;
  height: 9.5rem;
  object-fit: cover;
}

/* In-page album switcher on the gallery list. Everything is stacked in the
   stage; only .is-active is shown, and the incoming view slides in. */
.gallery-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.25rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.gallery-heading,
.gallery-album-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 400;
}

.gallery-album-title {
  margin-left: auto;
}

.gallery-back {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.gallery-back:hover {
  background: rgba(0, 0, 0, 0.3);
}

.gallery-app.is-js .gallery-view {
  display: none;
}

.gallery-app.is-js .gallery-view.is-active {
  display: flex;
}

.gallery-app.is-js .gallery-view.is-entering {
  animation: gallery-slide 0.4s ease both;
}

@keyframes gallery-slide {
  from {
    opacity: 0;
    transform: translateX(var(--slide-from, 40px));
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.gallery-list {
  justify-content: center;
  margin: 1.5rem 0;
}

.gallery-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  transform: rotate(-2deg) scale(1.04);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.album .photos {
  width: 100%;
}

/* Lightbox */
.lb-lock {
  overflow: hidden;
}

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem 4rem;
  background: rgba(40, 25, 0, 0.82);
}

.lb.is-open {
  display: flex;
  animation: lb-fade 0.2s ease both;
}

.lb-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  padding: 0.5rem 0.5rem 0;
  background: #fff;
  border-radius: 0.2rem;
  display: flex;
  flex-direction: column;
}

.lb-img {
  display: block;
  max-width: min(100%, 80vw);
  max-height: calc(100vh - 8rem);
  margin: 0 auto;
  object-fit: contain;
  opacity: 0;
}

.lb-img.is-in {
  animation: lb-img 0.3s ease both;
}

.lb-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.25rem;
  font-size: 0.8rem;
  color: #666;
}

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 4.5rem;
  border: 0;
  background: #fff;
  color: #333;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.lb-btn:hover {
  opacity: 1;
}

.lb-prev {
  left: 0.75rem;
  border-radius: 0.3rem 0 0 0.3rem;
}

.lb-next {
  right: 0.75rem;
  border-radius: 0 0.3rem 0.3rem 0;
}

.lb.is-single .lb-btn {
  display: none;
}

.lb-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

@keyframes lb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lb-img {
  from {
    opacity: 0;
    transform: translateX(var(--lb-from, 0));
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 40rem) {
  .lb {
    padding: 3rem 0.5rem;
  }

  .lb-img {
    max-width: 100%;
  }

  .lb-btn {
    top: auto;
    bottom: 0.5rem;
    transform: none;
    height: 2.75rem;
  }

  .photo-thumb img {
    width: 7rem;
    height: 7rem;
  }

  .gallery-heading,
  .gallery-album-title {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lb.is-open,
  .lb-img.is-in {
    animation: none;
  }

  .lb-img {
    opacity: 1;
  }
}

.attachments {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  max-width: 44rem;
}

.attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.attachment-title {
  margin: 0;
  font-weight: 600;
}

.attachment-description {
  margin: 0.25rem 0 0;
  color: #555;
  font-size: 0.9rem;
}

.attachment-download {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  background: var(--gold);
  border-radius: 0.4rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.attachment-download:hover {
  background: #d49a1c;
}

.article-list {
  list-style: none;
  padding: 0;
}

.article-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.article-list time {
  color: #666;
  font-size: 0.9rem;
}

@media (max-width: 40rem) {
  body {
    padding: 0.75rem;
  }

  .page-title {
    font-size: 1.9rem;
  }

  .logo-link img,
  .building-photo img {
    height: 5.5rem;
  }

  .mascot-strip {
    gap: 0.5rem;
  }

  .site-header--compact .logo-link img {
    height: 4rem;
  }

  .site-header--compact .mascot-strip li {
    flex-basis: 2rem;
  }

  .mascot-strip img {
    width: 2.3rem;
    height: 2.3rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .site-nav a {
    transition: background-color 0.15s ease;
  }
}

.gallery-back[hidden] {
  display: none;
}

/* Migrated page bodies: several images in one paragraph form a thumbnail row
   (former FooGalleries); a lone image is shown at natural size, capped to the column. */
.site-main video,
.site-main iframe {
  max-width: 100%;
}

.site-main audio {
  display: block;
  width: 100%;
  max-width: 24rem;
  margin: 0.5rem 0;
}

.site-main p > img:not(:only-child) {
  width: 11rem;
  height: 11rem;
  margin: 0 0.5rem 0.5rem 0;
  object-fit: cover;
  border-radius: 0.25rem;
}

/* Mascots link to their class page. */
.mascot-strip a {
  display: block;
  border-radius: 50%;
}

.mascot-strip a img,
.partner-logos a img {
  transition: transform 0.2s ease;
}

.mascot-strip a:hover img,
.mascot-strip a:focus-visible img,
.partner-logos a:hover img,
.partner-logos a:focus-visible img {
  transform: scale(1.08);
}

/* News feed on the Aktuality page: every article in full, newest first. */
.article-entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.article-entry:first-child {
  padding-top: 0;
}

.article-entry h2 {
  margin: 0 0 0.25rem;
}

.article-entry h2 a {
  text-decoration: none;
}

.article-entry time {
  display: block;
  margin-bottom: 0.75rem;
  color: #666;
  font-size: 0.9rem;
}

.article-cover,
.article-video {
  display: block;
  max-width: 100%;
  margin: 0.75rem 0;
}

/* Aktuality: centered feed; standalone pages (zápis, prázdninový provoz) are a link row on top. */
.article-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.article-links a {
  display: block;
  padding: 0.7rem 1.1rem;
  border-radius: 0.4rem;
  background: var(--gold);
  font-weight: 600;
  text-decoration: none;
}

.article-links a:hover {
  background: #d49a1c;
}

/* Same measure as body text (.site-main p/ul/ol: 44rem); media fills it and scales
   proportionally. */
.article-feed {
  max-width: 44rem;
  margin: 0 auto;
  text-align: center;
}

.article-feed .article-entry img,
.article-feed .article-entry video {
  width: 100%;
  height: auto;
}

/* Single-row nav on wide screens (the original wrapped onto two rows). Below the
   breakpoint the nav collapses behind a "Menu" button — see static/js/nav.js. */
.site {
  max-width: 80rem;
}

.site-nav > ul {
  flex-wrap: nowrap;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.65rem 0.4rem;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
}

.sub-menu-toggle {
  width: 1.6rem;
  padding: 0;
}

.nav-burger {
  display: none;
}

@media (max-width: 78rem) {
  .nav-burger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin: 0 0 0.5rem;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 0.4rem;
    background: var(--gold);
    color: inherit;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
  }

  .nav-burger::before {
    content: "\2630";
    font-size: 1.3rem;
  }

  .nav-open .nav-burger::before {
    content: "\00d7";
  }

  .site-nav {
    display: none;
  }

  .nav-open .site-nav {
    display: block;
  }

  .site-nav > ul {
    flex-direction: column;
    gap: 0.35rem;
  }

  .site-nav a {
    padding: 0.8rem 1rem;
    font-size: 1.05rem;
    white-space: normal;
  }

  .nav-pill > a:first-child {
    flex: 1;
  }

  .sub-menu-toggle {
    width: 3.25rem;
  }

  /* No hover on touch: sub-menus open by tapping the +/- (static/js/nav.js). */
  .sub-menu,
  .has-children:hover > .sub-menu,
  .has-children:focus-within > .sub-menu {
    display: none;
  }

  .has-children.is-open > .sub-menu {
    display: block;
    position: static;
    margin: 0.2rem 0 0.2rem 1rem;
    box-shadow: none;
    white-space: normal;
  }

  .sub-menu a {
    padding: 0.55rem 0;
  }

  .has-children:hover > .nav-pill .icon-plus::after,
  .has-children:focus-within > .nav-pill .icon-plus::after,
  .has-children:hover > .sub-row .icon-plus::after,
  .has-children:focus-within > .sub-row .icon-plus::after {
    transform: translateX(-50%);
  }

  .has-children.is-open > .nav-pill .icon-plus::after,
  .has-children.is-open > .sub-row .icon-plus::after {
    transform: translateX(-50%) scaleY(0);
  }

  .nav-pill > a:first-child {
    text-align: left;
  }

  /* Nested levels: the +/- button is shown, the desktop chevron is not. */
  .sub-row .sub-menu-toggle {
    display: flex;
    width: 2.75rem;
    background: transparent;
  }

  .sub-menu .has-children > .sub-row::after {
    content: none;
  }

  .sub-menu .sub-menu,
  .has-children.is-open > .sub-menu .sub-menu {
    position: static;
  }

  .has-children.is-open > .sub-menu .has-children.is-open > .sub-menu {
    display: block;
    margin-left: 1rem;
  }
}

/* Class pages: contact block stays left-aligned; everything after the first heading
   (the "Zprávy z naší třídy" posts, with their images) is centered in the text measure. */
.class-content h3 ~ h3,
.class-content h2,
.class-photos-heading {
  text-align: center;
}

.class-content h3 ~ h3 ~ p {
  margin-left: auto;
  margin-right: auto;
}

.class-content h3 ~ h3 ~ p > img:only-child {
  width: 100%;
  max-width: 44rem;
  height: auto;
  margin: 0 auto;
}

/* Standalone images (and video) in page and article content are centered. Not affected:
   photo galleries (.photos), class photo sections, and thumbnail rows (several images in
   one paragraph), which keep their own layout. */
.site-main p > img:only-child,
.site-main figure img,
.article-cover,
.article-video,
.site-main video {
  margin-left: auto;
  margin-right: auto;
}

/* The paragraph around a lone image spans the full column (text paragraphs are capped
   at 44rem and left-aligned), so the image centers on the page, not inside that cap. */
.site-main p:has(> img:only-child) {
  max-width: none;
}

.site-main p:has(> img:only-child) > img {
  max-width: min(100%, 44rem);
}

/* Thumbnail groups inside page content (Markdown images titled "galerie") look like the
   photo galleries: framed thumbs, centered, opening the lightbox. */
.site-main p:has(> .photo-thumb) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  max-width: none;
  margin: 1.5rem 0;
}

/* Nav fills the full width: items stretch evenly, so its left edge lines up with the logo
   and its right edge with the (compact header) mascots. */
.site-nav > ul {
  justify-content: space-between;
}

.site-nav > ul > li {
  flex: 1 1 auto;
}

.site-nav > ul > li > .nav-pill > a:first-child {
  flex: 1;
  text-align: center;
}

/* Multi-level sub-menus: a flyout opens to the right of its parent entry. */
.sub-menu li {
  position: relative;
}

.sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sub-row .sub-menu-toggle {
  display: none;
}

.sub-menu .has-children > .sub-row::after {
  content: "\203A";
  font-weight: 700;
}

.sub-menu .sub-menu {
  top: -0.4rem;
  left: calc(100% - 0.2rem);
  min-width: 0;
  border-radius: 0.4rem;
}

/* Opens upwards when there is no room below (static/js/nav.js). */
.has-children.opens-up > .sub-menu {
  top: auto;
  bottom: 100%;
  border-radius: 0.4rem 0.4rem 0 0;
  box-shadow: 0 -0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.sub-menu .has-children.opens-up > .sub-menu {
  top: auto;
  bottom: -0.4rem;
  border-radius: 0.4rem;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Mobile overrides of the desktop nav rules above (kept last so they win). */
@media (max-width: 78rem) {
  .site-nav > ul > li > .nav-pill > a:first-child {
    text-align: left;
  }

  .sub-menu .has-children > .sub-row::after {
    content: none;
  }

  .sub-row .sub-menu-toggle {
    display: flex;
  }

  .sub-menu .sub-menu {
    left: auto;
    top: auto;
  }

  .has-children.opens-up > .sub-menu {
    bottom: auto;
  }
}

/* ---- Layout fixes (round 2025-10-06) ---- */

/* Body text uses the full column; only the news feed keeps its own narrower measure. */
.site-main :is(p, ul, ol) {
  max-width: none;
}

.article-feed :is(p, ul, ol) {
  max-width: none;
}

/* Lists that are laid out as rows must not inherit the old 44rem cap. */
.gallery-list,
.article-links {
  max-width: none;
  justify-content: center;
}

/* Let the nav's sub-menus extend past the header (on the homepage there is no content
   below to hold them); round the corners on header and footer instead of clipping. */
.site {
  overflow: visible;
}

.site-header {
  position: relative;
  z-index: 20;
  border-radius: 0.625rem 0.625rem 0 0;
}

.site-footer {
  border-radius: 0 0 0.625rem 0.625rem;
}

/* Homepage header: logo and building photo scale with the viewport (same height, so both
   keep their proportions) instead of leaving a wide empty gap between them. */
@media (min-width: 40.01rem) {
  .is-home .logo-link img,
  .is-home .building-photo img {
    height: clamp(10rem, 22vw, 22rem);
  }
}

/* Portrait videos must not fill several screens: cap the height, keep the proportions. */
.article-feed .article-entry video,
.article-video {
  width: auto;
  max-width: 100%;
  max-height: 80vh;
}
