/* ============================================================
   OPTIMUS X — Design Tokens & Base
   Modern minimal · warm off-white · single red accent
   ============================================================ */

:root {
  /* Color — restrained palette */
  --bg:        #F5F2EC;          /* warm off-white */
  --bg-2:      #ECE7DE;          /* soft band */
  --paper:     #FBF9F5;          /* lightest cards */
  --ink:       #161412;          /* warm near-black */
  --ink-2:     #3A3631;          /* secondary text */
  --ink-3:     #7A746C;          /* muted */
  --line:      #DED7CB;          /* hairlines */
  --line-2:    #E8E2D7;
  --red:       #D6371C;          /* cricket ball accent */
  --red-ink:   #8A1F0C;
  --pitch:     #1F4D3A;          /* used sparingly */
  --gold:      #B58B3A;          /* highlight accent */

  /* Type */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Geist", "Söhne", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  /* Sizing */
  --maxw: 1440px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 24px;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

/* Reset + base ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

/* Type scale ------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.88;
  font-variation-settings: "wdth" 100, "opsz" 96;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mono { font-family: var(--font-mono); }
.serif-italic { font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 0;
}
h1 { font-size: clamp(40px, 7vw, 96px); }
h2 { font-size: clamp(32px, 4.6vw, 68px); }
h3 { font-size: clamp(22px, 2.4vw, 34px); }
p  { margin: 0; }

/* Layout ----------------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}
section { position: relative; }

/* Nav -------------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  transition: background .3s var(--ease), backdrop-filter .3s, padding .3s var(--ease), border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(245, 242, 236, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  padding-top: 12px; padding-bottom: 12px;
  border-bottom-color: var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-brand img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.nav-brand .wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}
.nav-brand .wordmark .x { color: var(--red); }

.nav-links {
  display: flex; gap: 4px;
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
}
.nav-links a {
  font-size: 13px; font-weight: 500;
  padding: 8px 16px; border-radius: 999px;
  color: var(--ink-2);
  transition: background .2s var(--ease), color .2s;
}
.nav-links a:hover { color: var(--ink); background: rgba(255,255,255,0.8); }
.nav-links a.active { background: var(--ink); color: var(--bg); }

.nav-cta {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.nav-cta:hover { background: var(--red); transform: translateY(-1px); }
.nav-cta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.nav-cta:hover .dot { background: var(--bg); }

.nav-burger { display: none; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-burger {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 999px;
    border: 1px solid var(--line); background: rgba(255,255,255,0.5);
  }
  .nav-cta { display: none; }
  .nav-burger.is-open + .mobile-menu,
  .mobile-menu.is-open { display: flex; }
}

.mobile-menu {
  display: none;
  position: fixed; inset: 0; z-index: 49;
  flex-direction: column;
  background: var(--bg);
  padding: 90px var(--gutter) 40px;
  gap: 4px;
}
.mobile-menu a {
  font-family: var(--font-display); font-size: 38px; font-weight: 700;
  letter-spacing: -0.02em;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.mobile-menu a.cta { color: var(--red); }

/* Buttons ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  transition: transform .2s var(--ease), background .2s, color .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(214,55,28,0.5); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--red); transform: translateY(-2px); }

.btn .arrow { transition: transform .3s var(--ease-out); }
.btn:hover .arrow { transform: translate(4px, -4px); }

/* Sections common ------------------------------------------- */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 48px; flex-wrap: wrap;
}
.section-head .title { max-width: 720px; }
.section-head .title h2 { margin-top: 8px; }

.divider {
  height: 1px; background: var(--line);
  margin: 0;
}

/* Cards ------------------------------------------------------ */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.card:hover { transform: translateY(-3px); border-color: var(--ink); }

/* Reveal-on-scroll ------------------------------------------ */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
  transition-delay: var(--delay, 0ms);
}
[data-reveal].is-in {
  opacity: 1;
  transform: translateY(0);
}

/* Marquee ---------------------------------------------------- */
.marquee {
  overflow: hidden;
  position: relative;
  border-block: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
}
.marquee-track {
  display: flex; gap: 56px;
  white-space: nowrap;
  animation: marquee 40s linear infinite;
  padding-block: 18px;
}
.marquee-track .item {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 16px;
}
.marquee-track .item .res-w { color: #79D38B; font-weight: 600; }
.marquee-track .item .res-l { color: #E89180; font-weight: 600; }
.marquee-track .item .sep   { color: rgba(245,242,236,0.4); }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Footer ----------------------------------------------------- */
.footer {
  background: var(--ink);
  color: var(--bg);
  padding: 80px 0 32px;
  margin-top: 120px;
  position: relative;
  overflow: hidden;
}
.footer .wordmark-huge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(80px, 18vw, 280px);
  letter-spacing: -0.05em;
  line-height: 0.85;
  margin-top: 60px;
  position: relative;
}
.footer .wordmark-huge .x { color: var(--red); font-style: italic; }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px; padding-bottom: 60px;
  border-bottom: 1px solid rgba(245,242,236,0.12);
}
.footer-grid h4 { font-size: 14px; color: rgba(245,242,236,0.5); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 18px; font-family: var(--font-mono); }
.footer-grid a { display: block; padding: 4px 0; color: rgba(245,242,236,0.85); transition: color .2s, transform .2s; }
.footer-grid a:hover { color: var(--red); transform: translateX(4px); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px;
  font-family: var(--font-mono); font-size: 12px;
  color: rgba(245,242,236,0.5);
}
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer { padding-top: 56px; margin-top: 80px; }
}

/* Page header (for non-home pages) --------------------------- */
.page-header {
  padding: 160px 0 60px;
  border-bottom: 1px solid var(--line);
}
.page-header .eyebrow { display: block; margin-bottom: 24px; }
.page-header h1 {
  font-size: clamp(56px, 11vw, 180px);
  letter-spacing: -0.04em;
  line-height: 0.9;
}
.page-header .meta {
  display: flex; gap: 24px; margin-top: 28px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em;
}
.page-header .meta span { display: flex; align-items: center; gap: 8px; }
.page-header .meta .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Image placeholders ---------------------------------------- */
.imgph {
  background:
    repeating-linear-gradient(135deg, #E8E2D7 0 12px, #DED7CB 12px 24px);
  border-radius: var(--radius);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  color: var(--ink-2);
}
.imgph .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  z-index: 2;
}
.imgph.dark {
  background: repeating-linear-gradient(135deg, #1f1c19 0 12px, #25221f 12px 24px);
  color: rgba(255,255,255,0.7);
}
.imgph.dark .label { background: var(--ink); border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.85); }

/* Utility ---------------------------------------------------- */
.spacer-xl { height: clamp(80px, 12vw, 160px); }
.spacer-lg { height: clamp(60px, 8vw, 120px); }
.spacer-md { height: clamp(40px, 5vw, 64px); }

.text-mute { color: var(--ink-3); }
.text-red { color: var(--red); }
.italic { font-style: italic; }

/* Scroll progress bar --------------------------------------- */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0;
  background: var(--red);
  z-index: 60;
  transition: width .1s linear;
}

/* Tweaks panel slot ----------------------------------------- */
#tweaks-host { z-index: 70; }

/* Hero variants (driven by tweaks panel) -------------------- */
.hero.hero-dark {
  background: var(--ink);
  color: var(--bg);
}
.hero.hero-dark .hero-eyebrow .live { background: var(--red); color: #fff; }
.hero.hero-dark .hero-eyebrow .tag { color: rgba(245,242,236,0.6); }
.hero.hero-dark .hero-foot { border-top-color: rgba(245,242,236,0.15); }
.hero.hero-dark .hero-foot .stat .lbl { color: rgba(245,242,236,0.55); }
.hero.hero-dark .hero-badges .bg-text { color: rgba(245,242,236,0.06); }
.hero.hero-dark .next-chip { background: rgba(245,242,236,0.08); border-color: rgba(245,242,236,0.18); color: var(--bg); }
.hero.hero-dark .next-chip .when { color: rgba(245,242,236,0.7); }
.hero.hero-dark .next-chip .label { color: rgba(245,242,236,0.6); }
.hero.hero-dark .btn-ghost { color: var(--bg); border-color: rgba(245,242,236,0.3); }
.hero.hero-dark .btn-ghost:hover { background: var(--bg); color: var(--ink); }

.hero.hero-minimal .hero-ball,
.hero.hero-minimal .hero-badges,
.hero.hero-minimal .next-chip { display: none !important; }
.hero.hero-minimal { min-height: auto; padding-top: 160px; padding-bottom: 120px; }
