/* Pool del Chiese — finestra "Tappe e orari" della pagina Trasporti.
   Una linea alla volta: il percorso è disegnato fermata per fermata, i giorni sono in colonna.
   Su schermi stretti si vede un giorno alla volta (lo si sceglie con i pulsanti). */

html.tt-lock { overflow: hidden; }

.tt { width: min(1040px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px; background: var(--paper); color: var(--text); box-shadow: 0 40px 90px -30px rgba(13, 16, 32, .85); overflow: hidden; }
.tt[open] { display: flex; flex-direction: column; animation: tt-in .28s cubic-bezier(.2, .7, .2, 1); }
.tt::backdrop { background: rgba(13, 16, 32, .64); backdrop-filter: blur(3px); }
@keyframes tt-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.tt-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem 1rem; background: var(--ink); color: #fff; }
.tt-head .eyebrow { color: var(--yellow); margin: 0 0 .45rem; }
.tt-head h2 { margin: 0; color: #fff; font-size: clamp(1.9rem, 5vw, 2.6rem); }
.tt-x { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .3); background: transparent; color: #fff; font: 700 1.1rem/1 var(--body); cursor: pointer; transition: background .2s, border-color .2s; }
.tt-x:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.tt-body { overflow: auto; overscroll-behavior: contain; padding: 1.2rem 1.3rem 1.4rem; }

/* ---------- Scelta della linea ---------- */
.tt-lines { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.tt-line { --c: var(--ink); display: grid; gap: .3rem; font: inherit; text-align: left; padding: .8rem .9rem .8rem calc(.9rem + 7px); border: 2px solid var(--line); border-radius: var(--r); background: linear-gradient(var(--c), var(--c)) left / 7px 100% no-repeat, #fff; color: var(--ink); cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .25s, background-color .2s; }
.tt-line b { font: 800 italic 1.45rem/1 var(--display); text-transform: uppercase; }
.tt-line span { font-size: .95rem; line-height: 1.2; color: var(--muted); }
.tt-line:hover { transform: translateY(-2px); border-color: var(--c); }
.tt-line[aria-pressed="true"] { border-color: var(--c); background-color: color-mix(in srgb, var(--c) 8%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 26%, transparent); }

.tt-sum { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; margin: 1rem 0 .9rem; font-size: 1rem; }
.tt-sum b { font: 700 1.3rem/1 var(--display); text-transform: uppercase; letter-spacing: .03em; color: var(--ink); margin-right: .3rem; }
.tt-sum span { padding: .28rem .65rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: .93rem; }

/* ---------- Scelta del giorno (solo su schermi stretti) ---------- */
.tt-days { display: none; gap: .4rem; margin-bottom: .9rem; }
.tt-day { position: relative; flex: 1; padding: .6rem .3rem; border: 2px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: 700 1.05rem/1 var(--display); text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.tt-day[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tt-day.today::after { content: ""; position: absolute; top: -3px; right: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px var(--paper); }

/* ---------- Tabella ---------- */
.tt-wrap { --c: var(--ink); background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.tt-table { width: 100%; border-collapse: collapse; }
.tt-table th, .tt-table td { padding: .5rem .55rem; text-align: center; vertical-align: middle; border-bottom: 1px solid var(--line); }
.tt-table tbody tr:last-child > * { border-bottom: 0; }
.tt-table thead th { padding: .75rem .5rem; border-bottom: 0; background: var(--ink); color: #fff; font: 700 1.02rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .08em; }
.tt-table thead th small { display: block; margin-top: .25rem; font: 500 .74rem/1 var(--body); letter-spacing: .02em; text-transform: none; opacity: .85; }
.tt-table thead .tt-hstop { text-align: left; padding-left: 2.6rem; }
.tt-ora { width: 4.6rem; font: 800 italic 1.35rem/1 var(--display); color: var(--ink); white-space: nowrap; }
/* fermata, con la linea del percorso: un pallino per fermata, pieno ai capolinea */
.tt-table .tt-stop { position: relative; text-align: left; padding-left: 2.6rem; font-weight: 400; }
.tt-stop b { display: block; font-weight: 700; line-height: 1.2; color: var(--ink); }
.tt-stop span { display: block; font-size: .92rem; line-height: 1.25; color: var(--muted); }
.tt-stop::before { content: ""; position: absolute; left: 1.05rem; top: 0; bottom: -1px; width: 4px; background: var(--c); }
.tt-stop::after { content: ""; position: absolute; left: calc(1.05rem - 5px); top: 50%; width: 14px; height: 14px; margin-top: -7px; box-sizing: border-box; border-radius: 50%; background: #fff; border: 3px solid var(--c); }
.tt-table tbody tr:first-child .tt-stop::before { top: 50%; }
.tt-table tbody tr:last-child .tt-stop::before { bottom: 50%; }
.tt-table tbody tr:first-child .tt-stop::after, .tt-table tbody tr:last-child .tt-stop::after { background: var(--c); }
/* colonne dei giorni */
.tt-d { width: 6.6rem; }
.tt-table tbody .tt-d.today { background: color-mix(in srgb, var(--yellow) 16%, #fff); }
.tt-table thead .tt-d.today { background: var(--yellow); color: var(--ink); }
.tt-table tbody .tt-d.off { background: repeating-linear-gradient(135deg, #fff 0 7px, #f1eee6 7px 14px); }
.tt-table thead .tt-d.off { background: var(--ink-3); color: var(--on-ink-muted); }
.tt-table thead .tt-d.off.today { background: #e9dfb9; color: var(--ink); }
.tt-none { color: #cdc8ba; }
.tt-cell { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .3rem; }
.tt-chip { display: inline-flex; align-items: center; justify-content: center; gap: .2rem; min-width: 2.9rem; padding: .32rem .5rem; border-radius: 999px; font: 700 1.1rem/1 var(--display); color: var(--ink); white-space: nowrap; }
.tt-chip i { font-style: normal; font-size: .95em; }
.tt-su { background: var(--yellow); }  /* salgono */
.tt-giu { background: var(--green); }  /* scendono */

.tt-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem; margin: .9rem 0 0; font-size: .95rem; color: var(--muted); }
.tt-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.tt-legend .tt-chip { min-width: 0; padding: .25rem .5rem; font-size: .95rem; }
.tt-note { margin: .9rem 0 0; padding: .8rem 1rem; background: #fff7dc; border-left: 6px solid var(--yellow); border-radius: 0 var(--r) var(--r) 0; font-size: .98rem; }
.tt-note b { color: var(--ink); }

@media (max-width: 720px) {
  .tt { width: calc(100vw - 12px); max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); border-radius: 14px; }
  .tt-head { padding: .9rem 1rem .8rem; }
  .tt-body { padding: 1rem .8rem 1.1rem; }
  .tt-lines { gap: .4rem; }
  .tt-line { padding: .7rem .4rem .7rem calc(.5rem + 6px); background-size: 6px 100%, auto; }
  .tt-line b { font-size: 1.12rem; }
  .tt-line span { display: none; }
  .tt-sum b { flex-basis: 100%; }
  /* un giorno alla volta */
  .tt-days { display: flex; }
  .tt-d:not(.on) { display: none; }
  .tt-d { width: 6rem; }
  .tt-ora { width: 3.7rem; font-size: 1.2rem; }
  .tt-table .tt-stop, .tt-table thead .tt-hstop { padding-left: 2.2rem; }
  .tt-stop::before { left: .85rem; }
  .tt-stop::after { left: calc(.85rem - 5px); }
}

/* ---------- Movimento ridotto (vedi site.css) ---------- */
@media (prefers-reduced-motion: reduce) {
  html:not(.motion) .tt-line:hover { transform: none; }
}
