/* ==========================================================================
   Vitamin Horgoš — route.css  (home: „Od polja do trpeze“, js/route.js)
   ORBIS 04–06. Modes set by route.js on the section:
   .is-pinned  desktop: pinned stage, the drawn path with numbered station rings left, step cards right
   .is-rail    phones / tablets: stacked steps on a vertical gold rail that draws with the scroll
               (reduced motion: the rail fully drawn, every step shown)
   .is-static  wide but not pinned (reduced motion, a short desktop window): everything shown, nothing dimmed
   No JS: the stacked list (the steps are rendered by JS, the heading and link stay).
   Ground: charcoal with an owner background image at ~12 % (.sbg--pozadina, css/brand.css; js/main.js initGrounds).
   ========================================================================== */
.route {
  background:
    radial-gradient(60% 50% at 28% 50%, rgba(74, 14, 18, 0.32), transparent 70%),
    var(--ground-black);
}
.route__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-48);
}
.route__map { display: none; }
.route__body { position: relative; display: grid; align-content: start; gap: var(--sp-16); max-width: 46rem; }
.route__title { font-size: var(--t-h2); margin-bottom: var(--sp-16); }
.route__body .eyebrow { justify-self: start; }

/* ---------- steps (stacked) ---------- */
.route__steps { display: grid; gap: var(--sp-16); }
.route__step {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--sp-24);
  align-items: start;
  padding: var(--sp-24);
  border: 1px solid var(--line-dark-soft);
  border-radius: var(--radius);
  transition: opacity 500ms var(--ease-out), border-color 500ms var(--ease-out), background-color 500ms var(--ease-out);
}
/* the medallion (lang round): a dark disc, a 1px gold ring at 40 %, the gold line-art emblem (48px on desktop, strokes
   1.5px); the active station's medallion at 100 % with the ring in full gold and a faint glow, the others at 50 % */
.route__medal {
  display: grid;
  place-items: center;
  border: 1px solid rgba(212, 175, 94, 0.4);
  border-radius: 50%;
  background: var(--ground-black);
  color: var(--gold);
  transition: opacity 500ms var(--ease-out), border-color 500ms var(--ease-out), box-shadow 500ms var(--ease-out);
}
.route__medal svg { width: 50%; height: 50%; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.5px; stroke-linecap: round; stroke-linejoin: round; }
.route__medal svg path { vector-effect: non-scaling-stroke; }
symbol[id^="m-route-"] { stroke-width: 1.5px; } /* the sprite drawings are 1.25: the medallions draw them at 1.5px */
.route__step-mark { width: 72px; height: 72px; }
.route__step-body { display: grid; gap: var(--sp-8); }
.route__step-title {
  font-family: var(--font-serif);
  font-size: var(--t-card);
  font-weight: var(--fw-regular);
  line-height: 1.25;
  color: var(--on-dark);
}
.route__num { margin-right: var(--sp-4); color: var(--gold); }
.route__step-text { font-size: var(--t-card-body); line-height: 1.6; color: var(--on-dark-body); }
.route__link { justify-self: start; margin-top: var(--sp-4); }
.route__rail { display: none; }

/* wide but not pinned (reduced motion, short windows, 900–1023px): two columns of cards */
@media (min-width: 900px) {
  .route:not(.is-pinned) .route__body { max-width: none; }
  .route:not(.is-pinned) .route__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-24); }
}

/* ---------- rail (phones, tablets) ---------- */
.route.is-rail .route__steps { gap: var(--sp-40, 2.5rem); }
.route.is-rail .route__step { padding: 0; border: 0; border-radius: 0; }
.route.is-rail .route__step-mark {
  position: relative;
  z-index: 1;  /* the rail passes behind the medallion */
  opacity: 0.5;
}
.route.is-rail .route__step-body { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out) 90ms, transform 700ms var(--ease-out) 90ms; }
.route.is-rail .route__step.is-in .route__step-mark { opacity: 1; border-color: var(--gold); }
.route.is-rail .route__step.is-in .route__step-body { opacity: 1; transform: none; }
.route.is-rail .route__step-body:focus-within { opacity: 1; transform: none; }
.route.is-rail .route__rail {
  display: block;
  position: absolute;
  left: 35.5px;          /* centre of the 72px ring column */
  width: 1px;
  background: var(--line-dark);
  pointer-events: none;
}
.route.is-rail .route__rail-fill {
  position: absolute;
  inset: 0 -0.5px;
  background: var(--gold);
  transform: scaleY(0);
  transform-origin: 50% 0;
}

/* ---------- pinned (desktop, set by js/route.js) ---------- */
.route.is-pinned { height: 400vh; padding-block: 0; }
.route.is-pinned .route__sticky {
  position: sticky;
  top: 0;
  display: grid;
  align-items: center;
  height: 100vh;
  padding-top: var(--header-h);
  padding-bottom: var(--sp-16);
  overflow: hidden;
}
.route.is-pinned .route__grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: var(--sp-16) var(--sp-64);
  align-items: center;
}
.route.is-pinned .route__map {
  position: relative;
  display: block;
  justify-self: center;
  height: min(calc(100vh - var(--header-h) - 200px), 540px);
  aspect-ratio: 1 / 2;
}
.route.is-pinned .route__body { gap: var(--sp-12); padding-left: var(--sp-48); border-left: 1px solid var(--line-dark-soft); }
.route.is-pinned .route__title { margin-bottom: var(--sp-4); font-size: clamp(2.25rem, 1.4rem + 1.6vw, 2.875rem); }
.route.is-pinned .route__steps { gap: var(--sp-4); }
.route.is-pinned .route__step { display: block; padding: var(--sp-12) var(--sp-24) var(--sp-16); border-color: transparent; opacity: 0.3; }
.route.is-pinned .route__step-mark { display: none; }
.route.is-pinned .shead { margin-bottom: var(--sp-16); }
.route.is-pinned .route__step.is-active { opacity: 1; border-color: var(--gold); background: rgba(245, 240, 232, 0.03); }
/* keyboard and pointer can always bring a dimmed card to full strength */
.route.is-pinned .route__step:is(:hover, :focus-within) { opacity: 1; }
.route.is-pinned .route__step.is-active .route__step-title { color: var(--gold); }

/* the path */
.route__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.route__track, .route__draw { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.route__track { stroke: rgba(201, 162, 77, 0.25); stroke-width: 1; }
.route__draw { stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 1; stroke-dashoffset: 1; }
.route__dot { fill: var(--ground-black); stroke: var(--gold); stroke-width: 2; vector-effect: non-scaling-stroke; transition: fill 350ms var(--ease-out); }
.route__dot.is-reached { fill: var(--gold); }

/* stations: the badge sits beside its dot on the outer side of the curve, a short tick joins them */
.route__station { position: absolute; width: 0; height: 0; }
.route__badge { position: absolute; top: -48px; width: 96px; height: 96px; }
.route__station--l .route__badge { right: 20px; }
.route__station--r .route__badge { left: 20px; }
.route__badge::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 1px;
  background: var(--gold);
  opacity: 0;
  transition: opacity 500ms var(--ease-out);
}
.route__station--l .route__badge::after { left: 100%; margin-left: -6px; }
.route__station--r .route__badge::after { right: 100%; margin-right: -6px; }
.route .route__mark { position: absolute; inset: 0; width: 96px; height: 96px; opacity: 0.5; }
.route .route__station.is-active .route__mark { opacity: 1; border-color: var(--gold); box-shadow: 0 0 24px rgba(212, 175, 94, 0.22); }
.route__station.is-reached .route__badge::after { opacity: 0.5; }
.route__station.is-active .route__badge::after { opacity: 1; }
.route__label {
  position: absolute;
  top: calc(100% + 6px);
  left: -8px;
  right: -8px;
  text-align: center;
  line-height: 1.35;
  font-size: 0.8125rem;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0;
  transition: opacity 500ms var(--ease-out);
}
.route__label { opacity: 0.55; }
.route__station.is-active .route__label { opacity: 1; }
/* one gold ring pulse when a station becomes active */
.route__pulse {
  position: absolute;
  left: -11px;
  top: -11px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.route__station.is-active .route__pulse { animation: route-pulse 800ms var(--ease-out) 1; }
@keyframes route-pulse {
  from { opacity: 0.9; transform: scale(1); }
  to { opacity: 0; transform: scale(3); }
}

/* lower desktop screens: tighter cards so all four fit beside the path */
@media (max-height: 860px) {
  .route.is-pinned .route__step { padding: var(--sp-8) var(--sp-24) var(--sp-12); }
  .route.is-pinned .route__step-text { line-height: 1.5; }
  .route.is-pinned .route__step-body { gap: var(--sp-4); }
  .route.is-pinned .route__title { font-size: 2.25rem; }
}
/* laptop screens (≤ 800px tall): the four cards still fit beside the path */
@media (max-height: 800px) {
  .route.is-pinned .route__sticky { padding-bottom: var(--sp-8); }
  .route.is-pinned .shead { margin-bottom: 0; }
  .route.is-pinned .route__title { font-size: 2rem; }
  .route.is-pinned .route__step { padding: var(--sp-4) var(--sp-24) var(--sp-8); }
  .route.is-pinned .route__step-title { line-height: 1.15; }
  .route.is-pinned .route__step-text { line-height: 1.45; }
  .route.is-pinned .route__link { margin-top: 0; }
}
/* 1024–1279: a narrower map column */
@media (max-width: 1279px) {
  .route.is-pinned .route__grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: var(--sp-16) var(--sp-48); }
  .route.is-pinned .route__body { padding-left: var(--sp-32); }
}

@media (max-width: 600px) {
  .route__step { grid-template-columns: 64px minmax(0, 1fr); gap: var(--sp-16); }
  .route__step-mark { width: 64px; height: 64px; }
  .route.is-rail .route__rail { left: 31.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .route__step, .route__medal, .route__label, .route__dot, .route__badge::after, .route__step-body { transition: none !important; }
  .route .route__mark, .route.is-rail .route__step-mark, .route__label { opacity: 1 !important; } /* nothing dimmed */
  .route__pulse { display: none; }
  .route.is-rail .route__rail-fill { transform: none !important; }
}
