/* Emporania "Transit": the route line (project header), the compact network rows, the platforms, the mini line.
   Drawn by templates/partials/transit/line.html and static/js/line.js. Colours are tokens; the project's own accent is
   --pc (set by the lib-p{id} or lib-c{n} class). Author: Jeremiah Buttler */

.line { position: relative; }
.line__svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.line__seg { stroke: var(--line); stroke-linecap: round; }
.line__seg.is-on { stroke: var(--pc); }
@keyframes line-draw { to { stroke-dashoffset: 0; } }
.line__loop, .line__branch { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 9; transition: stroke 400ms ease, stroke-width 400ms ease; }
.line__loop { stroke: var(--st-live); opacity: .55; }
.line__branch { stroke: var(--st-working); opacity: .7; }
.line__loop.is-lit, .line__branch.is-lit { opacity: 1; stroke-width: 6; stroke-dasharray: none; }
.line__loop.is-lit { stroke: var(--st-completed); }
.line__looplbl, .line__branchlbl { font: 600 12px var(--font-sign); letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); }
.line__looplbl { paint-order: stroke; stroke: var(--card); stroke-width: 8px; }
.line__branchlbl { fill: var(--st-working-ink); paint-order: stroke; stroke: var(--card); stroke-width: 8px; }
.line__arrow { fill: none; stroke: var(--st-live); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.line__arrow--b { stroke: var(--st-working); }
.line__train { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.line__train-body { fill: var(--st-building); }
.line__train-win { fill: #fff; opacity: .9; }

.line__stations { position: relative; height: 100%; }
.stn { position: absolute; top: calc(var(--y, 74px) - 22px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; width: calc(100% / 6 - 44px); text-align: center; }
.stn__r { font-size: 12px; font-weight: 700; }
.stn__btn { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 12px; color: inherit; text-decoration: none; }
span.stn__btn { cursor: default; }
.stn__dot { --size: 44px; border-width: 8px; font-size: 16px; transition: transform 300ms var(--ease-spring), box-shadow 200ms ease; box-shadow: 0 0 0 4px var(--bg); }
.st-live .stn__dot { color: var(--st-live); }
a.stn__btn:hover .stn__dot, button.stn__btn:hover .stn__dot { transform: scale(1.1); }
.stn__btn[aria-pressed="true"] .stn__dot, .stn__btn[aria-current="true"] .stn__dot { background: var(--st); color: #fff; }
.st-live .stn__btn[aria-pressed="true"] .stn__dot, .st-live .stn__btn[aria-current="true"] .stn__dot { color: var(--bg); }
.st-waiting .stn__btn[aria-pressed="true"] .stn__dot, .st-waiting .stn__btn[aria-current="true"] .stn__dot { color: #111; }
.stn__name { font-weight: 700; font-size: 14px; color: var(--ink); white-space: nowrap; }
.stn__btn[aria-pressed="true"] .stn__name, .stn__btn[aria-current="true"] .stn__name { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-color: var(--st); }
.stn__sub { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.35; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 32px; }
.stn__sub .mono { font-size: 11px; }
.stn .tip { position: absolute; top: 2px; right: calc(50% - 46px); margin: 0; }
.stn.is-dim .stn__dot { border-color: var(--line-strong); }
.stn.is-dim .stn__name { color: var(--muted); }
.stn.is-here .stn__dot { box-shadow: 0 0 0 4px var(--bg), 0 0 0 8px color-mix(in srgb, var(--st) 30%, transparent); }
.stn__here { position: absolute; top: -26px; padding: 3px 7px; border-radius: 4px; background: var(--st-working); color: #fff; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.stn__here::after { content: ""; position: absolute; left: 50%; bottom: -4px; margin-left: -4px; border: 4px solid transparent; border-bottom: 0; border-top-color: var(--st-working); }
.stn.is-busy .stn__dot { animation: busy 2s ease-out infinite; }
@keyframes busy { 0% { box-shadow: 0 0 0 4px var(--bg), 0 0 0 4px color-mix(in srgb, var(--st) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 4px var(--bg), 0 0 0 16px transparent; } }
.stn.is-bump .stn__dot { animation: bump 560ms var(--ease-spring); }
@keyframes bump { 30% { transform: scale(1.28); } }

.line--big { height: 240px; }
.line--slim { height: 52px; }
.line--slim .stn { top: 4px; flex-direction: row; justify-content: center; }
.line--slim .stn__btn { flex-direction: row; gap: 6px; }
.line--slim .stn__dot { --size: 26px; border-width: 5px; font-size: 11px; box-shadow: 0 0 0 3px var(--bg); }
.line--slim .stn__name { font-size: 11.5px; background: var(--bg); padding: 0 4px; }
.line--slim .stn__here { display: none; }
.line--slim .stn.is-here .stn__name { color: var(--st-working-ink); }

/* the line scrolls sideways inside its own box on narrow screens */
.line-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.line-scroll__in { min-width: 860px; }

/* ---------- Network map ---------- */
.netmap { padding: 8px 0 4px; }
.netmap__head, .nrow { display: grid; grid-template-columns: 220px 1fr 150px; gap: 0 18px; align-items: center; }
.netmap__head { position: sticky; top: var(--bar-h); z-index: 5; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); padding: 10px 0; border-bottom: 1px solid var(--line); }
.netmap__cols { position: relative; height: 34px; }
.netmap__col { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; width: calc(100% / 6); }
.netmap__col .sign { font-size: 12px; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.netmap__col::after { content: ""; width: 26px; height: 4px; border-radius: 2px; background: var(--st); }
.nrow { min-height: 78px; border-bottom: 1px solid var(--line); position: relative; transition: background 160ms ease; }
.nrow:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.nrow__name { display: flex; align-items: center; gap: 12px; padding-left: 4px; min-width: 0; text-decoration: none; color: inherit; }
.nrow__bullet { width: 30px; height: 30px; border-radius: 8px; background: var(--pc); color: var(--pi); display: grid; place-items: center; font: 700 13px/1 var(--font-sign); flex: none; }
.nrow__name b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrow__name small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nrow__name:hover b { text-decoration: underline; }
.nrow__line { position: relative; height: 40px; }
.nrow__track { position: absolute; inset: 0; }
.nrow__seg { position: absolute; top: 50%; height: 7px; margin-top: -3.5px; background: var(--line); border-radius: 4px; }
.nrow__seg.is-on { background: var(--pc); }
.nrow.is-drawn .nrow__seg { transform-origin: left; animation: seg-in 600ms var(--ease-out) backwards; }
@keyframes seg-in { from { transform: scaleX(0); } }
.nrow__ret { position: absolute; top: 50%; right: calc(100% / 12 - 18px); width: 18px; height: 18px; margin-top: -9px; border: 3px solid var(--line-strong); border-left: 0; border-radius: 0 12px 12px 0; }
.nstn { position: absolute; top: 50%; transform: translate(-50%, -50%); border: 0; background: none; padding: 4px; cursor: pointer; border-radius: 50%; text-decoration: none; display: block; }
.nstn .roundel { --size: 30px; border-width: 6px; font-size: 13px; transition: transform 260ms var(--ease-spring); }
.nstn:hover .roundel, .nstn:focus-visible .roundel { transform: scale(1.18); }
.nstn.is-empty .roundel { --size: 16px; border-width: 4px; border-color: var(--line-strong); }
.nstn.st-working:not(.is-empty) .roundel { --size: 36px; border-width: 7px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--st); }
.nstn__r { font-size: 11px; }
.nstn.st-live .roundel { background: var(--st-live); border-color: var(--st-live); }
.nstn.live-ok .roundel { box-shadow: inset 0 0 0 5px var(--bg); background: var(--st-completed); }
.nstn.live-warn .roundel { box-shadow: inset 0 0 0 5px var(--bg); background: var(--st-waiting); }
.nstn.live-bad .roundel { box-shadow: inset 0 0 0 5px var(--bg); background: var(--st-red); border-color: var(--st-red); }
.nstn.is-busy .roundel { animation: busy-sm 2s ease-out infinite; }
@keyframes busy-sm { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 14px transparent; } }
.nrow__end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-right: 4px; font-size: 12px; }
.nrow__end .btn { min-height: 34px; }

.station-peek { position: absolute; z-index: 40; width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 12px; opacity: 0; transform: translateY(6px) scale(.97); pointer-events: none; visibility: hidden; transition: opacity 140ms ease, transform 220ms var(--ease-spring); }
.station-peek.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.station-peek h4 { margin: 0 0 2px; font: 700 15px/1.2 var(--font-sign); text-transform: uppercase; letter-spacing: .05em; display: flex; gap: 8px; align-items: center; }
.station-peek p { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; }
.station-peek ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.station-peek li { display: flex; gap: 8px; align-items: center; }

/* ---------- Platforms (project hub) ---------- */
.platforms { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: start; }
.platform { min-height: 300px; border-radius: var(--r-lg); background: var(--surface); padding: 10px; border: 2px solid transparent; transition: border-color 160ms ease, background 200ms ease; scroll-snap-align: start; }
.platform__sign { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; font: 700 13px/1 var(--font-sign); text-transform: uppercase; letter-spacing: .07em; }
.platform__sign .num { margin-left: auto; min-width: 26px; height: 26px; border-radius: 13px; background: var(--st); color: #fff; display: grid; place-items: center; font-size: 13px; }
.st-waiting .platform__sign .num { color: #111; }
.st-live .platform__sign .num { color: var(--bg); }
.platform__body { display: grid; gap: 10px; }
.platform.is-target { border-color: var(--st); background: color-mix(in srgb, var(--st) 9%, var(--surface)); }
.platform.is-filtered-out { opacity: .35; }
.decline-dock { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); z-index: 80; display: flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 999px; background: var(--st-red); color: #fff; font-weight: 700; box-shadow: var(--shadow-3); transition: transform 300ms var(--ease-spring); }
.decline-dock.is-on { transform: translate(-50%, 0); }
.decline-dock.is-target { transform: translate(-50%, 0) scale(1.08); }
.ticket.is-dragging { opacity: .35; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; width: 230px; transform: rotate(-3deg); box-shadow: var(--shadow-3) !important; }

/* ---------- Mini line (tiles and cards): one lit station = where the project is now ---------- */
.mline { list-style: none; margin: 0; padding: 0 0 14px; display: flex; align-items: flex-start; }
.mline li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 46px; }
.mline li::before { content: ""; position: absolute; top: 9px; left: -50%; right: 50%; height: 5px; background: var(--line); }
.mline li:first-child::before { display: none; }
.mline li.is-past::before, .mline li.is-here::before { background: var(--pc); }
.mline i { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; border: 4px solid var(--st); background: var(--bg); display: grid; place-items: center; font: 700 9.5px/1 var(--font-sign); font-style: normal; color: var(--ink); }
.mline i .i { width: 9px; height: 9px; }
.mline li.is-empty i { border-color: var(--line-strong); color: var(--muted); }
.mline li.is-here i { width: 26px; height: 26px; margin-top: -2px; background: var(--st); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--st) 30%, transparent); }
.mline li.is-here.st-waiting i { color: #111; }
.mline span { display: none; font: 600 9.5px/1 var(--font-sign); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mline li.is-here span { display: block; position: absolute; top: 30px; white-space: nowrap; color: var(--st-ink); font-weight: 700; }

@media (max-width: 1279px) {
  .platforms-scroll { overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; }
  .platforms-scroll .platforms, .platforms-scroll .line-scroll__in { min-width: 1260px; }
}
@media (max-width: 1023px) {
  .netmap__head { display: none; }
  .nrow { grid-template-columns: 1fr auto; grid-template-areas: "name end" "line line"; padding: 12px 0 8px; gap: 6px 10px; }
  .nrow__name { grid-area: name; } .nrow__end { grid-area: end; } .nrow__line { grid-area: line; }
  .nrow__end .btn { display: none; }
  .netmap { padding: 0 12px; }
}
@media (max-width: 420px) {
  .mline li { width: 40px; }
}

/* positions along the line: six stops, each centred in a sixth (no inline style: the stop's index picks the place) */
.stn[data-i="0"], .nstn[data-i="0"], .netmap__col[data-i="0"] { left: 8.3333%; }
.stn[data-i="1"], .nstn[data-i="1"], .netmap__col[data-i="1"] { left: 25%; }
.stn[data-i="2"], .nstn[data-i="2"], .netmap__col[data-i="2"] { left: 41.6667%; }
.stn[data-i="3"], .nstn[data-i="3"], .netmap__col[data-i="3"] { left: 58.3333%; }
.stn[data-i="4"], .nstn[data-i="4"], .netmap__col[data-i="4"] { left: 75%; }
.stn[data-i="5"], .nstn[data-i="5"], .netmap__col[data-i="5"] { left: 91.6667%; }
.nrow__seg { width: 16.6667%; }
.nrow__seg[data-i="0"] { left: 8.3333%; }
.nrow__seg[data-i="1"] { left: 25%; }
.nrow__seg[data-i="2"] { left: 41.6667%; }
.nrow__seg[data-i="3"] { left: 58.3333%; }
.nrow__seg[data-i="4"] { left: 75%; }
