/* ==========================================================================
   layout.css — containers, the single section utility, page chrome
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container and section rhythm

   Vertical spacing lives here and only here. Section variants change colour,
   never padding, so nothing has to out-specify anything else.
   -------------------------------------------------------------------------- */

/* max() with the safe-area insets keeps content clear of a notch in landscape
   without adding padding on every other device. */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px))
    max(var(--gutter), env(safe-area-inset-right, 0px));
}

.container--narrow {
  max-width: 880px;
}

.container--wide {
  max-width: 1480px;
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: calc(var(--section-y) * 0.6);
}

.section--flush-top {
  padding-block-start: 0;
}

.section--flush-bottom {
  padding-block-end: 0;
}

.section--dark {
  background: var(--stillwater);
}

.section--paper {
  background: var(--paper);
}

/* Section head: eyebrow, heading, optional lead and trailing link. */
.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-block-end: var(--sp-6);
}

.section-head__title {
  max-width: 20ch;
}

.section-head__lead {
  max-width: 52ch;
}

.section-head__aside {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* --------------------------------------------------------------------------
   Generic layout primitives
   -------------------------------------------------------------------------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.stack--sm {
  gap: var(--sp-2);
}

.stack--lg {
  gap: var(--sp-6);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.grid {
  display: grid;
  gap: var(--sp-4);
}

/* The site's one repeating card rhythm: 1 column, 2 from 480, 4 from 1024. */
.grid-4 {
  display: grid;
  gap: var(--sp-3);
}

.split {
  display: grid;
  gap: var(--sp-6);
}

/* --------------------------------------------------------------------------
   Topbar — hidden on phones, its contents move into the drawer
   -------------------------------------------------------------------------- */

/* The topbar lives inside the sticky header, so "hides on scroll down" means
   collapsing its height to zero — the header itself never leaves the top. */
.topbar {
  display: none;
  overflow: hidden;
  height: var(--topbar-h);
  background: var(--stillwater);
  color: rgb(var(--mineral-rgb) / 0.86);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  transition: height var(--t-micro) var(--ease);
}

.topbar.is-hidden {
  height: 0;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  height: var(--topbar-h);
}

.topbar__list {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.topbar__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar__item .icon {
  width: 1rem;
  height: 1rem;
  color: var(--sandalwood);
}

/* Phone and email earn their place in the topbar at 768px; the opening hours
   only fit once there is desktop room for them. */
.topbar__item--hours {
  display: none;
}

/* The topbar is 44px tall, so the links can fill it and become 44px targets
   without changing how anything looks. */
.topbar__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  transition: color var(--t-micro) var(--ease);
}

/* The social links wrap a 16px icon and nothing else. Widening the box would
   spread the row out, so the target is grown with a pseudo-element instead —
   it costs no layout and the icons stay where the design puts them. */
.topbar__link:has(> .icon) {
  position: relative;
}

.topbar__link:has(> .icon)::after {
  content: '';
  position: absolute;
  inset: 50% 50% auto auto;
  width: 44px;
  height: 44px;
  transform: translate(50%, -50%);
}

.topbar__link:hover {
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

/* Deliberately no backdrop-filter.
   A blurred sticky header has to re-composite the blur on every scrolled
   frame, which was the single largest source of scroll jank on this page. The
   page background is --mineral anyway, so an opaque header is visually
   equivalent almost everywhere and costs nothing to scroll past. */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--mineral);
  border-block-end: 1px solid transparent;
  transition: border-color var(--t-micro) var(--ease),
    box-shadow var(--t-micro) var(--ease);
}

.header.is-stuck {
  border-block-end-color: var(--rule);
  box-shadow: 0 1px 24px rgb(var(--ink-rgb) / 0.05);
}

/* --------------------------------------------------------------------------
   Overlay header

   Every page except the 404 opens with a dark band — the hero, or a breadcrumb
   banner. The header sits transparently on top of it in light type, then turns
   solid the moment you scroll. Without this it would cut a pale horizontal
   line across the top of the design.
   -------------------------------------------------------------------------- */

.header--overlay:not(.is-stuck) {
  background: transparent;
  box-shadow: none;
}

.header--overlay:not(.is-stuck) .wordmark {
  color: var(--mineral);
}

.header--overlay:not(.is-stuck) .wordmark__tag {
  color: rgb(var(--mineral-rgb) / 0.6);
}

.header--overlay:not(.is-stuck) .nav__link {
  color: rgb(var(--mineral-rgb) / 0.82);
}

.header--overlay:not(.is-stuck) .nav__link:hover,
.header--overlay:not(.is-stuck) .nav__link[aria-current='page'] {
  color: var(--mineral);
}

.header--overlay:not(.is-stuck) .burger {
  color: var(--mineral);
}

/* The bands that sit underneath the overlay header carry its height
   themselves, so nothing is hidden behind it. */
.under-header {
  margin-block-start: calc((var(--header-h) + var(--topbar-h)) * -1);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: var(--header-h);
}

/* Wordmark — renders as text whenever the logo file is absent. */
/* Padding cancelled by an equal negative margin: the link becomes a 46px tap
   target in the header and the footer while occupying exactly the same box. */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  padding-block: 0.6875rem;
  margin-block: -0.6875rem;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--stillwater);
}

.wordmark__mark {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border: 1.5px solid var(--sandalwood);
  border-radius: 50%;
  transform: translateY(-0.1em);
}

.wordmark__img {
  height: 34px;
  width: auto;
}

.wordmark__tag {
  display: none;
  font-family: var(--font-body);
  /* 11px was below the 12px floor the rest of the site keeps to. */
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.on-dark .wordmark {
  color: var(--mineral);
}

/* Desktop nav is hidden on phones; the drawer carries it instead. */
.nav {
  display: none;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.nav__link {
  position: relative;
  display: inline-block;
  /* 0.5rem left these 41px tall; 1024px is tablet territory, so they need 44. */
  padding-block: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--fg);
  transition: color var(--t-micro) var(--ease);
}

.nav__link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0.15rem;
  width: 100%;
  height: 1.5px;
  background: var(--sandalwood);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-micro) var(--ease);
}

.nav__link:hover::after,
.nav__link:focus-visible::after,
.nav__link[aria-current='page']::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__link[aria-current='page'] {
  color: var(--stillwater);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* The header CTA moves into the drawer on phones.

   Qualified with .btn deliberately. components.css loads after this file and
   sets `.btn { display: inline-flex }`; at equal specificity the later rule
   won, so the CTA rendered on phones and pushed the burger off the right edge
   of every page. The ≥1024 rule that brings it back is qualified to match. */
.header__cta.btn {
  display: none;
}

/* --------------------------------------------------------------------------
   Hamburger
   -------------------------------------------------------------------------- */

.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-inline-end: -0.5rem;
  border-radius: var(--r-sm);
  color: var(--stillwater);
}

.burger__box {
  position: relative;
  width: 22px;
  height: 14px;
}

.burger__bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--t-micro) var(--ease),
    opacity var(--t-micro) var(--ease);
}

.burger__bar:nth-child(1) {
  top: 0;
}

.burger__bar:nth-child(2) {
  top: 6.25px;
}

.burger__bar:nth-child(3) {
  top: 12.5px;
}

.burger[aria-expanded='true'] .burger__bar:nth-child(1) {
  transform: translateY(6.25px) rotate(45deg);
}

.burger[aria-expanded='true'] .burger__bar:nth-child(2) {
  opacity: 0;
}

.burger[aria-expanded='true'] .burger__bar:nth-child(3) {
  transform: translateY(-6.25px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Mobile drawer — full-screen panel from the right
   -------------------------------------------------------------------------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) - 1);
  background: rgb(var(--ink-rgb) / 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-micro) var(--ease),
    visibility var(--t-micro) var(--ease);
}

.drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: var(--z-drawer);
  width: min(100%, 30rem);
  display: flex;
  flex-direction: column;
  background: var(--stillwater);
  color: var(--mineral);
  padding: var(--sp-3) var(--gutter)
    calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--t-micro) var(--ease),
    visibility var(--t-micro) var(--ease);
}

.drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.drawer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  margin-block-end: var(--sp-5);
}

.drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-inline-end: -0.5rem;
  border-radius: var(--r-sm);
  color: var(--mineral);
}

.drawer__close .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.drawer__nav {
  display: flex;
  flex-direction: column;
  border-block-start: 1px solid rgb(var(--mineral-rgb) / 0.16);
}

.drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 60px;
  padding-block: var(--sp-2);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 300;
  border-block-end: 1px solid rgb(var(--mineral-rgb) / 0.16);
}

.drawer__link .icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--sandalwood);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--t-micro) var(--ease),
    transform var(--t-micro) var(--ease);
}

.drawer__link[aria-current='page'] .icon,
.drawer__link:hover .icon,
.drawer__link:focus-visible .icon {
  opacity: 1;
  transform: translateX(0);
}

.drawer__foot {
  margin-block-start: auto;
  padding-block-start: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.drawer__meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  color: rgb(var(--mineral-rgb) / 0.78);
}

.drawer__meta a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}

.drawer__meta .icon {
  width: 1rem;
  height: 1rem;
  color: var(--sandalwood);
}

/* Locks the page behind the drawer without losing scroll position. */
body.is-locked {
  overflow: hidden;
  touch-action: none;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  background: var(--stillwater);
  color: var(--mineral);
  padding-block-start: var(--section-y);
  padding-block-end: calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
}

.footer__grid {
  display: grid;
  gap: var(--sp-7);
}

.footer__col-title {
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sandalwood);
  margin-block-end: var(--sp-3);
}

.footer__blurb {
  max-width: 34ch;
  margin-block: var(--sp-3) var(--sp-4);
  color: rgb(var(--mineral-rgb) / 0.74);
  font-size: var(--fs-small);
}

.footer__links {
  display: grid;
  gap: 0.25rem;
}

.footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: rgb(var(--mineral-rgb) / 0.82);
  font-size: var(--fs-small);
  transition: color var(--t-micro) var(--ease),
    transform var(--t-micro) var(--ease);
}

.footer__links a:hover {
  color: var(--paper);
  transform: translateX(3px);
}

.footer__hours {
  display: grid;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  color: rgb(var(--mineral-rgb) / 0.82);
}

.footer__hours div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  justify-content: space-between;
  padding-block-end: var(--sp-2);
  border-block-end: 1px solid rgb(var(--mineral-rgb) / 0.14);
}

.footer__hours span:last-child {
  color: var(--mineral);
}

.footer__address {
  font-style: normal;
  font-size: var(--fs-small);
  color: rgb(var(--mineral-rgb) / 0.82);
  line-height: 1.8;
}

.footer__address a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 0.5rem;
  color: var(--mineral);
}

.footer__bottom {
  margin-block-start: var(--sp-7);
  padding-block-start: var(--sp-4);
  border-block-start: 1px solid rgb(var(--mineral-rgb) / 0.16);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  align-items: center;
  text-align: center;
  font-size: 0.875rem;
  color: rgb(var(--mineral-rgb) / 0.62);
}

.footer__legal {
  display: flex;
  gap: var(--sp-4);
}

.footer__legal a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  transition: color var(--t-micro) var(--ease);
}

.footer__legal a:hover {
  color: var(--mineral);
}
