/* ==========================================================================
   asflagon.com · metro – theme visuals: lines, stations, trains, network map,
   page rail. Geometry rule: lines only horizontal, vertical or at 45°.
   ========================================================================== */

/* ---------- generic line diagram primitives (inline SVG) ---------- */
.ln {
  fill: none;
  stroke: var(--c, var(--line));
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ln-toll {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-dasharray: 7 6;
  stroke-linecap: butt;
}
.st { fill: #fff; stroke: var(--ink); stroke-width: 3.5; }
.st-x { stroke-width: 4.5; }
.svg-lbl { font-family: var(--font); font-size: 17px; font-weight: 800; fill: var(--ink); }

/* draw-on-scroll: only hidden once JS has set pathLength and motion is allowed */
.js-motion [data-draw] {
  stroke-dasharray: 1 1.001;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.5s var(--ease);
  transition-delay: calc(var(--i, 0) * 160ms + 120ms);
}
.js-motion .is-drawn [data-draw],
.js-motion [data-draw].is-drawn { stroke-dashoffset: 0; }

/* ---------- benefit icon details ---------- */
.benefit-icon { width: 150px; height: 60px; margin-bottom: 20px; overflow: visible; }
.benefit-icon .pass { fill: #fff; stroke: var(--ink); stroke-width: 3; }
.benefit-icon .pass-line { stroke: var(--c-violet); stroke-width: 4; stroke-linecap: round; }
.benefit-icon .plate { fill: #fff; stroke: var(--ink); stroke-width: 3; }
.benefit-icon .plate-band { fill: var(--c-blue); }
.benefit-icon .plate-txt { stroke: var(--ink); stroke-width: 6; stroke-dasharray: 5 3; }
.benefit-icon .ticks { stroke: var(--ink); stroke-width: 2; opacity: 0.55; }

/* ---------- network map (rendered by network.js) ---------- */
.netmap { width: 100%; height: auto; overflow: hidden; }
.nm-casing { fill: none; stroke: var(--card); stroke-width: 18; stroke-linecap: round; stroke-linejoin: round; }
.nm-line {
  fill: none;
  stroke: var(--c);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.5s, stroke-width 0.4s;
}
.nm-line.is-foreign { stroke-width: 7; }
.nm-toll { fill: none; stroke: #fff; stroke-width: 3.5; stroke-dasharray: 9 7; pointer-events: none; transition: opacity 0.5s; }
.nm-st { fill: #fff; stroke: var(--ink); stroke-width: 4; transition: r 0.3s var(--ease), fill 0.3s; }
.nm-st.is-x { stroke-width: 5; }
.nm-lbl {
  font-family: var(--font);
  font-size: 21px;
  font-weight: 800;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 7px;
  stroke-linejoin: round;
  transition: opacity 0.5s, font-size 0.3s;
}
.nm-lbl .cc { font-family: var(--mono); font-size: 14px; font-weight: 600; fill: var(--ink-3); }
.nm-lbl.is-foreign { fill: var(--ink-2); font-weight: 700; }
.nm-train rect { fill: var(--ink); stroke: #fff; stroke-width: 3; }
.nm-train circle { fill: var(--c); }

.js-motion .netmap .nm-line,
.js-motion .netmap .nm-casing {
  stroke-dasharray: 1 1.001;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.8s var(--ease), opacity 0.5s, stroke-width 0.4s;
  transition-delay: calc(var(--i, 0) * 130ms);
}
.js-motion .netmap .nm-toll,
.js-motion .netmap .nm-st,
.js-motion .netmap .nm-lbl,
.js-motion .netmap .nm-train { opacity: 0; transition: opacity 0.6s; transition-delay: calc(var(--i, 0) * 25ms + 700ms); }
.js-motion .netmap.is-drawn .nm-line,
.js-motion .netmap.is-drawn .nm-casing { stroke-dashoffset: 0; }
.js-motion .netmap.is-drawn .nm-toll,
.js-motion .netmap.is-drawn .nm-st,
.js-motion .netmap.is-drawn .nm-lbl,
.js-motion .netmap.is-drawn .nm-train { opacity: 1; }

/* route highlight on the network map */
.netmap.is-routing .nm-line { opacity: 0.18; }
.netmap.is-routing .nm-toll { opacity: 0.25; }
.netmap.is-routing .nm-lbl { opacity: 0.35; }
.netmap.is-routing .nm-train { display: none; }
.netmap.is-routing .nm-lbl.on-route { opacity: 1; }
.nm-route-casing { fill: none; stroke: var(--ink); stroke-width: 20; stroke-linecap: round; stroke-linejoin: round; }
.nm-route { fill: none; stroke: var(--c); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.nm-route-toll { fill: none; stroke: #fff; stroke-width: 4; stroke-dasharray: 9 7; }
.nm-route-st { fill: #fff; stroke: var(--ink); stroke-width: 5; }
.nm-route-st.is-stop { fill: var(--c-yellow); }
.nm-route-train rect { fill: var(--c-yellow); stroke: var(--ink); stroke-width: 4; }
.js-motion .nm-hl [data-route-draw] {
  stroke-dasharray: 1 1.001;
  stroke-dashoffset: 1;
  animation: route-draw 1.6s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 260ms);
}
@keyframes route-draw { to { stroke-dashoffset: 0; } }

/* map card around the svg */
.map-card {
  position: relative;
  margin: 0;
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow: inset 0 0 0 2px var(--ink), var(--shadow-lg);
  overflow: hidden;
}
.map-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 12px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.map-card-meta { color: var(--ink-3); }
@media (max-width: 480px) { .map-card-meta { display: none; } }
.map-frame { position: relative; padding: 18px 18px 10px; }
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-2);
}
.lg { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lg i { width: 22px; height: 6px; border-radius: 3px; background: var(--c); }
.lg i.lg-toll { background: repeating-linear-gradient(90deg, var(--ink) 0 6px, #fff 6px 10px); box-shadow: inset 0 0 0 1px var(--ink); height: 8px; }

/* ---------- page rail: the page itself is one line, sections are stations ---------- */
.has-rail { position: relative; }
.rail {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 3;
  display: none;
  overflow: visible;
}
@media (min-width: 1240px) { .rail { display: block; } }
.rail-track { fill: none; stroke: rgba(17, 24, 39, 0.13); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.rail-progress { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.rail-branch { fill: none; stroke: var(--line); stroke-width: 4; stroke-linecap: round; opacity: 0.9; }
.rail-st { fill: #fff; stroke: var(--ink); stroke-width: 4; transition: fill 0.3s; }
.rail-st.is-passed { fill: var(--line); }
.rail-train rect { fill: var(--ink); stroke: #fff; stroke-width: 3; }

/* ---------- reduced motion: everything drawn, trains parked ---------- */
@media (prefers-reduced-motion: reduce) {
  .js-motion [data-draw],
  .js-motion .netmap .nm-line,
  .js-motion .netmap .nm-casing,
  .js-motion .nm-hl [data-route-draw] { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .js-motion .netmap .nm-toll,
  .js-motion .netmap .nm-st,
  .js-motion .netmap .nm-lbl { opacity: 1; }
  .nm-train, .cta-train, .steps-train, .toll-train, .rail-train, .header-progress-train, .nav-stops-train { display: none; }
}
