/* «برنامهٔ حرکت شناورها» on the port page. Built on port.css tokens, so
   light (default) and dark ([data-theme="dark"], the page's own switch)
   follow the site. Logical properties for fa/ar (RTL) and en (LTR). */
:root {
  --bd-bg: var(--card); --bd-border: var(--line); --bd-line: var(--line-2); --bd-head: var(--muted);
  --bd-text: var(--text); --bd-text-2: var(--text-2); --bd-next: var(--accent-soft);
  --flap-a: #eef2f8; --flap-b: #e1e7f0; --flap-ink: var(--brand);
  --flap-shadow: inset 0 -1px 0 rgba(15, 27, 45, .12), 0 1px 0 rgba(15, 27, 45, .04);
}
:root[data-theme="dark"] {
  --bd-bg: #071226; --bd-border: #13284a; --bd-line: #12223d; --bd-head: #7f95b3;
  --bd-text: #e6eef8; --bd-text-2: #c3d2e6; --bd-next: rgba(25, 211, 193, .08);
  --flap-a: #16263f; --flap-b: #0f1c31; --flap-ink: #ffd666; --flap-shadow: inset 0 -1px 0 #0006;
}

.tt { display: grid; gap: 18px; }
.tt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tt-head h2 { font-size: 20px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.tt-head .day { font-size: 14px; font-weight: 500; color: var(--muted); }
.tt-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.tt-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: tt-pulse 2.4s infinite; }
.tt-live.stale i { background: var(--warn); animation: none; }
@keyframes tt-pulse { 0% { box-shadow: 0 0 0 0 rgba(19,138,82,.45); } 70% { box-shadow: 0 0 0 8px rgba(19,138,82,0); } 100% { box-shadow: 0 0 0 0 rgba(19,138,82,0); } }

.tt-ban { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); font-weight: 500; }
.tt-ban small { color: var(--muted); font-weight: 400; }

.tt .seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.tt .seg button { font: 500 13px/1 var(--font); color: var(--muted); background: none; border: 0; padding: 8px 13px; border-radius: 999px; cursor: pointer; min-height: 34px; }
.tt .seg button.on { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .tt .seg button.on { background: var(--accent); color: #04201d; }
.tt-filters { display: flex; flex-wrap: wrap; gap: 8px; }

/* next departure per direction */
.tt-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tt .nx { position: relative; padding: 16px 18px 14px; display: grid; gap: 8px; align-content: start; }
.tt .nx::before { content: ''; position: absolute; inset-inline-start: 0; inset-block: 0; width: 4px; background: var(--accent); opacity: .85; }
.tt .nx-route { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.tt .nx-route .arr { color: var(--accent); font-weight: 700; }
.tt .nx-time { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.tt .nx-time b { font-size: 38px; line-height: 1; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tt .nx-cd { font-size: 13px; color: var(--muted); }
.tt .nx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--text-2); }
.tt .nx-win { color: var(--muted); font-size: 12px; }
.tt .nx-then { font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.tt .nx-then span { font-variant-numeric: tabular-nums; color: var(--text-2); }
.tt .nx-empty { color: var(--muted); font-size: 13.5px; }
.tt .ico { width: 18px; height: 18px; flex: none; color: var(--muted); }
.tt .ico.car { color: var(--warn); }
.tt .ico.pax { color: var(--link); }

/* one colour = one meaning, the same legend everywhere */
.tt .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.tt .chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tt .chip[data-s="scheduled"] { color: var(--link); background: var(--link-soft); }
.tt .chip[data-s="usual"] { color: var(--muted); border: 1px dashed var(--line); }
.tt .chip[data-s="departed"], .tt .chip[data-s="underway"] { color: var(--accent); background: var(--accent-soft); }
.tt .chip[data-s="arrived"] { color: var(--ok); background: var(--ok-soft); }
.tt .chip[data-s="delayed"] { color: var(--warn); background: var(--warn-soft); }
.tt .chip[data-s="cancelled"], .tt .chip[data-s="cancelled_weather"] { color: var(--bad); background: var(--bad-soft); }
.tt .chip[data-s="unknown"] { color: var(--dim); background: var(--card-2); }
.tt .chip.full { color: var(--warn); background: var(--warn-soft); }
.tt .chip.full::before { border-radius: 2px; }
.tt a.onmap { font-size: 12px; font-weight: 600; margin-inline-start: 8px; }

/* departures board (split-flap) */
.tt-board { background: var(--bd-bg); border-radius: 16px; padding: 18px 18px 8px; color: var(--bd-text); box-shadow: var(--shadow-up); border: 1px solid var(--bd-border); }
.tt-board .bh, .tt-board .row { display: grid; grid-template-columns: 96px 1.5fr 1.2fr 1.5fr 110px 150px; gap: 12px; align-items: center; }
.tt-board .bh { padding: 0 12px 10px; font-size: 11.5px; letter-spacing: .3px; color: var(--bd-head); font-weight: 600; }
.tt-board .row { padding: 9px 12px; border-top: 1px solid var(--bd-line); }
.tt-board .row.past { opacity: .5; }
.tt-board .row.next { background: var(--bd-next); border-radius: 10px; }
.tt-board .row.empty { display: block; color: var(--bd-head); text-align: center; padding: 22px; }
.tt .flap { display: inline-flex; gap: 3px; direction: ltr; }
.tt .flap span { display: inline-grid; place-items: center; width: 19px; height: 30px; border-radius: 4px; background: linear-gradient(var(--flap-a) 50%, var(--flap-b) 50%); color: var(--flap-ink); font: 600 19px/1 var(--mono); box-shadow: var(--flap-shadow); }
html[lang="fa"] .tt .flap span, html[lang="ar"] .tt .flap span { font-family: var(--font); font-weight: 700; }
/* no hinge line across the digit: it crosses the small Persian zero («۰») */
.tt .flap span.sep { width: 8px; background: none; box-shadow: none; }
.tt .flap span.flip { animation: tt-flip .5s ease-in-out; }
@keyframes tt-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.tt-board .rt { font-weight: 600; font-size: 14.5px; }
.tt-board .ty { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--bd-text-2); }
.tt-board .vs { font-size: 14px; } .tt-board .vs small { display: block; color: var(--bd-head); font-size: 12px; }
.tt-board .cap { font-size: 13px; color: var(--bd-text-2); font-variant-numeric: tabular-nums; }
.tt-board .bf { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px 6px; border-top: 1px solid var(--bd-line); font-size: 12px; color: var(--bd-head); }

/* day timeline (right to left in fa/ar, like the page's 24 h chart) */
.tt-tl .tl-body { padding: 8px 18px 16px; min-height: 120px; }
.tt .tl-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); padding: 10px 0 0; }
.tt .tl-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: middle; margin-inline-end: 5px; }
.tt .tl-axis, .tt .tl-lane { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.tt .tl-axis .ticks { position: relative; height: 22px; }
.tt .tl-axis .ticks span { position: absolute; top: 2px; font-size: 11px; color: var(--dim); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.tt .tl-lane { min-height: 38px; border-top: 1px solid var(--line-2); }
.tt .tl-lane .nm { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tt .tl-lane .tr { position: relative; height: 38px; }
.tt .tl-lane .grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.tt .tl-win { position: absolute; top: 9px; height: 20px; border-radius: 6px; background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 6px, transparent 6px, transparent 11px); border: 1px dashed var(--warn); opacity: .9; }
.tt .tl-bar { position: absolute; top: 11px; height: 16px; border-radius: 5px; background: var(--c-bar); opacity: .85; }
.tt .tl-bar.full { background: var(--warn); }
.tt .tl-dot { position: absolute; top: 12px; width: 14px; height: 14px; border-radius: 50%; background: var(--link); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--link); transform: translateX(-50%); }
html[dir="rtl"] .tt .tl-axis .ticks span, html[dir="rtl"] .tt .tl-dot { transform: translateX(50%); }
.tt .tl-bar.past, .tt .tl-dot.past { opacity: .35; }
.tt .tl-now { position: absolute; top: -26px; bottom: 0; width: 2px; background: var(--bad); z-index: 2; }
.tt .tl-now[data-t]::before { content: attr(data-t); position: absolute; top: -2px; left: 50%; transform: translateX(-50%); font-size: 10.5px; background: var(--bad); color: #fff; padding: 1px 5px; border-radius: 4px; white-space: nowrap; }

.tt-src { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.tt-src .card-b { font-size: 13px; color: var(--text-2); display: grid; gap: 8px; }
.tt-src .kv { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
.tt-src .note { font-size: 12px; }
.tt .ais-note { display: flex; gap: 10px; align-items: flex-start; }
.tt .ais-note svg { flex: none; width: 22px; height: 22px; color: var(--accent); }

@media (max-width: 760px) {
  /* swipe inside the panel's own width: the page gutter is not a fixed 16 px on phones */
  .tt-hero { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; scrollbar-width: none; }
  .tt-hero .nx { flex: 0 0 82%; scroll-snap-align: start; }
  .tt-board { padding: 12px 6px 6px; border-radius: 14px; }
  .tt-board .bh { display: none; }
  .tt-board .row { grid-template-columns: auto 1fr auto; grid-template-areas: "tm rt st" "tm vs cap"; row-gap: 4px; }
  .tt-board .row > :nth-child(1) { grid-area: tm; }
  .tt-board .row > :nth-child(2) { grid-area: rt; }
  .tt-board .row > :nth-child(3) { display: none; }
  .tt-board .row > :nth-child(4) { grid-area: vs; }
  .tt-board .row > :nth-child(5) { grid-area: cap; text-align: end; }
  .tt-board .row > :nth-child(6) { grid-area: st; text-align: end; }
  .tt .flap span { width: 16px; height: 26px; font-size: 16px; }
  .tt-tl .tl-body { padding: 6px 12px 12px; }
  .tt .tl-axis, .tt .tl-lane { grid-template-columns: 1fr; gap: 2px; }
  .tt .tl-axis > span:first-child { display: none; }
  .tt .tl-lane { padding-top: 6px; }
  .tt .tl-axis .ticks span:nth-child(even) { display: none; }
  .tt-src { grid-template-columns: 1fr; }
  .tt-filters .seg { overflow-x: auto; max-width: 100%; }
  .tt .seg button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .tt .flap span.flip, .tt-live i { animation: none !important; } }
