/* ============================================================
   ORIGEN — coffee demo
   Recipe: Product Scrub & Split · ProfitRigs flagship #1
   ============================================================ */

:root {
  /* Palette sampled from the generated footage */
  --cream: #ecdebf;        /* page ground, matches video bg */
  --cream-hi: #f6eeda;     /* lighter panels */
  --cream-lo: #dcc9a1;     /* vignette edge */
  --latte: #c19a6b;        /* accent */
  --roast: #4a3428;        /* primary text */
  --espresso: #241610;     /* headings / dark section */
  --ink-on-dark: #f2e7d3;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 76px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overscroll-behavior-y: none; }

body {
  font-family: var(--font-body);
  color: var(--roast);
  background: var(--cream);
  background-image: radial-gradient(120% 90% at 50% 40%, var(--cream-hi) 0%, var(--cream) 55%, var(--cream-lo) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--roast); color: var(--cream-hi); }

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

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--cream);
  background-image: radial-gradient(120% 90% at 50% 40%, var(--cream-hi) 0%, var(--cream) 55%, var(--cream-lo) 100%);
  display: flex; align-items: center; justify-content: center;
  transition: clip-path 1s var(--ease-out);
  clip-path: inset(0 0 0 0);
}
#loader.done { clip-path: inset(0 0 100% 0); pointer-events: none; }
.loader-inner { text-align: center; }
.loader-mark {
  font-family: var(--font-display);
  font-weight: 560; font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0.32em; text-indent: 0.32em;
  color: var(--espresso); margin-bottom: 28px;
}
.loader-bar {
  width: min(260px, 60vw); height: 2px; margin: 0 auto;
  background: color-mix(in srgb, var(--roast) 18%, transparent);
  overflow: hidden; border-radius: 2px;
}
.loader-bar span { display: block; width: 0%; height: 100%; background: var(--roast); transition: width .25s ease; }
.loader-pct {
  margin-top: 14px; font-size: 11px; letter-spacing: 0.28em;
  text-transform: uppercase; color: color-mix(in srgb, var(--roast) 65%, transparent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Idle-life layers ---------- */
.grain {
  position: fixed; inset: -100px; z-index: 90; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.045; mix-blend-mode: multiply;
  animation: grainShift 0.9s steps(3) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-40px, 25px); }
  66% { transform: translate(30px, -35px); }
  100% { transform: translate(0, 0); }
}
#dust { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }

/* ---------- Nav ---------- */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 56px);
  transition: transform .5s var(--ease-out);
}
#nav.hidden { transform: translateY(-100%); }
.nav-mark {
  font-family: var(--font-display); font-weight: 560;
  letter-spacing: 0.3em; text-indent: 0.3em; font-size: 1.05rem;
  color: var(--espresso);
}
.nav-links { display: flex; gap: clamp(18px, 3vw, 40px); }
.nav-links a, .nav-cta {
  font-size: 12px; font-weight: 650; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--roast); position: relative; padding: 8px 2px;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 2px; height: 1px;
  background: var(--roast); transition: right .4s var(--ease-out);
}
.nav-links a:hover::after { right: 0; }
.nav-cta {
  border: 1px solid color-mix(in srgb, var(--roast) 55%, transparent);
  padding: 10px 22px; border-radius: 999px;
  transition: background .35s var(--ease-out), color .35s var(--ease-out);
}
.nav-cta:hover { background: var(--roast); color: var(--cream-hi); }

/* ---------- Stage (pinned sequence) ---------- */
#stage { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
#seq { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Acts — overlay text choreographed against the footage */
.act { position: absolute; z-index: 5; will-change: transform, opacity; }

.act-hero {
  inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; text-align: center;
  padding-top: max(14vh, calc(var(--nav-h) + 4vh));
}
.overline {
  font-size: clamp(10px, 1.1vw, 12px); font-weight: 650;
  letter-spacing: 0.34em; text-transform: uppercase;
  color: color-mix(in srgb, var(--roast) 78%, transparent);
  margin-bottom: 3.2vh;
}
.wordmark {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(4.2rem, 16.5vw, 15rem);
  line-height: 0.94; letter-spacing: 0.06em; text-indent: 0.06em;
  color: var(--espresso); display: flex;
  margin-bottom: 2.6vh;
  /* the bean floats between R-I-G in the footage; title sits behind it */
  mix-blend-mode: multiply;
}
.wordmark .ch { display: inline-block; }
/* Sits in the plain lower-third of the footage (cream ground, below the
   bean + its shadow) so it never overlaps the subject — RECIPE-RULES §4 */
.tagline {
  position: absolute; left: 0; right: 0; bottom: 12.5vh;
  text-align: center;
  font-family: var(--font-display); font-weight: 340; font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.6rem);
  color: color-mix(in srgb, var(--roast) 88%, transparent);
}
.scrollcue {
  position: absolute; bottom: 4.5vh; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 650; letter-spacing: 0.34em; text-transform: uppercase;
  color: color-mix(in srgb, var(--roast) 70%, transparent);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.scrollcue-line {
  width: 1px; height: 44px; overflow: hidden; position: relative;
  background: color-mix(in srgb, var(--roast) 22%, transparent);
}
.scrollcue-line::after {
  content: ""; position: absolute; left: 0; top: -50%; width: 100%; height: 50%;
  background: var(--roast);
  animation: cueDrop 1.8s var(--ease-out) infinite;
}
@keyframes cueDrop { 0% { top: -50%; } 60% { top: 100%; } 100% { top: 100%; } }

/* Side acts */
.act-side {
  top: 50%; transform: translateY(-50%);
  width: min(34vw, 460px);
}
.act-left  { left: clamp(24px, 6.5vw, 110px); text-align: left; }
/* act-right sits tighter to the edge: the grind frame's right bean half
   reaches further right than any left-side subject (QA finding) */
.act-right { right: clamp(20px, 4.5vw, 80px); width: min(30vw, 430px); text-align: left; }
.act-label {
  display: inline-block; font-size: 10.5px; font-weight: 650;
  letter-spacing: 0.3em; text-transform: uppercase;
  /* roast, not latte: gold ghosts out over cream footage (QA finding 2026-08-26) */
  color: color-mix(in srgb, var(--roast) 88%, transparent); margin-bottom: 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--latte) 75%, transparent);
  padding-bottom: 8px;
}

/* Cream halo: keeps type legible when footage particles/subject pass behind it
   (QA dissection finding — see docs/RECIPE-RULES.md §6) */
.act-label, .act-title, .act-body, .overline, .tagline, .scrollcue,
.nav-mark, .nav-links a, .nav-cta {
  text-shadow:
    0 0 26px var(--cream),
    0 0 10px color-mix(in srgb, var(--cream) 80%, transparent),
    0 1px 3px color-mix(in srgb, var(--cream) 55%, transparent);
}
.act-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: 1.02;
  color: var(--espresso); margin-bottom: 20px;
}
.act-title .line { display: inline-block; }
.act-body {
  font-size: clamp(0.92rem, 1.15vw, 1.05rem); line-height: 1.75;
  color: color-mix(in srgb, var(--roast) 92%, transparent);
  max-width: 42ch;
}
.act-ctas { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block; padding: 15px 30px; border-radius: 999px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.2em; text-transform: uppercase;
  transition: background .35s var(--ease-out), color .35s var(--ease-out), border-color .35s var(--ease-out);
  will-change: transform;
}
.btn-solid { background: var(--espresso); color: var(--ink-on-dark); }
.btn-solid:hover { background: var(--roast); }
.btn-ghost { border: 1px solid color-mix(in srgb, var(--roast) 55%, transparent); color: var(--roast); }
.btn-ghost:hover { background: var(--roast); color: var(--cream-hi); border-color: var(--roast); }

/* Progress rail */
.rail {
  position: absolute; right: clamp(14px, 2.6vw, 40px); top: 50%;
  transform: translateY(-50%); z-index: 6;
  display: flex; flex-direction: column; gap: 22px;
}
.rail-dot { display: flex; align-items: center; gap: 10px; flex-direction: row-reverse; }
.rail-dot i {
  width: 7px; height: 7px; border-radius: 50%;
  background: color-mix(in srgb, var(--roast) 28%, transparent);
  transition: transform .4s var(--ease-out), background .4s var(--ease-out);
}
.rail-dot em {
  font-style: normal; font-size: 10px; font-weight: 650;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--roast); opacity: 0; transform: translateX(6px);
  transition: opacity .35s var(--ease-out), transform .35s var(--ease-out);
}
.rail-dot.on i { background: var(--roast); transform: scale(1.7); }
.rail-dot.on em, .rail-dot:hover em { opacity: 0.85; transform: translateX(0); }

/* ---------- Below-the-fold sections ---------- */
section:not(#stage) { position: relative; z-index: 4; }

.sec-label {
  display: inline-block; font-size: 11px; font-weight: 650;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--latte);
  margin-bottom: 22px;
}
.sec-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.2rem, 4.6vw, 4rem); line-height: 1.05;
  color: var(--espresso); margin-bottom: 28px;
}

/* Story */
#story { padding: clamp(90px, 14vh, 160px) clamp(20px, 6vw, 100px); }
.story-grid {
  display: grid; grid-template-columns: 1.05fr 1fr;
  gap: clamp(40px, 6vw, 100px); align-items: center;
  max-width: 1280px; margin: 0 auto;
}
.story-copy p { line-height: 1.8; margin-bottom: 20px; max-width: 52ch; }
.story-copy .btn { margin-top: 12px; }
.story-media img { border-radius: 4px; }
.story-media figcaption {
  margin-top: 14px; font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: color-mix(in srgb, var(--roast) 60%, transparent);
}

/* Roasts */
#roasts { padding: clamp(90px, 14vh, 160px) clamp(20px, 6vw, 100px); background: var(--cream-hi); }
#roasts .sec-head { max-width: 1280px; margin: 0 auto clamp(40px, 6vh, 70px); }
.cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 44px); max-width: 1280px; margin: 0 auto;
}
.card {
  background: var(--cream);
  border: 1px solid color-mix(in srgb, var(--roast) 10%, transparent);
  border-radius: 6px; padding: clamp(18px, 2vw, 28px);
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out);
}
.card:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--espresso) 35%, transparent); }
.card-media { border-radius: 4px; overflow: hidden; margin-bottom: 22px; aspect-ratio: 4 / 5; background: var(--cream-lo); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.card:hover .card-media img { transform: scale(1.045); }
.card-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.card h3 {
  font-family: var(--font-display); font-weight: 560;
  font-size: 1.6rem; color: var(--espresso); letter-spacing: 0.02em;
}
.card-price { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--roast); }
.card-notes { font-size: 0.88rem; line-height: 1.6; color: color-mix(in srgb, var(--roast) 75%, transparent); margin-bottom: 18px; }
.card-link {
  display: inline-block; font-size: 11.5px; font-weight: 650;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--roast);
  border-bottom: 1px solid color-mix(in srgb, var(--roast) 40%, transparent);
  padding-bottom: 4px; transition: border-color .3s var(--ease-out), color .3s var(--ease-out);
}
.card-link:hover { color: var(--espresso); border-color: var(--espresso); }

/* Visit */
#visit { padding: clamp(90px, 14vh, 160px) clamp(20px, 6vw, 100px); }
.visit-inner { max-width: 1280px; margin: 0 auto; }
.visit-cols {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 4vw, 60px); margin-top: clamp(30px, 5vh, 50px);
  max-width: 820px;
}
.visit-cols h4 {
  font-size: 11px; font-weight: 650; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--latte); margin-bottom: 12px;
}
.visit-cols p { line-height: 1.7; }

/* ---------- Footer ---------- */
footer { background: var(--espresso); color: var(--ink-on-dark); overflow: hidden; }
.marquee {
  border-bottom: 1px solid color-mix(in srgb, var(--ink-on-dark) 14%, transparent);
  padding: 20px 0; overflow: hidden; white-space: nowrap;
}
.marquee-track {
  display: inline-flex; white-space: nowrap;
  font-size: 12px; font-weight: 650; letter-spacing: 0.32em; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink-on-dark) 75%, transparent);
  animation: marquee 26s linear infinite;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.foot-mark {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(5rem, 19vw, 19rem); line-height: 0.9;
  letter-spacing: 0.04em; text-align: center;
  padding: clamp(40px, 7vh, 90px) 0 0;
  color: color-mix(in srgb, var(--ink-on-dark) 92%, transparent);
}
.foot-row {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: clamp(30px, 5vh, 50px) clamp(20px, 4vw, 56px);
  font-size: 12px; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--ink-on-dark) 55%, transparent);
}

/* ---------- Reveal defaults (JS animates in) ---------- */
[data-reveal] { opacity: 0; transform: translateY(36px); }
.no-js [data-reveal], .reduced [data-reveal] { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }

  /* Legibility scrims: on 9:16 the center-cropped subject fills the frame, so
     bottom-sheet copy and the nav need a soft cream bed (QA finding) */
  #stage::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 16vh;
    background: linear-gradient(to bottom,
      color-mix(in srgb, var(--cream) 88%, transparent) 0%,
      color-mix(in srgb, var(--cream) 45%, transparent) 55%, transparent 100%);
    pointer-events: none; z-index: 4;
  }
  #stage::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46vh;
    background: linear-gradient(to top,
      color-mix(in srgb, var(--cream) 96%, transparent) 0%,
      color-mix(in srgb, var(--cream) 82%, transparent) 38%,
      color-mix(in srgb, var(--cream) 40%, transparent) 70%, transparent 100%);
    pointer-events: none; z-index: 4;
  }

  .act-side, .act-left, .act-right {
    left: 50%; right: auto; top: auto; bottom: max(7vh, calc(env(safe-area-inset-bottom) + 44px));
    transform: translateX(-50%);
    width: min(88vw, 480px); text-align: center;
  }
  .act-label { margin-bottom: 12px; }
  .act-title { font-size: clamp(2.1rem, 9vw, 3rem); margin-bottom: 12px; }
  .act-body { font-size: 0.92rem; line-height: 1.65; margin: 0 auto; }
  .act-ctas { justify-content: center; margin-top: 20px; }
  .act-hero { padding-top: max(12vh, calc(var(--nav-h) + 2vh)); }
  .tagline { bottom: 14vh; }

  .rail { right: 12px; gap: 16px; }
  .rail-dot em { display: none; }

  .story-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .visit-cols { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain, .scrollcue-line::after { animation: none; }
  .marquee-track { animation-duration: 80s; }
}
