/* ==========================================================================
   Site chrome: loader, header, fullscreen menu, footer
   ========================================================================== */

/* ---- Loader ---------------------------------------------------------- */

/* Only shown when scripting is available — nothing else can lift it. */
.loader { display: none; }

.js .loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: clip-path var(--dur-slow) var(--ease-in-out);
  clip-path: inset(0 0 0 0);
}

.loader__mark {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  text-indent: 0.5em;
  opacity: 0;
  transform: translateY(0.4em);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}

.is-loading .loader__mark { opacity: 1; transform: translateY(0); }

.is-loaded .loader {
  clip-path: inset(0 0 100% 0);
  pointer-events: none;
}
.is-loaded .loader__mark { opacity: 0; transition-duration: 380ms; }

/* ---- Header ----------------------------------------------------------
   The /v1 nav. Two states, not three: transparent while it sits over the
   top of the hero, veiled with a hairline once the page moves. /v1 flipped
   at 70vh and this flips at 40px — the same idea, read sooner.
   -------------------------------------------------------------------- */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  display: flex;
  align-items: center;
  /* Declared transparent rather than added with the veil, so the border
     does not shift the header's height the first time it appears. */
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}

/* w2 retracted the header on the way down; /v1's is always there. The class
   is still set by chrome.js — this is what makes it inert. */
.header--hidden { transform: none; }

.header--veiled {
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line-gold-soft);
}

.header__inner {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 0.8rem + 0.55vw, 1.35rem);
  font-weight: 300;
  /* Letter-spacing pads the right of the last glyph but not the left of the
     first, so the same value as text-indent recentres the word. */
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 0.2rem + 2.6vw, 2rem);
  font-size: var(--text-sm);
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.header__nav a {
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}

.header__nav a:hover,
.header__nav a[aria-current="page"] { color: var(--ink); }

.header__cta {
  flex: none;
  padding: 0.7em 1.5em;
  border: 1px solid color-mix(in srgb, var(--ink) 70%, transparent);
  border-radius: 999px;
  font-size: var(--text-sm);
  letter-spacing: 0.09em;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.header__cta:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--veil);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 0.3rem + 1vw, 1.5rem);
}

/* Four things do not fit a phone. The links and the pill both give way and
   the toggle stays, because everything they reach is inside the overlay. */
@media (max-width: 48rem) {
  .header__nav,
  .header__cta { display: none; }
}

.menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75em 1.35em;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: border-color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.menu-toggle:hover { border-color: var(--ink); background: var(--veil); }

.menu-toggle__bars {
  position: relative;
  width: 14px;
  height: 8px;
  flex: none;
}

.menu-toggle__bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
}
.menu-toggle__bars span:first-child { top: 0; }
.menu-toggle__bars span:last-child { bottom: 0; }

/* ---- Fullscreen menu --------------------------------------------------
   Above the header and opaque, so the header is painted over while it is
   open. The overlay therefore carries its own bar and its own way out.
   -------------------------------------------------------------------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  background: var(--ink);
  color: var(--veil);
  /* Nothing above the bar: .menu__bar is exactly one header tall, which is
     what keeps the wordmark from jumping as the overlay opens. */
  padding: 0 var(--gutter) var(--gutter);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2rem;
  clip-path: inset(0 0 100% 0);
  transition: clip-path var(--dur-slow) var(--ease-in-out);
  visibility: hidden;
  /* Last resort only. The cap on .menu__link is what normally keeps the set
     on screen; this catches the shapes it cannot, such as a phone held
     sideways, rather than clipping links away silently. */
  overflow-y: auto;
  overscroll-behavior: contain;
}

.is-menu-open .menu {
  clip-path: inset(0 0 0 0);
  visibility: visible;
}

/* The page behind the overlay is locked in CSS, not by a custom scroller. */
.is-menu-open { overflow: hidden; }

/* Mirrors .header__inner, so the overlay's wordmark lands on the header's
   at any width rather than only below --max. */
.menu__bar,
.menu__nav,
.menu__foot {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
}

.menu__bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.menu__close {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75em 1.35em;
  border: 1px solid rgba(251, 250, 248, 0.32);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: border-color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.menu__close:hover {
  border-color: var(--veil);
  background: rgba(251, 250, 248, 0.1);
}

.menu__close-x {
  position: relative;
  width: 13px;
  height: 13px;
  flex: none;
}

.menu__close-x span {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
}
.menu__close-x span:first-child { transform: rotate(45deg); }
.menu__close-x span:last-child { transform: rotate(-45deg); }

.menu__nav {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: clamp(0.1rem, 0.4vw, 0.5rem);
}

.menu__link {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  font-family: var(--font-display);
  /* The width clamp alone takes no account of how tall the window is, so a
     short one used to push the last link and the footer off screen. The svh
     cap keeps the set whole. Sized for the three links the overlay now
     carries: at a normal window height it does not bite and the width clamp
     governs, as the design intends. */
  font-size: min(clamp(2rem, 1rem + 5.5vw, 5.5rem), 11svh);
  font-weight: 300;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(0.35em);
  transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 55ms);
}

.is-menu-open .menu__link { opacity: 1; transform: translateY(0); }
.menu__link:hover { color: var(--gold-lit); }

.menu__link .idx {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  color: var(--gold-lit);
  flex: none;
}

.menu__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-gold-lit);
  color: rgba(251, 250, 248, 0.7);
  font-size: var(--text-sm);
}

.menu__foot a:hover { color: var(--veil); }

/* ---- Footer ----------------------------------------------------------- */

.footer {
  background: var(--ink);
  color: rgba(251, 250, 248, 0.7);
  padding-block: clamp(3.5rem, 2rem + 6vw, 8rem) 2.5rem;
}

.footer a { color: var(--veil); }
.footer a:hover { color: var(--gold-lit); }

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: clamp(2rem, 1rem + 3vw, 4rem);
  padding-bottom: clamp(2.5rem, 1.5rem + 4vw, 6rem);
}

.footer__brand { grid-column: 1 / -1; }

@media (min-width: 60rem) {
  .footer__brand { grid-column: span 2; }
}

.footer__wordmark {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 1.2rem + 3.6vw, 4.5rem);
  font-weight: 300;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--veil);
  line-height: 1;
}

.footer__col h3 {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-lit);
  margin-bottom: 1.2rem;
}

.footer__col ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  font-size: var(--text-sm);
}

.footer__base {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--line-gold-lit);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: rgba(251, 250, 248, 0.5);
}
