/* ==========================================================================
   GESCHICHTE / STORYTELLING
   ========================================================================== */

.history-page{
  background: var(--bg-white);
}

/* HERO */
.story-hero{
  position: relative;
  overflow: hidden;
  padding: clamp(5.5rem, 10vw, 8rem) 5% 4.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-bottom: 1px solid #eef2f7;
}

.story-hero::before{
  content:"";
  position:absolute;
  inset:-80px -120px auto auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(3,147,44,0.16), transparent 62%);
  transform: translate(60px, -30px);
  pointer-events:none;
}

.story-hero::after{
  content:"";
  position:absolute;
  inset:auto auto -140px -160px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(227,96,104,0.14), transparent 62%);
  pointer-events:none;
}

.story-hero-inner{
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
}

.story-title{
  font-size: clamp(2.8rem, 4vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -1px;
  margin: 0.6rem 0 1.2rem;
  font-weight: 900;
  color: var(--text-dark);
}

.story-lead{
  max-width: 70ch;
  font-size: 1.15rem;
  color: var(--text-light);
}

/* METRICS */
.story-metrics{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
}

.metric{
  background: rgba(255,255,255,0.78);
  border: 1px solid #eef2f7;
  border-radius: 22px;
  padding: 1.2rem 1.35rem;
  box-shadow: 0 14px 35px rgba(15,23,42,0.06);
  backdrop-filter: blur(10px);
}

.metric strong{
  display:block;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.metric span{
  display:block;
  margin-top: 0.2rem;
  color: var(--text-light);
  font-weight: 700;
}

.metric--secondary{
  border-color: rgba(227,96,104,0.18);
  box-shadow: 0 14px 35px rgba(227,96,104,0.08);
}

/* SECTION */
.story-section{
  padding-top: 6.5rem;
  padding-left: 4.5rem;
  padding-right: 4.5rem;
}

/* TIMELINE */
.timeline{
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 0 0;
}

.timeline::before{
  content:"";
  position:absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    rgba(3,147,44,0.42),
    rgba(3,147,44,0.10) 40%,
    rgba(227,96,104,0.14) 85%,
    rgba(227,96,104,0.10)
  );
}

.timeline-item{
  display: grid;
  grid-template-columns: 1fr 120px 1fr;
  gap: 2rem;
  align-items: start;
  margin: 2.4rem 0;
}

.timeline-date{
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  position: relative;
  padding-top: 0.2rem;
}

.timeline-dot{
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(3,147,44,0.12);
}

.date-pill{
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #eef2f7;
  color: var(--text-dark);
  box-shadow: 0 12px 28px rgba(15,23,42,0.07);
  white-space: nowrap;
}

.date-pill--secondary{
  border-color: rgba(227,96,104,0.22);
}

.timeline-card{
  grid-column: 1;
  background: var(--bg-white);
  border: 1px solid #eef2f7;
  border-radius: 22px;
  padding: 1.6rem 1.7rem;
  box-shadow: 0 14px 35px rgba(15,23,42,0.06);
  position: relative;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.35s cubic-bezier(0.4,0,0.2,1),
              border-color 0.35s cubic-bezier(0.4,0,0.2,1);
}

.timeline-item:nth-child(even) .timeline-card{
  grid-column: 3;
}

.timeline-card::before{
  content:"";
  position:absolute;
  left: 0;
  top: 0;
  height: 4px;
  width: 52%;
  border-radius: 22px 0 12px 0;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.95;
}

.timeline-item:nth-child(even) .timeline-card::before{
  background: linear-gradient(90deg, var(--secondary), transparent);
}

/* Pointer zur Linie */
.timeline-card::after{
  content:"";
  position:absolute;
  top: 24px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: var(--bg-white);
  border-right: 1px solid #eef2f7;
  border-top: 1px solid #eef2f7;
  transform: rotate(45deg);
}

.timeline-item:nth-child(even) .timeline-card::after{
  left: -10px;
  right: auto;
  border-right: none;
  border-top: 1px solid #eef2f7;
  border-left: 1px solid #eef2f7;
  transform: rotate(-45deg);
}

.timeline-card:hover{
  transform: translateY(-6px);
  box-shadow: 0 24px 60px rgba(15,23,42,0.10);
  border-color: rgba(3,147,44,0.18);
}

.timeline-card h3{
  font-size: 1.35rem;
  margin-bottom: 0.55rem;
  font-weight: 900;
  letter-spacing: -0.3px;
}

.timeline-card p{
  color: var(--text-light);
  margin: 0.2rem 0 0;
}

.timeline-card--secondary{
  border-color: rgba(227,96,104,0.18);
  box-shadow: 0 14px 35px rgba(227,96,104,0.08);
}

.card-note{
  margin-top: 1.05rem;
  border: 1px solid #eef2f7;
  background: var(--bg-light);
  border-radius: 18px;
  padding: 1rem 1rem;
}

.card-note strong{
  display:block;
  margin-bottom: 0.55rem;
}

.story-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.story-list li{
  color: var(--text-dark);
  font-weight: 600;
  padding-left: 1.2rem;
  position: relative;
}

.story-list li::before{
  content:"";
  position:absolute;
  left: 0;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(3,147,44,0.9);
  transform: translateY(-50%);
}

.timeline-item:nth-child(even) .story-list li::before{
  background: rgba(227,96,104,0.9);
}

.tag-row{
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.tag{
  border: 1px solid #eef2f7;
  background: rgba(248,250,252,0.9);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-dark);
}

.tag--primary{
  border-color: rgba(3,147,44,0.18);
  color: var(--primary);
  background: rgba(3,147,44,0.08);
}

.tag--secondary{
  border-color: rgba(227,96,104,0.18);
  color: var(--secondary);
  background: rgba(227,96,104,0.08);
}

.story-quote{
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--secondary);
  background: rgba(227,96,104,0.06);
  border-radius: 14px;
  color: var(--text-dark);
  font-weight: 700;
}

/* CALLOUT */
.callout{
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0.8rem;
  align-items: center;
  padding: 1rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(3,147,44,0.18);
  background: rgba(3,147,44,0.06);
}

.callout-icon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  color: white;
  background: var(--primary);
  box-shadow: 0 12px 25px rgba(3,147,44,0.18);
}

.callout-text{
  color: var(--text-dark);
  font-weight: 700;
}

/* OUTRO */
.story-outro{
  padding-top: 4.5rem;
  padding-bottom: 4.5rem;
}

.outro-card{
  max-width: 1100px;
  margin: 0 auto;
  border-radius: 28px;
  border: 1px solid #eef2f7;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(248,250,252,0.92));
  padding: clamp(1.8rem, 3vw, 2.4rem);
  box-shadow: 0 18px 50px rgba(15,23,42,0.07);
  position: relative;
  overflow: hidden;
}

.outro-card::before{
  content:"";
  position:absolute;
  right:-160px;
  top:-220px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(3,147,44,0.12), transparent 62%);
}

.outro-card h2{
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: -0.6px;
  margin-bottom: 0.8rem;
  position: relative;
  z-index: 2;
}

.outro-card p{
  color: var(--text-light);
  position: relative;
  z-index: 2;
  max-width: 80ch;
}

.outro-line{
  height: 1px;
  background: linear-gradient(90deg, rgba(3,147,44,0.35), rgba(227,96,104,0.22), transparent);
  margin: 1.4rem 0 1.2rem;
  position: relative;
  z-index: 2;
}

.outro-sub{
  color: var(--text-dark) !important;
  font-weight: 700;
}

/* RESPONSIVE */
@media (max-width: 980px){
  .story-metrics{ grid-template-columns: 1fr; }
  .timeline::before{
    left: 16px;
    transform: none;
  }
  .timeline-item{
    grid-template-columns: 44px 1fr;
    gap: 1rem;
  }
  .timeline-date{
    grid-column: 1;
    align-items: flex-start;
  }
  .timeline-card{
    grid-column: 2 !important;
  }
  .timeline-card::after{
    left: -10px !important;
    right: auto !important;
    border-right: none;
    border-top: 1px solid #eef2f7;
    border-left: 1px solid #eef2f7;
    transform: rotate(-45deg);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .timeline-card{ transition: none !important; }
  .timeline-card:hover{ transform: none !important; }
}

/* Section-Head in der Geschichte zentrieren */
.history-page .story-section .section-head{
  text-align: center;
}

.history-page .story-section .section-head p{
  margin-left: auto;
  margin-right: auto;
  max-width: 75ch; /* optional: schöner lesbar */
  padding-bottom: 1rem;
}

/* Gemeinsame Anker-Höhe für Dot + Pfeil (unterhalb der Rundung) */
.timeline{
  --anchor-y: 34px;     /* 32–40px: höher/niedriger nach Geschmack */
  --dot-size: 14px;     /* muss zu .timeline-dot passen */
  --arrow-size: 20px;   /* muss zu .timeline-card::after passen */
}

/* Dot so weit nach unten schieben, dass sein Zentrum auf --anchor-y liegt */
.timeline-date{
  padding-top: calc(var(--anchor-y) - (var(--dot-size) / 2));
}

/* Pfeil so setzen, dass sein Zentrum ebenfalls auf --anchor-y liegt */
.timeline-card::after{
  top: calc(var(--anchor-y) - (var(--arrow-size) / 2));
}

/* Sicherheit: gleiche Regel explizit auch für die rechten Karten */
.timeline-item:nth-child(even) .timeline-card::after{
  top: calc(var(--anchor-y) - (var(--arrow-size) / 2));
}

/* Rechtes-Seite-Offset fix: Karte + Datum immer in derselben Grid-Zeile */
.timeline-item{
  grid-auto-flow: row; /* sicherstellen */
}

.timeline-item > .timeline-card{
  grid-column: 1;
  grid-row: 1;
}

.timeline-item > .timeline-date{
  grid-column: 2;
  grid-row: 1;
}

/* even = Karte rechts, Datum bleibt Mitte */
.timeline-item:nth-child(even) > .timeline-card{
  grid-column: 3;
  grid-row: 1;
}

/* Streifen oben: gleiche Position, aber abgerundet */
.timeline-card::before{
  /* bleibt top:0 / left:0 wie bei dir */
  border-radius: 22px 999px 999px 22px; /* links an Kartenradius, rechts pill */
}

/* Top-Streifen als Background-Layer -> rundet automatisch mit der Card */
.timeline-card::before{
  content: none !important; /* alten Pseudo-Streifen deaktivieren */
}

.timeline-card{
  background:
    linear-gradient(90deg, var(--primary), transparent) 0 0 / 52% 4px no-repeat,
    var(--bg-white);
}

.timeline-item:nth-child(even) .timeline-card{
  background:
    linear-gradient(90deg, var(--secondary), transparent) 0 0 / 52% 4px no-repeat,
    var(--bg-white);
}

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity 0.65s ease,
        transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--delay, 0ms);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        transition: none !important;
        transform: none !important;
    }

    .reveal {
        opacity: 1 !important;
    }
}

/* ==========================================================================
   MOBILE FIX: Geschichte Hero + Timeline Datum in Karte
   ========================================================================== */

@media (max-width: 980px) {

  /* Mehr Abstand zum fixed Header */
  .story-hero {
    padding-top: clamp(7.5rem, 22vw, 9rem);
  }

  .story-section {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .timeline {
    --anchor-y: 34px;
    --dot-size: 14px;
    --arrow-size: 20px;
    --mobile-rail-col: 32px;
    --mobile-line-x: 16px;
  }

  /* Strahl exakt durch die Mitte der linken Spalte */
  .timeline::before {
    left: var(--mobile-line-x);
    transform: none;
  }

  .timeline-item {
    grid-template-columns: var(--mobile-rail-col) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    position: relative;
  }

  /* WICHTIG: überschreibt deine globale grid-column: 2-Regel */
  .timeline-item > .timeline-date {
    grid-column: 1 !important;
    grid-row: 1;
    width: var(--mobile-rail-col);
    align-items: center;
    padding-top: calc(var(--anchor-y) - (var(--dot-size) / 2));
    z-index: 5;
  }

  .timeline-dot {
    position: relative;
    z-index: 6;
  }

  .timeline-item > .timeline-card {
    grid-column: 2 !important;
    grid-row: 1;
    min-width: 0;
    padding-top: 4rem;
    margin-top: 0;
  }

  /* Datum oben in der Karte */
  .timeline-date .date-pill {
    position: absolute;
    top: 1rem;
    left: calc(var(--mobile-rail-col) + 1rem + 1.2rem);
    z-index: 7;
    max-width: calc(100vw - var(--mobile-rail-col) - 3.5rem);
  }

  /* Pfeil bleibt auf Höhe des Punktes */
  .timeline-card::after {
    top: calc(var(--anchor-y) - (var(--arrow-size) / 2));
    left: -10px !important;
    right: auto !important;
    border-right: none;
    border-top: 1px solid #eef2f7;
    border-left: 1px solid #eef2f7;
    transform: rotate(-45deg);
  }
}