/* Site-wide chrome on top of tokens.css */

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--fg); overflow-x: hidden; }

/* Subtle full-page dot grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* Film grain overlay */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 9999;
  animation: grain 8s steps(10) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10%  { transform: translate(-2%, -3%); }
  20%  { transform: translate(3%, 1%); }
  30%  { transform: translate(-1%, 4%); }
  40%  { transform: translate(2%, -2%); }
  50%  { transform: translate(-3%, 2%); }
  60%  { transform: translate(1%, 3%); }
  70%  { transform: translate(-2%, -1%); }
  80%  { transform: translate(3%, 2%); }
  90%  { transform: translate(-1%, -3%); }
}

/* Hero entrance animations */
@keyframes heroWordIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Diagonal slash shapes (hero background) */
@keyframes geoSlash {
  0%, 100% { transform: skewX(-12deg); }
  33%       { transform: skewX(-11deg) scaleX(1.015); }
  66%       { transform: skewX(-13deg) scaleX(0.988); }
}

/* Kept for CTABand section glow shapes */
@keyframes heroShape1 {
  0%, 100% { transform: rotate(-15deg) scale(1); }
  50%      { transform: rotate(18deg) scale(1.06); }
}
@keyframes heroShape3 {
  0%, 100% { transform: rotate(-30deg) scale(1); }
  50%      { transform: rotate(8deg) scale(1.1); }
}

/* Marquee strip */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 50s linear infinite;
}

/* Flip card */
.flip-card-inner {
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.flip-card-inner.flipped { transform: rotateY(180deg); }
.flip-card-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip-card-back { transform: rotateY(180deg); }

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { display: none; }
  .hero-word, .hero-fade { animation: none !important; opacity: 1 !important; transform: none !important; }
  .flip-card-inner { transition: none !important; }
  [style*="heroShape"] { animation: none !important; }
}

a { color: inherit; }

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #222; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #333; }
*::-webkit-scrollbar-track { background: transparent; }

/* Reveal-on-scroll utility */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: translateY(0); }

/* Density variants */
html[data-density="compact"]  { --section-y: 80px;  --card-pad: 20px; }
html[data-density="comfy"]    { --section-y: 100px; --card-pad: 28px; }
html[data-density="spacious"] { --section-y: 140px; --card-pad: 36px; }
html:not([data-density]),
html[data-density="comfy"]    { --section-y: 100px; --card-pad: 28px; }

/* Glow intensity */
html[data-glow="off"]       { --site-glow-mul: 0; }
html[data-glow="dim"]       { --site-glow-mul: 0.5; }
html[data-glow="signature"] { --site-glow-mul: 1; }
html:not([data-glow])       { --site-glow-mul: 1; }

/* ── Section containers ─────────────────────────────────────── */
.section {
  padding: var(--section-y, 100px) 32px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}
.section-tight  { max-width: 960px; }
.section-narrow { max-width: 720px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.h-display {
  font-family: var(--font-display);
  font-weight: var(--display-weight, 800);
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--fg);
  margin: 0;
  text-wrap: balance;
}

.dim { color: var(--fg-3); }

/* Focus rings */
button:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(255,107,107,0.6);
}
input:focus, input:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none;
  -webkit-appearance: none;
}

/* ── Feature grid cells ─────────────────────────────────────── */
.fg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #1a1a1a;
  border-left: 1px solid #1a1a1a;
}
.fg-cell {
  border-right: 1px solid #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  padding: 48px;
  position: relative;
}
.fg-cell-wide {
  grid-column: 1 / -1;
}

/* ── Subtle breathe ─────────────────────────────────────────── */
@keyframes breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.02); filter: brightness(1.1); }
}
.breathe { animation: breathe 2.4s ease-in-out infinite; }

/* ================================================================
   Responsive — breakpoints: mobile <768px
   ================================================================ */

@media (max-width: 767px) {
  .section { padding: 60px 20px !important; }
  #waitlist { padding: 60px 20px !important; }
  footer { padding: 40px 20px 28px !important; }
  .footer-inner { flex-direction: column !important; gap: 32px !important; }

  /* Hero */
  .hero-split-grid { grid-template-columns: 1fr !important; }
  .hero-wordmark-grid { grid-template-columns: 1fr !important; gap: 24px !important; }

  /* Feature grid — single column on mobile */
  .fg-grid { grid-template-columns: 1fr !important; }
  .fg-cell-wide { grid-column: 1 !important; }
  .fg-cell { padding: 32px 24px !important; }
  .fg-cell-inner { grid-template-columns: 1fr !important; gap: 32px !important; }

  /* Sub-page sections */
  .algo-grid { grid-template-columns: 1fr !important; }
  .sm2-grid { grid-template-columns: 1fr !important; }
  .sm2-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .study-modes-header { grid-template-columns: 1fr !important; gap: 16px !important; }
  .study-modes-tabs { grid-template-columns: 1fr !important; }
  .study-modes-tabs > button { font-size: 17px !important; padding: 16px 8px !important; }
  .study-modes-content { grid-template-columns: 1fr !important; }
  .pricing-grid { grid-template-columns: 1fr !important; }
  .pricing-promises-grid { grid-template-columns: 1fr !important; }
  .feature-row { grid-template-columns: 1fr !important; gap: 32px !important; }
  .stats-panel-grid { grid-template-columns: 1fr !important; }
  .privacy-row { grid-template-columns: 1fr !important; gap: 32px !important; }
  .comparison-scroll { overflow-x: auto !important; }
  .demo-scroll { overflow-x: auto; }
  .legal-hero { padding: 80px 20px 40px !important; }
  .legal-body { padding: 0 20px 80px !important; }
  .page-404 { padding: 60px 20px !important; }
  .countdown-row { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 479px) {
  .section { padding: 48px 16px !important; }
  #waitlist { padding: 48px 16px !important; }
  footer { padding: 32px 16px 24px !important; }
  .legal-hero { padding: 64px 16px 32px !important; }
  .legal-body { padding: 0 16px 64px !important; }
}
