/* =========================================================
   1. RESET + DESIGN TOKENS
   ========================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }   /* JS handles smoothness via lerp */

:root {
  --bg-0: #0a0a0a;
  --bg-1: #f5f4ef;
  --ink: #111;
  --ink-mute: rgba(17, 17, 17, 0.55);
  --paper-mute: rgba(245, 244, 239, 0.55);
  --accent: #ff6a1a;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 2rem;
  --space-4: 4rem;
  --space-5: 8rem;

  --side-width: clamp(220px, 22vw, 360px);   /* width of each side panel at progress=1 */

  /* updated by JS, drives the hero shrink + side reveal */
  --progress: 0;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
}

body {
  background: var(--bg-1);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

/* =========================================================
   2. SITE HEADER (transparent over hero, solid below)
   ========================================================= */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2rem;
  mix-blend-mode: difference;
  color: #fff;
  transition: padding 0.3s ease;
}
.site-header__brand {
  font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  font-size: 0.875rem;
}
.site-header__nav { display: flex; gap: 1.5rem; }
.site-header__nav a {
  font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
  opacity: 0.85; transition: opacity 0.2s;
}
.site-header__nav a:hover { opacity: 1; }

/* =========================================================
   3. HERO ZONE — sticky + horizontal shrink driven by --progress
   ========================================================= */
.hero-zone {
  position: relative;
  height: 220vh;             /* total scroll runway for the hero */
  background: var(--bg-0);
}

.hero-sticky {
  position: sticky; top: 0;
  width: 100%; height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* The frame that visibly shrinks. Canvas behind, overlay on top. */
.hero-frame {
  position: relative;
  width: calc(100vw - var(--progress) * var(--side-width) * 2);
  height: 100vh;
  overflow: hidden;
  background: var(--bg-0);
  transition: border-radius 0.4s ease;
  border-radius: calc(var(--progress) * 24px);
  will-change: width;
}

/* Canvas always renders at full viewport; clipped by frame. No GL resize during scroll. */
.hero-canvas {
  position: absolute;
  left: 50%; top: 50%;
  width: 100vw; height: 100vh;
  transform: translate(-50%, -50%);
  pointer-events: none;
  cursor: none;
}

.hero-overlay {
  position: absolute; inset: 0;
  display: grid; align-content: end;
  padding: 4rem 5vw;
  color: #fff;
  pointer-events: none;
  mix-blend-mode: difference;
}
.hero-eyebrow {
  font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase;
  opacity: 0.7; margin-bottom: 1rem;
}
.hero-title {
  font-size: clamp(2.5rem, 8vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 700;
  max-width: 16ch;
  margin-bottom: 1.5rem;
}
.hero-title em { font-style: normal; color: var(--accent); }
.hero-sub {
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  max-width: 38ch; opacity: 0.75;
  margin-bottom: 2rem;
}
.hero-scroll-cue {
  font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase;
  opacity: 0.6;
}
.hero-scroll-cue::before {
  content: '↓ '; display: inline-block; margin-right: 0.4rem;
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(4px); }
}

/* Side panels — slide in from outside as the frame shrinks */
.hero-side {
  position: absolute; top: 0;
  width: var(--side-width); height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem 2rem;
  color: var(--ink);
  background: var(--bg-1);
  will-change: transform;
}
.hero-side--left {
  left: 0;
  transform: translateX(calc((var(--progress) - 1) * 100%));
}
.hero-side--right {
  right: 0;
  transform: translateX(calc((1 - var(--progress)) * 100%));
}
.side-eyebrow {
  font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase;
  opacity: 0.5; margin-bottom: 1.5rem;
}
.side-card-title {
  font-size: clamp(1.1rem, 1.4vw, 1.4rem);
  line-height: 1.25; font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.side-card-body {
  font-size: 0.875rem; line-height: 1.55;
  color: var(--ink-mute);
  margin-bottom: 2rem;
}
.side-stat {
  display: flex; align-items: baseline; gap: 0.6rem;
  border-top: 1px solid rgba(0,0,0,0.12);
  padding-top: 1.5rem;
}
.side-stat__num { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.04em; }
.side-stat__label {
  font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0.55;
}

/* =========================================================
   4. STANDARD SECTIONS (about / features / cta / footer)
   ========================================================= */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

section[data-reveal] > * {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.6, 0.2, 1),
              transform 0.9s cubic-bezier(0.2, 0.6, 0.2, 1);
}
section[data-reveal].is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}
section[data-reveal].is-revealed > *:nth-child(2) { transition-delay: 0.08s; }
section[data-reveal].is-revealed > *:nth-child(3) { transition-delay: 0.16s; }

.eyebrow {
  font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase;
  opacity: 0.5; margin-bottom: 1.5rem;
}
.section-title {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05; letter-spacing: -0.03em; font-weight: 700;
  max-width: 22ch;
}

/* About */
.about {
  padding: 10rem 0;
  background: var(--bg-1);
}
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 5rem;
  align-items: end;
}
.about-text p {
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: 1.7;
  color: var(--ink-mute);
  margin-top: 2rem;
  max-width: 48ch;
}
.about-img {
  aspect-ratio: 4 / 5;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.75rem, 3vw, 2.75rem);
  background:
    radial-gradient(ellipse at 30% 20%, #f1ece2 0%, transparent 60%),
    linear-gradient(165deg, #ebe5d8 0%, #d8d1c2 100%);
  isolation: isolate;
}
/* Inline SVG grain — paper / fabric noise overlay */
.about-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='400' height='400' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  opacity: 0.45;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}
/* Subtle inner shadow for paper depth */
.about-img::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.10);
  pointer-events: none;
  z-index: 0;
}
.about-img__quote {
  position: relative;
  z-index: 1;
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.035em;
  color: #1a1a18;
  max-width: 12ch;
  margin: 0;
}
.about-img__attribution {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(26, 26, 24, 0.55);
}

/* Features */
.features {
  padding: 10rem 0;
  background: var(--bg-0);
  color: #fff;
}
.features .section-title { color: #fff; }
.features .eyebrow { color: rgba(255,255,255,0.55); }
.features-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: end;
  margin-bottom: 5rem;
}
.features-head p {
  color: rgba(255,255,255,0.6);
  font-size: 1.05rem; line-height: 1.65;
  max-width: 48ch;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  perspective: 1200px;                 /* 3D viewport for card tilt */
}
.feature-card {
  --mx: 0;                             /* cursor x in [-1, 1], JS-driven */
  --my: 0;
  --lift: 0;                           /* 0 idle, 1 fully hovered */

  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 2.5rem 2rem;
  border-radius: 4px;
  min-height: 360px;
  display: flex; flex-direction: column;
  transform-style: preserve-3d;
  transform:
    translateY(calc(var(--lift) * -6px))
    rotateX(calc(var(--my) * -6deg))
    rotateY(calc(var(--mx) *  6deg));
  transition: background 0.3s, border-color 0.3s;
  will-change: transform;
}
.feature-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,106,26,0.5);
}
/* Feature card hero — big-typo + dark paper grain composition */
.feature-card__hero {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: clamp(1.25rem, 2vw, 1.75rem);
  margin-bottom: 1.75rem;
  font-size: clamp(2.8rem, 5.5vw, 5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: #e8e2d2;                                   /* warm off-white "ink" */
  background:
    radial-gradient(ellipse at 75% 110%, rgba(255, 106, 26, 0.10) 0%, transparent 60%),
    linear-gradient(160deg, #1c1916 0%, #0c0b0a 100%);
  transform: translateZ(calc(var(--lift) * 48px));   /* strongest parallax */
}
/* paper grain — white noise via SVG, screen-blended for dark base */
.feature-card__hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.55 0'/></filter><rect width='400' height='400' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
  opacity: 0.30;
  mix-blend-mode: lighten;
  pointer-events: none;
  z-index: -1;
}
/* inner shadow for paper depth */
.feature-card__hero::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: -1;
}
.feature-card__title {
  font-size: 1.5rem; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.2;
  margin-top: auto;                                  /* push toward bottom of card */
  margin-bottom: 1rem;
  transform: translateZ(calc(var(--lift) * 28px));
}
.feature-card__body {
  font-size: 0.9rem; line-height: 1.6;
  color: rgba(255,255,255,0.55);
  transform: translateZ(calc(var(--lift) * 14px));
}

/* CTA */
.cta {
  padding: 10rem 0;
  background: var(--accent);
  color: #fff;
}
.cta-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3rem;
}
.cta-title {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05; letter-spacing: -0.03em; font-weight: 700;
  max-width: 18ch;
}
.cta-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 1.2rem 2rem;
  background: #fff; color: var(--ink);
  border-radius: 999px;
  font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 600;
  transition: transform 0.2s, background 0.2s;
}
.cta-btn:hover { transform: scale(1.04); background: #111; color: #fff; }

/* Footer */
.site-footer {
  padding: 4rem 0 2rem;
  background: var(--bg-0);
  color: rgba(255,255,255,0.6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 3rem;
  align-items: start;
  padding-bottom: 4rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-brand {
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em; color: #fff;
  margin-bottom: 1rem;
}
.footer-tagline { font-size: 0.85rem; max-width: 32ch; line-height: 1.5; }
.footer-col-title {
  font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: #fff; margin-bottom: 1rem;
}
.footer-col ul { list-style: none; display: grid; gap: 0.5rem; }
.footer-col a { font-size: 0.85rem; }
.footer-col a:hover { color: #fff; }
.footer-meta {
  display: flex; justify-content: space-between;
  padding-top: 2rem;
  font-size: 0.75rem; letter-spacing: 0.06em;
}

/* =========================================================
   4b. SCROLL-STOP (frame sequence sticky canvas)
   ========================================================= */
.scroll-stop {
  position: relative;
  height: 300vh;                  /* runway: 200vh of scroll for the effect */
  background: var(--bg-0);
  color: #fff;
}
.scroll-stop__sticky {
  position: sticky; top: 0;
  width: 100%; height: 100vh;
  overflow: hidden;
}
.scroll-stop__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  display: block;
  background: var(--bg-0);
}

/* Heading: top-left, always visible while sticky is active */
.ss-heading {
  position: absolute;
  top: clamp(2rem, 5vh, 4rem);
  left: 5vw;
  right: 5vw;
  z-index: 3;
  pointer-events: none;
}
.ss-heading .eyebrow { color: rgba(255,255,255,0.55); margin-bottom: 0.75rem; }
.ss-title {
  font-size: clamp(1.8rem, 4.2vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
  max-width: 22ch;
}

/* Cards: bottom-left, progress-driven fade in/out */
.ss-cards {
  position: absolute;
  left: 5vw;
  right: 5vw;
  bottom: clamp(2rem, 6vh, 5rem);
  z-index: 4;
  pointer-events: none;
  min-height: 12rem;
}
.ss-card {
  position: absolute;
  bottom: 0; left: 0;
  max-width: 30rem;
  padding: 1.5rem 1.75rem;
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: auto;
}
.ss-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.ss-card__num {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.ss-card__title {
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.ss-card__body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.65);
  max-width: 36ch;
}

/* Loader: full overlay until preload finishes */
.ss-loader {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: var(--bg-0);
  transition: opacity 0.5s ease;
  --ss-progress: 0;
}
.ss-loader.is-done {
  opacity: 0;
  pointer-events: none;
}
.ss-loader__bar {
  width: clamp(180px, 22vw, 280px);
  height: 2px;
  background: rgba(255, 255, 255, 0.10);
  position: relative;
  overflow: hidden;
}
.ss-loader__bar::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--accent);
  transform: scaleX(var(--ss-progress));
  transform-origin: left;
  transition: transform 0.15s ease;
}
.ss-loader__text {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

/* =========================================================
   5. RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .hero-zone { height: 100vh; }
  .hero-frame { width: 100vw; border-radius: 0; }
  .hero-side { display: none; }
  .about-grid, .features-head, .features-grid, .cta-inner, .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .features-grid { gap: 1rem; }
  .site-header__nav { display: none; }
  .about, .features, .cta { padding: 5rem 0; }

  /* scroll-stop: shorter runway, compact card */
  .scroll-stop { height: 250vh; }
  .ss-heading { top: 1.5rem; left: 1.25rem; right: 1.25rem; }
  .ss-title { font-size: clamp(1.4rem, 7vw, 2.2rem); max-width: 20ch; }
  .ss-cards { bottom: 1.5rem; left: 1.25rem; right: 1.25rem; min-height: 8rem; }
  .ss-card { padding: 1rem 1.1rem; max-width: 100%; }
  .ss-card__body { display: none; }   /* compact: number + title only on mobile */
}

/* =========================================================
   6. LOAD-ERROR OVERLAY
   ========================================================= */
#load-err {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0,0,0,0.85);
  font: 14px/1.6 var(--font);
  padding: 32px; text-align: center;
}
#load-err code {
  background: #222; padding: 4px 8px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
