/* ==========================================================================
   layout.css — page structure: container, header/footer shells, section rhythm
   Reusable page-layout rules live here. Component-level styling lives in
   components.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* --------------------------------------------------------------------------
   Site header / nav shell
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding-block: var(--space-6);
}

/* Desktop header logo size. Kept here (not components.css, which loads
   after this file) so the mobile step-downs further down this same file
   can win on source order once their media query matches. */
.site-header .brand__logo {
  height: 60px;
}

.brand {
  flex-shrink: 0;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-width: 0;
  /* pushes the nav (and the CTA after it) to the right edge, as when the
     nav and CTA shared one right-aligned wrapper */
  margin-left: auto;
}

/* Hamburger + scrim only exist below the mobile breakpoint (see the
   max-width: 1024px block further down). */
.nav-toggle,
.nav-scrim {
  display: none;
}

/* Minimal header (header.php's $minimal_header) — brand + a single back
   link, used only by the Get Started booking flow. */
.header-back-link {
  font-size: var(--fs-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.header-back-link:hover,
.header-back-link:focus-visible {
  color: var(--color-accent);
}

.site-header__cta {
  flex-shrink: 0;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Site footer shell
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  /* same fine dot-grid texture as the body, applied locally so it reads
     regardless of the footer's own opaque background paint. */
  background-color: var(--color-bg);
  background-image: radial-gradient(circle, rgba(22, 24, 29, 0.09) 0.8px, transparent 0.9px);
  background-size: 24px 24px;
}

/* A full-bleed CTA banner sits flush against the footer; otherwise give the
   footer breathing room from page content. */
main:not(:has(.cta-banner:last-child)) + .site-footer {
  margin-top: var(--space-9);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: var(--space-6);
  padding-block: var(--space-8);
}

.site-footer__brand {
  max-width: 34ch;
}

.site-footer__desc {
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
}

.site-footer__art {
  margin-top: var(--space-5);
  width: min(200px, 100%);
  height: auto;
  aspect-ratio: 1774 / 887;
}

.site-footer__social {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding: 0;
  list-style: none;
}

.site-footer__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.site-footer__social a:hover,
.site-footer__social a:focus-visible {
  color: var(--color-accent);
}

.site-footer__heading {
  display: block;
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--fs-sm);
}

.site-footer__links a {
  color: var(--color-text-secondary);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.site-footer__links a:hover,
.site-footer__links a:focus-visible {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.site-footer__quote {
  display: inline-block;
  font-size: var(--fs-md);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  border-bottom: 1px solid transparent;
}

.site-footer__quote:hover,
.site-footer__quote:focus-visible {
  border-bottom-color: var(--color-accent);
}

/* Deliberately understated next to .site-footer__quote — this is a
   secondary, quick-access trigger, not a second primary CTA. */
.site-footer__quick-enquiry {
  display: block;
  margin-top: var(--space-3);
  padding: 0;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  text-align: left;
}

.site-footer__quick-enquiry:hover,
.site-footer__quick-enquiry:focus-visible {
  color: var(--color-text);
  border-bottom-color: var(--color-text-secondary);
}

.site-footer__divider {
  width: 32px;
  height: 0;
  margin: var(--space-4) 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

.site-footer__note {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

.site-footer__legal-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

.site-footer__legal-links a,
.site-footer__legal-links button {
  font: inherit;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.site-footer__legal-links a:hover,
.site-footer__legal-links a:focus-visible,
.site-footer__legal-links button:hover,
.site-footer__legal-links button:focus-visible {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.site-footer__top {
  color: var(--color-text-muted);
  border-bottom: 1px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.site-footer__top:hover,
.site-footer__top:focus-visible {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   Generic section rhythm
   -------------------------------------------------------------------------- */
.section {
  padding-block: var(--space-9);
  border-bottom: 1px solid var(--color-border);
}

.section:last-child {
  border-bottom: none;
}

.section__lede {
  font-size: var(--fs-md);
  color: var(--color-text-secondary);
  max-width: 52ch;
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
/* Mobile / tablet header — max-width: 1024px.
   This is the width at which the desktop nav stops fitting on one row (it
   used to wrap onto a second and third row here), so the nav collapses into
   a hamburger panel instead. One row: brand, compact "Book a Strategy
   Call" button, hamburger. The nav links stay real <a> elements in the
   markup; below this width they simply live in a panel that is hidden (not
   removed) until the toggle opens it (assets/js/nav-mobile.js). The panel
   rules are scoped to html.js, so without JavaScript the nav degrades to a
   stacked block under the header row instead of disappearing.

   Selectors are prefixed with .site-header so they out-rank the equal-
   specificity desktop rules in components.css, which loads after this file. */
@media (max-width: 1024px) {
  .site-header {
    /* header-only gutter, so the panel padding below lines up with the logo */
    --container-pad: 16px;
  }

  .site-header__inner {
    flex-wrap: nowrap;
    gap: var(--space-3);
    padding-block: var(--space-4);
  }

  .site-header .brand { margin-right: auto; }

  .site-header .brand__logo { height: 44px; }

  .site-header .site-nav { margin-left: 0; }

  .site-header .site-header__cta {
    padding: 9px 14px;
    font-size: var(--fs-xs);
    line-height: 1;
  }

  /* ---- no-JS fallback: nav wraps beneath the brand row ------------------ */
  html:not(.js) .site-header__inner { flex-wrap: wrap; }
  html:not(.js) .site-header .site-nav { order: 3; width: 100%; }
  html:not(.js) .site-header .nav-links { flex-wrap: wrap; row-gap: var(--space-2); }

  /* ---- hamburger ------------------------------------------------------- */
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    margin-right: -12px; /* optical: bars, not the 44px hit area, meet the gutter */
    padding: 0;
    color: var(--color-text);
    border-radius: var(--radius);
  }

  .nav-toggle__bars {
    position: relative;
    display: block;
    width: 20px;
    height: 14px;
  }

  .nav-toggle__bars span {
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: top 220ms ease, transform 220ms ease, opacity 150ms ease;
  }

  .nav-toggle__bars span:nth-child(1) { top: 0; }
  .nav-toggle__bars span:nth-child(2) { top: 6px; }
  .nav-toggle__bars span:nth-child(3) { top: 12px; }

  .nav-toggle.is-open .nav-toggle__bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
  .nav-toggle.is-open .nav-toggle__bars span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open .nav-toggle__bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

  .site-header .nav-toggle:focus-visible,
  .site-header .site-header__cta:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }

  /* ---- dropdown panel -------------------------------------------------- */
  .js .site-header .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1;
    display: block;
    margin: 0;
    padding: var(--space-2) var(--container-pad) var(--space-5);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 18px 30px -20px rgba(20, 20, 25, 0.35);
    /* header height is measured by nav-mobile.js when the menu opens */
    max-height: calc(100dvh - var(--header-h, 72px));
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 220ms ease, transform 220ms ease, visibility 0s linear 220ms;
  }

  .js .site-header .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .js .nav-scrim {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-h, 72px);
    bottom: 0;
    z-index: -1;
    background: rgba(20, 20, 25, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 0s linear 220ms;
  }

  .js .nav-scrim.is-open {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }

  /* no scrolling behind the open menu */
  html.nav-open { overflow: hidden; }

  /* ---- stacked links, 48px tap targets --------------------------------- */
  .site-header .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    font-size: var(--fs-base);
  }

  .site-header .nav-links > li {
    display: block;
    border-bottom: 1px solid var(--color-border-light);
  }

  .site-header .nav-links > li:last-child { border-bottom: none; }

  .site-header .nav-links a,
  .site-header .nav-links__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding-block: var(--space-2);
    font-size: var(--fs-base);
    border-bottom: none;
  }

  .site-header .nav-links a[aria-current='page'] {
    border-bottom: none;
    font-weight: var(--weight-semibold);
  }

  .site-header .nav-links__trigger--active { border-bottom: none; }

  .site-header .nav-links a:focus-visible,
  .site-header .nav-links__trigger:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
  }

  /* ---- Services / About: tap-to-expand accordion ------------------------
     Still driven only by each trigger's aria-expanded (nav-dropdowns.js);
     there is no hover behaviour anywhere in this nav. The arrow is the
     trigger's existing ::after chevron, enlarged, which already rotates
     when aria-expanded="true". */
  .site-header .nav-links__dropdown { display: block; }

  .site-header .nav-links__trigger::after {
    width: 8px;
    height: 8px;
    margin: 0 4px 3px 0;
    flex-shrink: 0;
    transition: transform 220ms ease;
  }

  .site-header .nav-links__submenu {
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0 0 var(--space-2) var(--space-4);
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: none;
  }

  .site-header .nav-links__dropdown--js .nav-links__submenu { display: none; }

  .site-header .nav-links__trigger[aria-expanded="true"] + .nav-links__submenu {
    display: flex;
    animation: nav-sub-in 200ms ease;
  }

  .site-header .nav-links__submenu a {
    min-height: 48px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-sm);
  }

  .site-header .nav-links__submenu a:focus-visible { outline-offset: -2px; }
}

@keyframes nav-sub-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Very small phones: shrink the wordmark and the CTA a touch so brand,
   button, and hamburger always share one row without overflow. */
@media (max-width: 400px) {
  .site-header__inner { gap: 8px; }
  .site-header .brand { font-size: 0.9rem; }
  .site-header .brand__logo { height: 40px; }
  .site-header .site-header__cta { padding: 8px 11px; font-size: 0.75rem; }
}

@media (max-width: 360px) {
  .site-header__inner { gap: 6px; }
  .site-header .brand { font-size: 0.8rem; letter-spacing: 0.01em; }
  .site-header .brand__logo { height: 36px; }
  .site-header .site-header__cta { padding: 7px 9px; font-size: 0.6875rem; }
  .js .nav-toggle { width: 40px; margin-right: -10px; }
}

@media (max-width: 860px) {
  /* brand + description + illustration first, full width; the three nav
     groups pair up two-per-row where there's still room for them. */
  :root {
    --container-pad: 24px;
  }

  .site-footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer__brand {
    grid-column: 1 / -1;
    max-width: 52ch;
  }

  .brand__logo--footer {
    height: 34px;
  }

  /* tighter footer: less vertical padding and smaller gaps */
  .site-footer__grid {
    gap: var(--space-5) var(--space-4);
    padding-block: var(--space-6);
  }

  /* "Let's talk" spans the full width beneath the two link lists, with its
     two links on one row (heading, links, divider, tagline as grid rows) */
  div.site-footer__col {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: start;
    column-gap: var(--space-5);
  }

  div.site-footer__col > .site-footer__heading,
  div.site-footer__col > .site-footer__divider,
  div.site-footer__col > .site-footer__note {
    grid-column: 1 / -1;
  }

  div.site-footer__col > .site-footer__quote,
  div.site-footer__col > .site-footer__quick-enquiry {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin-top: 0;
    white-space: nowrap;
  }

  div.site-footer__col > .site-footer__divider {
    justify-self: start;
    margin-block: var(--space-2) var(--space-3);
  }

  /* comfortable 40px tap targets without the old loose row gaps */
  .site-footer__links { gap: 0; }

  .site-footer__links a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }
}

/* Keep the Explore and The Studio lists side by side on phones too (they
   used to drop to a single column here). */
@media (max-width: 560px) {
  .site-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
