/* ======================================================
   STORY 1 – VARIABLEN
====================================================== */

:root {
  /* Farben */
  --bg: #e6dbd2;
  --text: #111;

  /* Layout */
  --pad: clamp(16px, 6vw, 80px);
  --gap: 24px;

  /* Typo */
  --font-base: "Inter", system-ui, sans-serif;

  /* CTA */
  --cta-bg: #111;
  --cta-text: #fff;
  --cta-radius: 999px;
  --cta-pad-y: 0.3em;
  --cta-pad-x: 0.8em;
  --cta-grow-ms: 380ms;
  --cta-fade-ms: 240ms;
}


/* ======================================================
   BASE
====================================================== */

body {
  margin: 0;
  padding: 30px;
  font-family: var(--font-base);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Alle Texte nutzen Variablen */
h1, h2, h3, p, span, li,
.page-title, .page-subtitle, .optional-text,
.chat .message {
  color: var(--text);
  font-family: var(--font-base);
}


/* ======================================================
   INTRO (Story 1 Einstieg)
====================================================== */

/* --- Intro--- */
.intro1 {
  grid-column: 3 / 10; 
}

.segment-1 {
  grid-template-columns: repeat(12, 1fr);
}

/* Segment 1 Einstieg */
.story1-intro-segment {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.story1-intro {
  grid-column: 3 / 10;
}



/* ======================================================
   STORY 1 – ZWISCHENSEGMENTE (GRID)
====================================================== */

.story-zwischensegment {
  padding-top: 15vh;
  position: relative;
  min-height: 60vh;

  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: center;

  background-color: #e6dbd2;
  background-image: none;
}

.story-zwischensegment::before {
  /* content: "→"; */
  grid-column: 1 / 2;
  justify-self: right;
  align-self: start;
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(3rem, 7vw, 8rem);
  font-weight: 400;
  opacity: 0.80;
}

.story-zwischensegment .zwischentext-block {
  grid-column: 3 / 10;
  grid-row: 1;
  align-self: start;
  padding-top: 4vh;
}

.story-zwischensegment h2 {
 /* font-size: clamp(1.5rem, 2.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1.15;
  opacity: 0.85; */
  max-width: 60ch;
  /* letter-spacing: 0.005em; */
}

.story-zwischensegment .Hervorhebung {
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(1.5rem, 3.8vw, 4.3rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  /* margin: 1.2rem 0; */

  display: inline-block;
  background-color: #fcc764;
  margin-top: 0.3em;
  margin-left: -0.25em;
  margin-bottom: 0.15em;
  padding: 0.1em 0.25em;
}



/* ======================================================
   SEGMENT 3 – CHART 1 (Sticky + Steps)
====================================================== */

#chart-1 {
  width: 100%;
  height: clamp(320px, 55vh, 620px);
}
#chart-1 svg {
  width: 100%;
  height: 100%;
  display: block;
}

#chart-1 {
  height: clamp(420px, 80vh, 820px);
}

/* ======================================================
   SEGMENT 4 – CHART 2 (Sticky + Steps)
====================================================== */

#visualization-container2 {
  grid-column: 4 / 13;
  grid-row: 1 / 6;
  margin-top: 0vh;
}

.segment4-grid {
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto 1fr;
  align-items: start;
}

/* Steps links */
.segment4-steps {
  grid-column: 1 / 4;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  padding-top: 1vh;
  padding-bottom: 50vh;
}

.segment4-steps .step h2 { margin-bottom: .5rem; }

/* Sticky rechts */
.segment4-sticky {
  grid-column: 4 / 13;
  grid-row: 1 / span 3;
  position: sticky;
  top: 10vh;
  align-self: start;
}

.segment4-sticky .visualization {
  min-height: 500px;
}

/* Wichtig: Sticky darf nicht durch overflow-Parents kaputtgehen */
#segment-4,
#segment-4 .segment-content,
#segment-4 .segment4-grid {
  overflow: visible;
}

/* Sticky Panel: feste Höhe im Viewport */
#segment-4 .segment4-sticky {
  position: sticky;
  top: 10vh;
  align-self: start;
  height: calc(100vh - 10vh);
  display: flex;
  flex-direction: column;
}

/* Chart-Wrapper nimmt den verfügbaren Platz */
#segment-4 #visualization-container2 {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* Quelle bleibt sichtbar unten */
#segment-4 .Quelle {
  width: 90%;
  margin: 0 auto;
  text-align: right;
  opacity: 0.7;
  font-size: 12px;
}


/* Interaktion / Highlight */
.step.is-active { font-weight: 700; }
.step.is-dimmed { opacity: 0.4; }

/* NUR Kategorie-Steps */
.step[data-category] {
  max-width: 30ch;
  margin-bottom: 0.1rem;
  line-height: 1.4;
}

.step[data-category] p { font-weight: 400; }
.step[data-category] p::first-line { font-weight: 600; }


/* ======================================================
   SEGMENT 6 – CHART 3 (Sticky + Steps)
====================================================== */

.segment6-grid {
  grid-template-rows: auto auto 1fr;
  align-items: start;
}

.segment6-steps {
  grid-column: 1 / 4;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 5vh;
  padding-top: 10vh;
  padding-bottom: 65vh;
}

.segment6-steps .step h2 { margin-bottom: .5rem; }

.segment6-sticky {
  grid-column: 4 / 13;
  grid-row: 1 / span 3;
  position: sticky;
  top: 10vh;
  align-self: start;
}

.segment6-sticky .visualization {
  min-height: 500px;
}

#segment-6 .Quelle {
  grid-row: 1 / span 3;
  align-self: end;
  justify-self: end;
  opacity: 0.7;
  font-size: 12px;
  margin-top: -30px;
}

#chart-3{
  width: 100%;
  height: clamp(380px, 80vh, 780px);
}
#chart-3 svg{
  width: 100%;
  height: 100%;
  display: block;
}

/* ======================================================
   SEGMENT 7 – CHART 4 (Sticky + Steps)
====================================================== */

.tooltip4 {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 9999;
  white-space: nowrap;
}

.segment7-grid {
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto 1fr;
  align-items: start;
}

.segment7-steps {
  grid-column: 1 / 4;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 30vh;
  padding-top: 10vh;
  padding-bottom: 120vh;
}

.segment7-steps .step h2 { margin-bottom: .5rem; }

.segment7-sticky {
  grid-column: 4 / 13;
  grid-row: 1 / span 3;
  position: sticky;
  top: 10vh;
  align-self: start;
}

.segment7-sticky .visualization {
  min-height: 500px;
}

#segment-7 .Quelle {
  align-self: end;
  justify-self: end;
  opacity: .7;
  font-size: 12px;
}

#chart4{
  width: 100%;
  height: clamp(380px, 80vh, 780px);
}
#chart4 svg{
  width: 100%;
  height: 100%;
  display: block;
}


/* ======================================================
   SCROLLIO INTRO – REVEAL STEPS (Sektion 1+2)
====================================================== */

#scrollio-intro { scroll-snap-align: none; }

#scrollio-intro .segment-content {
  display: block;
  max-width: 900px;
  padding: 0 8px;
}

#scrollio-intro .reveal-step {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 450ms ease, transform 450ms ease;
  margin: 25vh 0;
  will-change: opacity, transform;
}

#scrollio-intro .reveal-step.is-in {
  opacity: 1;
  transform: translateY(0);
}

#scrollio-intro .reveal-step.was-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 350ms ease, transform 350ms ease;
}

#scrollio-intro h1 {
  font-family: var(--font-headline); /* (wie bei dir) */
  line-height: 1.05;
  margin: 0;
}

.zwischentext { font-size: clamp(1rem, 3vw, 2rem); }
#first-reveal-step { padding-top: 200px; }
#last-reveal-step { padding-bottom: 100px; }

/* weiches Ein-/Ausblenden */
.fade-in { opacity: 0; transition: opacity .4s ease; }
.fade-in.show { opacity: 1; }
.hide { opacity: 0 !important; pointer-events: none; transition: opacity .3s ease; }

.inline-button {
  display: inline-block;
  margin-top: 12px;
}


/* ======================================================
   CTA – TEXT → BUTTON (letzter Reveal Step)
====================================================== */

#last-reveal-step h1 {
  position: relative;
  display: inline-block;
  line-height: 1.15;
  margin: 0;
  padding: var(--cta-pad-y) var(--cta-pad-x);
  border-radius: var(--cta-radius);
  transition: color var(--cta-fade-ms) ease;
  cursor: default;
}

#last-reveal-step h1::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cta-bg);
  border-radius: var(--cta-radius);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--cta-grow-ms) ease;
  z-index: -1;
}

#last-reveal-step.cta-active h1 {
  color: var(--cta-text);
  cursor: pointer;
}

#last-reveal-step.cta-active h1::before {
  transform: scaleX(1);
}

#last-reveal-step.cta-active h1:hover { filter: brightness(1.05); }

#last-reveal-step.cta-active h1:focus {
  outline: 2px solid rgba(0,0,0,.2);
  outline-offset: 3px;
}

#bottom-cta.hide {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity .3s ease;
}


/* ======================================================
   STORY 1 – KONSISTENTES SEGMENT-DESIGN (Global)
====================================================== */

body {
  font-family: "Inter", system-ui, sans-serif;
}

#segment-3,
#segment-4,
#segment-6,
#segment-7,
.story-zwischensegment {
  font-family: "Inter", system-ui, sans-serif;
}

.story-segment {
  background-image: none;
}


.story-segment h1 {
/*  font-size: clamp(1.5rem, 2.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1.00;
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: 0.75rem; */
}


.segment3-steps,
.segment7-steps {
  gap: 5vh;
  padding-top: 2vh;
  padding-bottom: 60vh;
}

.visualization-container {
  background: none;
  padding: 0;
  box-shadow: none;
}

.visualization {
  min-height: 460px;
}

.Quelle {
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
  float: right;
}



/*  NEU */
/* 1) Grid-/Flex-Items dürfen schrumpfen (sonst Overflow!) */
.segment-content > *,
[class$="-grid"] > * {
  min-width: 0;
  min-height: 0;
}

/* 2) Container darf nicht größer als sein Grid-Cell werden */
.visualization-container {
  max-width: 100%;
  overflow: hidden;     /* verhindert horizontales Ausbrechen */
}

/* 3) Das Chart selbst passt sich an */
.visualization {
  width: 100%;
  max-width: 100%;
}

/* 4) SVG/Canvas innerhalb des Charts müssen 100% respektieren */
.visualization svg,
.visualization canvas {
  display: block;
  max-width: 100%;
}

