/* =============================================================================
   RedStripe — marketing landing (/site)
   Aesthetic: Neo-Swiss data grid. Rigorous hairline grid, razor alignment,
   restrained warm-paper palette, RedStripe red as the single sharp accent.
   Type: Archivo (variable grotesk) + Martian Mono (instrument/data accents).
   Self-hosted; satisfies the app CSP (style/script/font all 'self').
   ========================================================================== */

/* ---- Fonts (variable, single file per family) ---------------------------- */
@font-face {
  font-family: 'Archivo';
  src: url('/static/site/fonts/archivo-var.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Martian Mono';
  src: url('/static/site/fonts/martian-var.woff2') format('woff2');
  font-weight: 100 800;
  font-stretch: 75% 112%;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens -------------------------------------------------------------- */
:root {
  --paper:        #F0EEE8;  /* warm light canvas        */
  --panel:        #FBFAF6;  /* lighter raised panels    */
  --ink:          #16130F;  /* near-black, warm         */
  --ink-2:        #5C564C;  /* muted secondary text     */
  --ink-3:        #8C857A;  /* faint / captions         */
  --line:         #D7D2C7;  /* hairline grid            */
  --line-2:       #C3BDB0;  /* stronger rule            */
  --red:          #E5342B;  /* brand red — marks/accents*/
  --red-deep:     #C21F1A;  /* button bg (AA on white)  */
  --red-tint:     #FBE7E4;  /* faint red wash           */

  --maxw: 1220px;
  --gut: clamp(20px, 4vw, 56px);

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(0.97rem, 0.94rem + 0.15vw, 1.06rem);
  --step-1:  clamp(1.18rem, 1.08rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2.1rem, 1.6rem + 2.4vw, 3.4rem);
  --step-4:  clamp(2.8rem, 1.9rem + 4.4vw, 5.4rem);
  --step-5:  clamp(3.4rem, 2.0rem + 6.6vw, 7.2rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* faint paper grain over everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---- Layout primitives -------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gut);
}

.mono {
  font-family: 'Martian Mono', ui-monospace, monospace;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-family: 'Martian Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(229, 52, 43, 0.55);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229,52,43,0.5); }
  70%  { box-shadow: 0 0 0 9px rgba(229,52,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(229,52,43,0); }
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  padding: 0.85em 1.5em;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  will-change: transform;
}
.btn .arr { transition: transform 0.3s var(--ease); }
.btn:hover { transform: translateY(-2px); }
.btn:hover .arr { transform: translateX(4px); }

.btn--primary {
  background: var(--red-deep);
  border-color: var(--red-deep);
  color: #fff;
  box-shadow: 4px 4px 0 0 var(--ink);
}
.btn--primary:hover {
  box-shadow: 6px 6px 0 0 var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--paper); }

/* =============================================================================
   TOP BAR
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand img { height: 26px; width: auto; }
.brand__tag {
  font-family: 'Martian Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-left: 1px solid var(--line-2);
  padding-left: 0.7rem;
}
.nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.4rem); }
.nav a.nav__link {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-2);
  position: relative;
  transition: color 0.2s var(--ease);
}
.nav a.nav__link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  height: 2px; width: 0;
  background: var(--red);
  transition: width 0.28s var(--ease);
}
.nav a.nav__link:hover { color: var(--ink); }
.nav a.nav__link:hover::after { width: 100%; }
.nav__cta {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55em 1.15em;
  border: 1px solid var(--ink);
  transition: background 0.22s var(--ease), color 0.22s var(--ease);
}
.nav__cta:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 720px) {
  .nav__link, .brand__tag { display: none; }
}

/* =============================================================================
   HERO
   ========================================================================== */
.hero {
  border-bottom: 1px solid var(--line);
  position: relative;
}
/* vertical grid rules behind hero */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / 3) 100%;
  opacity: 0.5;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
.hero__in {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-block: clamp(3.5rem, 8vw, 7rem);
  position: relative;
}
@media (max-width: 880px) {
  .hero__in { grid-template-columns: 1fr; gap: 2.8rem; }
}

.hero h1 {
  font-size: var(--step-5);
  font-weight: 800;
  line-height: 0.96;
  letter-spacing: -0.035em;
  margin-top: 1.4rem;
  text-wrap: balance;
}
.hero h1 .accent {
  color: var(--red);
  font-style: italic;
}
.hero__sub {
  margin-top: 1.6rem;
  font-size: var(--step-1);
  color: var(--ink-2);
  max-width: 30ch;
  line-height: 1.45;
}
.hero__actions {
  margin-top: 2.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.hero__note {
  font-family: 'Martian Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

/* hero data panel ------------------------------------------------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line-2);
  box-shadow: 12px 12px 0 0 rgba(22,19,15,0.06);
}
.panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  font-family: 'Martian Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.panel__live { display: inline-flex; align-items: center; gap: 0.45em; color: var(--red); }
.panel__live .dot { width: 6px; height: 6px; background: var(--red); border-radius: 50%; animation: pulse 2s infinite; }
.panel__chart { padding: 1.2rem 1.1rem 0.4rem; }
.panel__chart svg { width: 100%; height: auto; }
.panel__legend {
  display: flex;
  gap: 1.3rem;
  padding: 0.4rem 1.1rem 1.1rem;
  font-family: 'Martian Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.panel__legend i { display: inline-block; width: 14px; height: 3px; margin-right: 0.45em; vertical-align: middle; }

/* svg chart strokes animate on load */
.chart-floor { stroke: var(--line-2); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.chart-price {
  stroke: var(--ink); stroke-width: 2.5; fill: none;
  stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 620; stroke-dashoffset: 620;
}
.is-in .chart-price { animation: draw 1.6s var(--ease) 0.3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-breach { fill: var(--red); opacity: 0; transform-box: fill-box; transform-origin: center; }
.is-in .chart-breach { animation: pop 0.5s var(--ease) 1.6s forwards; }
@keyframes pop { 0%{opacity:0; transform:scale(0);} 60%{transform:scale(1.4);} 100%{opacity:1; transform:scale(1);} }
.chart-flag { opacity: 0; }
.is-in .chart-flag { animation: fade 0.5s ease 1.85s forwards; }
@keyframes fade { to { opacity: 1; } }

/* =============================================================================
   LIVE TICKER (marquee)
   ========================================================================== */
.ticker {
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  white-space: nowrap;
}
.ticker__track {
  display: inline-flex;
  gap: 3rem;
  padding-block: 0.7rem;
  font-family: 'Martian Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  animation: marquee 38s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__item { display: inline-flex; align-items: center; gap: 0.6em; }
.ticker__item b { color: var(--red); font-weight: 600; }
.ticker__item .sku { color: var(--ink-3); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =============================================================================
   STAT BAND
   ========================================================================== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: clamp(1.8rem, 4vw, 3rem) clamp(1rem, 2.5vw, 2rem);
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }
.stat__num {
  font-family: 'Martian Mono', monospace;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}
.stat__num .u { color: var(--red); }
.stat__label {
  margin-top: 0.7rem;
  font-size: 0.82rem;
  color: var(--ink-2);
  max-width: 22ch;
}
@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--line); }
}

/* =============================================================================
   SECTION SCAFFOLD
   ========================================================================== */
.section { border-bottom: 1px solid var(--line); padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section__head {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
@media (max-width: 760px) { .section__head { grid-template-columns: 1fr; gap: 1.2rem; align-items: start; } }
.section__title {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-wrap: balance;
}
.section__lead { font-size: var(--step-1); color: var(--ink-2); line-height: 1.45; text-wrap: pretty; }
.idx { font-family: 'Martian Mono', monospace; font-size: 0.66rem; letter-spacing: 0.16em; color: var(--red); text-transform: uppercase; }

/* ---- Problem statement -------------------------------------------------- */
.lede {
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.02em;
  max-width: 22ch;
}
.problem__grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem,5vw,4rem); align-items: start; }
@media (max-width: 820px) { .problem__grid { grid-template-columns: 1fr; gap: 2rem; } }
.problem__body p { color: var(--ink-2); max-width: 52ch; }
.problem__body p + p { margin-top: 1.1rem; }
.problem__body strong { color: var(--ink); font-weight: 600; }

/* ---- How it works (numbered steps) ------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); }
.step {
  padding: 2rem 1.4rem 2.4rem;
  border-right: 1px solid var(--line);
  position: relative;
}
.step:last-child { border-right: 0; }
.step__n {
  font-family: 'Martian Mono', monospace;
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.05em;
  color: var(--paper);
  -webkit-text-stroke: 1.2px var(--line-2);
  line-height: 1;
}
.step:hover .step__n { color: var(--red); -webkit-text-stroke: 0; transition: color 0.3s var(--ease); }
.step h3 { margin-top: 1.4rem; font-size: var(--step-1); font-weight: 600; letter-spacing: -0.02em; }
.step p { margin-top: 0.6rem; font-size: 0.88rem; color: var(--ink-2); }
.step::after {
  content: '';
  position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--red);
  transition: width 0.4s var(--ease);
}
.step:hover::after { width: 100%; }
@media (max-width: 820px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(1), .step:nth-child(2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .steps { grid-template-columns: 1fr; }
  .step { border-right: 0; border-bottom: 1px solid var(--line); }
  .step:last-child { border-bottom: 0; }
}

/* ---- Features grid ------------------------------------------------------ */
.features { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.feat { background: var(--panel); padding: 1.8rem 1.6rem 2rem; transition: background 0.3s var(--ease); }
.feat:hover { background: var(--paper); }
.feat--lg { grid-column: span 3; }
.feat--sm { grid-column: span 2; }
.feat--wide { grid-column: span 6; }
@media (max-width: 900px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .feat--lg, .feat--sm, .feat--wide { grid-column: span 1; }
  .feat--wide { grid-column: span 2; }
}
@media (max-width: 560px) {
  .features { grid-template-columns: 1fr; }
  .feat--wide { grid-column: span 1; }
}
.feat__k { font-family: 'Martian Mono', monospace; font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); }
.feat h3 { margin-top: 0.9rem; font-size: var(--step-1); font-weight: 600; letter-spacing: -0.02em; }
.feat p { margin-top: 0.55rem; font-size: 0.88rem; color: var(--ink-2); max-width: 40ch; }
.feat__big {
  font-family: 'Martian Mono', monospace; font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -0.05em; line-height: 1; color: var(--ink);
}
.feat__big .u { color: var(--red); }

/* =============================================================================
   CTA
   ========================================================================== */
.cta { background: var(--ink); color: var(--paper); border-bottom: 1px solid var(--ink); position: relative; overflow: hidden; }
.cta::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 80% 20%, rgba(229,52,43,0.22), transparent 45%);
  pointer-events: none;
}
.cta__in { padding-block: clamp(4rem, 9vw, 7rem); position: relative; display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 2rem; align-items: center; }
@media (max-width: 760px) { .cta__in { grid-template-columns: 1fr; gap: 2.2rem; } }
.cta h2 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; line-height: 0.98; text-wrap: balance; }
.cta h2 .accent { color: var(--red); }
.cta p { margin-top: 1.2rem; color: rgba(240,238,232,0.7); max-width: 40ch; font-size: var(--step-1); }
.cta .btn--primary { box-shadow: 4px 4px 0 0 var(--red); }
.cta .btn--primary:hover { box-shadow: 6px 6px 0 0 var(--red); }
.cta__actions { display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; }
.cta .btn--line { border-color: rgba(240,238,232,0.35); color: var(--paper); }
.cta .btn--line:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* =============================================================================
   FOOTER
   ========================================================================== */
.foot { padding-block: 2.6rem; }
.foot__in { display: flex; flex-wrap: wrap; gap: 1.5rem 2rem; align-items: center; justify-content: space-between; }
.foot img { height: 22px; opacity: 0.9; }
.foot__meta { font-family: 'Martian Mono', monospace; font-size: 0.64rem; letter-spacing: 0.06em; color: var(--ink-3); }
.foot__links { display: flex; gap: 1.6rem; font-size: 0.82rem; color: var(--ink-2); }
.foot__links a:hover { color: var(--red); }

/* =============================================================================
   REVEAL ANIMATIONS
   ========================================================================== */
[data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }
[data-reveal][data-delay="1"] { transition-delay: 0.08s; }
[data-reveal][data-delay="2"] { transition-delay: 0.16s; }
[data-reveal][data-delay="3"] { transition-delay: 0.24s; }
[data-reveal][data-delay="4"] { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .chart-price { stroke-dashoffset: 0; }
  .chart-breach, .chart-flag { opacity: 1; }
}
