/* RallyReel — product site. Endevo brand system (ENDEVO-BRAND.md):
   Carbon leads, Fog surfaces, Gunmetal secondary text, Patina reserved for the
   endevo mark's solid stroke only. RallyReel carries its own louder accent
   (Signal Orange) as a product "by endevo"; the maker's mark stays quiet (§7).
   Space Grotesk = human text, IBM Plex Mono = machine text, Josefin Sans = the
   endevo wordmark only. */

:root {
  --carbon: #0F1216;
  --carbon-deep: #0A0C0E;
  --ink-soft: #181D22;
  --fog: #E8EBEE;
  --gunmetal: #3A424C;
  --muted: #9A9DA3;
  --hairline: #AEB4BB;
  --paper: #F4F5F3;
  --canvas: #DDE1E5;
  --accent: #F15A0A;
  --accent-strong: #D13000;
  --patina: #79B4A9;
  --maxw: 1440px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--fog);
  color: var(--gunmetal);
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- machine text ---------- */
.kicker {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 500;
  margin: 0 0 14px;
}
.kicker.on-dark { color: var(--accent); }
.mono {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 20;
  background: rgba(232, 235, 238, 0.86);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid rgba(15, 18, 22, 0.08);
}
header.site .bar {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; display: block; }
.brand .name {
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: var(--carbon);
  line-height: 1.05;
}
.brand .sub { display: block; margin-top: 1px; }
nav.site a {
  font-size: 14px; color: var(--gunmetal); text-decoration: none;
  margin-left: 22px; font-weight: 500;
}
nav.site a:hover { color: var(--carbon); }
@media (max-width: 640px) { nav.site a { margin-left: 14px; font-size: 13px; } }

/* ---------- hero ---------- */
.hero { background: var(--carbon); color: var(--fog); padding: 84px 0 0; overflow: hidden; }
.hero-copy { max-width: 640px; }
.hero h1 {
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1.02; letter-spacing: -0.035em; font-weight: 700;
  color: var(--fog); margin: 0 0 20px; max-width: 15ch; text-wrap: balance;
}
.hero p.lede {
  font-size: 18px; line-height: 1.55; color: #C8CCD1;
  max-width: 52ch; margin: 0 0 30px;
}
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 26px; border-radius: 14px;
  font-weight: 700; font-size: 14px; letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none; border: 0; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--carbon); }
.btn-primary:hover { background: #FF6B1F; }
.btn-ghost { background: transparent; color: var(--fog); border: 1px solid rgba(232,235,238,0.28); }
.btn-ghost:hover { border-color: rgba(232,235,238,0.55); }
.hero-note { font-size: 13px; color: var(--muted); margin-top: 16px; }

.shots {
  display: flex; gap: 22px; justify-content: center; align-items: flex-end;
  margin-top: 58px; padding-bottom: 0;
}
.shots img {
  width: 260px; max-width: 42vw; border-radius: 22px 22px 0 0;
  border: 1px solid rgba(232,235,238,0.14); border-bottom: 0;
  box-shadow: 0 -8px 60px rgba(0,0,0,0.5); display: block;
}
.shots img:nth-child(2) { margin-bottom: -26px; }
@media (max-width: 560px) { .shots img:nth-child(2) { display: none; } .shots img { width: 78vw; max-width: 320px; } }

/* ---------- sections ---------- */
section { padding: 76px 0; }
section h2 {
  font-size: clamp(27px, 3.6vw, 36px); line-height: 1.12; letter-spacing: -0.028em;
  font-weight: 700; color: var(--carbon); margin: 0 0 16px; max-width: 20ch;
  text-wrap: balance;
}
section p { max-width: 62ch; }
section > .wrap > .kicker, section > .wrap > h2 { max-width: 22ch; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 44px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.card {
  background: #fff;
  min-height: 190px; border: 1px solid rgba(15,18,22,0.09); border-radius: 18px;
  padding: 24px; display: flex; flex-direction: column; gap: 8px;
}
.card h3 { margin: 0; font-size: 17px; color: var(--carbon); font-weight: 600; }
.card p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.card .n {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.16em;
  color: var(--accent-strong); margin-bottom: 4px;
}

.dark { background: var(--carbon); color: #C8CCD1; }
.dark h2 { color: var(--fog); }
.dark .card { background: var(--ink-soft); border-color: rgba(232,235,238,0.1); }
.dark .card h3 { color: var(--fog); }
.dark .card p { color: var(--muted); }

/* ---------- legal pages ---------- */
.legal { padding: 56px 0 90px; }
.legal h1 {
  font-size: clamp(30px, 4.6vw, 42px); line-height: 1.08; letter-spacing: -0.03em;
  color: var(--carbon); margin: 0 0 10px; font-weight: 700;
}
.legal .updated { font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 34px; }
.legal h2 {
  font-size: 20px; letter-spacing: -0.015em; color: var(--carbon);
  margin: 40px 0 10px; font-weight: 600; max-width: none;
}
.legal h3 { font-size: 16px; color: var(--carbon); margin: 24px 0 6px; font-weight: 600; }
.legal p, .legal li { max-width: 68ch; font-size: 15.5px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 7px; }
.legal .callout {
  background: var(--paper); border-left: 3px solid var(--accent);
  padding: 16px 20px; border-radius: 0 12px 12px 0; margin: 26px 0;
}
.legal .callout p { margin: 0; }
.legal a { color: var(--accent-strong); }
.toc {
  background: #fff; border: 1px solid rgba(15,18,22,0.09); border-radius: 14px;
  padding: 18px 22px; margin: 0 0 34px;
}
.toc ol { margin: 8px 0 0; padding-left: 20px; }
.toc li { margin-bottom: 4px; font-size: 14.5px; }
.toc a { color: var(--gunmetal); text-decoration: none; }
.toc a:hover { color: var(--accent-strong); text-decoration: underline; }

table.data { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 14.5px; }
table.data th, table.data td {
  text-align: left; padding: 11px 12px; border-bottom: 1px solid rgba(15,18,22,0.1);
  vertical-align: top;
}
table.data th {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.tbl-scroll { overflow-x: auto; }

/* ---------- footer ---------- */
footer.site { background: var(--carbon-deep); color: var(--muted); padding: 46px 0 40px; }
footer.site .cols { display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: flex-start; }
footer.site a { color: #C8CCD1; text-decoration: none; font-size: 14px; display: block; margin-bottom: 7px; }
footer.site a:hover { color: var(--fog); }
footer.site .colhead {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: #6B7178; margin-bottom: 12px;
}
footer.site .base {
  margin-top: 34px; padding-top: 22px; border-top: 1px solid rgba(232,235,238,0.1);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
}
footer.site .copy { font-size: 13px; color: #6B7178; }

/* ---------- endevo maker's mark (ENDEVO-BRAND.md §8.1, verbatim geometry) ---------- */
.endevo-credit { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.endevo-credit .e-mark { display: inline-flex; gap: 2px; }
.endevo-credit .e-mark .e-solid,
.endevo-credit .e-mark .e-outline { width: 4px; height: 12px; transform: skewX(-18deg); display: block; }
.endevo-credit .e-mark .e-solid { background: #79B4A9; }
.endevo-credit .e-mark .e-outline { border: 1px solid #0F1216; }
.endevo-credit .e-text {
  font-family: 'Josefin Sans', sans-serif; font-weight: 300;
  font-size: 12px; color: #9A9DA3; text-transform: lowercase;
}
.endevo-credit .e-word { font-size: 13.5px; letter-spacing: 0.02em; color: #3A424C; }
.endevo-credit.dark .e-mark .e-outline { border-color: #E8EBEE; }
.endevo-credit.dark .e-text { color: rgba(232, 235, 238, 0.5); }
.endevo-credit.dark .e-word { color: #E8EBEE; }

a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ===========================================================================
   Hero composition — asymmetric split.

   The first pass centred two phones under the copy and drew a fake dynamic
   island on each. Two problems: the island sat ON TOP of real UI (it covered
   the RallyReel wordmark and the session title), and the phones hard-cut
   against the section edge. Both are gone. There is no synthetic notch — the
   status bar is already cropped away inside the frame, so simulating one only
   re-occludes the product.

   Now: copy left, devices right on a shallow perspective, overlapping, with
   the lower edge dissolving into the ground instead of colliding with it.
   =========================================================================== */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  position: relative;
  z-index: 1;
}
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 8px; }
}

.device-stage {
  position: relative;
  perspective: 1600px;
  perspective-origin: 40% 50%;
  min-height: 560px;
}
@media (max-width: 940px) {
  .device-stage { min-height: 420px; margin-top: 12px; }
}

.device {
  position: absolute;
  width: 236px;
  aspect-ratio: 9 / 19.3;
  border-radius: 32px;
  padding: 7px;
  background: linear-gradient(155deg, #333A42 0%, #171C22 38%, #0B0E11 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.13) inset,
    0 50px 100px -28px rgba(0,0,0,0.9),
    0 0 0 1px rgba(232,235,238,0.06);
  transform-style: preserve-3d;
}
.device .screen {
  position: relative; width: 100%; height: 100%;
  border-radius: 26px; overflow: hidden; background: var(--fog);
}
/* Pull the capture up so its iOS status bar is hidden by the bezel. No fake
   notch is drawn — one would land on top of the app's own header. */
.device .screen img { position: absolute; top: -5.4%; left: 0; width: 100%; display: block; }

/* Front phone: closer, upright, catching the light. */
.device--front {
  left: 4%; top: 34px; z-index: 2;
  transform: rotateY(-9deg) rotateX(1.5deg) translateZ(40px);
}
/* Back phone: further, tilted away, dimmed so depth reads as distance. */
.device--back {
  left: 42%; top: 0; z-index: 1;
  transform: rotateY(-13deg) rotateX(2deg) translateZ(-30px) scale(.955);
  filter: brightness(.82) saturate(.94);
}
@media (max-width: 940px) {
  .device--front { left: 50%; margin-left: -170px; top: 12px; transform: rotateY(-7deg); }
  .device--back  { left: 50%; margin-left: -30px;  top: 0;   transform: rotateY(-11deg) scale(.95); }
}
@media (max-width: 560px) {
  .device--back { display: none; }
  .device--front { left: 50%; margin-left: -118px; transform: none; }
}

/* Dissolve the lower edge into the hero ground so the phones end rather than
   get chopped by the section boundary. */
.device-stage::after {
  content: ''; position: absolute; left: -12%; right: -12%; bottom: -1px; height: 130px;
  background: linear-gradient(to bottom, rgba(15,18,22,0) 0%, var(--carbon) 88%);
  pointer-events: none; z-index: 3;
}

/* ===========================================================================
   Motion. Everything is transform/opacity only so it stays on the compositor.
   All of it is disabled wholesale under prefers-reduced-motion — the media
   query at the top of this file already kills transitions and animations, and
   the reveal script checks the same preference before observing anything.
   =========================================================================== */
.reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity 620ms cubic-bezier(.22,.61,.36,1),
              transform 620ms cubic-bezier(.22,.61,.36,1);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 90ms; }
.reveal[data-delay="2"] { transition-delay: 180ms; }
.reveal[data-delay="3"] { transition-delay: 270ms; }

/* Hero entrance — runs once on load, not on scroll. */
@keyframes riseIn {
  from { opacity: 0; transform: translate3d(0, 26px, 0); }
  to   { opacity: 1; transform: none; }
}
.hero .kicker  { animation: riseIn 700ms cubic-bezier(.22,.61,.36,1) both; }
.hero h1       { animation: riseIn 760ms cubic-bezier(.22,.61,.36,1) 80ms both; }
.hero .lede    { animation: riseIn 760ms cubic-bezier(.22,.61,.36,1) 160ms both; }
.hero .cta-row { animation: riseIn 760ms cubic-bezier(.22,.61,.36,1) 240ms both; }
.hero .hero-note { animation: riseIn 760ms cubic-bezier(.22,.61,.36,1) 320ms both; }
.device-stack .device { animation: riseIn 900ms cubic-bezier(.22,.61,.36,1) 380ms both; }
.device-stack .device:nth-child(2) { animation-delay: 480ms; }

/* Parallax layers. Depth is applied by JS writing --py; the transform reads it
   so no layout is touched and nothing reflows during scroll. */
.par { transform: translate3d(0, calc(var(--py, 0) * 1px), 0); will-change: transform; }

/* An ambient orange bloom behind the hero phones, drifting slowly. */
.hero-glow {
  position: absolute; left: 50%; bottom: -180px;
  width: min(900px, 120vw); height: 520px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(241,90,10,0.30), rgba(241,90,10,0) 72%);
  filter: blur(18px);
  pointer-events: none; z-index: 0;
  animation: bloom 9s ease-in-out infinite alternate;
}
@keyframes bloom {
  from { opacity: .55; transform: translateX(-50%) scale(1); }
  to   { opacity: .95; transform: translateX(-50%) scale(1.12); }
}
.hero .wrap, .device-stack { position: relative; z-index: 1; }

/* A faint court-line grid that drifts on scroll — subject-specific texture
   rather than a generic dot pattern. */
.court-lines {
  position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .16;
  background-image:
    linear-gradient(to right, rgba(232,235,238,.5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(232,235,238,.5) 1px, transparent 1px);
  background-size: 118px 118px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 35%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 35%, transparent 78%);
}

/* Cards lift on hover — pointer devices only, so it never fires on touch. */
@media (hover: hover) {
  .card { transition: transform 320ms cubic-bezier(.22,.61,.36,1), border-color 320ms; }
  .card:hover { transform: translateY(-4px); border-color: rgba(241,90,10,.42); }
  .btn { transition: transform 200ms cubic-bezier(.22,.61,.36,1), background 200ms, border-color 200ms; }
  .btn:hover { transform: translateY(-2px); }
}

/* Counters occupy their final width before animating so the row cannot jump. */
.stat-num { font-variant-numeric: tabular-nums; }

/* A scroll-progress hairline in the accent, fixed to the very top. */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  transform: scaleX(var(--sp, 0)); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  z-index: 100; pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .par { transform: none !important; }
  .hero-glow { animation: none; }
  .scroll-progress { display: none; }
}
