/*
 * Projekt-Timeline (Content Block mask/projekt-timeline).
 * Loaded only on pages that contain the element (<f:asset.css> in its template).
 * Everything is scoped to .module-projekt-timeline / .pt-*; font, colours and container come from
 * the theme. Layering inside the module: section background → 3D canvas → cards.
 */
.module-projekt-timeline {
  --pt-red: var(--bs-primary, #bc1830);
  --pt-red-bright: #dd0b2f;
  --pt-grey: #706f6f;
  --pt-shadow-card: 0 1px 2px rgba(40, 30, 25, 0.06), 0 12px 32px rgba(40, 30, 25, 0.1);
  --pt-shadow-card-hover: 0 2px 4px rgba(40, 30, 25, 0.08), 0 22px 48px rgba(40, 30, 25, 0.16);
  --pt-card-w: 400px;
  --pt-step: 430px;          /* vertical distance between projects */
  --pt-clamp-offset: 70px;   /* clamp x offset from the centre line (mirrored per side) */
  --pt-ease: cubic-bezier(0.22, 1, 0.36, 1);

  position: relative;
  isolation: isolate;        /* the fixed canvas stays inside this stacking context */
}
.module-projekt-timeline:not(.bg-white) { background-color: #f6f5f3; }  /* bg-warm, also when unset */

/* 3D layer: fixed to the viewport, clipped to the module by timeline.js */
.pt-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; clip-path: inset(100% 0 0 0); }
.module-projekt-timeline > .container { position: relative; z-index: 1; }

.pt-inner { position: relative; max-width: 1200px; margin: 0 auto; }

/* ---------- intro ---------- */
.pt-intro { max-width: 440px; display: grid; gap: 16px; min-height: 305px; align-content: start; }
.pt-intro__eyebrow { font-weight: 700; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pt-red); }
.pt-intro__title { font-weight: 800; font-size: 40px; line-height: 1.1; margin: 0; }
.pt-intro__text { font-size: 18px; }
.pt-intro__text > :last-child { margin-bottom: 0; }

/* ---------- project cards ---------- */
.pt-projects { list-style: none; margin: 0; padding: 0; }
.pt-projects > li { position: relative; height: var(--pt-step); }
.pt-projects > li:last-child { height: calc(var(--pt-step) + 140px); }

.pt-card {
  position: absolute; top: 0; width: var(--pt-card-w); background: #fff; box-shadow: var(--pt-shadow-card);
  cursor: pointer; text-align: left;
  opacity: 0; transform: translate3d(var(--pt-from-x, -40px), 36px, 0) scale(0.98);
  transition: opacity 0.7s var(--pt-ease), transform 0.9s var(--pt-ease), box-shadow 0.3s;
}
.pt-projects > li:nth-child(odd) .pt-card { left: 0; --pt-from-x: -40px; }
.pt-projects > li:nth-child(even) .pt-card { right: 0; --pt-from-x: 40px; }
.pt-card.is-in { opacity: 1; transform: none; }
.pt-card.is-in:hover { box-shadow: var(--pt-shadow-card-hover); transform: translateY(-3px); }
.pt-card:focus-visible { outline: 3px solid var(--pt-red-bright); outline-offset: 3px; }
.pt-card__media { aspect-ratio: 16 / 9; overflow: hidden; background: #ddd; }
.pt-card__img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--pt-ease); }
.pt-card:hover .pt-card__img { transform: scale(1.04); }
.pt-card__body { padding: 24px 28px 28px; display: grid; gap: 12px; justify-items: start; }
.pt-card__meta { display: flex; gap: 12px; margin: 0; font-size: 14px; color: var(--pt-grey); }
.pt-card__num { color: var(--pt-red); font-weight: 800; letter-spacing: 0.04em; }
.pt-card__title { font-weight: 800; font-size: 24px; line-height: 1.15; text-transform: uppercase; margin: 0; }
.pt-card__teaser { font-size: 16px; margin: 0; }
.pt-card__more { color: var(--pt-red); font-weight: 600; font-size: 16px; }

/* connector from the card to its clamp (width set by timeline.js) */
.pt-card__link { position: absolute; top: 50%; height: 2px; background: var(--pt-red); transform: scaleX(0); transition: transform 0.6s 0.25s var(--pt-ease); }
.pt-projects > li:nth-child(odd) .pt-card__link { left: 100%; transform-origin: 0 50%; }
.pt-projects > li:nth-child(even) .pt-card__link { right: 100%; transform-origin: 100% 50%; }
.pt-card.is-in .pt-card__link { transform: scaleX(1); }

/* ---------- counter ---------- */
.pt-counter {
  position: fixed; z-index: 5; right: 50px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px; font-weight: 800; font-size: 16px;
  opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
.pt-counter.is-on { opacity: 1; }
.pt-counter__now { color: var(--pt-red); font-variant-numeric: tabular-nums; }
.pt-counter__total { color: var(--pt-grey); font-weight: 600; font-size: 14px; }
.pt-counter__track { position: relative; width: 3px; height: 160px; background: #dcd8d2; overflow: hidden; border-radius: 2px; }
.pt-counter__fill { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: var(--pt-red); transform-origin: 50% 0; transform: scaleY(0); }
.no-3d .pt-counter { display: none; }

/* ---------- expanded project (moved to <body> by timeline.js) ---------- */
html.pt-expand-open { overflow: hidden; }
.pt-expand { position: fixed; inset: 0; z-index: 1090; --pt-red: var(--bs-primary, #bc1830); --pt-grey: #706f6f; }
.pt-expand[hidden] { display: none; }
.pt-expand__scrim { position: absolute; inset: 0; background: rgba(246, 245, 243, 0.75); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.pt-expand__panel {
  position: fixed; display: grid; grid-template-columns: 46% 1fr; background: #fff;
  box-shadow: 0 30px 80px rgba(30, 20, 15, 0.25); overflow: hidden;
}
.pt-expand__media { position: relative; overflow: hidden; background: #ddd; }
.pt-expand__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pt-expand__content { padding: 56px; display: flex; flex-direction: column; gap: 20px; overflow: auto; }
.pt-expand__meta { display: flex; gap: 12px; margin: 0; font-size: 14px; color: var(--pt-grey); }
.pt-expand__num { color: var(--pt-red); font-weight: 800; letter-spacing: 0.04em; }
.pt-expand__title { font-weight: 800; font-size: 40px; line-height: 1.1; text-transform: uppercase; margin: 0; }
.pt-expand__text { font-size: 16px; line-height: 1.6; }
.pt-expand__text > :last-child { margin-bottom: 0; }
.pt-expand__nav { margin-top: auto; display: flex; justify-content: space-between; gap: 20px; padding-top: 12px; }
.pt-expand__nav button:disabled { visibility: hidden; }
.pt-link { padding: 0; border: 0; background: none; color: var(--pt-red); font-weight: 600; font-size: 15px; text-align: left; cursor: pointer; }
.pt-link[data-step="1"] { text-align: right; margin-left: auto; }
.pt-link:hover { text-decoration: underline; }
.pt-expand__close {
  position: absolute; top: 18px; right: 18px; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: var(--pt-red); color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(188, 24, 48, 0.35);
}
.pt-expand :focus-visible { outline: 3px solid var(--pt-red-bright); outline-offset: 3px; }

/* ---------- fallback (reduced motion / no WebGL): everything visible, simple line ---------- */
.no-3d .pt-canvas { display: none; }
.no-3d .pt-card { opacity: 1; transform: none; }
.no-3d .pt-card__link { transform: none; }
.no-3d .pt-projects { position: relative; }
.no-3d .pt-projects::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 8px; margin-left: -4px; border-radius: 4px; background: var(--pt-red); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .module-projekt-timeline { --pt-card-w: 340px; --pt-clamp-offset: 60px; }
  .pt-counter { right: 16px; }
}
@media (max-width: 760px) {
  .module-projekt-timeline { --pt-clamp-offset: 0px; }
  .pt-intro { min-height: 0; padding-left: 44px; margin-bottom: 40px; }
  .pt-intro__title { font-size: 30px; }
  .pt-intro__text { font-size: 16px; }
  /* cable runs down the left edge; cards stack to its right */
  .pt-projects > li, .pt-projects > li:last-child { height: auto; padding: 0 0 48px 44px; }
  .pt-projects > li:last-child { padding-bottom: 80px; }
  .pt-projects > li:nth-child(n) .pt-card { position: relative; left: auto; right: auto; width: 100%; --pt-from-x: 24px; }
  .pt-card__body { padding: 18px 20px 22px; }
  .pt-card__title { font-size: 20px; }
  .pt-card__link { display: none; }
  .pt-counter { display: none; }   /* no room beside the cards; the cable itself shows progress */
  .pt-expand__panel { grid-template-columns: 1fr; grid-template-rows: 38% 1fr; }
  .pt-expand__content { padding: 24px 22px 28px; }
  .pt-expand__title { font-size: 26px; }
  .no-3d .pt-projects::before { left: 18px; }
}
