/* =============================================================
   03 – UNSERE GESCHICHTE
   Blaue Sektion mit partiell eingeblendeter Papier-Textur.
   Einleitung + horizontale Zeitleiste (Drag & Nav-Buttons):
   Punkte auf einer Schiene, per senkrechter Linie mit weißen
   Bild-Kacheln verbunden. Interaktivität in js/main.js.
   ============================================================= */

.geschichte {
  position: relative;
  isolation: isolate;          /* eigener Stacking-Context für die Textur-Ebene */
  overflow: hidden;
  color: #DCE8F5;
  background: linear-gradient(180deg, var(--c-blue) 0%, var(--c-blue-dark) 58%, var(--c-blue-deep) 100%);
}

/* Papier-Textur nur PARTIELL: oben präsent, nach unten in den blauen
   Verlauf auslaufend (mask). soft-light legt den Grain sanft auf die Farbe. */
.geschichte::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("../assets/images/Maxlrainer_Hintergrund.webp") center top / cover no-repeat;
  mix-blend-mode: soft-light;
  opacity: 0.7;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0.72) 34%, transparent 80%);
          mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0.72) 34%, transparent 80%);
}
.geschichte > .container,
.geschichte > .tl { position: relative; z-index: 1; }

/* Hopfen-Skizze: stark vergrößert, oben rechts angeschnitten, sehr dezent */
.geschichte::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  top: clamp(-150px, -10vw, -70px); right: clamp(-150px, -10vw, -70px);
  width: clamp(360px, 42vw, 720px); aspect-ratio: 1 / 1;
  background: url("../assets/images/Hopfen_Skizze@4x.webp") center / contain no-repeat;
  opacity: 0.1;
  transform: rotate(12deg);
}

/* ---- Einleitung (komplett zentriert) ---- */
.geschichte__intro { max-width: 900px; margin-inline: auto; text-align: center; }
.geschichte .section__title {
  color: #fff;
  text-transform: uppercase;   /* Größe kommt global aus 00-base.css */
  letter-spacing: 0.005em;
  line-height: 1.05;
}
.geschichte__lead {
  margin-top: 1.7rem;
  text-align: center;
  color: #C6D6EA;
  font-size: clamp(1.15rem, 1.6vw, 1.35rem);
}
.geschichte__lead + .geschichte__lead { margin-top: 0.9rem; }

/* =============================================================
   ZEITLEISTE
   ============================================================= */
.tl {
  /* Rand-Einzug: erste/letzte Kachel bündig zur .container-Kante,
     auch auf sehr breiten Screens (Bleed bis zum Fensterrand). */
  --edge: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  --card-w: clamp(320px, 44vw, 660px);   /* Kachelbreite inkl. Abstand – Desktop: 2 ganze Kacheln */
  --card-gap: clamp(1.1rem, 2.4vw, 2.2rem);
  --head-h: 56px;                          /* Höhe der Punkt-/Jahres-Zeile */
  --dot: 16px;
  --rail: rgba(255, 255, 255, 0.3);        /* Farbe von Schiene + Verbinder */
  margin-top: clamp(3.5rem, 7.5vw, 5.8rem);
}

/* Scroll-Viewport – hier greifen Drag (Maus) und natives Wischen (Touch) */
.tl__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 0.9rem clamp(2rem, 3.5vw, 3rem);  /* Platz für Hover-Lift/Schatten */
  cursor: grab;
  scrollbar-width: none;                   /* Firefox */
  -webkit-overflow-scrolling: touch;
}
.tl__viewport::-webkit-scrollbar { display: none; }   /* WebKit */
.tl__viewport.is-grabbing { cursor: grabbing; user-select: none; }
.tl__viewport:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 4px; border-radius: 6px; }

/* Schienen-Spur: horizontale Flex-Reihe aller Meilensteine */
.tl__track {
  display: flex;
  align-items: stretch;                    /* alle Kacheln gleich hoch */
  width: max-content;
  padding-inline: var(--edge);
  margin: 0;
}

/* Ein Meilenstein = Spalte: Punkt (auf Schiene) → Linie → Kachel */
.tl__item {
  position: relative;
  flex: 0 0 var(--card-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-inline: calc(var(--card-gap) / 2);
}
/* durchgehende Schiene: pro Spalte ein Segment über die volle Spaltenbreite,
   die Segmente stoßen aneinander → ununterbrochene Linie durch alle Punkte */
.tl__item::before {
  content: ""; position: absolute; left: 0; right: 0;
  top: calc(var(--head-h) - var(--dot) / 2 - 1px);
  height: 2px; background: var(--rail);
}
.tl__item:first-child::before { left: 50%; }   /* Linie beginnt am 1. Punkt */
.tl__item:last-child::before  { right: 50%; }   /* … und endet am letzten */

/* Kopf: Jahres-Label (oben) + Punkt (unten, auf der Schiene) */
.tl__head { position: relative; width: 100%; height: var(--head-h); }
.tl__year-label {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  white-space: nowrap;
  font: 700 0.95rem/1 var(--font-sans);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  transition: color 0.3s var(--ease);
}
.tl__dot {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: var(--dot); height: var(--dot); border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.14), 0 2px 6px rgba(0, 20, 45, 0.4);
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
  z-index: 1;
}
.tl__connector {
  width: 2px; height: clamp(26px, 4vw, 42px);
  background: var(--rail);
}

/* Aktiver Meilenstein (per JS gesetzt): gelb hervorgehoben */
.tl__item.is-active .tl__dot {
  background: var(--c-yellow);
  box-shadow: 0 0 0 5px rgba(255, 210, 0, 0.22), 0 3px 10px rgba(0, 20, 45, 0.5);
  transform: translateX(-50%) scale(1.15);
}
.tl__item.is-active .tl__year-label { color: var(--c-yellow); }

/* ---- Kachel ---- */
.tl__card {
  --tl-r: 22px;                            /* Radius der konkaven Ecken */
  position: relative;
  width: 100%;
  flex-grow: 1;                            /* füllt Resthöhe → Kacheln gleich hoch */
  display: flex; flex-direction: column;
  background: #fff;
  overflow: hidden;
  /* Konkave (nach innen gewölbte) Ecken: an jeder Ecke wird ein Viertelkreis
     „ausgestanzt". Vier Radial-Masken, je ein Quadrant (51 %) an einer Ecke. */
  -webkit-mask:
    radial-gradient(circle var(--tl-r) at top left,     #0000 98%, #000) top left,
    radial-gradient(circle var(--tl-r) at top right,    #0000 98%, #000) top right,
    radial-gradient(circle var(--tl-r) at bottom left,  #0000 98%, #000) bottom left,
    radial-gradient(circle var(--tl-r) at bottom right, #0000 98%, #000) bottom right;
  -webkit-mask-size: 51% 51%;
  -webkit-mask-repeat: no-repeat;
  mask:
    radial-gradient(circle var(--tl-r) at top left,     #0000 98%, #000) top left,
    radial-gradient(circle var(--tl-r) at top right,    #0000 98%, #000) top right,
    radial-gradient(circle var(--tl-r) at bottom left,  #0000 98%, #000) bottom left,
    radial-gradient(circle var(--tl-r) at bottom right, #0000 98%, #000) bottom right;
  mask-size: 51% 51%;
  mask-repeat: no-repeat;
  /* Schatten + feine Glanzkante als drop-shadow → folgen der konkaven Silhouette
     (box-shadow würde die geraden Ecken zeigen und in die Kerben „durchscheinen"). */
  filter:
    drop-shadow(0 0 0.6px rgba(255, 255, 255, 0.85))
    drop-shadow(0 16px 30px rgba(0, 20, 45, 0.3));
  transition: transform 0.4s var(--ease), filter 0.4s var(--ease);
}
/* Glanz-Sweep bei Hover (Lichtstreifen läuft schräg über die Kachel) */
.tl__card::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,0.55) 50%, transparent 58%);
  background-size: 250% 100%; background-position: 130% 0; opacity: 0;
}
.tl__card:hover {
  transform: translateY(-8px);
  filter:
    drop-shadow(0 0 0.6px rgba(255, 255, 255, 0.95))
    drop-shadow(0 26px 46px rgba(0, 20, 45, 0.42));
}
.tl__card:hover::after { animation: tl-shine 0.9s var(--ease) forwards; }
@keyframes tl-shine {
  0%   { background-position: 130% 0; opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { background-position: -30% 0; opacity: 0; }
}

/* Bild-Bereich: geht per Verlauf in den weißen Textbereich über.
   translateZ(0) erzwingt eine eigene Compositing-Ebene → beim Zoom-Hover
   entsteht keine dunkle Kante/„Blitzer" mehr am geclippten Bildrand. */
.tl__media {
  position: relative; z-index: 1;
  aspect-ratio: 16 / 10; overflow: hidden;
  background: #fff;
  transform: translateZ(0);
  margin-bottom: -1px;                     /* keine Haarlinie zwischen Bild u. Text */
}
.tl__media img {
  width: 100%; height: 100%; object-fit: cover;
  -webkit-user-drag: none; user-select: none;
  backface-visibility: hidden;
  transition: transform 0.6s var(--ease);
}
.tl__card:hover .tl__media img { transform: scale(1.05); }
.tl__media::after {
  content: ""; position: absolute; inset: 0; bottom: -1px; pointer-events: none;
  background: linear-gradient(to bottom, transparent 50%, rgba(255,255,255,0.65) 82%, #fff 99%);
}

/* Textbereich */
.tl__body {
  position: relative; z-index: 1;
  flex-grow: 1;
  padding: clamp(1.5rem, 2.6vw, 2.4rem) clamp(1.5rem, 2.6vw, 2.3rem) clamp(1.7rem, 2.8vw, 2.5rem);
}
.tl__year {
  display: block;
  font: 600 clamp(2.8rem, 4vw, 4rem)/0.95 var(--font-serif);
  letter-spacing: -0.01em;
  color: var(--c-blue);
}
.tl__title {
  margin-top: 0.6rem;
  font: 700 clamp(1.2rem, 1.5vw, 1.5rem)/1.3 var(--font-sans);
  letter-spacing: 0.01em;
  color: var(--c-ink);
}
.tl__body p {
  margin-top: 0.6rem;
  font-size: clamp(1rem, 1.15vw, 1.15rem); line-height: 1.7;
  color: var(--c-ink-soft);
}

/* ---- Steuerung ---- */
.tl__nav {
  display: flex; justify-content: flex-end; gap: 0.65rem;
  margin-top: clamp(1.25rem, 2.5vw, 1.9rem);
}
.tl__btn {
  display: inline-grid; place-items: center;
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  color: #fff; cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease), opacity 0.25s;
}
.tl__btn:hover { background: var(--c-yellow); border-color: var(--c-yellow); color: var(--c-blue-deep); transform: translateY(-2px); }
.tl__btn:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 3px; }
.tl__btn:disabled { opacity: 0.32; cursor: default; transform: none; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.45); color: #fff; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .tl { --card-w: clamp(260px, 86vw, 420px); }   /* ~1 ganze Kachel + Vorschau */
  .tl__nav { justify-content: center; }    /* Buttons mittig, gut erreichbar */
}

@media (prefers-reduced-motion: reduce) {
  .tl__card:hover { transform: none; }
  .tl__card:hover .tl__media img { transform: none; }
  .tl__card:hover::after { animation: none; }
}
