/* Conservation page: force logo to white */
body.conservation-page .logo-img {
  filter: brightness(0) invert(1);
}

/* Conservation hero: reduce dead-scroll once title slips behind foreground layer */
@media (min-width: 769px) {
  body.conservation-page #conservationHero {
    --chapter-hero-scroll-height: 1720px;
  }
}

/* Prevent extra gap before footer */
.content-section:last-of-type {
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Index contacts block: keep bottom spacing */
body.home-page .contacts-section {
  padding-bottom: 20px;
  margin-bottom: 20px;
}

/* Download section spacing reset */
.download-main-section {
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Apply the main patterned cover to content blocks on every page */
:is(
  .content-section,
  .maps-page-section,
  [class$="-page-section"],
  .chapter__paper
) {
  background-image: var(--global-bg-pattern);
  background-size: var(--bg-size) var(--bg-size);
  background-repeat: repeat;
  background-color: transparent;
}

/* Ensure inner content blocks also use the same cover pattern */
main :is(
  .section-content,
  .about-content,
  .contacts-content,
  .story,
  .subsection,
  .criteria-item,
  .ouv-content,
  .maps-content,
  .identification-content,
  .justification-content
) {
  background-image: var(--global-bg-pattern);
  background-size: var(--bg-size) var(--bg-size);
  background-repeat: repeat;
  background-color: transparent;
}

/* Home page About block: left aligned heading */
body.home-page .about-section .section-header {
  width: min(100%, var(--content-width));
  margin: 0 auto 3rem;
  text-align: left;
}

body.home-page .about-section .section-header h2::after {
  left: 0;
  transform: none;
}

/* Home page Contacts block: left aligned heading */
body.home-page .contacts-section .section-header {
  width: min(100%, var(--content-width));
  margin: 0 auto 3rem;
  text-align: left;
}

body.home-page .contacts-section .section-header h2::after {
  left: 0;
  transform: none;
}

/* QHD alignment: keep home section titles aligned with widened content column */
@media (min-width: 2000px) {
  body.home-page .about-section .section-header,
  body.home-page .contacts-section .section-header {
    width: min(100%, var(--wide-content-width));
  }
}

/* Home page: pull information blocks upward */
body.home-page .about-content,
body.home-page .contacts-content {
  margin-top: 0;
}

/* Home page About galleries: place lower and offset text after first gallery */
body.home-page .about-content .about-gallery {
  margin-top: calc(4rem + 50px);
}

body.home-page .about-content .about-gallery:first-of-type {
  margin-top: calc(4rem + 70px);
}

body.home-page .about-content .about-mid-text {
  --about-mid-gap: 48px;
  padding-top: 0;
  margin-top: var(--about-mid-gap);
  margin-bottom: var(--about-mid-gap);
}

/* Keep the text block exactly centered between the two About galleries. */
body.home-page .about-content .about-mid-text + .about-gallery {
  margin-top: 0;
}

/* Home page Contacts: remove colored info panel block */
body.home-page .contacts-section .contact-info {
  background: transparent;
  border-left: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

/* ========================================
   DARK MODE SWITCH
   Sticky/fixed control on the left side, below the header logo.
   ======================================== */
.theme-switcher {
  position: relative;
  left: auto;
  top: auto;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: calc(-1.5rem - 20px);
  margin-right: 0.75rem;
  font-family: "Tw Cen MT", "Tw Cen MT Std", "Trebuchet MS", sans-serif;
  user-select: none;
  flex-shrink: 0;
}

.theme-switcher__switch {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-switcher .toggle-button {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #f5efe6;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
  transition: transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.theme-switcher .toggle {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #000000;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.theme-switcher .moon-mask {
  position: absolute;
  top: 10px;
  left: 20px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5efe6;
  transform: translate(10px, -10px);
  transition: transform 0.25s ease, background-color 0.25s ease;
  display: none;
}

.theme-switcher__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-transform: lowercase;
  font-size: 0.92rem;
  line-height: 1;
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.theme-switcher__text p {
  margin: 0;
  opacity: 0.5;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.theme-switcher__text p:first-child {
  opacity: 0.35;
}

.theme-switcher__text p:last-child {
  opacity: 0.95;
}

.theme-switcher.is-on .toggle-button {
  background: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
  transform: translateY(1px) scale(0.98);
}

.theme-switcher.is-on .toggle {
  background: #ffffff;
  transform: translateY(9px) scale(0.9);
}

.theme-switcher.is-on .moon-mask {
  background: #1f1f1f;
  transform: translate(-2px, 11px);
}

.theme-switcher.is-on .theme-switcher__text {
  color: #ffffff;
}

.theme-switcher.is-on .theme-switcher__text p:first-child {
  opacity: 1;
}

.theme-switcher.is-on .theme-switcher__text p:last-child {
  opacity: 0.35;
}

/* ========================================
   DARK MODE PALETTE
   ======================================== */
body.dark-mode {
  --color-text: #e6e6e6;
  --color-text-light: #bdbdbd;
  --color-primary: #d9d0ac;
  --color-secondary: #c7b787;
  --color-tertiary: #b98a72;
  --bg-color: #111111;
  --bg-layer: #1a1a1a 20%, #0000 0;
  --bg-mid: 35%, #ffffff10 0 45%, #1a1a1a 0;
  color: var(--color-text);
  background-color: #111111;
}

body.dark-mode :is(h1, h2, h3, h4, h5, h6) {
  color: #efe8cf;
}

body.dark-mode :is(p, li) {
  color: var(--color-text);
}

body.dark-mode a {
  color: #e6d79e;
}

body.dark-mode a:hover {
  color: #ffffff;
}

body.dark-mode :is(
  .site-header,
  .menu-content,
  .chapter-list li,
  .single-map-block,
  .contact-card,
  .contact-info,
  .download-box,
  .criteria-item,
  .ouv-content,
  .subsection,
  .map-item,
  .gallery-item,
  .gallery-header,
  .gallery-modal-content
) {
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark-mode :is(
  .single-map-block,
  .contact-card,
  .contact-info,
  .download-box,
  .criteria-item,
  .ouv-content,
  .subsection,
  .map-item,
  .gallery-item,
  .gallery-header,
  .gallery-modal-content
) {
  background-color: rgba(20, 20, 20, 0.78);
}

body.dark-mode .single-map-frame {
  border-color: rgba(255, 255, 255, 0.24);
}

@media (max-width: 768px) {
  .theme-switcher {
    display: inline-flex;
    left: auto;
    top: auto;
    gap: 0.25rem;
    margin-left: 0;
    margin-right: 0.2rem;
  }

  .theme-switcher .toggle-button {
    width: 30px;
    height: 30px;
  }

  .theme-switcher .toggle {
    top: 6px;
    left: 6px;
    width: 16px;
    height: 16px;
  }

  .theme-switcher .moon-mask {
    top: 6px;
    left: 13px;
    width: 12px;
    height: 12px;
  }

  .theme-switcher.is-on .toggle {
    transform: translateY(7px) scale(0.9);
  }

  .theme-switcher__text {
    display: none;
  }
}

@media (max-width: 480px) {
  .theme-switcher {
    margin-left: 0;
    margin-right: 0.1rem;
  }
}

@media (min-width: 2000px) {
  .theme-switcher {
    margin-left: -1.2rem;
    margin-right: 1rem;
    gap: 0.6rem;
  }

  .theme-switcher .toggle-button {
    width: 46px;
    height: 46px;
  }

  .theme-switcher .toggle {
    width: 26px;
    height: 26px;
    top: 9px;
    left: 9px;
  }

  .theme-switcher__text {
    font-size: 1rem;
  }
}

/* ========================================
   CONTENT PHOTO FULLSCREEN VIEWER
   ======================================== */
/* Show zoom cursor anywhere content images already open in the fullscreen viewer. */
:is(main, .content-section, .maps-page-section, .photo-page-section) img:not([data-no-fullscreen]),
.info-post__bg:not([data-no-fullscreen]) {
  cursor: zoom-in;
}

.content-photo-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding:
    calc(1rem + var(--safe-area-top))
    calc(1rem + var(--safe-area-right))
    calc(1rem + var(--safe-area-bottom))
    calc(1rem + var(--safe-area-left));
  background: rgba(0, 0, 0, 0.92);
  z-index: 2600;
  pointer-events: none;
}

.content-photo-lightbox.active {
  display: flex;
  pointer-events: auto;
}

.content-photo-lightbox__image {
  width: auto;
  max-width: min(96vw, 1680px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.content-photo-lightbox__close {
  position: absolute;
  top: calc(1rem + var(--safe-area-top));
  right: calc(1rem + var(--safe-area-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.content-photo-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}

.content-photo-lightbox__nav--prev {
  left: 1rem;
}

.content-photo-lightbox__nav--next {
  right: 1rem;
}

.content-photo-lightbox__nav:disabled {
  opacity: 0;
  cursor: default;
  pointer-events: none;
}

.content-photo-lightbox__caption {
  margin: 0.8rem 0 0;
  max-width: min(96vw, 1680px);
  color: #f2f2f2;
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
}

body.content-lightbox-open > *:not(.content-photo-lightbox) {
  pointer-events: none;
}

@media (max-width: 768px) {
  .content-photo-lightbox__nav {
    display: none;
  }

  .content-photo-lightbox__nav {
    width: 44px;
    height: 44px;
    font-size: 1.9rem;
  }
}

.image-caption {
  margin: 0.55rem 0 0;
  color: var(--color-text-light);
  font-size: 0.9rem;
  line-height: 1.55;
}

.gallery-slide .image-caption {
  width: 100%;
  padding: 0 0.25rem;
  text-align: left;
}

/* Show descriptions only in fullscreen lightbox, not inline on page */
main .image-caption {
  display: none;
}

/* ========================================
   SHARED INFORMATION BLOCKS
   For internal thematic pages only
   ======================================== */

.info-post {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 3rem 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.info-post--reverse .info-post__media {
    order: 1;
}

.info-post--reverse .info-post__container {
    order: 2;
}

.info-post__media {
    position: relative;
    min-height: 260px;
    background: #d9d6cb;
}

.info-post__bg {
    position: absolute;
    inset: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.info-post__container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    background: #f9f7f2;
}

.info-post__category {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-accent-warm);
}

.info-post__content {
    display: block;
}

.info-post__header-wrap {
    margin-bottom: 1rem;
}

.info-post__header {
    margin: 0;
    color: var(--color-primary);
    line-height: 1.05;
}

.info-post__text p {
    margin: 0 0 1rem;
    line-height: 1.8;
    color: var(--color-text);
}

.info-post__text p:last-child {
    margin-bottom: 0;
}

.info-post__text ul {
    margin: 0 0 1rem 1.25rem;
    line-height: 1.8;
    color: var(--color-text);
}

.info-post__text ul:last-child {
    margin-bottom: 0;
}

.info-post__link {
    margin-top: 1.5rem;
}

.info-post__link:empty {
    display: none;
}

@media (min-width: 900px) {
    .info-post {
        grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
        align-items: stretch;
    }

    .info-post--reverse {
        grid-template-columns: minmax(360px, 1.05fr) minmax(320px, 0.95fr);
    }

    .info-post--reverse .info-post__media {
        order: 2;
    }

    .info-post--reverse .info-post__container {
        order: 1;
    }

    .info-post__media {
        min-height: 420px;
    }

    .info-post__container {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .info-post {
        margin: 2rem 0;
    }

    .info-post__media {
        min-height: 220px;
    }

    .info-post__container {
        padding: 1.25rem;
    }
}

.maps-embed-section {
  margin: 3rem 0 5rem;
}

.maps-embed-wrap {
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

.maps-embed-wrap arcgis-embedded-map {
  width: 100%;
  height: 600px;
  display: block;
}

@media (max-width: 768px) {
  .maps-embed-wrap arcgis-embedded-map {
    height: 500px;
  }
}

/* ========================================
   IDENTIFICATION PAGE — CLEAN EDITORIAL LAYOUT
   ======================================== */

body.identification-page .chapter__paper {
    max-width: var(--container-width);
}

body.executive-summary-page .chapter__paper {
    max-width: var(--container-width);
}

.location-intro {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: center;
    margin: 2rem 0 4rem;
}

.location-intro__media img {
    display: block;
    width: 100%;
    height: auto;
}

/* Keep intro media sizing identical between Location and World Heritage Nomination. */
body.identification-page .location-intro__media,
body.executive-summary-page .location-intro__media {
    display: flex;
    align-items: center;
}

body.identification-page .location-intro__media img,
body.executive-summary-page .location-intro__media img {
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    margin: 0 auto;
}

.location-intro__content {
    max-width: 520px;
}

.location-intro__eyebrow {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-accent-warm);
}

.location-intro__content h1 {
    margin: 0 0 1rem;
    color: var(--color-primary);
}

.location-intro__content p {
    margin: 0;
    line-height: 1.85;
    color: var(--color-text);
}

.location-intro--text-only {
    display: block;
    margin: 2rem 0 3rem;
}

.location-intro--text-only .location-intro__content {
    max-width: 980px;
}

.nomination-download {
    margin: 0 0 3rem;
}

.nomination-download .btn-secondary {
    display: inline-block;
}

body.world-heritage-nomination-page .gallery-slide figcaption,
body.executive-summary-page .gallery-slide figcaption {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text);
}

.location-gallery {
    margin: 4rem 0 0;
    padding-bottom: 0;
}

.location-gallery__header {
    display: none;
}

.photo-gallery-slider {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0;
}

.gallery-track-container {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x pinch-zoom;
}

.gallery-track {
    display: flex;
    gap: 1rem;
}

.gallery-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    scroll-snap-align: start;
    min-height: 520px;
    background: color-mix(in srgb, var(--page-color) 65%, transparent);
}

.gallery-nav {
    width: 40px;
    height: 40px;
    border: 0;
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-primary);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-slide img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
}

@media (min-width: 900px) {
    .location-intro {
        grid-template-columns: minmax(380px, 0.95fr) minmax(420px, 1.05fr);
        gap: 3rem;
    }

}

@media (max-width: 768px) {
    .photo-gallery-slider {
        position: relative;
        grid-template-columns: 1fr;
    }

    .location-intro {
        gap: 1.5rem;
        margin: 1rem 0 3rem;
    }

    .location-intro--text-only {
        margin: 1rem 0 2rem;
    }

    .nomination-download {
        margin: 0 0 2rem;
    }

    .location-intro__content {
        max-width: 100%;
    }

    .gallery-slide img {
        max-height: 320px;
    }

    .gallery-slide {
        min-height: 320px;
    }

    .photo-gallery-slider {
        grid-template-columns: 1fr;
    }

    .gallery-nav {
        position: absolute;
        top: 50%;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        transform: translateY(-50%);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.78);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
        backdrop-filter: blur(6px);
    }

    .gallery-prev {
        left: 0.5rem;
    }

    .gallery-next {
        right: 0.5rem;
    }

    .gallery-track-container {
        padding-bottom: max(0px, var(--safe-area-bottom));
    }
}

.nomination-text-block {
    max-width: 980px;
    margin: 2rem auto 2.5rem;
}

/* Protection & Management now uses a single text block; remove forced tall paper height. */
body.protection-management-page :is(main.chapter, .chapter) .chapter__paper {
    min-height: auto;
}

.nomination-text-block h2 {
    margin: 0 0 1rem;
    color: var(--color-primary);
}

.nomination-text-block p {
    margin: 0 0 1.2rem;
    line-height: 1.9;
    color: var(--color-text);
}

.nomination-text-block p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .nomination-text-block {
        margin: 1.5rem auto 2rem;
    }

    .nomination-text-block p {
        line-height: 1.8;
    }
}

.ouv-text-block {
    max-width: 980px;
    margin: 2rem auto 4rem;
}

.ouv-text-block p {
    margin: 0 0 1.4rem;
    line-height: 1.9;
    color: var(--color-text);
}

.ouv-text-block h2 {
    margin: 2.5rem 0 1rem;
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .ouv-text-block {
        margin: 1.5rem auto 3rem;
    }

    .ouv-text-block p {
        line-height: 1.8;
    }
}

.info-section {
    margin: 0 0 4rem;
}

.location-intro--reverse {
    display: grid;
}

body.natural-heritage-page .location-intro--geology-top {
    align-items: start;
}

body.natural-heritage-page .location-intro--geology-top .location-intro__media {
    align-self: start;
}

@media (min-width: 900px) {
    body.natural-heritage-page .location-intro--geology-top .location-intro__media {
        margin-top: 96px;
    }
}

@media (min-width: 900px) {
    .location-intro--reverse .location-intro__media {
        order: 2;
    }

    .location-intro--reverse .location-intro__content {
        order: 1;
    }
}


