/* wp-content/plugins/notts-osteo-elements/assets/css/site-footer.css
 *
 * Footer navigation. Columns come from the menu structure, so the layout is edited in the
 * WordPress menu screen rather than here.
 *
 * LAYOUT IS MOBILE-FIRST AND CONTAINER-DRIVEN. The stacked accordion is the DEFAULT; the
 * four-column layout is the thing that gets switched on, and only when the footer actually
 * has room for it. Viewport media queries were wrong for this: they describe the window,
 * not the box this widget was dropped into, so the footer could sit in a narrow container
 * on a wide screen (or an editor preview) and still lay itself out as four columns. Basing
 * it on the container's own width makes it correct everywhere, and makes the fallback
 * "stacked" rather than "four squashed columns".
 *
 * Author: Sean Burn
 */

.nosteo-footer {
  --nosteo-footer-bg:         var(--nosteo-tint);
  --nosteo-footer-heading:    var(--nosteo-ink);
  --nosteo-footer-link:       var(--nosteo-ink);
  --nosteo-footer-link-hover: var(--nosteo-accent);

  background: var(--nosteo-footer-bg);
  font-family: var(--nosteo-font);
  color: var(--nosteo-footer-link);
}

/* Background runs full width; content sits on the site grid, same as the header. */
.nosteo-footer__inner {
  max-width: var(--nosteo-site-max);
  margin: 0 auto;
  /* Top on the shared rhythm, so the gap between the last section and the footer matches the gap
     between any two sections. The bottom stays tighter — nothing follows it. */
  /* gap-end, not pad-y: nothing above adds to this, so it keeps the original generous value. */
  padding: var(--nosteo-section-gap-end) var(--nosteo-site-pad) clamp(24px, 3vw, 40px);
  /* The element everything below measures itself against. */
  container-type: inline-size;
  container-name: nosteo-footer;
}

/* ---------- stacked accordion: the default ---------- */

/* NOT a grid. <details> are block-level, so plain flow stacks them and there is no
   grid-template for anything to override — the stacked layout is structural rather than
   something a rule has to win. Two query-based attempts at stacking failed on Sean's
   machine while the CSS was demonstrably correct and unopposed, so the default no longer
   depends on any query being evaluated: the columns are what has to be switched ON. */
.nosteo-footer__cols {
  display: block;
}

.nosteo-footer__col + .nosteo-footer__col {
  border-top: 1px solid var(--nosteo-hair-soft);
}

.nosteo-footer__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  min-height: 52px;             /* tap target floor */
  cursor: pointer;
  list-style: none;             /* Firefox's default triangle */
}
.nosteo-footer__summary::-webkit-details-marker { display: none; }
.nosteo-footer__summary::marker { content: ""; }

/* The title toggles the panel at this size, so it must not navigate on the way. The
   column's own page is still reachable from the main menu. */
.nosteo-footer__summary a { pointer-events: none; }

.nosteo-footer__heading {
  display: block;
  color: var(--nosteo-footer-heading);
  font-size: 15px;
  font-weight: var(--nosteo-weight-strong);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
a.nosteo-footer__heading:hover { color: var(--nosteo-footer-link-hover); }

.nosteo-footer__chev {
  width: 12px;
  height: 8px;
  flex: none;
  color: var(--nosteo-footer-heading);
  transition: transform 200ms var(--nosteo-ease);
}
.nosteo-footer__col[open] .nosteo-footer__chev { transform: rotate(180deg); }

.nosteo-footer__col ul { list-style: none; margin: 0; padding: 0 0 12px; }
.nosteo-footer__col li + li { margin-top: 2px; }
.nosteo-footer__col a {
  display: block;
  padding: 10px 0;
  color: var(--nosteo-footer-link);
  text-decoration: none;
  line-height: 1.45;
  /* A single long unbroken item — a stray URL, a long treatment name — used to push the
     grid wider than the screen. A page that scrolls sideways drags every full-width
     section out of alignment with the viewport, which is how this first surfaced as "the
     hero is not full width on mobile". */
  overflow-wrap: anywhere;
}
.nosteo-footer__col a:hover { color: var(--nosteo-footer-link-hover); text-decoration: underline; }
.nosteo-footer__col a:focus-visible {
  outline: 2px solid var(--nosteo-accent);
  outline-offset: 2px;
}

/* ---------- accreditations ----------
   Above the rule, below the columns. These are the reason a first-time visitor believes the rest of
   the page, so they get room rather than being tucked into a corner at favicon size. */

.nosteo-footer__badges {
  list-style: none;
  margin: clamp(26px, 3.5vw, 44px) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

.nosteo-footer__badge img {
  display: block;
  width: auto;
  height: clamp(58px, 6vw, 76px);
  /* The badges arrive as flat artwork on transparent; nothing else needed. */
  max-width: 100%;
}

/* ---------- the small print ----------
   A rule separates it from the columns above, then copyright to one side and links to the other. */

.nosteo-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  margin: clamp(24px, 3.5vw, 40px) 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--nosteo-hair-soft);
}

.nosteo-footer__legal {
  margin: 0;
  color: var(--nosteo-muted);
  font-size: 14px;
}

.nosteo-footer__legal-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.nosteo-footer__legal-links a {
  color: var(--nosteo-muted);
  font-size: 14px;
  text-decoration: none;
}
/* Colour restated on both states: the theme sets a global a:hover colour that beats a single
   class, so a hover rule without `color` would protect nothing. */
.nosteo-footer .nosteo-footer__legal-links a:hover,
.nosteo-footer .nosteo-footer__legal-links a:focus {
  color: var(--nosteo-footer-link-hover, var(--nosteo-ink));
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 640px) {
  .nosteo-footer__bottom { justify-content: flex-start; }
}

/* ---------- columns, once there is room for them ----------
   900px of CONTAINER, not viewport: at the 1440 site width the footer's content box is
   about 1296px, so four columns land at roughly 320px each. Below that they stay stacked. */

@container nosteo-footer (min-width: 900px) {
  .nosteo-footer__cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(24px, 3vw, 48px);
  }

  .nosteo-footer__col + .nosteo-footer__col { border-top: 0; }

  /* Not collapsible here, so the summary stops taking pointer events and the heading link
     inside it takes them back. Keyboard users still reach that link — it is the summary
     that stops being interactive, not its contents. */
  .nosteo-footer__summary {
    margin: 0 0 14px;
    padding: 0 0 12px;
    min-height: 0;
    border-bottom: 2px solid var(--nosteo-resolve);
    cursor: default;
    pointer-events: none;
  }
  .nosteo-footer__summary a { pointer-events: auto; }

  .nosteo-footer__chev { display: none; }

  .nosteo-footer__col ul { padding: 0; }
  .nosteo-footer__col a { padding: 7px 0; }
}

/* Same switch for browsers without container queries. Scoped to @supports so the two can
   never both apply — and because this is the mobile-first direction, an old browser that
   matches neither simply keeps the stacked layout, which is the safe way to be wrong. */
@supports not (container-type: inline-size) {
  @media (min-width: 1025px) {
    .nosteo-footer__cols {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: clamp(24px, 3vw, 48px);
    }
    .nosteo-footer__col + .nosteo-footer__col { border-top: 0; }
    .nosteo-footer__summary {
      margin: 0 0 14px;
      padding: 0 0 12px;
      min-height: 0;
      border-bottom: 2px solid var(--nosteo-resolve);
      cursor: default;
      pointer-events: none;
    }
    .nosteo-footer__summary a { pointer-events: auto; }
    .nosteo-footer__chev { display: none; }
    .nosteo-footer__col ul { padding: 0; }
    .nosteo-footer__col a { padding: 7px 0; }
  }
}
