/*
Theme Name: The Prestige Group
Theme URI: https://theprestigegroup.com
Author: The Prestige Group
Author URI: https://theprestigegroup.com
Description: A bespoke "Obsidian Luxury" theme for The Prestige Group — Licensing Agent & Strategic Partner positioning. One-page conversion architecture with glassmorphism UI, Cyber-Teal accents, and mobile-first above-the-fold density. Built for VPs of Licensing and IP owners. v3.7 reimagines the Legacy Wall as a flip-clock partner display: three split-flap-style cards, one per category, that flip 3D-style to reveal the next partner each time the visitor clicks "Flip Partners." Simpler, more reliable, and just as on-brand as the previous slot-reel concept.
Version: 3.7.3
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: prestige-group
Tags: one-page, dark, minimal, business, custom-colors, custom-logo
*/

/* =========================================================================
   1. DESIGN TOKENS
   ========================================================================= */
:root {
  /* Surface */
  --tpg-black: #0A0A0A;
  --tpg-black-2: #0F0F11;
  --tpg-ink: #14141A;
  --tpg-ink-2: #1A1A22;

  /* Accent */
  --tpg-teal: #00F2FF;
  --tpg-teal-soft: rgba(0, 242, 255, 0.10);
  --tpg-teal-line: rgba(0, 242, 255, 0.22);
  --tpg-teal-glow: rgba(0, 242, 255, 0.35);

  /* Text */
  --tpg-text: #F5F5F7;
  --tpg-text-muted: #8B8B95;
  --tpg-text-dim: #5A5A63;

  /* Lines / glass */
  --tpg-border: rgba(255, 255, 255, 0.07);
  --tpg-border-strong: rgba(255, 255, 255, 0.14);
  --tpg-glass: rgba(255, 255, 255, 0.025);
  --tpg-glass-strong: rgba(255, 255, 255, 0.045);

  /* Type */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Layout */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --max-width: 1280px;
  --container-pad: clamp(20px, 4vw, 48px);

  /* Motion */
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur: 320ms;
  --dur-slow: 520ms;
}

/* =========================================================================
   2. RESET & BASE
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--tpg-black);
  color: var(--tpg-text);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
body.modal-open { overflow: hidden; }

img, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--tpg-teal); color: var(--tpg-black); }

/* Reduced motion */
@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;
  }
}

/* =========================================================================
   3. UTILITIES
   ========================================================================= */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tpg-teal);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--tpg-teal);
  display: inline-block;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
   4. SITE HEADER
   ========================================================================= */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 18px 0;
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease-out-expo), padding var(--dur) var(--ease-out-expo);
}
.site-header.is-scrolled {
  border-bottom-color: var(--tpg-border);
  padding: 12px 0;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 15px;
}
.site-brand__mark {
  width: 22px; height: 22px;
  border: 1px solid var(--tpg-teal);
  position: relative;
  display: inline-block;
}
.site-brand__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--tpg-teal);
  opacity: 0.6;
}
.site-brand__name { display: inline-block; }
.site-brand__suffix {
  color: var(--tpg-text-muted);
  font-weight: 400;
  font-size: 13px;
  margin-left: 4px;
}
.site-nav {
  display: none;
  gap: 28px;
  font-size: 13px;
  color: var(--tpg-text-muted);
}
.site-nav a { transition: color var(--dur-fast) var(--ease-out-expo); }
.site-nav a:hover { color: var(--tpg-text); }
@media (min-width: 768px) {
  .site-nav { display: inline-flex; }
}
.site-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--tpg-border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--tpg-text);
  transition: border-color var(--dur-fast) var(--ease-out-expo), background var(--dur-fast) var(--ease-out-expo);
}
.site-cta:hover {
  border-color: var(--tpg-teal);
  background: var(--tpg-teal-soft);
}
.site-cta__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tpg-teal);
  box-shadow: 0 0 10px var(--tpg-teal-glow);
}

/* =========================================================================
   5. HERO
   ========================================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 84px;
  padding-bottom: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}
.hero__bg {
  position: absolute; inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 50% 35%, rgba(0, 242, 255, 0.08), rgba(0, 242, 255, 0) 70%),
    radial-gradient(80% 60% at 50% 100%, rgba(0, 242, 255, 0.04), rgba(0, 242, 255, 0) 70%),
    var(--tpg-black);
}
.hero__grid-overlay {
  position: absolute; inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--tpg-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--tpg-border) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, #000 30%, transparent 80%);
  opacity: 0.6;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vw, 28px);
}

.hero__headline {
  font-size: clamp(28px, 6.5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 700;
  max-width: 22ch;
}
.hero__headline .accent {
  color: var(--tpg-teal);
  position: relative;
  white-space: nowrap;
}
.hero__headline .accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.06em;
  height: 1px;
  background: var(--tpg-teal-line);
}

.hero__subheadline {
  font-size: clamp(14px, 1.8vw, 18px);
  line-height: 1.55;
  color: var(--tpg-text-muted);
  max-width: 60ch;
  font-weight: 400;
}

/* =========================================================================
   6. PILLAR GRID (2x2)
   ========================================================================= */
.pillars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  gap: clamp(8px, 1.6vw, 14px);
  margin-top: clamp(8px, 2vw, 16px);
}

.pillar {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(14px, 2.4vw, 24px);
  min-height: clamp(110px, 17vw, 180px);
  background: var(--tpg-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--tpg-border);
  border-radius: var(--radius);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease-out-expo),
    background var(--dur) var(--ease-out-expo),
    transform var(--dur) var(--ease-out-expo);
}
.pillar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, var(--tpg-teal-soft), transparent 50%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out-expo);
}
.pillar:hover,
.pillar:focus-visible {
  border-color: var(--tpg-teal-line);
  background: var(--tpg-glass-strong);
  outline: none;
}
.pillar:hover::before,
.pillar:focus-visible::before { opacity: 1; }

.pillar__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pillar__num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--tpg-teal);
  font-weight: 500;
}
.pillar__toggle {
  position: relative;
  width: 22px; height: 22px;
  border: 1px solid var(--tpg-border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  transition: border-color var(--dur-fast) var(--ease-out-expo), background var(--dur-fast) var(--ease-out-expo);
}
.pillar__toggle::before,
.pillar__toggle::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  background: var(--tpg-text);
  transition: transform var(--dur) var(--ease-out-expo), background var(--dur-fast) var(--ease-out-expo);
}
.pillar__toggle::before {
  width: 8px; height: 1px;
  transform: translate(-50%, -50%);
}
.pillar__toggle::after {
  width: 1px; height: 8px;
  transform: translate(-50%, -50%);
}
.pillar:hover .pillar__toggle,
.pillar:focus-visible .pillar__toggle { border-color: var(--tpg-teal); }
.pillar:hover .pillar__toggle::before,
.pillar:hover .pillar__toggle::after { background: var(--tpg-teal); }

.pillar__title {
  font-size: clamp(13px, 1.7vw, 18px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.pillar__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-slow) var(--ease-out-expo);
}
.pillar__body-inner {
  overflow: hidden;
  min-height: 0;
}
.pillar__body-content {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--tpg-border);
  font-size: clamp(12px, 1.4vw, 14px);
  line-height: 1.55;
  color: var(--tpg-text-muted);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--dur) var(--ease-out-expo) 80ms,
              transform var(--dur) var(--ease-out-expo) 80ms;
}

/* Expanded state */
.pillar[aria-expanded="true"] {
  border-color: var(--tpg-teal-line);
  background: var(--tpg-glass-strong);
}
.pillar[aria-expanded="true"] .pillar__body { grid-template-rows: 1fr; }
.pillar[aria-expanded="true"] .pillar__body-content {
  opacity: 1;
  transform: translateY(0);
}
.pillar[aria-expanded="true"] .pillar__toggle::after {
  transform: translate(-50%, -50%) rotate(90deg);
}
.pillar[aria-expanded="true"] .pillar__toggle {
  border-color: var(--tpg-teal);
  background: var(--tpg-teal-soft);
}

/* When expanded, allow card to grow taller than the rigid grid row */
.pillars:has(.pillar[aria-expanded="true"]) { grid-auto-rows: auto; }

/* =========================================================================
   7. PRIMARY CTA
   ========================================================================= */
.hero__cta-wrap {
  margin-top: clamp(12px, 2.4vw, 20px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: var(--tpg-teal);
  color: var(--tpg-black);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out-expo), box-shadow var(--dur) var(--ease-out-expo);
  box-shadow: 0 0 0 0 var(--tpg-teal-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px -8px var(--tpg-teal-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary__arrow {
  display: inline-block;
  transition: transform var(--dur) var(--ease-out-expo);
}
.btn-primary:hover .btn-primary__arrow { transform: translateX(4px); }

.cta-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
}

/* =========================================================================
   8. SECTION: STRATEGIC REPRESENTATION
   ========================================================================= */
.section {
  padding: clamp(80px, 12vh, 140px) 0;
  position: relative;
}
.section--strategic {
  border-top: 1px solid var(--tpg-border);
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(0, 242, 255, 0.04), rgba(0, 242, 255, 0) 60%),
    var(--tpg-black);
}

.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: clamp(32px, 5vw, 64px);
  align-items: end;
}
@media (min-width: 900px) {
  .section-head {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
  }
}
.section-head__title {
  font-size: clamp(28px, 4.5vw, 48px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.025em;
  max-width: 16ch;
}
.section-head__lead {
  color: var(--tpg-text-muted);
  font-size: clamp(14px, 1.6vw, 17px);
  max-width: 50ch;
}

.repr-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.repr-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: start;
  gap: clamp(16px, 3vw, 36px);
  padding: clamp(24px, 3.5vw, 36px) 0;
  border-top: 1px solid var(--tpg-border);
  transition: padding var(--dur) var(--ease-out-expo);
}
.repr-item:last-child { border-bottom: 1px solid var(--tpg-border); }
.repr-item__num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--tpg-teal);
  padding-top: 6px;
}
.repr-item__title {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.repr-item__body {
  color: var(--tpg-text-muted);
  font-size: clamp(14px, 1.5vw, 16px);
  margin-top: 8px;
  max-width: 60ch;
}
.repr-item__chev {
  width: 36px; height: 36px;
  border: 1px solid var(--tpg-border-strong);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--tpg-text-muted);
  transition: border-color var(--dur) var(--ease-out-expo), color var(--dur) var(--ease-out-expo), transform var(--dur) var(--ease-out-expo);
  align-self: center;
}
@media (min-width: 700px) { .repr-item__chev { display: inline-flex; } }
.repr-item:hover .repr-item__chev {
  border-color: var(--tpg-teal);
  color: var(--tpg-teal);
  transform: translateX(4px);
}

/* =========================================================================
   9. CTA STRIP (between sections)
   ========================================================================= */
.cta-strip {
  border-top: 1px solid var(--tpg-border);
  padding: clamp(48px, 8vw, 96px) 0;
  background:
    radial-gradient(50% 60% at 50% 100%, rgba(0, 242, 255, 0.06), rgba(0, 242, 255, 0) 70%),
    var(--tpg-black);
}
.cta-strip__inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
}
@media (min-width: 800px) {
  .cta-strip__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
  }
}
.cta-strip__title {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 24ch;
}

/* =========================================================================
   10. FOOTER
   ========================================================================= */
.site-footer {
  border-top: 1px solid var(--tpg-border);
  padding: 48px 0 32px;
  background: var(--tpg-black);
}
.site-footer__top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--tpg-border);
}
@media (min-width: 800px) {
  .site-footer__top { grid-template-columns: 2fr 1fr 1fr 1fr; }
}
.site-footer__col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  margin-bottom: 16px;
  font-weight: 500;
}
.site-footer__col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--tpg-text-muted);
}
.site-footer__col a:hover { color: var(--tpg-teal); }
.site-footer__copy {
  color: var(--tpg-text-muted);
  font-size: 13px;
  max-width: 40ch;
  margin-top: 12px;
}
.site-footer__bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
  font-size: 12px;
  color: var(--tpg-text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
@media (min-width: 700px) {
  .site-footer__bottom { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* =========================================================================
   11. MODAL (Lead Capture)
   ========================================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.is-open { display: flex; }
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  animation: fadeIn var(--dur) var(--ease-out-expo) forwards;
}
.modal__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--tpg-ink), var(--tpg-black-2));
  border: 1px solid var(--tpg-border-strong);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  animation: panelIn var(--dur-slow) var(--ease-out-expo) forwards 80ms;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--tpg-teal-line);
}
@keyframes fadeIn { to { opacity: 1; } }
@keyframes panelIn { to { opacity: 1; transform: translateY(0) scale(1); } }

.modal__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border: 1px solid var(--tpg-border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tpg-text-muted);
  transition: all var(--dur-fast) var(--ease-out-expo);
}
.modal__close:hover {
  border-color: var(--tpg-teal);
  color: var(--tpg-teal);
  transform: rotate(90deg);
}
.modal__title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
  padding-right: 40px;
}
.modal__lead {
  color: var(--tpg-text-muted);
  font-size: 14px;
  margin-bottom: 28px;
  max-width: 50ch;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 520px) {
  .form-grid--2col { grid-template-columns: 1fr 1fr; }
}

.field { position: relative; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--tpg-border-strong);
  padding: 10px 0;
  font-size: 15px;
  color: var(--tpg-text);
  transition: border-color var(--dur-fast) var(--ease-out-expo);
  border-radius: 0;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-bottom-color: var(--tpg-teal);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--tpg-text-dim); }

.form__submit {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}
.form__notice {
  margin-top: 16px;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: none;
}
.form__notice.is-success {
  display: block;
  background: var(--tpg-teal-soft);
  border: 1px solid var(--tpg-teal-line);
  color: var(--tpg-teal);
}
.form__notice.is-error {
  display: block;
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.3);
  color: #ff8a8a;
}
.form__legal {
  font-size: 11px;
  color: var(--tpg-text-dim);
  margin-top: 16px;
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* =========================================================================
   12. ENTRANCE ANIMATIONS
   ========================================================================= */
.fade-up {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease-out-expo), transform 700ms var(--ease-out-expo);
}
.fade-up.is-visible { opacity: 1; transform: translateY(0); }

/* Stagger children */
.stagger > * { transition-delay: calc(var(--i, 0) * 70ms); }

/* =========================================================================
   13. RESPONSIVE FINE-TUNING (HERO / PILLARS)
   ========================================================================= */
@media (max-width: 480px) {
  .hero { padding-top: 72px; padding-bottom: 24px; }
  .hero__inner { gap: 14px; }
  .pillar { min-height: 96px; padding: 14px; }
  .pillar__title { font-size: 13px; }
  .btn-primary { padding: 12px 18px; font-size: 13px; width: 100%; justify-content: center; }
  .hero__cta-wrap { width: 100%; }
  .cta-meta { width: 100%; text-align: center; }
}

/* Very tall mobile (allow generous space) */
@media (min-height: 800px) and (max-width: 480px) {
  .pillar { min-height: 120px; }
}

@media (min-width: 1024px) {
  .pillars {
    grid-template-columns: repeat(4, 1fr);
  }
  .pillar { min-height: 200px; }
}


/* =========================================================================
   15. SECTION: CURRENT INNOVATION
   =========================================================================
   Two side-by-side "data dossier" cards. Glassmorphism continues from the
   pillars but at a larger scale, with a status pulse, KPI strip, and a
   hand-tuned SVG sparkline that reads as live trajectory rather than
   decoration.
   ========================================================================= */
.section--innovation {
  border-top: 1px solid var(--tpg-border);
  background:
    radial-gradient(40% 50% at 100% 0%, rgba(0, 242, 255, 0.045), transparent 60%),
    radial-gradient(40% 50% at 0% 100%, rgba(0, 242, 255, 0.025), transparent 60%),
    var(--tpg-black);
}

.innovation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 22px);
}
@media (min-width: 900px) {
  .innovation-grid { grid-template-columns: 1fr 1fr; }
}

.innovation-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 22px);
  padding: clamp(22px, 3vw, 36px);
  background: var(--tpg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--tpg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  isolation: isolate;
  transition:
    border-color var(--dur) var(--ease-out-expo),
    background var(--dur) var(--ease-out-expo),
    transform var(--dur) var(--ease-out-expo);
}
.innovation-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, var(--tpg-teal-soft), transparent 55%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out-expo);
  pointer-events: none;
  border-radius: inherit;
}
.innovation-card:hover {
  border-color: var(--tpg-teal-line);
  background: var(--tpg-glass-strong);
  transform: translateY(-2px);
}
.innovation-card:hover::before { opacity: 1; }

.innovation-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.innovation-card__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tpg-teal);
  font-weight: 500;
}
.innovation-card__status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--tpg-teal);
  box-shadow: 0 0 12px var(--tpg-teal-glow);
  animation: tpg-pulse 2.4s ease-in-out infinite;
}
@keyframes tpg-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.78); }
}
.innovation-card__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
}

.innovation-card__title {
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--tpg-text);
}
.innovation-card__lead {
  color: var(--tpg-text-muted);
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1.65;
  max-width: 50ch;
}

/* KPI strip — three-up grid of stats */
.innovation-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0;
  background: var(--tpg-border);
  border-top: 1px solid var(--tpg-border);
  border-bottom: 1px solid var(--tpg-border);
  border-radius: 2px;
  overflow: hidden;
}
.innovation-card__stat {
  background: rgba(10, 10, 10, 0.55);
  padding: clamp(12px, 1.6vw, 16px) clamp(14px, 1.8vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.innovation-card__stat dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  order: 2;
  margin: 0;
}
.innovation-card__stat dd {
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tpg-text);
  order: 1;
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.innovation-card__stat dd .unit {
  color: var(--tpg-teal);
  font-weight: 500;
  font-size: 0.6em;
}

/* Sparkline trajectory */
.innovation-card__viz {
  width: 100%;
  height: 60px;
  display: block;
  color: var(--tpg-teal);
  overflow: visible;
}
.innovation-card__viz .area {
  fill: var(--tpg-teal);
  fill-opacity: 0.10;
}
.innovation-card__viz .line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* draw-in animation triggered when the section becomes visible */
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1600ms var(--ease-out-expo);
}
.innovation-card.is-visible .innovation-card__viz .line {
  stroke-dashoffset: 0;
}
.innovation-card__viz .endpoint {
  fill: var(--tpg-teal);
  filter: drop-shadow(0 0 6px var(--tpg-teal-glow));
}

.innovation-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
  flex-wrap: wrap;
}
.innovation-card__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tpg-text);
  transition: color var(--dur-fast) var(--ease-out-expo), gap var(--dur-fast) var(--ease-out-expo);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.innovation-card__link:hover {
  color: var(--tpg-teal);
  gap: 12px;
}
.innovation-card__link__arrow {
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease-out-expo);
}
.innovation-card__link:hover .innovation-card__link__arrow { transform: translateX(4px); }

.innovation-card__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
}

/* Innovation — responsive */
@media (max-width: 640px) {
  .innovation-card__stats { grid-template-columns: 1fr; }
  .innovation-card__head { gap: 8px; }
}

/* =========================================================================
   16. STATE TOGGLES (v3) — pillars + innovation cards
   =========================================================================
   The Customizer exposes two display modes per section:
     - "expandable"     : details hidden, click reveals
     - "always_visible" : details rendered open, no toggle UI
   PHP writes the chosen mode onto the section container as `data-state`.
   These rules then either reinforce or override the v1/v2 defaults.
   ========================================================================= */

/* ---- Pillars: always-visible mode ---- */
/*
 * Default v2 behavior (pillar bodies hidden until aria-expanded="true") still
 * applies for "expandable" state. In "always_visible" mode we pin every body
 * open and hide the +/- toggle since it has no function.
 */
.pillars[data-state="always_visible"] .pillar {
  cursor: default;
}
.pillars[data-state="always_visible"] .pillar__body {
  grid-template-rows: 1fr;
}
.pillars[data-state="always_visible"] .pillar__body-content {
  opacity: 1;
  transform: translateY(0);
}
.pillars[data-state="always_visible"] .pillar__toggle {
  display: none;
}
.pillars[data-state="always_visible"] .pillar {
  /* Nudge the always-open border treatment so it doesn't look "active" */
  border-color: var(--tpg-border);
  background: var(--tpg-glass);
}
.pillars[data-state="always_visible"] .pillar:hover {
  border-color: var(--tpg-teal-line);
  background: var(--tpg-glass-strong);
}

/* ---- Innovation cards: expandable mode ---- */
/*
 * In "expandable" state, lead/stats/viz collapse behind a toggle button and
 * reveal on click. In "always_visible" state, the existing v2 layout applies
 * unchanged — card-body is just a transparent grouping div.
 */
.innovation-card__body {
  display: contents;
}

.innovation-card[data-state="expandable"] .innovation-card__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 600ms var(--ease-out-expo);
  overflow: hidden;
}
.innovation-card[data-state="expandable"] .innovation-card__body > .innovation-card__body-inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 22px);
  /* Fade body content along with the height transition */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--dur) var(--ease-out-expo) 60ms,
              transform var(--dur) var(--ease-out-expo) 60ms;
}
.innovation-card[data-state="expandable"][aria-expanded="true"] .innovation-card__body {
  grid-template-rows: 1fr;
}
.innovation-card[data-state="expandable"][aria-expanded="true"] .innovation-card__body > .innovation-card__body-inner {
  opacity: 1;
  transform: translateY(0);
}

/* In always-visible mode the body-inner is just a passthrough wrapper. */
.innovation-card[data-state="always_visible"] .innovation-card__body-inner {
  display: contents;
}

/* The toggle button — only shown when card is in expandable state. */
.innovation-card__toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-top: 4px;
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--tpg-border-strong);
  border-radius: var(--radius-sm);
  color: var(--tpg-text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out-expo),
              color var(--dur-fast) var(--ease-out-expo),
              background var(--dur-fast) var(--ease-out-expo);
}
.innovation-card__toggle:hover {
  border-color: var(--tpg-teal);
  color: var(--tpg-teal);
  background: var(--tpg-teal-soft);
}
.innovation-card__toggle-icon {
  position: relative;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.innovation-card__toggle-icon::before,
.innovation-card__toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  background: currentColor;
  transition: transform var(--dur) var(--ease-out-expo);
}
.innovation-card__toggle-icon::before {
  width: 12px; height: 1.5px;
  transform: translate(-50%, -50%);
}
.innovation-card__toggle-icon::after {
  width: 1.5px; height: 12px;
  transform: translate(-50%, -50%);
}
.innovation-card[aria-expanded="true"] .innovation-card__toggle-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Show the toggle only in expandable state */
.innovation-card[data-state="expandable"] .innovation-card__toggle {
  display: inline-flex;
}

/* Reduced motion: skip the height transition */
@media (prefers-reduced-motion: reduce) {
  .innovation-card[data-state="expandable"] .innovation-card__body,
  .innovation-card[data-state="expandable"] .innovation-card__body > .innovation-card__body-inner {
    transition: none !important;
  }
}


/* =========================================================================
   18. CUSTOM LOGO + SCROLL-DRIVEN ZOOM (v3.1)
   =========================================================================
   The header logo lives inside .site-brand__logo-wrap. Two animation paths:

     (a) Modern browsers with native CSS Scroll-Driven Animations
         (Chrome 115+, Edge 115+) get the pure-CSS path via
         `animation-timeline: scroll(root block)`. Zero JS, GPU-driven.

     (b) Browsers without that feature (Safari, Firefox as of writing)
         get a JS fallback that writes a --logo-scale CSS custom
         property in a rAF loop. Both paths produce identical visuals.

   The transform always sits on the .site-brand__logo-wrap so we never
   re-paint the entire header. transform-origin: left center keeps the
   logo anchored to the brand block as it scales.
   ========================================================================= */
.site-brand__logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transform-origin: left center;
  /* JS-fallback variable. Defaults to 1 (no scale) and is overwritten
   * by the rAF loop in script.js. The CSS path below also writes here
   * via @keyframes so the variable is always the source of truth. */
  --logo-scale: 1;
  transform: scale(var(--logo-scale));
  will-change: transform;
  transition: filter var(--dur) var(--ease-out-expo);
}

/* The hardcoded <img> sits inside .site-brand__logo-wrap and inherits the
 * scroll-zoom transform from the wrapper. Sizing is now driven by the
 * data-size attribute on .site-header, settable via the Customizer.
 * Mobile breakpoints below cap larger sizes so the logo never crowds
 * the nav on narrow viewports. */
.site-brand__logo-img {
  display: block;
  max-height: var(--logo-h, 64px);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: max-height var(--dur) var(--ease-out-expo);
}

/* Header logo size — desktop defaults */
.site-header[data-size="small"]   { --logo-h: 32px; --logo-h-scrolled: 28px; }
.site-header[data-size="medium"]  { --logo-h: 48px; --logo-h-scrolled: 40px; }
.site-header[data-size="large"]   { --logo-h: 64px; --logo-h-scrolled: 52px; }
.site-header[data-size="xlarge"]  { --logo-h: 80px; --logo-h-scrolled: 64px; }
.site-header[data-size="xxlarge"] { --logo-h: 96px; --logo-h-scrolled: 76px; }

/* Header padding adjusts to logo size so the logo always sits comfortably */
.site-header[data-size="xlarge"]  { padding: 14px 0; }
.site-header[data-size="xxlarge"] { padding: 16px 0; }

.site-header.is-scrolled .site-brand__logo-img {
  max-height: var(--logo-h-scrolled, 52px);
}

/* Tablet — cap at xlarge */
@media (max-width: 900px) {
  .site-header[data-size="xxlarge"] { --logo-h: 72px; --logo-h-scrolled: 60px; }
}

/* Mobile — cap larger sizes so the logo doesn't dominate or push out the CTA */
@media (max-width: 600px) {
  .site-header[data-size="xlarge"]  { --logo-h: 52px; --logo-h-scrolled: 44px; }
  .site-header[data-size="xxlarge"] { --logo-h: 56px; --logo-h-scrolled: 46px; }
  /* Cap any logo at 56px on phones to preserve nav real estate */
  .site-brand__logo-img { max-width: 200px; }
}

@media (max-width: 380px) {
  .site-header[data-size="large"]   { --logo-h: 40px; --logo-h-scrolled: 36px; }
  .site-header[data-size="xlarge"]  { --logo-h: 44px; --logo-h-scrolled: 38px; }
  .site-header[data-size="xxlarge"] { --logo-h: 48px; --logo-h-scrolled: 40px; }
}

/* Modern browsers: drive --logo-scale from a scroll-progress timeline.
 * The animation runs as the document scrolls 0–600px from the top. */
@supports (animation-timeline: scroll()) {
  @keyframes tpg-logo-zoom-subtle {
    from { --logo-scale: 1;    }
    to   { --logo-scale: 1.08; }
  }
  @keyframes tpg-logo-zoom-bold {
    from { --logo-scale: 1;    }
    to   { --logo-scale: 1.18; }
  }
  /* Tell the browser this property animates so the keyframes above
   * actually interpolate it (custom properties default to discrete). */
  @property --logo-scale {
    syntax: "<number>";
    inherits: true;
    initial-value: 1;
  }
  .site-header[data-zoom="subtle"] .site-brand__logo-wrap {
    animation: tpg-logo-zoom-subtle linear forwards;
    animation-timeline: scroll(root block);
    animation-range: 0 600px;
  }
  .site-header[data-zoom="bold"] .site-brand__logo-wrap {
    animation: tpg-logo-zoom-bold linear forwards;
    animation-timeline: scroll(root block);
    animation-range: 0 600px;
  }
}

/* "Off" state — pin scale at 1 regardless of scroll. */
.site-header[data-zoom="off"] .site-brand__logo-wrap {
  --logo-scale: 1 !important;
  animation: none !important;
}

/* Optional teal glow for crispness against #0A0A0A. Cheap drop-shadow
 * filter that survives across SVG/PNG and animates with the transform. */
.site-header[data-glow="on"] .site-brand__logo-img {
  filter: drop-shadow(0 0 6px rgba(0, 242, 255, 0.18));
}

/* Reduced motion: kill the scroll-zoom entirely. */
@media (prefers-reduced-motion: reduce) {
  .site-brand__logo-wrap {
    animation: none !important;
    --logo-scale: 1 !important;
  }
}

/* =========================================================================
   19. FOOTER LOGO (v3.1)
   ========================================================================= */
.site-brand--footer { display: inline-flex; align-items: center; gap: 10px; }

/* Footer logo size driven by data-size attribute on .site-brand--footer */
.site-brand--footer[data-size="small"]   { --footer-logo-h: 40px; }
.site-brand--footer[data-size="medium"]  { --footer-logo-h: 60px; }
.site-brand--footer[data-size="large"]   { --footer-logo-h: 80px; }
.site-brand--footer[data-size="xlarge"]  { --footer-logo-h: 100px; }
.site-brand--footer[data-size="xxlarge"] { --footer-logo-h: 120px; }

.site-brand__footer-img {
  max-height: var(--footer-logo-h, 80px);
  max-width: 240px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: opacity var(--dur) var(--ease-out-expo);
  opacity: 0.92;
}
.site-brand--footer:hover .site-brand__footer-img { opacity: 1; }

/* Mobile — keep the footer logo readable but not dominating */
@media (max-width: 600px) {
  .site-brand--footer[data-size="xlarge"]  { --footer-logo-h: 80px; }
  .site-brand--footer[data-size="xxlarge"] { --footer-logo-h: 88px; }
  .site-brand__footer-img { max-width: 180px; }
}

/* =========================================================================
/* =========================================================================
   21. LOGO FAILSAFE FALLBACK (v3.3.1)
   =========================================================================
   The header / footer now wrap the hardcoded <img> alongside a
   .site-brand__logo-fallback span. The fallback is display:none by
   default — JS onerror flips it to inline-flex if the PNG fails to
   load (404, MIME mismatch, server config issue). This prevents a
   broken-image icon and keeps the brand legible no matter what.
   ========================================================================= */
.site-brand__logo-fallback {
  display: none;
  align-items: center;
  gap: 10px;
}
.site-brand__logo-fallback .site-brand__mark {
  width: 22px;
  height: 22px;
  border: 1px solid var(--tpg-teal);
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.site-brand__logo-fallback .site-brand__mark::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--tpg-teal);
  opacity: 0.6;
}
.site-brand__logo-fallback .site-brand__name {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 15px;
  color: var(--tpg-text);
}

/* =========================================================================
   22. RESPONSIVE POLISH (v3.4)
   =========================================================================
   Targeted fixes for narrow viewports. The theme was already mobile-first
   for the hero/pillars/sections, but v3.4's larger logo sizes and the
   newer Legacy Wall toggles needed a polish pass.
   ========================================================================= */

/* Mobile header — keep the brand + CTA visible without crowding */
@media (max-width: 600px) {
  .site-header__inner {
    gap: 12px;
  }
  .site-cta {
    padding: 8px 12px;
    font-size: 11px;
  }
  .site-cta span:nth-child(2) {
    /* Truncate long custom CTA labels on phones */
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Very narrow phones — collapse the CTA dot to save space */
@media (max-width: 380px) {
  .site-cta__dot { display: none; }
  .site-cta { padding: 7px 10px; }
}

/* Footer columns — more breathable on tablet */
@media (max-width: 800px) {
  .site-footer__top {
    gap: 28px;
  }
  .site-brand--footer { margin-bottom: 4px; }
}

/* Legacy Wall spin button — full width on phones */
@media (max-width: 600px) {
  .legacy-spin-btn {
    width: 100%;
    justify-content: center;
    padding: 14px 16px;
  }
}

/* Innovation cards — extra padding tightening on phones */
@media (max-width: 480px) {
  .innovation-card {
    padding: 20px;
  }
  .innovation-card__title {
    font-size: 22px;
  }
  .innovation-card__lead {
    font-size: 13px;
    line-height: 1.55;
  }
}

/* Modal — full-screen on tiny phones for breathing room */
@media (max-width: 480px) {
  .modal {
    padding: 0;
  }
  .modal__panel {
    border-radius: 0;
    max-height: 100vh;
    max-height: 100dvh;
    width: 100%;
    max-width: none;
    padding: 24px 20px;
  }
  .modal__close {
    top: 12px;
    right: 12px;
  }
}

/* Container padding — slightly tighter on phones */
@media (max-width: 480px) {
  :root { --container-pad: 16px; }
}

/* Long headlines should wrap nicely on phones — add word-break safety */
.hero__headline,
.section-head__title,
.cta-strip__title {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Image responsiveness baseline — every image in the theme caps at its
 * container width regardless of intrinsic dimensions */
img {
  max-width: 100%;
  height: auto;
}

/* Touch-friendly tap targets on mobile — 44px minimum */
@media (max-width: 768px) {
  .pillar,
  .legacy-spin-btn,
  .innovation-card__toggle,
  .btn-primary,
  .modal__close,
  .site-cta {
    min-height: 44px;
  }
}


/* =========================================================================
   14. SECTION: LEGACY WALL — FLIP-CLOCK PARTNER DISPLAY (v3.7)
   =========================================================================
   Three split-flap-style cards, one per partner category. Each card shows
   ONE partner at a time. Clicking the "Flip Partners" button advances every
   card to the next partner in its category, with a mechanical 3D flip
   animation borrowed from old airport arrival boards.

   The flip mechanic uses the active card rotating -180° on the X-axis
   while a hidden incoming card rotates from +90° to 0°. JS swaps the
   .is-active marker at the rotation midpoint, producing the visual
   effect of "the front of the card flipped down to reveal the back."
   ========================================================================= */

.section--legacy {
  border-top: 1px solid var(--tpg-border);
  padding: clamp(72px, 10vh, 120px) 0 clamp(56px, 8vh, 96px);
  background:
    radial-gradient(40% 60% at 0% 50%, rgba(0, 242, 255, 0.035), transparent 60%),
    radial-gradient(40% 60% at 100% 50%, rgba(0, 242, 255, 0.025), transparent 60%),
    var(--tpg-black);
  position: relative;
}
.section--legacy .section-head { margin-bottom: clamp(32px, 5vw, 56px); }

/* The 3-up flip-card grid */
.legacy-flips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 24px);
  margin-top: clamp(24px, 4vw, 48px);
}
@media (max-width: 800px) {
  .legacy-flips { grid-template-columns: 1fr; }
}

/* Individual flip card container */
.legacy-flip {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legacy-flip__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 4px;
  border-bottom: 1px solid var(--tpg-border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.legacy-flip__num {
  color: var(--tpg-teal);
  font-weight: 500;
}
.legacy-flip__label {
  color: var(--tpg-text);
  font-weight: 500;
  flex: 1;
  margin-left: 10px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.legacy-flip__count {
  color: var(--tpg-text-dim);
  font-variant-numeric: tabular-nums;
}

/* Flip viewport — fixed height, hides overflow, sets 3D perspective */
.legacy-flip__window {
  --card-h: 120px;
  position: relative;
  height: var(--card-h);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.005)),
    var(--tpg-black);
  border: 1px solid var(--tpg-border);
  border-radius: var(--radius);
  isolation: isolate;
  perspective: 600px;
  transform-style: preserve-3d;
}
/* Subtle horizontal hairline at midline — mimics the seam between
   top and bottom halves of a real split-flap card. */
.legacy-flip__window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.45);
  z-index: 3;
  pointer-events: none;
}

/* Individual partner card — all stacked at the same position, but
   only the .is-active one is visible. JS toggles .is-active to
   reveal a different partner per click. */
.legacy-flip__card {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px clamp(16px, 2vw, 28px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backface-visibility: hidden;
  transform-origin: center center;
  transform: rotateX(0deg);
}
.legacy-flip__card.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* During a flip: the outgoing card rotates -180°, the incoming card
   rotates from +90° to 0°. The keyframes timing is set so each is
   invisible during their off-screen half (top of arc / bottom of arc),
   producing the split-flap look. */
.legacy-flip__window.is-flipping .legacy-flip__card.is-active {
  animation: tpg-flip-out var(--flip-ms, 600ms) cubic-bezier(0.55, 0, 0.45, 1) forwards;
}
.legacy-flip__window.is-flipping .legacy-flip__card.is-incoming {
  visibility: visible;
  pointer-events: none;
  animation: tpg-flip-in var(--flip-ms, 600ms) cubic-bezier(0.55, 0, 0.45, 1) forwards;
}

@keyframes tpg-flip-out {
  0%   { transform: rotateX(0deg);    opacity: 1; }
  49%  { transform: rotateX(-90deg);  opacity: 1; }
  50%  { transform: rotateX(-90deg);  opacity: 0; }
  100% { transform: rotateX(-180deg); opacity: 0; }
}
@keyframes tpg-flip-in {
  0%   { transform: rotateX(90deg);  opacity: 0; }
  49%  { transform: rotateX(90deg);  opacity: 0; }
  50%  { transform: rotateX(90deg);  opacity: 1; }
  100% { transform: rotateX(0deg);   opacity: 1; }
}

/* Single-partner reels: there's no "next" partner to flip TO, so we
 * play a flip-and-return animation on the same card. The card rotates
 * to -90° (invisible at midpoint), then rotates BACK to 0°. Visually
 * identical to a real flip; semantically a no-op. Gives the user
 * feedback that the button worked even when there's only one logo. */
.legacy-flip[data-count="1"] .legacy-flip__window.is-flipping .legacy-flip__card.is-active {
  animation: tpg-flip-bounce var(--flip-ms, 600ms) cubic-bezier(0.55, 0, 0.45, 1) forwards;
}

@keyframes tpg-flip-bounce {
  0%   { transform: rotateX(0deg);    opacity: 1; }
  49%  { transform: rotateX(-90deg);  opacity: 1; }
  50%  { transform: rotateX(-90deg);  opacity: 0; }
  51%  { transform: rotateX(90deg);   opacity: 0; }
  100% { transform: rotateX(0deg);    opacity: 1; }
}

/* Logo image — same monochrome treatment as the slot-reel version */
.legacy-flip__img {
  max-height: 56px;
  max-width: 80%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  filter: brightness(0) invert(1) opacity(0.86);
  transition: filter var(--dur) var(--ease-out-expo);
}
.legacy-flip__card:hover .legacy-flip__img {
  filter: brightness(0) invert(1) opacity(1);
}
.legacy-flip__card--keep-color .legacy-flip__img {
  filter: none;
  opacity: 0.95;
}
.legacy-flip__card--keep-color:hover .legacy-flip__img {
  opacity: 1;
}

/* Text fallback when no logo is uploaded */
.legacy-flip__mark {
  width: 8px;
  height: 8px;
  background: var(--tpg-teal);
  opacity: 0.6;
  border-radius: 1px;
  flex-shrink: 0;
}
.legacy-flip__name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tpg-text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Empty state — a category with no partners assigned */
.legacy-flip__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  text-align: center;
}

/* Headline stats below the flip cards (unchanged from previous versions) */
.legacy-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: clamp(36px, 5vw, 56px);
  background: var(--tpg-border);
  border-top: 1px solid var(--tpg-border);
  border-bottom: 1px solid var(--tpg-border);
}
.legacy-stat {
  background: var(--tpg-black);
  padding: clamp(18px, 2.4vw, 28px) clamp(20px, 2.6vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legacy-stat__value {
  font-size: clamp(26px, 3.6vw, 40px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--tpg-text);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.legacy-stat__value-unit {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--tpg-teal);
}
.legacy-stat__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  margin-top: 4px;
  max-width: 28ch;
}

/* "Spin Partner Network" button — uses base .btn-primary styles for
 * the teal-on-dark CTA look (defined in section 7), with a few
 * spin-specific additions: centered under the reels, animated icon,
 * disabled state during spin, and a tiny "click to reveal" hint line. */
.legacy-spin-btn {
  margin: clamp(32px, 4vw, 48px) auto 0;
  /* The base .btn-primary already provides padding/colors; we just
   * center it and let the layout breathe under the reel grid. */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-direction: row;
  flex-wrap: wrap;
  text-align: center;
  position: relative;
}

.legacy-spin-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 18px;
  line-height: 1;
  /* Subtle resting rotation so the icon looks more "ready to spin" */
  transition: transform 400ms var(--ease-out-expo);
}
.legacy-spin-btn:hover:not(:disabled) .legacy-spin-btn__icon {
  transform: rotate(120deg);
}

.legacy-spin-btn__label {
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* The hint line below the main label — small, muted, mono font */
.legacy-spin-btn__hint {
  flex-basis: 100%;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  margin-top: 2px;
  transition: opacity 200ms ease-out;
}

/* While the reels are spinning, disable the button visually + functionally */
.legacy-spin-btn:disabled,
.legacy-spin-btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
  pointer-events: none;
}
.legacy-spin-btn[aria-busy="true"] .legacy-spin-btn__icon {
  animation: tpg-spin-icon var(--reel-spin-ms, 2500ms) cubic-bezier(0.45, 0.05, 0.15, 1);
}
.legacy-spin-btn[aria-busy="true"] .legacy-spin-btn__hint {
  opacity: 0;
}

@keyframes tpg-spin-icon {
  from { transform: rotate(0deg); }
  to   { transform: rotate(1440deg); }
}

@media (prefers-reduced-motion: reduce) {
  .legacy-spin-btn[aria-busy="true"] .legacy-spin-btn__icon {
    animation: none;
  }
}

/* Headline stats below the reels */
.legacy-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: clamp(36px, 5vw, 56px);
  background: var(--tpg-border);
  border-top: 1px solid var(--tpg-border);
  border-bottom: 1px solid var(--tpg-border);
}
.legacy-stat {
  background: var(--tpg-black);
  padding: clamp(18px, 2.4vw, 28px) clamp(20px, 2.6vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legacy-stat__value {
  font-size: clamp(26px, 3.6vw, 40px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--tpg-text);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.legacy-stat__value-unit {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--tpg-teal);
}
.legacy-stat__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tpg-text-dim);
  margin-top: 4px;
  max-width: 28ch;
}

/* Reduced motion: skip the flip animation entirely. Cards swap
 * instantly via the .is-active class toggle in JS — no rotation. */
@media (prefers-reduced-motion: reduce) {
  .legacy-flip__window.is-flipping .legacy-flip__card.is-active,
  .legacy-flip__window.is-flipping .legacy-flip__card.is-incoming {
    animation: none !important;
  }
  .legacy-spin-btn__icon {
    animation: none !important;
  }
}

/* Mobile sizing — slightly tighter cards */
@media (max-width: 700px) {
  .legacy-flip__window { --card-h: 90px; }
  .legacy-flip__img { max-height: 44px; }
  .legacy-flip__name { font-size: 14px; }
  .legacy-stats { grid-template-columns: 1fr; }
  .legacy-stat__label { max-width: none; }
}

/* =========================================================================
   20. LEGACY WALL — INTERACTIVE STATE (v3.5)
   =========================================================================
   When the Customizer "Show or Hide the Partner Marquee" is set to
   "Hide by default", the reels collapse behind a "Reveal partner network"
   button. Click expands them. Uses max-height (not display: none) so the
   reel animation initializes correctly when the user reveals.
   ========================================================================= */
.legacy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: clamp(8px, 1.4vw, 16px) 0 clamp(28px, 4vw, 40px);
  padding: 14px 22px;
  background: transparent;
  border: 1px solid var(--tpg-border-strong);
  border-radius: var(--radius-sm);
  color: var(--tpg-text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out-expo),
    color var(--dur-fast) var(--ease-out-expo),
    background var(--dur-fast) var(--ease-out-expo);
}
.legacy-toggle:hover {
  border-color: var(--tpg-teal);
  color: var(--tpg-teal);
  background: var(--tpg-teal-soft);
}
.legacy-toggle__icon {
  position: relative;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.legacy-toggle__icon::before,
.legacy-toggle__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: currentColor;
  transition: transform var(--dur) var(--ease-out-expo);
}
.legacy-toggle__icon::before {
  width: 14px;
  height: 1.5px;
  transform: translate(-50%, -50%);
}
.legacy-toggle__icon::after {
  width: 1.5px;
  height: 14px;
  transform: translate(-50%, -50%);
}
.section--legacy[data-state="interactive"] .legacy-toggle[aria-expanded="true"] .legacy-toggle__icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

/* Collapse the reels in Interactive mode until "Reveal" is clicked.
 * max-height (rather than display:none) keeps the CSS animation running
 * so when the reels reveal, they're already in motion. */
.section--legacy[data-state="interactive"] .legacy-flips,
.section--legacy[data-state="interactive"] .legacy-spin-btn {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 600ms var(--ease-out-expo),
    opacity 400ms var(--ease-out-expo);
}
.section--legacy[data-state="interactive"] .legacy-toggle[aria-expanded="true"] ~ .legacy-flips,
.section--legacy[data-state="interactive"] .legacy-toggle[aria-expanded="true"] ~ .legacy-spin-btn,
.section--legacy[data-state="interactive"] .legacy-flips.is-revealed,
.section--legacy[data-state="interactive"] .legacy-spin-btn.is-revealed {
  max-height: 1200px;
  opacity: 1;
}

@supports selector(:has(*)) {
  .section--legacy[data-state="interactive"]:has(.legacy-toggle[aria-expanded="true"]) .legacy-flips,
  .section--legacy[data-state="interactive"]:has(.legacy-toggle[aria-expanded="true"]) .legacy-spin-btn {
    max-height: 1200px;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section--legacy[data-state="interactive"] .legacy-flips,
  .section--legacy[data-state="interactive"] .legacy-spin-btn {
    transition: none !important;
  }
}
