/* Get involved is the standard for buttons. Navigation and footer text links share the same style.
   Local service links keep their illustrated layout.
   Load after page styles. Photo controls keep their image shapes and spacing. */
:root body :is(button, summary, .button, .pill-button, .service-button,
  .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
  .translation-link, .facts-jumps a, .facts-back,
  .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(.photo-open, .carousel-thumb, .gallery-thumbnail) {
  appearance: none;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-width: 0;
  min-inline-size: 0;
  min-height: 48px;
  max-width: 100%;
  padding: .7rem 1.5rem;
  border: 0 solid transparent;
  border-radius: 999px;
  background: #004b50;
  color: #fff;
  font: 700 1rem/1.55 Arial, Helvetica, sans-serif;
  text-align: center;
  text-decoration: none;
  text-underline-offset: .2em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
  animation: none;
  transition: none;
  transform: none;
  translate: none;
}
/* Preserve the navigation toggle's responsive visibility and native summaries. */
:root body :is(button, .button, .pill-button, .service-button, .explore-topic,
  .back-top, .text-link, .quiz-link, .story-link, .translation-link,
  .facts-jumps a, .facts-back, .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(
  .nav-toggle, .photo-open, .carousel-thumb, .gallery-thumbnail) { display: inline-flex; }
:root body summary { list-style-position: inside; }
:root body :is(.photo-open, .carousel-thumb, .gallery-thumbnail) {
  background: #004b50;
  color: #fff;
  cursor: pointer;
  animation: none;
  transition: none;
  transform: none;
}
/* Selected controls remain identifiable without changing their pill design. */
:root body :is(button, a.explore-topic, a.translation-link, .nav-list a[href]):is(
  [aria-pressed="true"], [aria-current], [aria-expanded="true"]),
:root body :is(.facts-details, .group-documents)[open] > summary {
  box-shadow: inset 0 0 0 2px #e8c36e;
}
:root body :is(.carousel-thumb[aria-current], .gallery-thumbnail[aria-pressed="true"]) {
  border-color: #e8c36e;
}

@media (hover: hover) {
  :root body :is(button, summary, .button, .pill-button, .service-button,
    .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
    .translation-link, .facts-jumps a, .facts-back,
    .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(:disabled):hover {
    background: #fff0d5;
    color: #74351d;
    text-decoration: underline;
    text-decoration-thickness: .12em;
    transform: none;
  }
}
:root body :is(button, summary, .button, .pill-button, .service-button,
  .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
  .translation-link, .facts-jumps a, .facts-back,
  .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):focus-visible {
  background: #fff0d5;
  color: #74351d;
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #073b45;
  text-decoration: underline;
  text-decoration-thickness: .12em;
}
:root body :is(button, summary, .button, .pill-button, .service-button,
  .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
  .translation-link, .facts-jumps a, .facts-back,
  .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(:disabled):active {
  background: #74351d;
  color: #fff;
  transform: none;
}
/* A focus ring inside photo frames stays visible in the scrollable image rails. */
:root body button:is(.photo-open, .carousel-thumb, .gallery-thumbnail):focus-visible {
  outline-offset: -3px;
  box-shadow: inset 0 0 0 6px #fff0d5;
}
:root body button:disabled { cursor: default; opacity: .65; }
:root body button.answer-button:disabled { opacity: 1; }
:root body button.answer-button.correct:disabled { box-shadow: inset 0 0 0 3px #b7dfbd; }
:root body button.answer-button.incorrect:disabled { box-shadow: inset 0 0 0 3px #ffae9f; }
:root body .answer-button { flex-wrap: wrap; }
:root body .answer-state { flex-basis: 100%; color: inherit; font-size: .85em; }

/* Labels and icons inherit the same control styling on every page. */
:root body .explore-topic-label {
  min-width: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
}
:root body :is(.explore-topic-icon, .carousel-arrow img) {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  filter: brightness(0) invert(1);
  animation: none;
  transition: none;
  transform: none;
}
:root body .translate-toggle::before {
  content: "";
  flex: 0 0 1.3rem;
  width: 1.3rem;
  height: 1.3rem;
  margin: 0;
  background: url('../icons/globe2.svg') center / contain no-repeat;
  filter: brightness(0) invert(1);
}
@media (hover: hover) {
  :root body :is(.explore-topic, .carousel-arrow):hover img,
  :root body .translate-toggle:hover::before { filter: brightness(0); }
}
:root body :is(.explore-topic, .carousel-arrow):focus-visible img,
:root body .translate-toggle:focus-visible::before { filter: brightness(0); }
:root body :is(.explore-topic, .carousel-arrow):active img,
:root body .translate-toggle:active::before { filter: brightness(0) invert(1); }
:root body .carousel-arrow { width: auto; height: auto; }
:root body .facts-jumps a { flex-direction: column; }
:root body .facts-jumps small { color: inherit; font-family: inherit; }
:root body .explore-topic-nav {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
/* Gallery labels need room to wrap on phones and with enlarged text. */
:root body .gallery-navigation {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(14rem, calc((100% - .5rem) / 2))), 1fr));
}
:root body .gallery-counter { grid-column: 1 / -1; grid-row: 1; }
@media (max-width: 36rem) {
  :root body .carousel-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  :root body .carousel-count { grid-column: 1 / -1; grid-row: 1; text-align: center; }
}
/* Shared navigation spacing leaves room for the full pill padding and focus rings. */
:root body .site-header .nav { flex-wrap: wrap; gap: .75rem; }
:root body .site-header .nav-list { gap: .75rem; }
:root body .site-header .nav-list > li > a { width: 100%; }
:root body .site-header .translate-menu { border-inline-start: 0; padding-inline-start: 0; }
:root body .site-header .translate-toggle { width: 100%; margin-top: 0; }
@media (min-width: 70.001rem) {
  :root body .site-header .brand { flex: 1 1 15rem; max-width: 17rem; }
  :root body .site-header .nav-list { flex: 1 1 48rem; flex-wrap: wrap; }
  :root body .site-header .nav-list > li { flex: 1 1 0; min-width: min-content; }
  :root body .site-header .nav-list > li > :is(a[href], .translate-toggle) { overflow-wrap: break-word; }
}
@media (max-width: 70rem) {
  :root body .site-header .nav-list { grid-template-columns: minmax(0, 1fr); }
  :root body .site-header:not(.nav-ready) .nav-list,
  :root body .site-header.nav-ready .nav-list.open { display: grid; }
  :root body .site-header.nav-ready .nav-toggle { display: inline-flex; }
}
/* Keep image-only logo and QR links intact; give text pills comfortable separation. */
:root body .site-footer .footer-grid ul { display: grid; gap: .75rem; justify-items: start; }
:root body .site-footer .footer-connect p { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; }
:root body .site-footer .footer-connect p > br { display: none; }

/* Keep navigation pinned on phones, landscape screens and desktop alike.
   The compact menu already scrolls within the available viewport height. */
:root body .site-header.nav-ready {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* At the narrowest viewport or a short landscape viewport, an enlarged sticky
   header can cover most of the page and intercept the next control. Keep the
   same compact menu, but let the header scroll with the document. */
@media (max-width: 22rem), (max-height: 32rem) {
  :root body .site-header.nav-ready { position: relative; }
}

/* Override older page-wide reduced-motion durations with the reference's zero delay. */
@media (prefers-reduced-motion: reduce) {
  :root body :is(button, summary, .button, .pill-button, .service-button,
    .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
    .translation-link, .facts-jumps a, .facts-back,
    .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img)), .explore-topic-icon, .service-icon) {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  :root body :is(button, summary, .button, .pill-button, .service-button,
    .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
    .translation-link, .facts-jumps a, .facts-back,
    .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(.photo-open, .carousel-thumb, .gallery-thumbnail),
  :root body button:is(.photo-open, .carousel-thumb, .gallery-thumbnail) {
    background: ButtonFace;
    color: ButtonText;
    border: 2px solid ButtonText;
    box-shadow: none;
  }
  :root body :is(button, summary, .button, .pill-button, .service-button,
    .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
    .translation-link, .facts-jumps a, .facts-back,
    .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(:disabled):is(:focus-visible, :active) {
    background: Highlight;
    color: HighlightText;
    outline-color: Highlight;
    box-shadow: none;
  }
  :root body button.answer-button:is(.correct, .incorrect):disabled {
    border: 4px solid Highlight;
    box-shadow: none;
  }
  :root body :is(.carousel-thumb[aria-current], .gallery-thumbnail[aria-pressed="true"]) {
    outline: 3px solid Highlight;
    outline-offset: -3px;
  }
}
@media (forced-colors: active) and (hover: hover) {
  :root body :is(button, summary, .button, .pill-button, .service-button,
    .explore-topic, .back-top, .text-link, .quiz-link, .story-link,
    .translation-link, .facts-jumps a, .facts-back,
    .group-documents-list a, .nav-list a[href], .site-footer a:not(:has(img))):not(:disabled):hover {
    background: Highlight;
    color: HighlightText;
  }
}

/* Centre the homepage call to action in both stacked and two-column layouts.
   Keep the shared pill colours, label styling and accessible focus ring. */
:root body[data-page="home"] .community-actions {
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: clamp(1.3rem, 2.5vw, 2rem);
}
:root body[data-page="home"] .community-actions > a.pill-button {
  width: min(100%, clamp(11rem, 60%, 18rem));
  flex: 0 1 auto;
}

/* Interaction-only motion: no looping animation or movement for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  :root body[data-page="home"] .community-actions > a.pill-button {
    transition: transform 180ms ease;
  }
  @media (hover: hover) and (pointer: fine) {
    :root body[data-page="home"] .community-actions > a.pill-button:hover {
      transform: translateY(-2px);
    }
  }
  :root body[data-page="home"] .community-actions > a.pill-button:active {
    transform: translateY(1px);
    transition-duration: 80ms;
  }
}
