/* =========================================================================
   GOSPOCCHIS — Site-level styles (built on tokens.css)
   ========================================================================= */

* { box-sizing: border-box; }

/* Eyebrows removed site-wide per user request.
   .hero__eyebrow (red-dot status pill on homepage) is a distinct component and stays. */
.eyebrow { display: none !important; }

/* =========================================================================
   GLOBAL FOCUS RINGS — keyboard-only, never swallowed
   ========================================================================= */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--g-red);
  outline-offset: 3px;
  border-radius: 2px;
  transition: outline-offset 140ms cubic-bezier(0.25, 1, 0.5, 1);
}
.g-btn:focus-visible,
.site-header__cta:focus-visible,
.theme-toggle:focus-visible,
.nav-menu-toggle:focus-visible {
  outline-offset: 4px;
}
a:focus-visible { outline-offset: 2px; }

/* =========================================================================
   UNIFIED DARK-WITH-RED AESTHETIC (default)
   The legacy tokens --g-white / --g-near-black / --g-black are remapped so
   every section — including ones originally designed as "white surfaces"
   (charter, manifesto, pullquote, comments) — renders on the same dark,
   red-ambient palette. Light mode flips to a warm cream palette; neither
   mode uses pure white or pure black.
   ========================================================================= */
:root,
:root[data-theme="dark"] {
  --g-white:        #110e0c;         /* was white surface → now dark surface */
  --g-near-black:   #fdfaf6;         /* body text — brightened warm near-white for readability */
  --g-black:        #0a0807;
  --g-surface-dark: #1a1513;
  --g-surface-light:#1a1513;
  --g-border:       rgba(255, 255, 255, 0.14);
  --g-gray-60:      rgba(255, 255, 255, 0.86);
  --g-gray-55:      rgba(255, 255, 255, 0.74);
  --g-gray-50:      rgba(255, 255, 255, 0.68);
  --red-ambient-1:  rgba(218, 41, 28, 0.18);
  --red-ambient-2:  rgba(218, 41, 28, 0.09);
}

html, body {
  background: var(--g-black);
  color: var(--g-near-black);
  overflow-x: hidden;
  transition: background 300ms ease, color 300ms ease;
}

/* Global ambient: red radial glows on every page, sits behind content. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 85% 12%, var(--red-ambient-1) 0%, transparent 62%),
    radial-gradient(ellipse 50% 50% at 10% 95%, var(--red-ambient-2) 0%, transparent 60%),
    radial-gradient(ellipse 70% 35% at 50% 60%, var(--red-ambient-2) 0%, transparent 72%);
}

/* Smooth scroll inside the page */
html { scroll-behavior: smooth; }

/* =========================================================================
   HEADER
   ========================================================================= */
.site-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 28px 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Nav always white regardless of theme — sits over dark page heroes. */
  color: #ffffff;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.site-header__brand svg { width: 28px; height: auto; display: block; }

.site-header__wordmark {
  font-family: var(--g-font-label);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  line-height: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.site-header__wordmark span:last-child {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 3.6px;
  color: inherit;
  opacity: 0.6;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 40px;
}

.site-nav a {
  font-family: var(--g-font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.6px;
  color: inherit;
  text-decoration: none;
  position: relative;
  padding: 8px 0;
  transition: color 160ms ease;
}

.site-nav a:hover { color: var(--g-red); }
.site-nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--g-red);
}

.site-header__cta {
  font-family: var(--g-font-sans);
  font-size: 12px;
  letter-spacing: 1.28px;
  padding: 11px 20px;
  border-radius: 2px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 160ms ease;
}
.site-header__cta:hover {
  background: var(--g-white);
  color: var(--g-black);
  border-color: var(--g-white);
}
.site-header.is-light .site-header__cta:hover {
  background: var(--g-black);
  color: var(--g-white);
}

/* =========================================================================
   BUTTONS (Gospocchis system)
   ========================================================================= */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--g-font-sans);
  font-size: 14px;
  letter-spacing: 1.28px;
  padding: 14px 26px;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 180ms ease;
  border: 1px solid transparent;
}

.g-btn--primary {
  background: var(--g-white);
  color: #000;
  border-color: var(--g-white);
}
.g-btn--primary:hover {
  background: var(--g-teal-hover);
  border-color: var(--g-teal-hover);
  color: var(--g-white);
  opacity: 0.9;
}

.g-btn--ghost {
  background: transparent;
  color: var(--g-white);
  border-color: var(--g-white);
}
.g-btn--ghost:hover {
  background: var(--g-white);
  color: var(--g-black);
}

.g-btn--red {
  background: var(--g-red);
  color: var(--g-white);
  border-color: var(--g-red);
}
.g-btn--red:hover {
  background: var(--g-red-90);
  border-color: var(--g-red-90);
}

.g-btn--dark {
  background: var(--g-black);
  color: var(--g-white);
  border-color: var(--g-black);
}
.g-btn--dark:hover {
  background: var(--g-teal-hover);
  border-color: var(--g-teal-hover);
}

.g-btn .arrow { font-size: 18px; line-height: 1; letter-spacing: 0; }

/* -------------------------------------------------------------------------
   Dark-mode button adjustments — keep everything readable with no dark text.
   The primary filled button becomes a pale glass pill; ghost-hover stays
   white-on-white-tint. CTA hover never flips to a dark-text state.
   ------------------------------------------------------------------------- */
:root[data-theme="dark"] .g-btn--primary {
  background: rgba(255, 255, 255, 0.92);
  color: #1a1513;
  border-color: rgba(255, 255, 255, 0.92);
}
:root[data-theme="dark"] .g-btn--primary:hover {
  background: #ffffff;
  color: #1a1513;
  border-color: #ffffff;
}
:root[data-theme="dark"] .g-btn--ghost {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
}
:root[data-theme="dark"] .g-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  border-color: #ffffff;
}
:root[data-theme="dark"] .g-btn--dark {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}
:root[data-theme="dark"] .g-btn--dark:hover {
  background: var(--g-red);
  color: #ffffff;
  border-color: var(--g-red);
}
:root[data-theme="dark"] .site-header__cta,
:root[data-theme="dark"] .site-header__cta:hover {
  color: #ffffff;
}
:root[data-theme="dark"] .site-header__cta:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
}
/* Nav link default color — white on home only; other pages inherit body color */
body[data-page="home"] .site-nav a { color: #ffffff; }
body:not([data-page="home"]) .site-nav a { color: var(--g-near-black); }

/* On the home page in dark mode, the entire site header renders pure white,
   with a subtle text-shadow + top scrim so the nav stays legible against the
   bright hero image. */
:root[data-theme="dark"] body[data-page="home"] .site-header,
:root[data-theme="dark"] body[data-page="home"] .site-header__brand,
:root[data-theme="dark"] body[data-page="home"] .site-header__wordmark,
:root[data-theme="dark"] body[data-page="home"] .site-header__wordmark span,
:root[data-theme="dark"] body[data-page="home"] .site-nav a,
:root[data-theme="dark"] body[data-page="home"] .site-header__cta,
:root[data-theme="dark"] body[data-page="home"] .theme-toggle,
:root[data-theme="dark"] body[data-page="home"] .nav-menu-toggle {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.55);
}
:root[data-theme="dark"] body[data-page="home"] .site-header {
  text-shadow: none; /* header itself holds no text; reset so children win */
}
:root[data-theme="dark"] body[data-page="home"] .site-header::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 140%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.25) 55%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}

/* Light-mode text colour for places that set inline "rgba(255,255,255,0.X)" —
   they're opaque white text meant for dark overlays. Leave as-is; the hero
   + page-hero areas remain dark in both modes. */

/* =========================================================================
   LABELS / EYEBROWS
   ========================================================================= */
.eyebrow {
  font-family: var(--g-font-label);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--g-gray-50);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow--on-dark { color: rgba(255,255,255,0.6); }
.eyebrow--red {
  color: var(--g-red);
  position: relative;
}
.eyebrow--red::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--g-red);
}

/* =========================================================================
   SECTION SCAFFOLD
   ========================================================================= */
.section {
  padding: 120px 56px;
  position: relative;
}
.section--black { background: var(--g-black); color: var(--g-near-black); }
.section--white { background: var(--g-white); color: var(--g-near-black); }
.section--dim   { background: var(--g-surface-dark); color: var(--g-near-black); }

.container { max-width: 1400px; margin: 0 auto; }
.container--narrow { max-width: 1120px; margin: 0 auto; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 48px;
  margin-bottom: 64px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.section-head p {
  max-width: 46ch;
  color: var(--g-gray-50);
  font-size: 15px;
  line-height: 1.6;
}
.section--white .section-head p { color: var(--g-gray-60); }

/* =========================================================================
   DISPLAY TYPOGRAPHY
   ========================================================================= */
.display {
  font-family: var(--g-font-sans);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.035em;
}
.display--xl { font-size: clamp(56px, 9vw, 128px); }
.display--italic { font-style: italic; font-weight: 400; }
.display--outline {
  -webkit-text-stroke: 1px currentColor;
  color: transparent;
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer {
  background: var(--g-black);
  color: var(--g-white);
  padding: 80px 56px 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 48px;
  max-width: 1400px;
  margin: 0 auto 56px;
}
.site-footer h4 {
  font-family: var(--g-font-label);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--g-gray-60);
  margin-bottom: 20px;
  font-weight: 500;
}
.site-footer a {
  display: block;
  color: var(--g-near-black);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
  transition: color 160ms ease, transform 200ms cubic-bezier(0.25,1,0.5,1);
}
.site-footer a:hover { transform: translateX(3px); }
.site-footer a:hover { color: var(--g-red); }
.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 32px;
  border-top: 1px solid var(--g-border);
  font-size: 12px;
  color: var(--g-gray-60);
  font-family: var(--g-font-label);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* =========================================================================
   FADE-IN REVEAL
   ========================================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
/* =========================================================================
   MOBILE NAV DRAWER
   ========================================================================= */
.nav-menu-toggle {
  display: none;
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 40px; height: 40px;
  padding: 8px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  color: inherit;
}
.nav-menu-toggle span {
  display: block;
  height: 1.5px; width: 100%;
  background: currentColor;
  transition: transform 240ms cubic-bezier(0.25,1,0.5,1), opacity 160ms ease;
  transform-origin: center;
}
.nav-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--g-black);
  color: var(--g-near-black);
  border-left: 1px solid var(--g-border);
  z-index: 60;
  padding: 92px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: translateX(100%);
  transition: transform 360ms cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
  visibility: hidden;
}
.mobile-nav.is-open {
  transform: translateX(0);
  pointer-events: auto;
  visibility: visible;
  box-shadow: -40px 0 80px rgba(0,0,0,0.6);
}
.mobile-nav a {
  font-family: var(--g-font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--g-near-black);
  padding: 16px 0;
  border-bottom: 1px solid var(--g-border);
  text-decoration: none;
  transition: color 160ms ease, padding-left 200ms cubic-bezier(0.25,1,0.5,1);
}
.mobile-nav a:hover, .mobile-nav a:focus-visible { color: var(--g-red); padding-left: 6px; }
.mobile-nav a[aria-current="page"] { color: var(--g-red); }
.mobile-nav__cta {
  margin-top: 20px;
  background: var(--g-red) !important;
  color: #fff !important;
  text-align: center;
  padding: 15px !important;
  border: none !important;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 13px !important;
  font-weight: 600 !important;
}
body.nav-open { overflow: hidden; }
body.nav-open::after {
  content: '';
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 55;
  backdrop-filter: blur(4px);
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 900px) {
  .section { padding: 72px 20px; }
  .site-header { padding: 16px 20px; gap: 8px; }
  .site-nav { display: none; }
  .site-header__wordmark { font-size: 12px; letter-spacing: 2px; }
  .site-header__wordmark span:last-child { display: none; }
  .site-header__cta { display: none; }
  .theme-toggle {
    margin-left: auto; margin-right: 4px;
    width: 44px; height: 44px;
  }
  .theme-toggle svg { width: 18px; height: 18px; }
  .nav-menu-toggle { display: flex; width: 44px; height: 44px; }
  .site-footer { padding: 56px 20px 24px; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .site-footer__bottom { flex-direction: column; gap: 12px; text-align: center; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 24px; margin-bottom: 40px; }
  .g-btn { padding: 14px 22px; font-size: 13px; min-height: 44px; }
  h1, .g-h1 { font-size: clamp(40px, 11vw, 64px); }
  .display--xl { font-size: clamp(44px, 12vw, 80px); }
}
@media (max-width: 520px) {
  .section { padding: 56px 16px; }
  .site-header { padding: 14px 16px; }
  .site-footer { padding: 48px 16px 20px; }
  .site-footer__grid { grid-template-columns: 1fr; gap: 24px; }
}

/* =========================================================================
   MOTION SYSTEM — easing tokens + interaction feedback
   ========================================================================= */
:root {
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
}

/* Button press — subtle depress, faster than the hover transition */
.g-btn {
  will-change: transform;
}
.g-btn:active {
  transform: scale(0.975);
  transition: transform 120ms var(--ease-out-quart), background 120ms ease;
}
.site-header__cta:active { transform: scale(0.975); }

/* Nav link underline — ink grows from left on hover */
.site-nav a::before {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  height: 1px;
  width: 100%;
  background: var(--g-red);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 320ms var(--ease-out-quart);
}
.site-nav a:hover::before { transform: scaleX(1); }
.site-nav a[aria-current="page"]::before { transform: scaleX(1); }
/* Hide the original after-pseudo underline — we replaced it with ::before */
.site-nav a[aria-current="page"]::after { display: none; }

/* Footer link inkwash */
.site-footer a {
  position: relative;
  transition: color 200ms var(--ease-out-quart), transform 200ms var(--ease-out-quart);
}
.site-footer a:hover { transform: translateX(3px); }

/* =========================================================================
   HERO ENTRANCE — staggered reveal on page load
   ========================================================================= */
@keyframes heroRise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroSpecSlide {
  from { opacity: 0; transform: translateY(24px) translateX(0); }
  to   { opacity: 1; transform: translateY(0) translateX(0); }
}
@keyframes heroDotsGrow {
  from { opacity: 0; transform: scaleY(0); }
  to   { opacity: 1; transform: scaleY(1); }
}

.hero .hero__eyebrow,
.hero .hero__title,
.hero .hero__sub,
.hero .hero__actions,
.hero .hero__kpi {
  opacity: 0;
  animation: heroRise 900ms var(--ease-out-quint) forwards;
}
.hero .hero__eyebrow { animation-delay: 120ms; }
.hero .hero__title   { animation-delay: 260ms; }
.hero .hero__sub     { animation-delay: 440ms; }
.hero .hero__actions { animation-delay: 600ms; }
.hero .hero__kpi     { animation-delay: 900ms; }

.hero__spec {
  opacity: 0;
  animation: heroSpecSlide 1000ms var(--ease-out-expo) 780ms forwards;
  /* Override [data-reveal] inline behaviour so the delayed animation wins */
  transition: none;
}
.hero__spec.is-visible { opacity: 1; }

.hero__dots {
  transform-origin: top center;
  animation: heroDotsGrow 700ms var(--ease-out-quart) 1100ms both;
}

/* Giant wordmark + car fade up as the ambient layer */
.hero__giant {
  opacity: 0;
  animation: heroRise 1400ms var(--ease-out-quart) 200ms forwards;
}
.hero__car {
  opacity: 0;
  animation: heroRise 1800ms var(--ease-out-expo) 300ms forwards;
}

/* =========================================================================
   REDUCED MOTION — strip non-essential animation for 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;
  }
  .hero .hero__eyebrow,
  .hero .hero__title,
  .hero .hero__sub,
  .hero .hero__actions,
  .hero .hero__kpi,
  .hero__spec,
  .hero__giant,
  .hero__car { opacity: 1 !important; transform: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* Home page: header stays white — hero image is always dark. */
body[data-page="home"] .site-header,
body[data-page="home"] .site-header__brand,
body[data-page="home"] .site-header__wordmark,
body[data-page="home"] .site-header__wordmark span,
body[data-page="home"] .site-nav a,
body[data-page="home"] .site-header__cta,
body[data-page="home"] .nav-menu-toggle { color: #ffffff; }

/* Mirror override for DARK mode: same sections use var(--g-white) which
   evaluates to near-black (#110e0c) here — force bright white instead. */
:root[data-theme="dark"] .page-hero,
:root[data-theme="dark"] .dispatch,
:root[data-theme="dark"] .dispatch-hero,
:root[data-theme="dark"] .manifesto,
:root[data-theme="dark"] .charter,
:root[data-theme="dark"] .heritage,
:root[data-theme="dark"] .pullquote,
:root[data-theme="dark"] .team,
:root[data-theme="dark"] .compose,
:root[data-theme="dark"] .members-hero,
:root[data-theme="dark"] .membership-cta,
:root[data-theme="dark"] .calendar,
:root .page-hero,
:root .dispatch,
:root .dispatch-hero,
:root .manifesto,
:root .charter,
:root .heritage,
:root .pullquote,
:root .team,
:root .compose,
:root .members-hero,
:root .membership-cta,
:root .calendar {
  color: #fff;
}
:root[data-theme="dark"] .page-hero *,
:root[data-theme="dark"] .dispatch *,
:root[data-theme="dark"] .dispatch-hero *,
:root[data-theme="dark"] .manifesto *,
:root[data-theme="dark"] .charter *,
:root[data-theme="dark"] .heritage *,
:root[data-theme="dark"] .pullquote *,
:root[data-theme="dark"] .team *,
:root[data-theme="dark"] .compose *,
:root[data-theme="dark"] .members-hero *,
:root[data-theme="dark"] .membership-cta *,
:root[data-theme="dark"] .calendar * {
  color: inherit;
}
:root[data-theme="dark"] .g-on-dark,
:root[data-theme="dark"] .g-on-dark a,
:root .g-on-dark,
:root .g-on-dark a { color: #fff; }
