/* Page frame: content column, sticky header, footer. */

html {
  scroll-padding-block-start: var(--header-offset);
}

/*
  Every top-level band is full width with a centred content column.
  Children sit in the column by default; dividers span edge to edge.
  This lets background bands reach the screen edge without extra wrapper divs.
*/
main > section,
.site-footer {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [content-start] min(100% - 2 * var(--gutter), var(--content-max))
    [content-end] minmax(var(--gutter), 1fr)
    [full-end];
  padding-block: var(--space-section);
}

main > section > *,
.site-footer > * {
  grid-column: content;
}

main > section > .divider {
  grid-column: full;
}

.section-head {
  margin-block-end: var(--space-xl);
}

.section-head > * + * {
  margin-block-start: var(--space-xs);
}

/* Header */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand actions"
    "nav nav";
  align-items: center;
  column-gap: var(--space-2xs);
  padding-inline: var(--gutter);
  background-color: var(--surface);
  border-block-end: var(--border-hair);
}

.site-header__brand {
  grid-area: brand;
  justify-self: start;
  display: block;
  min-inline-size: 0;
  max-inline-size: 100%;
  padding-block: var(--logo-clearance);
  line-height: 0;
}

/* Height drives the size. object-fit stops narrow phones squashing the logo if max-width bites. */
.site-header__logo {
  inline-size: auto;
  block-size: var(--logo-height);
  max-inline-size: 100%;
  object-fit: contain;
}

.site-header__actions {
  grid-area: actions;
  display: flex;
  gap: var(--space-3xs);
}

.site-header__actions .btn {
  min-height: 2.75rem;
  min-inline-size: 2.5rem;
  /* Tighter on phones so the logo, Call, Enquire and Menu share one 360px row. */
  padding-inline: var(--space-2xs);
  font-size: var(--step-n1);
}

/* On phones the buttons shorten to an icon and "Enquire"; screen readers hear the full label instead. */
.site-header__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.site-nav {
  grid-area: nav;
  margin-inline: calc(-1 * var(--gutter));
  border-block-start: var(--border-hair);
  /* Swipeable row of links: usable on a phone without any JavaScript. */
  overflow-x: auto;
  scrollbar-width: none;
}

/* Doubled class beats the reset's ul[role="list"] padding rule. */
.site-nav__list.site-nav__list {
  display: flex;
  gap: var(--space-s);
  padding: var(--space-2xs) var(--gutter);
  white-space: nowrap;
}

.site-nav a {
  display: inline-block;
  padding-block: var(--space-3xs);
  font-size: var(--nav-size-row);
  font-weight: 600;
  text-decoration-color: transparent;
}

.site-nav a:hover {
  text-decoration-color: var(--accent-ink);
}

/* Footer */
.site-footer {
  --focus-ring: var(--color-milk);
  padding-block: var(--space-2xl) var(--space-xl);
  background-color: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--step-n1);
}

.site-footer__inner {
  display: grid;
  gap: var(--space-s);
}

.site-footer a {
  color: var(--text-inverse);
  text-decoration-color: var(--text-inverse);
}

/* The logo's navy lettering would vanish on navy, so it sits on a plain milk-white plate. */
.site-footer__brand {
  justify-self: start;
  padding: var(--space-xs) var(--space-s);
  background-color: var(--surface);
  border-radius: var(--radius-card);
  line-height: 0;
}

.site-footer__logo {
  inline-size: auto;
  block-size: var(--logo-height-footer);
  max-inline-size: 100%;
  object-fit: contain;
}

.site-footer__address {
  font-style: normal;
}

.site-footer__line {
  display: block;
}

.site-footer__line + .site-footer__line {
  margin-block-start: var(--space-3xs);
}

.site-footer__note {
  max-width: none;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-m);
}

.site-footer__copy {
  max-width: none;
  margin-block-start: var(--space-m);
  padding-block-start: var(--space-s);
  border-block-start: 1px solid var(--text-muted);
}

@media (min-width: 40em) {
  :root {
    --logo-height: 3.5rem;
    --header-height: 4.0875rem;
  }

  .site-header {
    column-gap: var(--space-s);
  }

  .site-header__brand {
    padding-block: var(--space-3xs);
  }

  .site-header__actions {
    gap: var(--space-2xs);
  }

  .site-header__actions .btn {
    padding-inline: var(--space-xs);
  }

  .site-header__label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .site-header__short {
    display: none;
  }

  .site-footer__inner {
    grid-template-columns: 3fr 2fr;
    /* The nav list is taller than the lines beside it; the address row takes the spare height, so the text stays together. */
    grid-template-rows: auto auto 1fr auto auto;
    align-items: start;
    grid-template-areas:
      "brand brand"
      "desc nav"
      "address nav"
      "copy copy"
      "note note";
    column-gap: var(--space-xl);
  }

  .site-footer__brand { grid-area: brand; }
  .site-footer__desc { grid-area: desc; }
  .site-footer__address { grid-area: address; }
  .site-footer__nav { grid-area: nav; }
  .site-footer__copy { grid-area: copy; }
  .site-footer__note { grid-area: note; }

  .site-footer__links {
    flex-direction: column;
  }
}

/* One-row header from 71em: below that the logo, seven links and two buttons can't keep 24px clear. */
@media (min-width: 71em) {
  :root {
    --header-offset: 5.5rem;
  }

  .site-header {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav actions";
    column-gap: var(--space-s);
  }

  /* A percentage cap inside this auto-sized column would collapse the logo. */
  .site-header__brand,
  .site-header__logo {
    max-inline-size: none;
  }

  .site-nav {
    margin-inline: 0;
    border-block-start: 0;
    overflow: visible;
  }

  .site-nav__list.site-nav__list {
    justify-content: center;
    padding-inline: 0;
    gap: var(--space-xs);
  }

  .site-header__actions .btn--plain .site-header__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (min-width: 64em) {
  :root {
    --logo-height: 4rem;
    --header-height: 4.625rem;
  }

  .site-footer__inner {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    align-items: start;
    grid-template-areas:
      "brand nav"
      "desc nav"
      "address nav"
      "copy copy"
      "note note";
  }
}

/* ---------- Header with JavaScript: menu button on small screens ---------- */
.site-nav__toggle {
  grid-area: toggle;
  min-height: 2.75rem;
  min-inline-size: 2.5rem;
  padding-inline: var(--space-2xs);
  font-size: var(--step-n1);
}

.site-nav__toggle[aria-expanded="true"] {
  background-color: var(--color-button);
  color: var(--color-button-text);
}

@media (min-width: 40em) {
  .site-nav__toggle {
    padding-inline: var(--space-xs);
  }
}

.site-nav a[aria-current="true"] {
  text-decoration-color: var(--accent-ink);
  text-decoration-thickness: 0.18em;
}

/* Only after JS has run: the swipe strip becomes a menu that opens from the button. */
@media (max-width: 70.99em) {
  .has-js .site-header {
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "brand actions toggle"
      "nav nav nav";
  }

  .has-js .site-nav {
    display: none;
    margin-inline: calc(-1 * var(--gutter));
    overflow: visible;
  }

  .has-js .site-header.is-open .site-nav {
    display: block;
  }

  .has-js .site-nav__list.site-nav__list {
    flex-direction: column;
    gap: 0;
    padding-block: var(--space-2xs) var(--space-s);
    white-space: normal;
  }

  .has-js .site-nav a {
    display: block;
    padding-block: var(--space-xs);
    border-block-end: var(--border-hair);
    font-size: var(--nav-size-menu);
  }
}

/* Once the page scrolls, the hairline under the header firms up. */
.site-header.is-stuck {
  border-block-end-color: var(--text);
}

.scroll-sentinel {
  position: absolute;
  inset-block-start: 0;
  block-size: 4rem;
  inline-size: 1px;
}

/* Generic two-column split used by several sections. Columns are set per section. */
.split {
  display: grid;
  gap: var(--space-xl);
}

@media (min-width: 64em) {
  .split {
    grid-template-columns: var(--split-cols, 1fr 1fr);
    align-items: var(--split-align, start);
    column-gap: var(--space-2xl);
  }
}

@media (min-width: 71em) {
  .site-nav__toggle {
    display: none;
  }
}

/* The one-row header is tight on smaller laptops, so the logo and link spacing give a little back. */
@media (min-width: 71em) and (max-width: 79.99em) {
  :root {
    --logo-height: 3.5rem;
    --header-height: 4.0875rem;
  }

  .site-nav__list.site-nav__list {
    gap: calc(var(--space-2xs) * 0.75);
  }
}
