/* Shared components: buttons, header, nav, drawer, banner, footer. Tokens only. */

/* ---------- Buttons ---------- */

/* A button is never underlined, wherever it sits (blocks, prose, cards). */
a.button,
a.button:hover,
a.button:focus,
a.button:active {
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  min-height: 56px;
  min-width: var(--min-tap-target);
  padding: 0 var(--space-20);
  border: 1px solid var(--button-primary-border);
  border-radius: var(--radius-control);
  background: var(--button-primary-bg);
  color: var(--button-primary-text);
  font: 700 var(--text-label) / 1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.button--secondary {
  border-color: var(--button-secondary-border);
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
}

.button--compact {
  min-height: var(--min-tap-target);
}

.button:hover {
  background: var(--button-primary-hover-bg);
  border-color: var(--button-primary-hover-bg);
}

.button--secondary:hover {
  background: var(--button-secondary-hover-bg);
  border-color: var(--button-secondary-border);
}

/* Active is the moment of press, not the selected page. */
.button:active {
  background: var(--button-primary-active-bg);
  border-color: var(--button-primary-active-bg);
}

.button--secondary:active {
  background: var(--button-secondary-active-bg);
  border-color: var(--button-secondary-border);
}

/* Dark button: near-black with white text. For sand surfaces, where the white
   primary blends in and the secondary turns beige. */
.button--dark,
.button--dark:hover,
.button--dark:active {
  color: var(--paper-white);
}

.button--dark {
  border-color: var(--ink-base);
  background: var(--ink-base);
}

.button--dark:hover {
  border-color: var(--stone-dark);
  background: var(--stone-dark);
}

.button--dark:active {
  border-color: var(--stone-border);
  background: var(--stone-border);
}

/* Focus stays visible when combined with hover or active. */
.button:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

.button[disabled],
.button[aria-disabled="true"] {
  opacity: var(--disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
}

/* ---------- Header and nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-page);
  border-bottom: 1px solid var(--border);
  transition: transform 0.2s ease;
}

.site-header[data-hidden] {
  transform: translateY(-100%);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
  min-height: 80px;
}

.site-header__brand {
  font: 400 var(--text-heading-brand) / 1 var(--font-heading);
  text-decoration: none;
  letter-spacing: 0;
}

/* The seal sits behind the WMFA wordmark in the header and the footer: about
   three times a 48px mark, turned 25 degrees counter-clockwise, faint, and cut
   off by the header bar or footer. */
.site-header__bar {
  position: relative;
  overflow: hidden;
}

.site-header__bar .site-header__brand,
.site-footer__brand {
  position: relative;
}

.site-header__bar .site-header__brand::before,
.site-footer__brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  background: url("../img/logo-white.svg") center / contain no-repeat;
  opacity: 0.07;
  transform: translate(-50%, -50%) rotate(-20deg);
  pointer-events: none;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-40);
  list-style: none;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-tap-target);
  font: 600 17px / 1 var(--font-body);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  border-bottom-color: var(--sand-muted);
}

.menu-button,
.drawer__close {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  min-height: var(--min-tap-target);
  min-width: var(--min-tap-target);
  padding: 0 var(--space-4);
  border: 0;
  background: none;
  color: inherit;
  font: 700 17px / 1 var(--font-body);
  cursor: pointer;
}

.menu-button {
  display: none;
}

@media (min-width: 1025px) {
  .site-header__bar {
    min-height: 96px;
  }
}

/* Drawer menu from tablet width down. */
@media (max-width: 1024px) {
  .site-nav {
    display: none;
  }

  .menu-button {
    display: inline-flex;
  }
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.6);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(375px, 100%);
  overflow-y: auto;
  background: var(--ink-base);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

/* JS adds .is-open one frame after unhiding the drawer so the slide plays. */
.drawer.is-open .drawer__scrim {
  opacity: 1;
}

.drawer.is-open .drawer__panel {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .drawer__scrim,
  .drawer__panel {
    transition: none;
  }
}

.drawer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  padding-inline: var(--space-24);
  border-bottom: 1px solid var(--border);
}

.drawer__list {
  margin: 0 var(--space-24);
  list-style: none;
}

.drawer__link {
  display: flex;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  font: 700 18px / 1 var(--font-body);
  text-decoration: none;
}

.drawer__link[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.drawer__note {
  margin: var(--space-24);
  color: var(--text-muted);
  font-size: var(--text-small);
}

/* ---------- Alert banner (above the nav, inside the sticky header) ---------- */

/*
 * One slide per active alert, in Panel order. site.js rotates them; without
 * it the first shows. The "View all" block is full height and flush right.
 */
.alert-banner {
  --alert-all-width: 205px;
  position: relative;
  /* Slides share one cell so they can crossfade without moving the page. */
  display: grid;
}

.alert-banner__slide {
  position: relative;
  grid-area: 1 / 1;
  transition: opacity 0.3s ease;
  --banner-accent: var(--status-info);
  --banner-bg: var(--status-info-bg);
  background: var(--banner-bg);
  color: var(--text-primary);
  /* An accent-tinted edge keeps the bar visible against the dark header. */
  border-bottom: 1px solid color-mix(in srgb, var(--banner-accent) 40%, transparent);
}

.alert-banner__slide.is-fading {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .alert-banner__slide {
    transition: none;
  }
}

.alert-banner--success {
  --banner-accent: var(--status-success);
  --banner-bg: var(--status-success-bg);
}

.alert-banner--warning {
  --banner-accent: var(--status-warning);
  --banner-bg: var(--status-warning-bg);
}

.alert-banner--error {
  --banner-accent: var(--status-error);
  --banner-bg: var(--status-error-bg);
}

.alert-banner__bar {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding-right: var(--alert-all-width);
}

/* Arrows sit in the page gutter, outside the centered content. Their height
   is the bar's, so the 44px target costs no extra banner height. */
.alert-banner__arrow {
  display: grid;
  flex: 0 0 var(--page-gutter);
  place-items: center;
  align-self: stretch;
  min-width: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.alert-banner__arrow[hidden] {
  display: none;
}

.alert-banner__inner {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4) var(--space-12);
  max-width: calc(var(--page-max) - 2 * var(--page-gutter));
  margin-inline: auto;
  padding-block: var(--space-8);
}

.alert-banner__icon {
  display: inline-flex;
  align-items: center;
  color: var(--banner-accent);
}

.alert-banner__date {
  color: var(--banner-accent);
  font-weight: 700;
  font-size: var(--text-small);
  white-space: nowrap;
}

.alert-banner__message {
  font-size: var(--text-small);
  font-weight: 600;
}

.alert-banner__link,
.alert-banner__dismiss {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  font-weight: 700;
  font-size: var(--text-small);
}

.alert-banner__dismiss {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.alert-banner__dismiss[hidden] {
  display: none;
}

/* Grow the tap area to 44px without growing the banner. */
.alert-banner__link::after,
.alert-banner__dismiss::after {
  content: "";
  position: absolute;
  inset: -14px -8px;
}

.alert-banner__all {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  width: var(--alert-all-width);
  /* White at 80% so a little of the alert color shows through. */
  background: rgb(255 255 255 / 0.8);
  color: var(--ink-base);
  font-weight: 700;
  font-size: var(--text-small);
  text-decoration: none;
}

.alert-banner__all:hover {
  background: rgb(255 255 255 / 0.92);
}

.alert-banner__all:focus-visible {
  outline-color: var(--ink-base);
  outline-offset: -4px;
}

/* Phones: "View all" drops below the rotation as a full-width row, still on
   the slide so the alert color shows through it. The tap area grows to 44px
   without making the row taller. */
@media (max-width: 640px) {
  .alert-banner__bar {
    padding-right: 0;
  }

  .alert-banner__all {
    position: relative;
    inset: auto;
    width: auto;
    min-height: 36px;
  }

  .alert-banner__all::after {
    content: "";
    position: absolute;
    inset: -4px 0;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  z-index: 0; /* keeps the seal behind the footer text, inside the footer */
  overflow: hidden;
  border-top: 1px solid var(--border);
  margin-top: var(--space-80);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16) var(--space-24);
  min-height: 108px;
  padding-block: var(--space-24);
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8) var(--space-16);
  color: var(--text-primary);
  font-size: var(--text-small);
}

.site-footer__brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-tap-target);
  color: var(--text-primary);
  font: 400 var(--text-heading-brand) / 1 var(--font-heading);
  text-decoration: none;
}

/* Kirby credit band: its own strip under the footer navigation, same ink as the
   page, with a rule across the top and the credit right-aligned. */
.site-footer__band {
  border-top: 1px solid var(--border);
  background: var(--surface-page);
  padding-block: var(--space-8);
}

.site-footer__credit {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-8);
  color: var(--text-credit);
  font-size: var(--text-badge);
  line-height: 1.3;
}

/* Official Kirby icon, drawn from the unmodified SVG in the footer text colour
   (the file has no fill and would be black on the dark band). */
.site-footer__credit-icon {
  flex: none;
  width: 1.4em;
  height: 1.65em;
  background: currentColor;
  -webkit-mask: url("../img/kirby-icon.svg") center / contain no-repeat;
  mask: url("../img/kirby-icon.svg") center / contain no-repeat;
}

.site-footer__credit a {
  text-decoration: underline;
}

.site-footer__credit a:hover {
  color: var(--text-caption);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8) var(--space-24);
  list-style: none;
  font-weight: 600;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--min-tap-target);
  gap: var(--space-8);
  text-decoration: none;
}

.site-footer__links a:hover {
  text-decoration: underline;
}

/* ---------- Brand (text only until a reduced header logo exists) ---------- */

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-14);
  min-height: var(--min-tap-target);
}

