/**
 * Header and navigation. Scoped resets keep native boilerplate controls and
 * disclosure styles intact everywhere else.
 */
.site-header {
  min-height: 5rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  z-index: 10;
}

.logo {
  font-size: 1.13rem;
  font-weight: 700;
  margin-right: auto;
  white-space: nowrap;
}

.site-header a,
.site-footer a {
  text-decoration: none;
}

.site-header a {
  color: var(--muted-color);
}

.site-header a:hover,
.site-header a[aria-current] {
  color: var(--text-color);
}

.site-header .logo {
  color: var(--text-color);
}

.navigation {
  display: none;
}

.site-header ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header li+li {
  margin-top: 0;
}

.desktop-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header nav a {
  display: block;
  padding-block: 0.5em;
}

.site-header details {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.site-header details[open]>summary {
  margin-bottom: 0;
}

.nav-parent {
  display: flex;
  align-items: center;
  position: relative;
  gap: 0.25rem;
}

.submenu>summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 1.75rem;
  min-height: 2.5rem;
  cursor: pointer;
  list-style: none;
  color: var(--muted-color);
  font-weight: inherit;
}

.site-header summary::-webkit-details-marker {
  display: none;
}

.nav-chevron {
  display: inline-block;
  width: 0.44rem;
  height: 0.44rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin: -0.25rem 0.25rem 0;
}

.submenu[open]>summary .nav-chevron {
  transform: rotate(225deg);
  margin-top: 0.25rem;
}

.submenu>ul {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 13.75rem;
  max-width: min(20rem, calc(100vw - 3rem));
  padding: 0.75rem;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 0.5rem 1.5rem #00000012;
}

/** Submenu items use a full-row highlight as well as text decoration. */
.submenu li a {
  padding: 0.5em 0.75em;
  border-radius: var(--radius);
}

.submenu li a:hover,
.submenu li a:focus-visible {
  background: var(--surface-color);
  color: var(--text-color);
}

.submenu .nav-parent {
  flex-wrap: wrap;
  justify-content: space-between;
}

.submenu .submenu>ul {
  position: static;
  min-width: 0;
  width: 100%;
  box-shadow: none;
  border: 0;
  border-left: 1px solid var(--border-color);
  margin-left: 0.75rem;
}

/**
 * Theme switch appearance comes from the boilerplate's native checkbox toggle.
 */
.site-header .theme-control {
  align-items: center;
  flex: none;
  margin: 0;
}

.site-header .theme-toggle {
  flex: none;
  margin: 0;
}

.site-header .theme-control[hidden] {
  display: none;
}

/**
 * Listing covers and metadata; reuse boilerplate typography and palette.
 */
.post-card {
  min-width: 0;
  text-align: center;
}

.post-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.post-card-link:hover {
  color: inherit;
}

.post-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.post-card-link:hover img {
  opacity: 0.8;
}

.post-card h2 {
  font-size: var(--listing-title-size);
  font-weight: var(--listing-title-weight);
  margin: 1em 0 0.25em;
}

.post-list .post-card {
  text-align: left;
  padding-bottom: 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.post-list .post-card:last-child {
  margin-bottom: 0;
}

.post-list .post-card img {
  aspect-ratio: 16 / 9;
  margin-bottom: 1.5rem;
}

.post-list .post-card h2 {
  margin-top: 0;
}

.post-date {
  color: var(--muted-color);
  font-size: 0.88rem;
  margin-top: 0.5em;
}

.post-date .icon {
  margin-right: 0.38em;
}

.post-excerpt {
  margin-top: 0.75em;
}

.post-read-link {
  text-decoration: underline;
}

.post-categories {
  text-align: center;
  margin-top: var(--section-gap);
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0.75em 0 0;
}

.category-tags li {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 0;
  padding: 0.3em 0.75em;
  border-radius: var(--radius);
  background: var(--surface-color);
  font-size: 0.81rem;
}

.post-list .category-tags {
  justify-content: flex-start;
}

/**
 * Media blocks: source order and full-size viewer links.
 */
.block>figure {
  margin: 0;
}

.gallery {
  --columns: var(--columns-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--gallery-gap);
}

.gallery figure {
  margin: 0;
  min-width: 0;
  flex: 1 1 calc((100% - (var(--columns) - 1) * var(--gallery-gap)) / var(--columns));
}

.gallery .gallery-link {
  aspect-ratio: var(--row-ratio-lg);
}

.gallery .gallery-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-link {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
}

.gallery-link:hover img {
  opacity: 0.8;
}

.quotation {
  padding: var(--panel-padding);
  background: var(--surface-color);
}

.quotation blockquote {
  padding: 0;
  border: 0;
  margin: 0;
}

.quotation blockquote> :last-child {
  margin-bottom: 0;
}

.quotation figcaption {
  font-size: inherit;
  line-height: inherit;
  margin-top: 1em;
}

.video {
  background: #000;
  overflow: hidden;
  border-radius: var(--radius);
}

.video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.block--cta.align-center .cta-buttons {
  justify-content: center;
}

.block--cta.align-right .cta-buttons {
  justify-content: flex-end;
}

/**
 * Footer links stay flat and wrap naturally.
 */
.site-footer {
  margin-top: var(--section-gap);
  padding-bottom: var(--section-gap);
  text-align: center;
  color: var(--muted-color);
  font-size: 0.88rem;
}

.site-footer a {
  color: inherit;
}

.site-footer a:hover {
  color: var(--link-hover-color);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

.footer-links li {
  display: flex;
  align-items: center;
  margin-top: 0;
}

.footer-links a {
  display: inline-block;
  padding-block: 0.5em;
}

.footer-separator {
  padding-inline: 0.62em;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

/**
 * Native gallery dialog; viewer controls deliberately use a dark surface.
 */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  border: 0;
  margin: 0;
  padding: 4rem;
  background: #141414;
  color: #fff;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: #141414;
}

.lightbox figure {
  max-width: 100%;
  min-width: 0;
  margin: 0;
}

.lightbox img {
  width: auto;
  max-width: 100%;
  max-height: calc(100dvh - 10rem);
  margin: auto;
  object-fit: contain;
}

.lightbox figcaption {
  text-align: center;
  color: #ddd;
}

.lightbox button {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  font-size: 2.5rem;
  width: 3rem;
  height: 3rem;
  line-height: 1;
}

.lightbox button:not(:disabled):hover {
  background: #333;
  color: #fff;
}

.lightbox-close {
  right: 0.75rem;
  top: 0.75rem;
}

.lightbox-previous {
  left: 0.5rem;
  top: calc(50% - 1.5rem);
}

.lightbox-next {
  right: 0.5rem;
  top: calc(50% - 1.5rem);
}

html:has(.lightbox[open]) {
  overflow: hidden;
}

/**
 * Mobile navigation and media follow the same 768px boundary as layout.css.
 */
@media (width < 768px) {
  .site-header {
    min-height: 4rem;
    padding-block: 0.75rem;
  }

  .site-header nav {
    order: 3;
  }

  .desktop-menu {
    display: none;
  }

  .navigation {
    display: block;
  }

  .navigation>summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    list-style: none;
  }

  .menu-icon,
  .menu-icon::before,
  .menu-icon::after {
    width: 1.25rem;
    height: 2px;
    display: block;
    background: currentColor;
    position: relative;
  }

  .menu-icon::before,
  .menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
    top: -0.38rem;
  }

  .menu-icon::after {
    top: 0.38rem;
  }

  .navigation[open] .menu-icon {
    background: transparent;
  }

  .navigation[open] .menu-icon::before {
    top: 0;
    transform: rotate(45deg);
  }

  .navigation[open] .menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .navigation:not([open])>ul {
    display: none;
  }

  .navigation[open]>ul {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: calc(100dvh - 4rem);
    overflow-y: auto;
    background: var(--background-color);
    padding: 2rem 1.5rem;
  }

  html:has(.navigation[open]) {
    overflow: hidden;
  }

  .mobile-group-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
  }

  .site-header .mobile-children {
    margin: 0.75rem 0 0;
    padding-left: 1.5rem;
  }

  .mobile-children>li+li {
    margin-top: 0.75rem;
  }

  .gallery {
    --columns: var(--columns-sm);
  }

  .gallery .gallery-link {
    aspect-ratio: var(--row-ratio-sm);
  }

  .lightbox {
    padding: 4rem 3rem;
  }
}

/** 
 * Motion preferences apply to the site's optional hover effects.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}