/* KI-Kompass: sections story-scroll + story-teaser. Loaded only on pages that contain one of them (page.has_story).
   Colours from the green system only: #0B140C ground, #3F6B42 brand green, light sage (--color-sage, fallback #A9C7AB). */
.c-story, .c-story-teaser {
  --story-bg: var(--color-primary, #0B140C);
  --story-sage: var(--color-sage, #A9C7AB);
  --story-green: var(--color-secondary, #3F6B42);
  --story-line: rgba(169, 199, 171, .22);
  --story-muted: rgba(250, 250, 250, .7);
  --story-h: 100vh;
  background: var(--story-bg);
  color: var(--color-on-dark, #fff);
}
@supports (height: 100svh) { .c-story, .c-story-teaser { --story-h: 100svh; } }

/* ------------------------------------------------------------ story-scroll */
.c-story { position: relative; isolation: isolate; }
.c-story__sticky { position: sticky; top: 0; height: var(--story-h); z-index: 0; overflow: hidden; }
.c-story__stage { position: absolute; inset: 0; }
.c-story__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s var(--ease); }
.is-ready > .c-story__sticky .c-story__canvas, .c-story-teaser.is-ready .c-story__canvas { opacity: 1; }

/* static glow behind the object; becomes the full fallback (dot field) without WebGL */
.c-story__fallback {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(38% 46% at 70% 52%, rgba(63, 107, 66, .34), transparent 70%),
    radial-gradient(22% 28% at 70% 52%, rgba(169, 199, 171, .10), transparent 70%);
}
.is-fallback .c-story__fallback, .c-story:not(.is-js) .c-story__fallback, .c-story-teaser:not(.is-js) .c-story__fallback {
  background:
    radial-gradient(circle at 70% 52%, rgba(250, 250, 250, .55) 0 1px, transparent 1.6px) 0 0 / 14px 14px,
    radial-gradient(38% 46% at 70% 52%, rgba(63, 107, 66, .45), transparent 70%);
  -webkit-mask-image: radial-gradient(34% 42% at 70% 52%, #000 30%, transparent 75%);
  mask-image: radial-gradient(34% 42% at 70% 52%, #000 30%, transparent 75%);
}
.is-fallback .c-story__canvas { display: none; }

/* chapter navigation (vertical, right) */
.c-story__nav { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); z-index: 2; opacity: 0; transition: opacity .5s var(--ease); }
.c-story.is-inview .c-story__nav { opacity: 1; }
.c-story.is-outro .c-story__nav { opacity: .35; }
.c-story__nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.c-story__nav-link {
  position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 8px 0;
  color: rgba(250, 250, 250, .45); font-size: var(--fs-xs); letter-spacing: .08em; text-decoration: none;
  transition: color .3s var(--ease);
}
.c-story__nav-link::after { content: ""; width: 16px; height: 1px; background: currentColor; transition: width .4s var(--ease), background-color .3s; }
.c-story__nav-label { position: absolute; right: calc(100% + 14px); text-transform: uppercase; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateX(8px); transition: opacity .3s var(--ease), transform .3s var(--ease); }
.c-story__nav-num { font-variant-numeric: tabular-nums; }
.c-story__nav-link:hover, .c-story__nav-link:focus-visible { color: #fff; }
.c-story__nav-link:hover .c-story__nav-label, .c-story__nav-link:focus-visible .c-story__nav-label,
.c-story__nav-link.is-active .c-story__nav-label { opacity: 1; transform: none; }
.c-story__nav-link.is-active { color: var(--color-accent, #E3B85C); }
.c-story__nav-link.is-active::after { width: 40px; }
.c-story__nav-link:focus-visible { outline: 2px solid var(--story-sage); outline-offset: 4px; border-radius: 2px; }

/* text flow over the sticky stage */
.c-story__flow { position: relative; z-index: 1; margin-top: calc(-1 * var(--story-h)); pointer-events: none; }
.c-story__intro, .c-story__chapter, .c-story__outro { display: flex; align-items: center; }
.c-story__intro { min-height: var(--story-h); padding-block: calc(var(--header-h) + 24px) 64px; }
.c-story__chapter { min-height: calc(var(--story-h) * 1.5); padding-block: 15vh; scroll-margin-top: 0; }
.c-story__outro { min-height: calc(var(--story-h) * 1.2); padding-block: 15vh 20vh; }
.c-story__col { width: 100%; max-width: 540px; pointer-events: auto; }
.c-story__intro .c-story__col, .c-story__outro .c-story__col { max-width: 620px; }

.c-story .c-breadcrumb { margin-bottom: var(--space-5); }
.c-story__title { font-size: var(--fs-display); font-weight: var(--fw-light); line-height: var(--lh-tight); letter-spacing: -0.03em; margin: 0 0 var(--space-4); }
.c-story__lead { font-size: var(--fs-lg); color: var(--story-muted); max-width: 34em; margin: 0; }
.c-story__lead p { margin: 0 0 1em; }
.c-story__hint { display: inline-flex; align-items: center; gap: 12px; margin: var(--space-6) 0 0; font-size: var(--fs-xs); letter-spacing: var(--ls-eyebrow); text-transform: uppercase; color: rgba(250, 250, 250, .5); }
.c-story__hint span { position: relative; width: 1px; height: 40px; background: rgba(250, 250, 250, .2); overflow: hidden; }
.c-story__hint span::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--story-sage); animation: story-hint 2.4s var(--ease) infinite; }
@keyframes story-hint { to { top: 110%; } }

.c-story__num { margin: 0 0 var(--space-2); font-size: clamp(48px, 5vw, 72px); font-weight: 200; line-height: 1; letter-spacing: -0.04em; color: var(--color-accent, #E3B85C); opacity: .6; font-variant-numeric: tabular-nums; }
.c-story__headline { font-size: var(--fs-h2); font-weight: var(--fw-light); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); margin: 0 0 var(--space-3); }
.c-story__text { color: var(--story-muted); }
.c-story__text p { margin: 0 0 1em; }
.c-story__points { list-style: none; margin: var(--space-4) 0 0; padding: 0; border-top: 1px solid var(--story-line); }
.c-story__point { padding: 14px 0 14px 22px; border-bottom: 1px solid var(--story-line); position: relative; font-size: var(--fs-base); line-height: 1.5; color: var(--story-muted); }
.c-story__point::before { content: ""; position: absolute; left: 0; top: 23px; width: 8px; height: 1px; background: var(--story-sage); }
.c-story__point-title { display: block; color: #fff; font-weight: var(--fw-regular); }
.c-story__point-text { display: block; margin-top: 2px; font-size: var(--fs-sm); }
.c-story .c-actions { margin-top: var(--space-4); }

/* reveal (JS adds .is-js on the root and .is-visible per chapter) */
.c-story.is-js .c-story__col { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.c-story.is-js .is-visible .c-story__col { opacity: 1; transform: none; }

/* tablet */
@media (max-width: 1024px) {
  .c-story__col { max-width: 460px; }
  .c-story__nav-label { display: none; }
}

/* mobile: object small at the top of the sticky stage, text scrolls over it on a readable gradient */
@media (max-width: 767px) {
  .c-story__fallback { background: radial-gradient(60% 34% at 50% 36%, rgba(63, 107, 66, .38), transparent 72%); }
  .is-fallback .c-story__fallback, .c-story:not(.is-js) .c-story__fallback {
    background:
      radial-gradient(circle at 50% 36%, rgba(250, 250, 250, .5) 0 1px, transparent 1.6px) 0 0 / 12px 12px,
      radial-gradient(60% 34% at 50% 36%, rgba(63, 107, 66, .45), transparent 72%);
    -webkit-mask-image: radial-gradient(48% 26% at 50% 36%, #000 30%, transparent 75%);
    mask-image: radial-gradient(48% 26% at 50% 36%, #000 30%, transparent 75%);
  }
  .c-story__nav { top: calc(var(--header-h) + 10px); right: 50%; transform: translateX(50%); }
  .c-story__nav-list { grid-auto-flow: column; gap: 14px; }
  .c-story__nav-link { flex-direction: column-reverse; gap: 6px; padding: 4px 0; font-size: 11px; }
  .c-story__nav-link::after { width: 14px; }
  .c-story__nav-link.is-active::after { width: 24px; }
  .c-story__intro { align-items: flex-end; padding-block: 52vh 48px; }
  .c-story__intro .c-story__col { padding: 32px 0 0; background: linear-gradient(to bottom, rgba(11, 20, 12, 0), rgba(11, 20, 12, .82) 80px); }
  .c-story__chapter { display: block; min-height: 0; padding-block: 60vh 10vh; }
  .c-story__outro { display: block; min-height: 0; padding-block: 60vh 20vh; }
  .c-story__chapter .c-story__col, .c-story__outro .c-story__col {
    max-width: none; margin-inline: calc(-1 * var(--gutter)); padding: 72px var(--gutter) 24px;
    width: calc(100% + 2 * var(--gutter));
    background: linear-gradient(to bottom, rgba(11, 20, 12, 0), rgba(11, 20, 12, .9) 72px, rgba(11, 20, 12, .94));
  }
  .c-story__title { font-size: clamp(38px, 11vw, 52px); }
  .c-story__hint { margin-top: var(--space-4); }
}

/* ------------------------------------------------------------ story-teaser (home) */
.c-story-teaser { position: relative; overflow: hidden; padding-block: var(--section-pad); }
.c-story-teaser__inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); align-items: center; }
.c-story-teaser__content { max-width: 540px; position: relative; z-index: 1; }
.c-story-teaser__headline { font-size: var(--fs-h1); font-weight: var(--fw-light); line-height: var(--lh-heading); letter-spacing: var(--ls-heading); margin: 0 0 var(--space-3); }
.c-story-teaser__text { color: var(--story-muted); font-size: var(--fs-lg); }
.c-story-teaser__text p { margin: 0 0 1em; }
.c-story-teaser .c-actions { margin-top: var(--space-4); }
.c-story-teaser__stage { position: relative; width: 100%; max-width: 560px; aspect-ratio: 1 / 1; margin-left: auto; }
.c-story-teaser .c-story__fallback { background: radial-gradient(50% 50% at 50% 50%, rgba(63, 107, 66, .32), transparent 70%); }
.c-story-teaser.is-fallback .c-story__fallback, .c-story-teaser:not(.is-js) .c-story__fallback {
  background:
    radial-gradient(circle at 50% 50%, rgba(250, 250, 250, .5) 0 1px, transparent 1.6px) 0 0 / 12px 12px,
    radial-gradient(50% 50% at 50% 50%, rgba(63, 107, 66, .42), transparent 70%);
  -webkit-mask-image: radial-gradient(46% 46% at 50% 50%, #000 30%, transparent 75%);
  mask-image: radial-gradient(46% 46% at 50% 50%, #000 30%, transparent 75%);
}
@media (max-width: 767px) {
  .c-story-teaser__inner { grid-template-columns: 1fr; gap: var(--space-3); }
  .c-story-teaser__stage { max-width: 340px; margin: 0 auto; order: -1; }
}

@media (prefers-reduced-motion: reduce) {
  .c-story.is-js .c-story__col { transform: none; transition: opacity .4s linear; }
  .c-story__hint span::after { animation: none; top: 30%; }
  .c-story__canvas, .c-story__nav, .c-story__nav-link::after, .c-story__nav-label { transition-duration: .01s; }
}
