:root {
  --theme-color1: #000;
  --pm-hover: #333;
  --pm-header-bg: #000;
  --pm-header-fg: #fff;
  --pm-header-h: 88px;
  --pm-muted: #6b6b6b;   /* 5.3:1 on white */
  --pm-border: #8a8a8a;  /* 3.4:1 on white */
}

html { scroll-padding-top: var(--pm-header-h); }

/* ---- Header: every state has its own backdrop, whatever is behind it ---- */
.site-header,
.site-mobile-header {
  color: var(--pm-header-fg);
  background: linear-gradient(rgb(0 0 0 / .75), rgb(0 0 0 / .55) 60%, transparent);
  transition: padding .3s ease, box-shadow .3s ease;
}
.site-header.sticky-header,
.site-mobile-header.sticky-header {
  background: var(--pm-header-bg);
  box-shadow: 0 2px 12px rgb(0 0 0 / .25);
}
.site-logo img { height: auto; transition: width .3s ease; }
.site-header.sticky-header .site-logo img,
.site-mobile-header.sticky-header .site-logo img { width: 56px; }

.site-header .site-navigation ul li a,
.site-header.sticky-header .site-navigation ul li a:is(:hover, :focus-visible, :active) {
  color: var(--pm-header-fg);
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}
.site-header .site-navigation ul li a:is(:hover, :focus-visible) {
  color: var(--pm-header-fg);
  text-decoration-line: underline;
}
.site-header .site-navigation ul li a:active { opacity: .75; }

/* ---- Tablet and mobile (theme switches headers at 992px) ---- */
@media (max-width: 991.98px) {
  :root { --pm-header-h: 72px; }
  .site-mobile-header { padding: 16px 0; }
  .site-mobile-header .site-logo img { width: 64px; }
  .site-mobile-header.sticky-header { padding: 12px 0; }
  .site-mobile-header.sticky-header .site-logo img { width: 48px; }
  .site-mobile-header .header-content { display: flex; align-items: center; justify-content: space-between; }
}

.mobile-nav-toggle,
.hide-mobile-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
}
/* Hidden (not only off-screen) when closed, so keyboard users cannot tab into it. */
.mobile-navigation-wrap {
  width: min(320px, 85vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
  transition: right .3s ease, visibility 0s .3s;
}
.mobile-navigation-wrap.show {
  visibility: visible;
  transition: right .3s ease;
  box-shadow: -8px 0 24px rgb(0 0 0 / .35);
}
.mobile-navigation-wrap .mobile-nav ul li { margin-bottom: 4px; }
.mobile-navigation-wrap .mobile-nav ul li a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  text-underline-offset: 6px;
}
.mobile-navigation-wrap .mobile-nav ul li a:is(:hover, :focus-visible, :active) {
  color: var(--pm-header-fg);
  text-decoration: underline;
}

/* ---- Logged-in toolbar must not cover the fixed header ---- */
.admin-bar :is(.site-header, .site-mobile-header, .mobile-navigation-wrap) { top: 32px; }
@media (max-width: 782px) {
  .admin-bar :is(.site-header, .site-mobile-header, .mobile-navigation-wrap) { top: 46px; }
}
@media (max-width: 600px) {
  .admin-bar :is(.site-mobile-header.sticky-header, .mobile-navigation-wrap) { top: 0; }
}

/* ---- Keyboard focus: two-tone ring reads on light and dark. The theme removes outlines. ---- */
:is(a, button, [role="button"], input, textarea, select):focus-visible {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000;
}

/* ---- Buttons: theme hover colour equals the resting colour (both black) ---- */
:is(.button, .anchor-button, .wpcf7 [type="submit"], .back-to-top):hover {
  background: var(--pm-hover);
  color: #fff;
}

/* ---- Form contrast ---- */
:is(.contact-form, .newsletter-form) :is(input:not([type="submit"]), textarea) { border-color: var(--pm-border); }
:is(.contact-form, .newsletter-form) :is(input:not([type="submit"]), textarea):focus { border-color: #000; }
:is(input, textarea)::placeholder { color: var(--pm-muted); opacity: 1; }

/* ---- Back to top: compact on phones so it hides less text ---- */
@media (max-width: 767.98px) {
  .back-to-top { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; padding: 6px; }
  .back-to-top .top-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header, .site-mobile-header, .site-logo img, .mobile-navigation-wrap, .mobile-navigation-wrap.show { transition: none; }
}

/* ---- Images ---- */
/* width/height attributes give the browser the shape before loading; CSS still controls the size.
   :where() keeps this below every theme rule. */
:where(img[width][height]) { height: auto; }
.site-banner { background-image: var(--pm-hero); }
@media (max-width: 767.98px) {
  .site-banner { background-image: var(--pm-hero-mobile, var(--pm-hero)); }
}
