@property --nav-height {
  syntax: "<length>";
  inherits: true;
  initial-value: 4.5rem;
}

:root {
  /* Typography */
  --font-display: "DM Serif Display", serif;
  --font-hero: "Cormorant Garamond", "DM Serif Display", serif;
  --font-sans: "DM Sans", sans-serif;

  /* Surfaces */
  --color-surface: #ffffff;
  --color-surface-secondary: #fafaf8;
  --color-surface-dark: #0d1117;

  /* Text */
  --color-ink: #1a1a1a;
  --color-ink-soft: #6b6b6b;
  --color-inverse: #f5f5f0;

  /* Functional */
  --color-border: rgba(0, 0, 0, 0.08);

  /* Rhythm */
  --hero-gutter: clamp(1.5rem, 3.5vw, 4.5rem);
  --shell-max: 120rem;
  --shell-gutter: var(--hero-gutter);
  --frame-max: 80rem;
  --frame-gutter: 2rem;
  --spacing-section: clamp(3.5rem, 5vw, 6rem);

  /* Header — single source of truth, synced with the Astro site. */
  --nav-height: 4.5rem;
  --nav-height-scrolled: 4rem;

  /* Easing */
  --ease-luxury: cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (min-width: 1024px) {
  :root {
    --nav-height: 5rem;
  }
}

/* When the page is scrolled, all elements keyed to --nav-height (header, sticky
   rails, etc.) collapse to the scrolled height so offsets stay in sync with
   the compressed 4rem header. */
body.scrolled {
  --nav-height: var(--nav-height-scrolled);
}

@media (prefers-reduced-motion: no-preference) {
  body {
    transition: --nav-height 0.35s var(--ease-luxury);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 300;
  color: var(--color-inverse);
  background-color: var(--color-surface-dark);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Remove the browser's default focus ring on mouse/touch clicks; keyboard
   navigation still gets a visible outline via :focus-visible (defined
   per-component where a custom focus style is needed). */
a:focus,
button:focus {
  outline: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Shared containers */
.frame {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding-inline: var(--frame-gutter);
}

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--shell-gutter);
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 0;
  color: var(--color-inverse);
  background-color: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.5s var(--ease-luxury),
    border-color 0.5s var(--ease-luxury);
}

/* Neutralize the opaque background the wp-block-group inherits from
   theme.json (styles.color.background) so the header is truly transparent
   at the top. Scoped to the non-scrolled state via :not() so the scrolled
   overlay below still wins. */
header.site-header.wp-block-group:not(.nav-scrolled) {
  background: transparent;
}

/* Scrolled state — translucent dark overlay + hairline border + backdrop blur.
   Height is driven by body.scrolled overriding --nav-height, so it stays
   synchronized with any sticky offsets. */
.site-header.nav-scrolled,
header.site-header.wp-block-group.nav-scrolled {
  background-color: rgba(13, 17, 23, 0.65);
  border-bottom-color: rgba(245, 245, 240, 0.08);
  backdrop-filter: blur(10px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 32px;
}

.site-logo {
  display: block;
  flex-shrink: 0;
  width: 148px;
}

@media (min-width: 640px) {
  .site-logo {
    width: 166px;
  }
}

.site-logo-image {
  display: block;
  width: 100%;
  height: auto;
}

/* Desktop nav wrapper (menu + CTA). Hidden below lg; the mobile overlay
   takes over there. Never aria-hidden — it's exposed to assistive tech. */
.nav-desktop {
  display: none;
  align-items: center;
  gap: 3rem;
}

@media (min-width: 1024px) {
  .nav-desktop {
    display: flex;
  }
}

/* Classic nav menu (rendered by wp_nav_menu) */
.cw-classic-nav__list {
  display: flex;
  align-items: center;
  gap: 48px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cw-classic-nav__list a {
  position: relative;
  display: inline-block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
  transition: opacity 0.3s var(--ease-luxury);
}

.cw-classic-nav__list a:hover,
.cw-classic-nav__list .current-menu-item a,
.cw-classic-nav__list .current_page_item a {
  opacity: 1;
}

.cw-classic-nav__list .current-menu-item a::after,
.cw-classic-nav__list .current_page_item a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
}

/* Vertical divider between nav and CTA */
.nav-rule {
  display: none;
  flex-shrink: 0;
  width: 1px;
  height: 14px;
  background: currentColor;
  opacity: 0.15;
}

@media (min-width: 1024px) {
  .nav-rule {
    display: block;
  }
}

/* Header CTA */
.nav-cta {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  border: 1px solid rgba(245, 245, 240, 0.3);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-inverse);
  background-color: transparent;
  transition: border-color 0.4s var(--ease-luxury),
    background-color 0.4s var(--ease-luxury);
}

.nav-cta:hover {
  border-color: rgba(245, 245, 240, 0.7);
  background-color: rgba(245, 245, 240, 0.07);
}

/* Mobile burger */
.nav-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-inverse);
  cursor: pointer;
}

@media (min-width: 1024px) {
  .nav-cta {
    display: inline-flex;
  }

  .nav-burger {
    display: none;
  }
}

.nav-burger span {
  display: block;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  opacity: 1;
  transition: transform 0.3s var(--ease-luxury), opacity 0.3s var(--ease-luxury);
}

.nav-burger.is-open {
  position: fixed;
  top: calc((var(--nav-height) - 32px) / 2);
  right: var(--frame-gutter);
  z-index: 70;
  color: var(--color-inverse);
}

/* When the overlay is open, lift the header's whole stacking context above
   .mobile-menu (both default to z-index 50, but the menu paints later in the
   DOM and would otherwise cover the burger). The burger's own z-index:70 is
   trapped inside the header's context, so the header itself must win. This
   also restores clicks on the close button. */
body.menu-open .site-header {
  z-index: 60;
}

.nav-burger.is-open span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.nav-burger.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-burger.is-open span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* =========================================================
   MOBILE MENU (full-screen overlay, ported from the prototype /
   MobileNav.tsx). A separate element from the desktop nav, toggled
   open by JS; aria-hidden by default and only exposed when open.
   ========================================================= */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 2.5rem;
  background: var(--color-surface-dark);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-luxury);
}

.mobile-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu__nav .cw-classic-nav__list {
  flex-direction: column;
  align-items: flex-start;
  gap: 2rem;
}

.mobile-menu__nav .cw-classic-nav__list a {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: none;
  color: var(--color-inverse);
  opacity: 1;
  transition: opacity 0.3s var(--ease-luxury);
}

.mobile-menu__nav .cw-classic-nav__list a:hover {
  opacity: 0.6;
}

/* Suppress the desktop underline indicator inside the overlay */
.mobile-menu__nav .cw-classic-nav__list .current-menu-item a::after,
.mobile-menu__nav .cw-classic-nav__list .current_page_item a::after {
  display: none;
}

.mobile-menu__contact {
  margin-top: 4rem;
}

.mobile-menu__contact a {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(245, 245, 240, 0.6);
  transition: color 0.22s var(--ease-luxury);
}

.mobile-menu__contact a:hover {
  color: var(--color-inverse);
}

.mobile-menu__credit {
  position: absolute;
  bottom: 2rem;
  left: 2.5rem;
  right: 2.5rem;
}

.mobile-menu__credit a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.5;
  transition: opacity 0.22s var(--ease-luxury);
}

.mobile-menu__credit a:hover {
  opacity: 0.85;
}

.mobile-menu__credit-phrase {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: rgba(245, 245, 240, 0.55);
}

.mobile-menu__credit-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(245, 245, 240, 0.75);
}

.mobile-menu__credit-logo {
  display: block;
  width: 0.85rem;
  height: auto;
  filter: grayscale(1) brightness(1.75) opacity(0.62);
  transition: filter 220ms ease;
}

.mobile-menu__credit a:hover .mobile-menu__credit-logo,
.mobile-menu__credit a:focus-visible .mobile-menu__credit-logo {
  filter: grayscale(1) brightness(2) opacity(0.92);
}

body.menu-open {
  overflow: hidden;
}

/* =========================================================
   FOOTER
   ========================================================= */
/* Neutralize the block-gap margin WordPress/TT5 injects before the
   top-level <main> and <footer> groups, so sections sit flush exactly
   like the prototype (where the footer is a direct child of <body>). */
.wp-block-group.site-main,
.wp-block-group.site-footer {
  margin-block: 0;
}

.site-footer {
  color: var(--color-inverse);
  background-color: var(--color-surface-dark);
  border-top: 1px solid rgba(245, 245, 240, 0.08);
  padding: 5rem 2rem 2.5rem;
}

/* On blog surfaces the CTA band sits directly above the footer and
   already draws the dividing hairline; the footer's own border would
   double it (the prototype shows a single line). Drop the footer border
   right after a blog main. Non-blog pages keep the footer border. */
.site-main.blog-archive + .site-footer,
.site-main.blog-single + .site-footer {
  border-top: 0;
}

.site-footer__inner {
  max-width: 1280px;
  margin-inline: auto;
}

.site-footer__top {
  display: grid;
  gap: 3rem;
  padding-bottom: 3rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(245, 245, 240, 0.1);
}

@media (min-width: 768px) {
  .site-footer__top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
  }
}

.site-footer__logo {
  display: inline-block;
  width: 140px;
  margin-bottom: 1.25rem;
  transition: opacity 0.22s var(--ease-luxury);
}

.site-footer__logo:hover {
  opacity: 0.7;
}

.site-footer__logo img {
  width: 100%;
  height: auto;
}

.site-footer__brand p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.625;
  color: rgba(245, 245, 240, 0.6);
  max-width: 20rem;
}

/* Footer navigation */
.site-footer__nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-footer__nav .cw-classic-nav__list {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.site-footer__nav .cw-classic-nav__list a,
.site-footer__contact a {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(245, 245, 240, 0.6);
  transition: color 0.22s var(--ease-luxury);
}

.site-footer__nav .cw-classic-nav__list a:hover,
.site-footer__contact a:hover,
.site-footer__nav .cw-classic-nav__list .current-menu-item a,
.site-footer__nav .cw-classic-nav__list .current_page_item a {
  color: var(--color-inverse);
}

/* Footer contact */
.site-footer__contact {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.site-footer__contact p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1.625;
  color: rgba(245, 245, 240, 0.4);
}

.footer-cta {
  display: inline-flex;
  width: fit-content;
  margin-top: 0.5rem;
  padding: 0.55rem 1.25rem;
  border: 1px solid rgba(245, 245, 240, 0.3);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(245, 245, 240, 0.8);
  transition: border-color 0.4s var(--ease-luxury),
    background-color 0.4s var(--ease-luxury);
}

.footer-cta:hover {
  border-color: rgba(245, 245, 240, 0.7);
  background-color: rgba(245, 245, 240, 0.07);
}

/* Footer bottom */
.site-footer__bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: rgba(245, 245, 240, 0.28);
}

@media (min-width: 640px) {
  .site-footer__bottom {
    flex-direction: row;
    align-items: center;
  }
}

.site-footer__bottom p {
  margin: 0;
}

/* Misterfront credit — always visible, not configurable. Animated
   character reveal ported 1:1 from the prototype (wp/prototype). */
.site-footer__credit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  color: rgba(245, 245, 240, 0.58);
}

.mf-phrase {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
}

.mf-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  color: rgba(245, 245, 240, 0.66);
  transition: color 220ms ease;
}

.mf-link:hover,
.mf-link:focus-visible {
  color: rgba(245, 245, 240, 0.92);
}

.mf-text {
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

.mf-char {
  display: inline-block;
}

/* Only hide for the entrance animation when JS is present (and will
   reveal them). Without JS the characters stay fully visible. */
.js .mf-char {
  opacity: 0;
  transform: translateY(8px) scale(0.95);
}

.mf-logo-full {
  display: block;
  width: 16px;
  height: auto;
  filter: grayscale(1) brightness(1.75) opacity(0.62);
  transition: filter 220ms ease;
}

.js .mf-logo-full {
  opacity: 0;
  transform: translateY(8px) scale(0.95);
}

.mf-link:hover .mf-logo-full,
.mf-link:focus-visible .mf-logo-full {
  filter: grayscale(1) brightness(2) opacity(0.92);
}

@keyframes mfRevealChar {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.js .site-footer__credit.reveal.is-visible .mf-char {
  animation: mfRevealChar 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) var(--mf-delay) forwards;
}

.js .site-footer__credit.reveal.is-visible .mf-logo-full {
  animation: mfRevealChar 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.62s forwards;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* The credit must not stay in its hidden pre-animation state when motion
     is reduced; force it visible regardless of the observer. */
  .js .mf-char,
  .js .mf-logo-full {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Focus visible */
a:focus-visible,
button:focus-visible,
.cw-classic-nav__list a:focus-visible {
  outline: 2px solid rgba(245, 245, 240, 0.8);
  outline-offset: 3px;
}
