/*
 * 40-chrome.css — site chrome for dg-panchakarma-theme-2.
 *
 * Everything that frames a page lives here: skip link, top bar, header/nav,
 * mobile menu, footer. This file replaces the ~160 lines of <style> that used to
 * sit inline in header.php's <head>; inline styles there won the cascade over
 * every enqueued sheet, which is why nothing could be restyled without editing
 * the template.
 *
 * Load order is style.css -> this file -> wp-custom-css -> front-page.php's five
 * inline <style> blocks. Anything here that has to beat a later block does it on
 * specificity, not on order — see the .site-header rules at the bottom.
 *
 * Colour rule: every white-on-colour pair below is >= 4.5:1 (WCAG 2.1 AA 1.4.3).
 * DGA-085 — the old #4CAF50 phone CTA was 2.78:1 and #2f8d46 bars were 4.18:1.
 */

:root {
  /* Brand greens, darkened until white text clears AA. Ratios against #ffffff. */
  --dg-green-900: #1f5c2c; /* bars and footer ground        8.00:1 */
  --dg-green-800: #256b35; /* hover / pressed on the ground 6.58:1 */
  --dg-green-700: #2e7d32; /* solid green button            5.13:1 */
  --dg-green-ink: #1b5e20; /* green text on white           7.88:1 */
  --dg-green-tint: #f1f8f2;
  --dg-focus: #ffd54f;
}

/* --- Focus visibility ------------------------------------------------------
   A skip link is worthless if the user cannot see where focus landed
   (DGA-107 depends on this). Applies to keyboard focus only. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--dg-green-ink);
  outline-offset: 2px;
}

.top-bar a:focus-visible,
.footer a:focus-visible,
.hamburger:focus-visible {
  outline: 3px solid var(--dg-focus);
  outline-offset: 2px;
}

/* Visually hidden, still read aloud. */
.dg-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Skip link (DGA-107) --------------------------------------------------- */
.dg-skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100000;
  padding: 12px 18px;
  background: #ffffff;
  color: var(--dg-green-ink);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--dg-green-ink);
  border-radius: 0 0 6px 6px;
  transition: top 0.15s ease-in-out;
}

.dg-skip-link:focus {
  top: 0;
}

/* The landmark is only a focus target, so it must not draw a ring of its own —
   the skip link's own :focus style is what tells the user where they are. */
#dg-main:focus {
  outline: none;
}

/* --- Top bar --------------------------------------------------------------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background-color: var(--dg-green-900);
  color: #ffffff;
  padding: 8px 20px;
  font-size: 14px;
  flex-wrap: wrap;
}

.top-bar .shop-hours {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* The phone number is the clinic's conversion element, so it is now the highest
   contrast thing on the bar rather than the lowest (DGA-085). */
.top-bar a.top-bar-call {
  background-color: #ffffff;
  color: var(--dg-green-ink);
  font-weight: 700;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 5px;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s;
}

.top-bar a.top-bar-call:hover,
.top-bar a.top-bar-call:focus {
  background-color: var(--dg-green-tint);
  color: #14471a;
}

.top-bar a.top-bar-map,
.shop-hours a {
  background: none;
  color: #ffffff;
  text-decoration: none;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 7px 14px;
  border-radius: 5px;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.top-bar a.top-bar-map:hover,
.top-bar a.top-bar-map:focus,
.shop-hours a:hover,
.shop-hours a:focus {
  background-color: #ffffff;
  color: var(--dg-green-ink);
  border-color: #ffffff;
}

/* Stacked, and tightened: naming the locality makes the map link wider than the
   old "View on Map", so without this the bar costs ~35px more of a phone screen
   than it used to. */
@media (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    gap: 6px;
    padding: 6px 12px;
    text-align: center;
  }

  .top-bar .shop-hours {
    justify-content: center;
    gap: 6px;
    font-size: 13px;
  }

  .top-bar a.top-bar-map,
  .shop-hours a {
    padding: 5px 12px;
  }
}

/* --- Header / navbar ------------------------------------------------------- */
.navbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #ffffff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.logo img {
  height: 50px;
}

/* --- Primary menu (theme fallback; Max Mega Menu replaces this when active) -- */
.menu-items {
  list-style: none;
  display: flex;
  gap: 25px;
  margin: 0;
  padding: 0;
}

.menu-items li {
  position: relative;
}

.menu-items a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 8px 5px;
  display: block;
}

.menu-items ul {
  position: absolute;
  top: 120%;
  left: 0;
  min-width: 220px;
  background: #fff;
  list-style: none;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 0.3s ease;
  z-index: 999;
}

.menu-items li:hover > ul,
.menu-items li:focus-within > ul,
.menu-items li.open > ul {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-items ul li {
  width: 100%;
}

.menu-items ul li a {
  padding: 10px 18px;
  color: #444;
  transition: 0.25s;
}

.menu-items ul li a:hover {
  background: var(--dg-green-tint);
  color: var(--dg-green-ink);
  padding-left: 22px;
}

.menu-item-has-children > a::after {
  content: " ▾";
  font-size: 12px;
}

/* --- Hamburger (DGA-164) ---------------------------------------------------
   Only rendered when Max Mega Menu is NOT handling the primary location, so the
   two toggles can never appear together. It used to be three empty, unstyled
   spans in a div: 0x0 px, invisible, and toggling classes no rule defined. */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}

.hamburger .hamburger-bar,
.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--dg-green-ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1),
.hamburger.open .hamburger-bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2),
.hamburger.open .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3),
.hamburger.open .hamburger-bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-links .menu-items {
    display: none;
    flex-direction: column;
    gap: 0;
    background: #ffffff;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    padding: 8px 0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    z-index: 998;
  }

  /* .is-open is what the JS toggles; .active is kept for any stale markup. */
  .nav-links.is-open .menu-items,
  .menu-items.is-open,
  .menu-items.active {
    display: flex;
  }

  .nav-links .menu-items a {
    padding: 12px 20px;
  }

  .nav-links .menu-items ul {
    position: relative;
    top: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    display: none;
    padding: 0 0 0 16px;
  }

  .nav-links .menu-items li.open > ul {
    display: block;
  }
}

/* --- Footer ---------------------------------------------------------------- */
.footer {
  background: var(--dg-green-900);
  color: #ffffff;
  text-align: center;
  padding: 36px 20px 28px;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.footer-nap {
  font-style: normal;
  line-height: 1.7;
}

.footer-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.footer-nap p {
  margin: 0;
}

.footer-nap a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-btn {
  display: inline-block;
  min-height: 44px;
  padding: 11px 22px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.footer-btn-primary {
  background: #ffffff;
  color: var(--dg-green-ink);
  border: 2px solid #ffffff;
}

.footer-btn-primary:hover,
.footer-btn-primary:focus {
  background: var(--dg-green-tint);
  color: #14471a;
}

.footer-btn-outline {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.footer-btn-outline:hover,
.footer-btn-outline:focus {
  background: #ffffff;
  color: var(--dg-green-ink);
  border-color: #ffffff;
}

/* DGA-113 / DGA-114 — the only link between the clinic and the family store. */
.footer-family {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.95rem;
}

.footer-family a {
  color: #ffffff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-copy {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 600px) {
  .footer-actions .footer-btn {
    width: 100%;
    max-width: 320px;
  }
}

/* --- Main landmark ---------------------------------------------------------
   header.php opens this only for front-page.php and dg-fullwidth.php; every
   other template ships its own. It must not introduce a box of its own. */
.dg-main-wrap {
  display: block;
}
