/* ==========================================================================
   PAGE ARRÊT — /arret/{id}
   Chargé APRÈS assets/css/style.css (tokens --text, --muted, --card, --accent…).
   Parti pris (déc. 2026) : une fiche d'arrêt sobre, façon signalétique de transport.
   Pas de pastilles « live », pas de fil d'Ariane, pas de halos : un titre, les lignes
   aux couleurs officielles, un tableau de départs, une carte, des listes à filets fins.
   ========================================================================== */

.stop-detail {
  --sd-radius: 12px;
  --sd-line: rgba(var(--tint-rgb), 0.09);
  --sd-red: #dc2626;
}

.sd-wrap {
  max-width: 1080px;
}

/* ---------- En-tête de l'arrêt ---------- */
.sd-hero {
  padding-top: calc(var(--header-h) + clamp(36px, 6vh, 64px));
  padding-bottom: clamp(24px, 4vh, 36px);
}

.sd-up {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
  transition: color 0.15s;
}

.sd-up:hover {
  color: var(--text);
}

.sd-title {
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0;
}

.sd-meta {
  margin-top: 12px;
  font-size: 15.5px;
  color: var(--muted);
  max-width: 70ch;
}

.sd-sep {
  margin: 0 8px;
  opacity: 0.45;
}

.sd-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--muted);
}

.sd-meta code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}

/* Pastille de ligne : carré aux couleurs officielles, comme sur les poteaux TEC */
.sd-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sd-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.sd-lines a.sd-line {
  transition: opacity 0.15s;
}

.sd-lines a.sd-line:hover {
  opacity: 0.82;
}

.sd-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin-top: 24px;
}

.sd-actions .btn-accent,
.sd-actions .btn-accent:hover {
  box-shadow: none;
  transform: none;
}

.sd-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(var(--tint-rgb), 0.3);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.15s;
}

.sd-link:hover {
  text-decoration-color: currentColor;
}

/* ---------- Départs + carte ---------- */
.sd-board {
  padding-bottom: clamp(36px, 6vh, 64px);
}

.sd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.sd-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--sd-radius);
  overflow: hidden;
}

.sd-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
}

.sd-panel-head h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sd-updated {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dep-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.dep-table th {
  padding: 8px 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  border-top: 1px solid var(--sd-line);
  border-bottom: 1px solid var(--sd-line);
}

.dep-table th:first-child { width: 76px; }
.dep-table th:last-child { width: 108px; }
.dep-table .t-r { text-align: right; }

.dep-table td {
  padding: 12px 20px;
  vertical-align: middle;
  border-bottom: 1px solid var(--sd-line);
}

.dep-table tr:last-child td {
  border-bottom: none;
}

.dep-table td.c-line {
  padding-right: 0;
}

.arr-info {
  min-width: 0;
}

.arr-dest {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arr-hms {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.arr-info .arr-hms {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arr-time {
  text-align: right;
  white-space: nowrap;
}

.arr-mins {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.arr-mins.live {
  color: var(--green);
}

.arr-mins.appr {
  color: var(--green);
}

.arr-mins.urg {
  color: #ea580c;
}

.ap-live {
  color: var(--green);
  font-weight: 600;
}

.dep-empty td {
  padding: 44px 20px;
  text-align: center;
  font-size: 14.5px;
  color: var(--muted);
}

.sd-note {
  padding: 12px 20px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--sd-line);
}

.sd-key-live {
  color: var(--green);
  font-weight: 600;
}

/* passage supprimé / qui ne dessert pas l'arrêt (annonces GTFS-RT du TEC) */
.dep-table .arr-row.dep-off .arr-dest { text-decoration: line-through; color: var(--muted); }
.dep-table .arr-row.dep-off .sd-line { opacity: 0.45; }
.dep-table .arr-row.dep-off .arr-info .arr-hms { color: var(--sd-red); font-weight: 600; }
.dep-table .arr-row.dep-off .arr-mins.off { text-decoration: line-through; color: var(--muted); }

.dep-off-tag {
  margin-top: 2px;
  color: var(--sd-red);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Carte Leaflet ---------- */
.sd-mapbox {
  display: flex;
  min-height: 420px;
}

.stop-map {
  flex: 1;
  min-height: 420px;
  background: var(--bg-soft);
}

.stop-map .leaflet-container {
  background: var(--bg-soft);
  font-family: var(--font-body);
}

.stop-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.bus-marker-wrap {
  position: relative;
  width: 42px;
  height: 46px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bus-marker-icon {
  width: 34px;
  height: 34px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.lf-num {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: #17171a;
  color: #fff;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font-display);
  line-height: 1.55;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--muted);
}

/* ---------- Autres quais / arrêts proches ---------- */
.sd-around {
  padding-bottom: clamp(36px, 6vh, 64px);
}

.sd-around-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px 48px;
}

.sd-h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}

.sd-stoplist {
  list-style: none;
  border-top: 1px solid var(--sd-line);
}

.sd-stoplist li {
  border-bottom: 1px solid var(--sd-line);
}

.sd-stoplist a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 16px;
  padding: 11px 4px;
  transition: background-color 0.15s;
}

.sd-stoplist a:hover {
  background: rgba(var(--tint-rgb), 0.04);
}

.sl-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sl-id {
  margin-left: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.sl-lines {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sl-dist {
  min-width: 52px;
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- À propos + FAQ ---------- */
.sd-about {
  padding: clamp(36px, 6vh, 64px) 0 clamp(56px, 9vh, 110px);
  border-top: 1px solid var(--sd-line);
}

.sd-about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px 56px;
  align-items: start;
}

.sd-about-text p {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 16px;
  max-width: 62ch;
}

.sd-routes {
  display: grid;
  gap: 8px;
  margin: 4px 0 20px;
}

.sd-routes div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sd-routes dd {
  font-size: 14.5px;
  color: var(--text);
}

.sd-faq details {
  border-top: 1px solid var(--sd-line);
}

.sd-faq details:last-child {
  border-bottom: 1px solid var(--sd-line);
}

.sd-faq summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding: 15px 32px 15px 0;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
}

.sd-faq summary::-webkit-details-marker {
  display: none;
}

.sd-faq summary::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s;
}

.sd-faq details[open] summary::after {
  transform: translateY(-30%) rotate(-135deg);
}

.sd-faq details p {
  padding: 0 0 16px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 62ch;
}

/* ---------- Perturbations de l'arrêt (annonces du TEC) ---------- */
.sd-alerts {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.sd-alerts[hidden] { display: none; }

.sd-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sd-red);
  border-radius: 8px;
}

.sd-alert-ico {
  flex-shrink: 0;
  color: var(--sd-red);
  padding-top: 2px;
}

.sd-alert-body { min-width: 0; }

.sd-alert-kicker {
  font-size: 13px;
  font-weight: 600;
  color: var(--sd-red);
}

.sd-alert h2 {
  margin-top: 2px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.sd-alert h2 span { font-weight: 500; color: var(--muted); }

.sd-alert-text {
  margin-top: 6px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
}

.sd-alert-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Index des arrêts (/arrets, /arrets/{localité}) ---------- */
.ai-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 20px;
}

.ai-letters a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  transition: background-color 0.15s;
}

.ai-letters a:hover {
  background: rgba(var(--tint-rgb), 0.05);
}

.ai-search {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  max-width: 520px;
}

.ai-search input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.ai-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ai-group {
  padding-top: 28px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.ai-group h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

.ai-cols {
  columns: 4 200px;
  column-gap: 32px;
  list-style: none;
}

.ai-cols li {
  break-inside: avoid;
  padding: 4px 0;
  font-size: 15px;
}

.ai-cols a {
  color: var(--text);
}

.ai-cols a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ai-cols small {
  color: var(--muted);
  font-size: 12.5px;
  margin-left: 4px;
}

.ai-results {
  padding-bottom: clamp(56px, 9vh, 110px);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sd-grid,
  .sd-about-grid {
    grid-template-columns: 1fr;
  }

  .sd-mapbox,
  .stop-map {
    min-height: 300px;
  }
}

@media (max-width: 560px) {
  .dep-table th,
  .dep-table td {
    padding-left: 14px;
    padding-right: 14px;
  }

  .dep-table th:first-child { width: 62px; }
  .dep-table th:last-child { width: 116px; }

  .sd-panel-head {
    padding-left: 14px;
    padding-right: 14px;
  }

  .sd-note {
    padding-left: 14px;
    padding-right: 14px;
  }

  .sl-lines {
    display: none;
  }

  .sd-stoplist a {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* Passage suivi en temps réel : petites ondes vertes devant l'heure, heure et attente en vert
   (même principe que la fiche arrêt de la carte) */
.arr-mins .live-ico {
  display: inline-block;
  margin-right: 6px;
  vertical-align: -1px;
  color: var(--green);
}

.dep-table .arr-row.assured .arr-time .arr-hms {
  color: var(--green);
  font-weight: 600;
}

.live-ico .w1 { animation: live-wave 1.8s ease-in-out infinite; }
.live-ico .w2 { animation: live-wave 1.8s ease-in-out .3s infinite; }

@keyframes live-wave {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

@media (prefers-reduced-motion: reduce) {
  .live-ico .w1,
  .live-ico .w2 { animation: none; }
}
