/* ==========================================================================
   Shell — header, drawer, footer chrome. Above the fold, render-blocking.
   ========================================================================== */

/* The header carries its own ground at all times. Transparent-over-hero looked right in
   the spec and printed the nav on top of the eyebrow and the H1 in practice, at every
   width — the hero simply does not have 64px of empty space to lend it. */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--surface-page);
  view-transition-name: header;
  transition: background var(--dur-tick) var(--ease-slide),
              transform var(--dur-fast) var(--ease-exit);
}

/* Flat over the hero, paper once the scrub is behind us. */
.header.is-solid { box-shadow: var(--shadow-card); }

.header.is-hidden { transform: translateY(-100%); }

.header:not(.is-hidden) { transition-timing-function: var(--ease-settle); transition-duration: var(--dur-base); }

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  height: var(--header-h);
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.header__datum {
  position: relative;
  z-index: var(--z-raised);
  display: block;
  height: var(--border-width-rule);
  background: var(--accent);
  transform-origin: left center;
  view-transition-name: datum;
}

.header__mark {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  flex: 0 0 auto;
}

.header__mark-word {
  font-family: var(--font-display);
  font-stretch: var(--font-stretch-display);
  font-weight: var(--weight-display);
  font-size: var(--text-h4);
  letter-spacing: var(--track-label);
}

/* The mark is a dimension string, not a dash: the rule runs out of the word, a tick
   stands at its midpoint and a cap closes it. Same figure as the favicon, same figure
   as the dimension strings pinned across the page. */
.header__mark-rule {
  position: relative;
  width: var(--space-2xl);
  height: var(--border-width-rule);
  background: var(--accent);
}

.header__mark-rule::before,
.header__mark-rule::after {
  content: "";
  position: absolute;
  width: var(--border-width-rule);
  background: var(--accent);
}

/* the midpoint tick stands taller than the closing cap */
.header__mark-rule::before {
  left: 50%;
  inset-block: calc(-1 * var(--space-2xs));
}

.header__mark-rule::after {
  right: 0;
  inset-block: calc(-1 * var(--space-2xs) + var(--border-width-hair));
}

.header__mark-sub {
  grid-column: 1 / -1;
  font-family: var(--font-data);
  font-size: var(--text-label);
  font-weight: var(--weight-data-light);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.header__nav { flex: 1 1 auto; align-self: stretch; }

/* No script means no drawer, and below 900px the list is hidden: that left a phone with
   no navigation at all above the footer. The burger cannot do anything without JS, so it
   goes, and the list returns as a wrapping row. */
.no-js .header__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  height: auto;
  gap: var(--space-md);
}

.no-js .header__burger { display: none; }

/* The wrapped list makes the header tall. Sticky at that height would eat a quarter of a
   phone screen for the whole page, so without script the header scrolls away. */
.no-js .header { position: static; }

.no-js .header__inner {
  height: auto;
  flex-wrap: wrap;
  padding-block: var(--space-sm);
}

.header__list {
  display: none;
  align-items: stretch;
  height: 100%;
  gap: var(--space-lg);
}

/* The row, not the baseline, is what the disclosure has to centre on — and the item has
   to be the full height of the header so that 100% is the datum rule and not the bottom
   of a link box floating in the middle of it. */
.header__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
}

.header__link,
.header__sublink {
  display: inline-block;
  padding-block: var(--space-xs);
  font-family: var(--font-data);
  font-size: var(--text-data);
  text-decoration: none;
  color: var(--text-secondary);
}

.header__link:hover,
.header__link--here,
.header__link[aria-current="page"] { color: var(--text-primary); }

.header__disc {
  padding: var(--space-2xs);
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
}

/* The panel hangs from the datum line, not from the header box: it starts below the
   2px rule, is pinned to its own item, and carries a top edge in the accent so it reads
   as an extension of the rule rather than a card that happened to land there. */
.header__sub {
  position: absolute;
  top: calc(100% + var(--border-width-rule));
  left: calc(-1 * var(--space-md));
  min-width: 260px;
  padding: var(--space-md);
  background: var(--surface-raised);
  border: var(--border-hairline);
  border-top: var(--border-datum);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  box-shadow: var(--shadow-card-lift);
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(-1 * var(--space-2xs)));
  transition: opacity var(--dur-fast) var(--ease-settle),
              transform var(--dur-fast) var(--ease-settle),
              visibility var(--dur-fast) var(--ease-settle);
}

.header__item:hover .header__sub,
.header__item:focus-within .header__sub {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.header__sublink-idx {
  margin-right: var(--space-xs);
  color: var(--text-accent);
}

.header__end {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-left: auto;
  flex: 0 0 auto;
}

.header__tel {
  display: none;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-data);
  font-size: var(--text-data);
  text-decoration: none;
  color: var(--text-secondary);
}
.header__tel:hover { color: var(--text-accent); }

.header__cta { display: none; }

.header__burger {
  display: inline-flex;
  padding: var(--space-xs);
  background: none;
  border: var(--border-hairline);
  border-radius: var(--radius-control);
  cursor: pointer;
}

@media (min-width: 900px) {
  .header__list { display: flex; }
  .header__tel { display: inline-flex; }
  .header__cta { display: inline-flex; }
  .header__burger { display: none; }
}

/* ---- drawer --------------------------------------------------------------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--scrim);
}

.drawer__panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  width: min(420px, 88vw);
  height: 100%;
  margin-left: auto;
  padding: var(--space-lg);
  background: var(--surface-page);
  overflow-y: auto;
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-md);
  border-bottom: var(--border-datum);
}

.drawer__label {
  font-family: var(--font-data);
  font-size: var(--text-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

.drawer__close {
  padding: var(--space-xs);
  background: none;
  border: var(--border-hairline);
  border-radius: var(--radius-control);
  cursor: pointer;
}

.drawer__list { display: grid; gap: var(--space-md); }

.drawer__row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.drawer__link {
  font-family: var(--font-display);
  font-stretch: var(--font-stretch-display);
  font-size: var(--text-h4);
  text-decoration: none;
}

.drawer__disc {
  display: inline-flex;
  padding: var(--space-2xs);
  color: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease-exit);
}

.drawer__item[data-open="true"] .drawer__disc { transform: rotate(45deg); }

.drawer__sublink--all { color: var(--text-primary); }

.drawer__sub {
  display: grid;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  padding-left: var(--space-md);
  border-left: var(--border-hairline);
}

.drawer__item[data-open="false"] .drawer__sub { display: none; }

.drawer__sublink {
  font-family: var(--font-data);
  font-size: var(--text-data);
  text-decoration: none;
  color: var(--text-secondary);
}

.drawer__sublink-idx { margin-right: var(--space-xs); color: var(--text-accent); }

.drawer__foot { margin-top: auto; display: grid; gap: var(--space-md); }

.drawer__tel {
  font-family: var(--font-data);
  font-size: var(--text-data);
  text-align: center;
  text-decoration: none;
}

@media (min-width: 900px) {
  .drawer { display: none; }
}
