/* Founder story prototype (/lab/our-story/) — markup in src/content/pages/lab__our-story.html,
   behaviour in /js/story.js. Both themes. */
.sto {
  --st-bg: #fff;
  --st-ink: #2f3a42;
  --st-text: #5b5b5b;
  --st-muted: #8a8178;
  --st-accent: #a8866c;
  --st-sand: #ceb19c;
  --st-card: #faf7f3;
  --st-line: rgba(168, 134, 108, 0.28);
  background: var(--st-bg);
  color: var(--st-text);
  font-family: 'Cormorant Garamond', serif;
}
html.sm-dark .sto {
  --st-bg: #171513;
  --st-ink: #eee8e1;
  --st-text: #bdb5ac;
  --st-muted: #8f877e;
  --st-accent: #ceb19c;
  --st-card: #201d1a;
  --st-line: #3b3630;
}
.sto-main { padding: 0 !important; }
.sto *, .sto *::before, .sto *::after { box-sizing: border-box; }

/* ---------- buttons ---------- */
.sto-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border: 1px solid var(--st-accent);
  border-radius: 999px;
  background: var(--st-accent);
  color: #fff !important;
  font: 600 12px/1 'Poppins', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform 0.25s, background-color 0.25s, color 0.25s;
}
.sto-btn:hover { transform: translateY(-2px); }
.sto-btn--ghost { background: transparent; color: inherit !important; border-color: currentColor; }
html.sm-dark .sto-btn:not(.sto-btn--ghost) { color: #1d1916 !important; }

/* ---------- hero ---------- */
.sto-hero {
  position: relative;
  min-height: 78vh;
  display: grid;
  place-items: end start;
  padding: 0 7vw 9vh;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}
.sto-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  transform: scale(1.08);
  animation: sto-zoom 14s ease-out forwards;
}
@keyframes sto-zoom { to { transform: scale(1); } }
.sto-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(18, 14, 10, 0.78) 0%, rgba(18, 14, 10, 0.25) 55%, rgba(18, 14, 10, 0.1) 100%);
}
.sto-hero-in { max-width: 760px; }
.sto-hero-in > * { opacity: 0; transform: translateY(20px); animation: sto-up 1s cubic-bezier(0.22, 0.61, 0.16, 1) forwards; }
.sto-hero-in > :nth-child(2) { animation-delay: 0.15s; }
.sto-hero-in > :nth-child(3) { animation-delay: 0.3s; }
.sto-hero-in > :nth-child(4) { animation-delay: 0.45s; }
@keyframes sto-up { to { opacity: 1; transform: none; } }
.sto-kicker {
  margin: 0 0 14px !important;
  font: 600 12px/1 'Poppins', sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--st-sand) !important;
}
.sto-hero h1 {
  margin: 0 0 16px !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-size: clamp(40px, 6vw, 76px) !important;
  line-height: 1.04 !important;
  font-weight: 500 !important;
  color: #fff !important;
}
.sto-by { margin: 0 0 28px !important; font-size: 21px; font-style: italic; color: rgba(255, 255, 255, 0.85) !important; }
.sto-hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.sto-hero .sto-btn--ghost { color: #fff !important; }

/* ---------- chapter bar ---------- */
.sto-chapters {
  position: sticky;
  top: var(--sto-top, 0px);
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--st-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--st-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.sto-chapters a {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  font: 500 12px/1 'Poppins', sans-serif;
  letter-spacing: 0.04em;
  color: var(--st-muted) !important;
  text-decoration: none !important;
  white-space: nowrap;
  transition: color 0.25s, background-color 0.25s;
}
.sto-chapters a span { margin-right: 6px; color: var(--st-accent); font-weight: 600; }
.sto-chapters a.is-on { background: var(--st-accent); color: #fff !important; }
html.sm-dark .sto-chapters a.is-on { color: #1d1916 !important; }
.sto-chapters a.is-on span { color: inherit; }

/* ---------- story: text + sticky photo ---------- */
.sto-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 70px 24px 40px;
}
.sto-ch { padding: 10px 0 70px; scroll-margin-top: 140px; }
.sto-num {
  margin: 0 0 6px !important;
  font: 600 11px/1 'Poppins', sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--st-accent) !important;
}
.sto-h {
  margin: 0 0 22px !important;
  font-family: 'Cormorant Garamond', serif !important;
  font-size: 46px !important;
  line-height: 1.1 !important;
  font-weight: 500 !important;
  color: var(--st-ink) !important;
}
.sto-text p { margin: 0 0 18px !important; font-size: 22px; line-height: 1.55; color: var(--st-text); }
.sto-text p.sto-lead { font-size: 26px; font-weight: 600; color: var(--st-ink); }
.sto-quote {
  position: relative;
  margin: 34px 0 !important;
  padding: 6px 0 6px 28px !important;
  border: 0 !important;
  border-left: 3px solid var(--st-accent) !important;
  background: none !important;
}
.sto-quote p {
  margin: 0 !important;
  font-size: 34px !important;
  line-height: 1.25 !important;
  font-style: italic;
  color: var(--st-ink) !important;
}

/* scroll reveal for text pieces (added by story.js) */
html.sto-js .sto-text .sto-rv { opacity: 0; transform: translateY(22px); transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.22, 0.61, 0.16, 1); }
html.sto-js .sto-text .sto-rv.is-in { opacity: 1; transform: none; }

/* sticky photo column */
.sto-photos-in {
  position: sticky;
  top: 130px;
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.45);
}
.sto-photo {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.9s ease, transform 1.4s ease;
}
.sto-photo.is-on { opacity: 1; transform: none; }
.sto-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sto-photo figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 20px 16px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), transparent);
  color: #fff;
  font: 500 12px/1.4 'Poppins', sans-serif;
  letter-spacing: 0.04em;
}

/* ---------- route ---------- */
.sto-route { margin: 34px 0 !important; padding: 20px; border: 1px solid var(--st-line); border-radius: 18px; background: var(--st-card); }
.sto-route-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sto-route-end { font: 600 12px/1 'Poppins', sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--st-ink); }
.sto-route-line { position: relative; flex: 1; height: 2px; background: var(--st-line); }
.sto-route-line i {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--st-accent);
  transition: width 2.2s cubic-bezier(0.22, 0.61, 0.16, 1);
}
.sto-route-line i::after {
  content: "";
  position: absolute;
  right: -6px;
  top: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--st-accent);
}
.sto-route.is-in .sto-route-line i { width: 100%; }
.sto-route-km {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  font: 600 13px/1 'Poppins', sans-serif;
  color: var(--st-accent);
  white-space: nowrap;
}
.sto-route-map { position: relative; height: 300px; border-radius: 12px; overflow: hidden; background: var(--st-line); }
.sto-route-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
html.sm-dark .sto-route-map iframe { filter: invert(0.9) hue-rotate(180deg) saturate(0.6); }
.sto-route figcaption, .sto-loop figcaption {
  margin-top: 10px;
  font: 400 13px/1.4 'Poppins', sans-serif;
  color: var(--st-muted);
  text-align: center;
}

/* ---------- closed loop ---------- */
.sto-loop { position: relative; width: min(100%, 480px); margin: 30px auto 70px !important; aspect-ratio: 1; }
.sto-loop figcaption { position: absolute; left: 0; right: 0; bottom: -46px; }
.sto-loop svg { position: absolute; inset: 9%; width: 82%; height: 82%; overflow: visible; }
.sto-loop-track { fill: none; stroke: var(--st-line); stroke-width: 2; }
.sto-loop-run {
  fill: none;
  stroke: var(--st-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 880;
  stroke-dashoffset: 880;
  transform: rotate(-90deg);
  transform-origin: 200px 200px;
  transition: stroke-dashoffset 2.4s cubic-bezier(0.22, 0.61, 0.16, 1);
}
.sto-loop.is-in .sto-loop-run { stroke-dashoffset: 0; }
.sto-loop-dot { fill: var(--st-accent); transform-origin: 200px 200px; opacity: 0; }
.sto-loop.is-in .sto-loop-dot { opacity: 1; animation: sto-orbit 8s linear 2.4s infinite; }
@keyframes sto-orbit { to { transform: rotate(360deg); } }
.sto-loop-center {
  position: absolute;
  inset: 33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 19px;
  line-height: 1.15;
  color: var(--st-ink);
}
.sto-loop-center span { color: var(--st-accent); }
.sto-node {
  position: absolute;
  width: 31%;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--st-line);
  border-radius: 14px;
  background: var(--st-bg);
  text-align: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.6s, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s;
}
.sto-loop.is-in .sto-node { opacity: 1; transform: none; }
.sto-node span { font: 600 10px/1 'Poppins', sans-serif; color: var(--st-accent); }
.sto-node b { font-size: 20px; line-height: 1.1; color: var(--st-ink); }
.sto-node small { font: 400 11px/1.35 'Poppins', sans-serif; color: var(--st-muted); }
.sto-node.n1 { left: 50%; top: 0; translate: -50% 0; transition-delay: 0.3s; }
.sto-node.n2 { right: 0; top: 50%; translate: 0 -50%; transition-delay: 0.9s; }
.sto-node.n3 { left: 50%; bottom: 0; translate: -50% 0; transition-delay: 1.5s; }
.sto-node.n4 { left: 0; top: 50%; translate: 0 -50%; transition-delay: 2.1s; }
.sto-node.is-hot { border-color: var(--st-accent); box-shadow: 0 0 0 3px rgba(206, 177, 156, 0.25); }

/* ---------- timeline ---------- */
.sto-tl { position: relative; list-style: none !important; margin: 30px 0 10px !important; padding: 0 0 0 30px !important; }
.sto-tl::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--st-line); }
.sto-tl::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  width: 2px;
  height: 0;
  background: var(--st-accent);
  transition: height 2s cubic-bezier(0.22, 0.61, 0.16, 1);
}
.sto-tl.is-in::after { height: calc(100% - 12px); }
.sto-tl li {
  position: relative;
  margin: 0 0 22px !important;
  padding: 0 !important;
  list-style: none !important;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.6s, transform 0.6s;
}
.sto-tl li::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--st-accent);
  background: var(--st-bg);
}
.sto-tl li:last-child::before { background: var(--st-accent); }
.sto-tl.is-in li { opacity: 1; transform: none; }
.sto-tl.is-in li:nth-child(2) { transition-delay: 0.35s; }
.sto-tl.is-in li:nth-child(3) { transition-delay: 0.7s; }
.sto-tl.is-in li:nth-child(4) { transition-delay: 1.05s; }
.sto-tl.is-in li:nth-child(5) { transition-delay: 1.4s; }
.sto-tl-when { font: 600 11px/1 'Poppins', sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--st-accent); }
.sto-tl b { font-size: 24px; line-height: 1.2; color: var(--st-ink); }
.sto-tl small { font-size: 17px; line-height: 1.4; color: var(--st-muted); }

/* ---------- ending ---------- */
.sto-end {
  padding: 90px 24px 110px;
  text-align: center;
  background: var(--st-card);
  border-top: 1px solid var(--st-line);
}
.sto-end .sto-end-logo { width: 130px; margin-bottom: 26px; }
.sto-end blockquote {
  max-width: 820px;
  margin: 0 auto 34px !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
}
.sto-end blockquote p { margin: 0 !important; font-size: clamp(28px, 3.6vw, 44px) !important; line-height: 1.2 !important; font-style: italic; color: var(--st-ink) !important; }
.sto-end-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.sto-end .sto-btn--ghost { color: var(--st-ink) !important; }

/* ---------- video lightbox ---------- */
.sto-video {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 8, 6, 0.9);
}
.sto-video[hidden] { display: none; }
.sto-video-frame { position: relative; width: min(100%, 1100px); aspect-ratio: 16 / 9; }
.sto-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 12px; }
.sto-video-x {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .sto-body { grid-template-columns: 1fr; gap: 0; padding-top: 40px; }
  .sto-photos { display: none; }
  .sto-ch[data-img]::before {
    content: "";
    display: block;
    aspect-ratio: 4 / 3;
    margin: 0 0 22px;
    border-radius: 16px;
    background: var(--sto-img) center / cover no-repeat;
  }
  .sto-h { font-size: 36px !important; }
  .sto-text p { font-size: 20px; }
  .sto-quote p { font-size: 27px !important; }
  .sto-node small { display: none; }
  .sto-node { width: 30%; padding: 8px 6px; }
  .sto-node b { font-size: 15px; }
  .sto-loop-center { font-size: 15px; inset: 34%; }
}

@media (prefers-reduced-motion: reduce) {
  .sto-hero-bg, .sto-hero-in > * { animation: none !important; opacity: 1; transform: none; }
  .sto-loop-dot { animation: none !important; }
  html.sto-js .sto-text .sto-rv { opacity: 1; transform: none; transition: none; }
}
