/* ═══════════════════════════════════════════════════════════════════════════
   WebCam Meteo — Frontend pubblico (index / station / timelapse)
   Mobile-first, responsive, tema "cielo notturno".
   L'area Admin continua a usare style.css: questo file non la tocca.
═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #060a13;
    --bg-2:        #0b1120;
    --surface:     rgba(255,255,255,.045);
    --surface-2:   rgba(255,255,255,.08);
    --surface-solid:#111a2c;
    --line:        rgba(255,255,255,.09);
    --line-strong: rgba(255,255,255,.18);
    --text:        #eef2f8;
    --text-2:      #a7b1c2;
    --text-3:      #6b7689;
    --sky:         #5cc8ff;
    --sky-2:       #2f8cff;
    --sun:         #ffb547;
    --ok:          #3ee08f;
    --warn:        #ffc93c;
    --bad:         #ff6b7a;
    --grad:        linear-gradient(135deg, #5cc8ff 0%, #2f8cff 55%, #7a5cff 100%);
    --grad-warm:   linear-gradient(135deg, #ffb547 0%, #ff7a59 100%);
    --radius:      18px;
    --radius-sm:   12px;
    --radius-xs:   8px;
    --shadow:      0 20px 50px -20px rgba(0,0,0,.7);
    --shadow-glow: 0 10px 40px -12px rgba(47,140,255,.55);
    --ease:        cubic-bezier(.2,.8,.2,1);
    --header-h:    64px;
    --tabbar-h:    64px;
    --gutter:      16px;
    --font:        "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: dark;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(1200px 600px at 85% -10%, rgba(47,140,255,.22), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(122,92,255,.16), transparent 60%),
        radial-gradient(800px 500px at 50% 110%, rgba(255,181,71,.08), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

a { color: var(--sky); text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.num { font-variant-numeric: tabular-nums; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(6,10,19,.72);
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}
.header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
    color: var(--text);
}
.brand-mark {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: grid; place-items: center;
    background: var(--grad);
    box-shadow: var(--shadow-glow);
    color: #fff;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name {
    font-weight: 750;
    font-size: 1rem;
    letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: .72rem; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }

.header-right { display: flex; align-items: center; gap: .75rem; }

.clock {
    display: inline-flex; align-items: center; gap: .45rem;
    font-size: .85rem; font-weight: 600; color: var(--text-2);
    padding: .4rem .7rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nav-desktop { display: none; gap: .25rem; }
.nav-desktop a {
    color: var(--text-2);
    font-size: .92rem; font-weight: 550;
    padding: .5rem .9rem;
    border-radius: 999px;
    transition: color .2s, background .2s;
}
.nav-desktop a:hover { color: var(--text); background: var(--surface); }
.nav-desktop a.active { color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ── Tab bar mobile ─────────────────────────────────────────────────────── */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(8,13,24,.86);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--line);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    font-size: .7rem; font-weight: 600;
    color: var(--text-3);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.tabbar a.active { color: var(--text); }
.tabbar a.active::before {
    content: "";
    position: absolute; top: 0; left: 50%;
    width: 32px; height: 3px; margin-left: -16px;
    border-radius: 0 0 3px 3px;
    background: var(--grad);
}
.tabbar a.active svg { color: var(--sky); }

/* ── Pulsanti ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 44px;
    padding: .6rem 1.1rem;
    border-radius: 999px;
    font-size: .92rem; font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    white-space: nowrap;
    transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(255,255,255,.12); border-color: var(--line-strong); color: #fff; }
.btn:active { transform: scale(.97); }
.btn-primary {
    color: #fff;
    background: var(--grad);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-glass {
    color: #fff;
    background: rgba(0,0,0,.42);
    border-color: rgba(255,255,255,.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.btn-glass:hover { background: rgba(0,0,0,.6); }
.btn-sm { min-height: 36px; padding: .4rem .85rem; font-size: .84rem; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

/* ── Status pill ────────────────────────────────────────────────────────── */
.status-pill {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .28rem .7rem .28rem .6rem;
    border-radius: 999px;
    font-size: .74rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
    background: rgba(8,12,22,.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--line);
}
.status-pill::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: currentColor;
}
.status-online  { color: var(--ok); }
.status-online::before { box-shadow: 0 0 0 0 rgba(62,224,143,.6); animation: ping 1.8s infinite; }
.status-warning { color: var(--warn); }
.status-offline { color: var(--bad); }
@keyframes ping {
    0%   { box-shadow: 0 0 0 0 rgba(62,224,143,.55); }
    70%  { box-shadow: 0 0 0 8px rgba(62,224,143,0); }
    100% { box-shadow: 0 0 0 0 rgba(62,224,143,0); }
}

.live-badge {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: rgba(255,59,92,.18);
    border: 1px solid rgba(255,59,92,.45);
    color: #ff8fa3;
    font-size: .72rem; font-weight: 800; letter-spacing: .12em;
}
.live-badge::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: #ff3b5c; animation: blink 1.4s infinite;
}
@keyframes blink { 50% { opacity: .25; } }

/* ── Hero homepage ──────────────────────────────────────────────────────── */
.hero {
    position: relative;
    margin: 0 calc(var(--gutter) * -1);
    min-height: 62vh;
    min-height: 62svh;
    display: flex; align-items: flex-end;
    overflow: hidden;
    isolation: isolate;
    background: var(--bg-2);
}
.hero-media {
    position: absolute; inset: 0; z-index: -2;
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scale(1.04);
    animation: kenburns 30s ease-in-out infinite alternate;
}
@keyframes kenburns { to { transform: scale(1.12) translate(-1%, -1%); } }
.hero::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
        linear-gradient(180deg, rgba(6,10,19,.35) 0%, rgba(6,10,19,0) 30%, rgba(6,10,19,.55) 65%, var(--bg) 100%),
        linear-gradient(90deg, rgba(6,10,19,.55) 0%, rgba(6,10,19,0) 60%);
}
.hero--empty::after {
    background:
        radial-gradient(600px 300px at 80% 20%, rgba(92,200,255,.25), transparent 70%),
        radial-gradient(500px 300px at 10% 90%, rgba(255,181,71,.15), transparent 70%);
}
.hero-content {
    width: 100%;
    padding: 2rem var(--gutter) 1.75rem;
    display: flex; flex-direction: column; gap: .9rem;
}
.hero-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.hero h1 {
    font-size: clamp(2rem, 8.5vw, 4.2rem);
    line-height: 1.02;
    font-weight: 800;
    letter-spacing: -.035em;
    max-width: 16ch;
    text-shadow: 0 2px 30px rgba(0,0,0,.4);
}
.hero h1 .grad {
    background: linear-gradient(90deg, #fff 0%, #bfe8ff 45%, var(--sky) 100%);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.hero-desc { color: #d5deea; font-size: clamp(.95rem, 2.6vw, 1.15rem); max-width: 52ch; }
.hero-meta {
    display: flex; flex-wrap: wrap; gap: .5rem;
    font-size: .85rem; color: var(--text-2);
}
.hero-meta > span {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    background: rgba(0,0,0,.35);
    border: 1px solid var(--line);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .25rem; }
.hero-actions .btn { flex: 1 1 auto; }

/* ── Sezioni ────────────────────────────────────────────────────────────── */
.section { padding: 1.75rem 0 0; }
.section-head {
    display: flex; align-items: flex-end; flex-wrap: wrap; justify-content: space-between;
    gap: 1rem; margin-bottom: 1rem;
}
.eyebrow {
    display: block;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--sky);
    margin-bottom: .2rem;
}
.section-title { font-size: clamp(1.3rem, 4vw, 1.75rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.section-sub { color: var(--text-3); font-size: .88rem; }

.segmented {
    display: inline-flex; padding: 4px; gap: 2px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
}
.segmented button, .segmented a {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-width: 38px; min-height: 36px;
    padding: 0 .8rem;
    border-radius: 999px;
    font-size: .85rem; font-weight: 600;
    color: var(--text-2);
    transition: background .2s, color .2s;
}
.segmented button:hover { color: var(--text); }
.segmented .active, .segmented .btn-primary {
    color: #fff;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}
.layout-switch button { padding: 0; width: 38px; }

/* ── Griglia stazioni ───────────────────────────────────────────────────── */
.stations-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
.station-card {
    position: relative;
    display: flex; flex-direction: column;
    border-radius: var(--radius);
    overflow: hidden;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: transform .35s var(--ease), border-color .3s, box-shadow .3s;
    -webkit-tap-highlight-color: transparent;
}
.station-card:hover {
    transform: translateY(-4px);
    border-color: rgba(92,200,255,.35);
    box-shadow: var(--shadow), 0 0 0 1px rgba(92,200,255,.12), 0 18px 50px -20px rgba(47,140,255,.45);
}
.card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #0a0f1c;
    overflow: hidden;
}
.card-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .8s var(--ease), opacity .4s;
}
.station-card:hover .card-thumb img { transform: scale(1.06); }
.card-thumb::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 35%, rgba(0,0,0,0) 60%, rgba(0,0,0,.55) 100%);
    pointer-events: none;
}
.card-badges {
    position: absolute; z-index: 2;
    top: .7rem; left: .7rem; right: .7rem;
    display: flex; justify-content: space-between; align-items: center; gap: .5rem;
}
.card-time {
    position: absolute; z-index: 2;
    right: .7rem; bottom: .7rem;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .76rem; font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-variant-numeric: tabular-nums;
}
.card-play {
    position: absolute; z-index: 2; left: 50%; top: 50%;
    width: 56px; height: 56px; margin: -28px 0 0 -28px;
    display: grid; place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0; transform: scale(.85);
    transition: opacity .3s, transform .3s var(--ease);
}
.station-card:hover .card-play { opacity: 1; transform: scale(1); }
.no-image {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
    color: var(--text-3); font-size: .85rem;
    background:
        radial-gradient(circle at 30% 20%, rgba(92,200,255,.12), transparent 60%),
        #0a0f1c;
}
.card-body {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem 1rem 1rem;
}
.card-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.25; }
.card-location {
    display: flex; align-items: center; gap: .3rem;
    margin-top: .15rem;
    font-size: .82rem; color: var(--text-3);
}
.card-arrow {
    width: 36px; height: 36px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-2);
    transition: background .3s, color .3s, transform .3s var(--ease);
}
.station-card:hover .card-arrow { background: var(--grad); color: #fff; transform: translateX(2px); }

/* Layout: singola */
.stations-grid.layout-single { grid-template-columns: 1fr; max-width: 1040px; margin: 0 auto; }
.stations-grid.layout-single .card-name { font-size: 1.25rem; }

/* Layout: lista */
.stations-grid.layout-list { grid-template-columns: 1fr; gap: .6rem; }
.stations-grid.layout-list .station-card { flex-direction: row; align-items: stretch; border-radius: var(--radius-sm); }
.stations-grid.layout-list .card-thumb { width: 38%; max-width: 220px; aspect-ratio: 4 / 3; flex-shrink: 0; }
.stations-grid.layout-list .card-body { flex: 1; min-width: 0; padding: .75rem .9rem; }
.stations-grid.layout-list .card-play,
.stations-grid.layout-list .card-thumb .status-pill { display: none; }
.stations-grid.layout-list .card-time { left: .4rem; right: auto; bottom: .4rem; font-size: .68rem; padding: .15rem .45rem; }
.stations-grid.layout-list .card-name { font-size: .98rem; }
.stations-grid.layout-list .card-location { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.stations-grid.layout-list .card-location svg { display: inline; vertical-align: -1px; }
.list-status { display: none; }
.stations-grid.layout-list .list-status { display: inline-flex; margin-top: .45rem; }
.card-badges .spacer { flex: 1; }

/* ── Pagina stazione ────────────────────────────────────────────────────── */
.page-head { padding: 1.25rem 0 1rem; }
.back-link {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .85rem; font-weight: 600; color: var(--text-2);
    margin-bottom: .6rem;
}
.back-link:hover { color: var(--text); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.page-title {
    font-size: clamp(1.6rem, 6vw, 2.6rem);
    font-weight: 800; letter-spacing: -.03em; line-height: 1.08;
}
.chips {
    display: flex; gap: .5rem;
    margin-top: .9rem;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .42rem .8rem;
    border-radius: 999px;
    font-size: .82rem; color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    white-space: nowrap;
}
.chip svg { color: var(--sky); }
a.chip:hover { color: var(--text); border-color: var(--line-strong); }
a.chip.active { color: #fff; background: var(--surface-2); border-color: rgba(92,200,255,.5); box-shadow: 0 0 0 3px rgba(92,200,255,.12); }

.viewer-bar {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    margin-bottom: .75rem;
}

.main-viewer {
    position: relative;
    margin: 0 calc(var(--gutter) * -1);
    background: #000;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    max-height: 78vh;
    box-shadow: var(--shadow);
}
.main-viewer > div { position: absolute; inset: 0; }
.main-viewer img,
.main-viewer video {
    width: 100%; height: 100%;
    object-fit: contain;
    background: #000;
    user-select: none; -webkit-user-drag: none;
}
.main-viewer img { transition: opacity .25s; }
.main-viewer img.is-loading { opacity: .55; }
.viewer-top {
    position: absolute; z-index: 3;
    top: 0; left: 0; right: 0;
    display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
    padding: .7rem;
    background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
    pointer-events: none;
}
.viewer-top > * { pointer-events: auto; }
.viewer-time {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    font-size: .8rem; font-weight: 650; color: #fff;
    background: rgba(0,0,0,.45);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-variant-numeric: tabular-nums;
}
.viewer-actions { display: flex; gap: .4rem; }
.viewer-nav {
    position: absolute; z-index: 3; top: 50%;
    width: 44px; height: 44px; margin-top: -22px;
    display: grid; place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(0,0,0,.4);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity .25s, background .2s, transform .15s;
}
.viewer-nav:hover { background: rgba(0,0,0,.65); }
.viewer-nav:active { transform: scale(.92); }
.viewer-nav:disabled { opacity: 0 !important; pointer-events: none; }
.viewer-nav.prev { left: .6rem; }
.viewer-nav.next { right: .6rem; }
.main-viewer:fullscreen { max-height: none; aspect-ratio: auto; width: 100vw; height: 100vh; margin: 0; }
.main-viewer.is-fake-fs {
    position: fixed; inset: 0; z-index: 200;
    margin: 0; max-height: none; aspect-ratio: auto;
}
.viewer-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem;
    text-align: center; padding: 1.5rem;
    color: var(--text-3);
    background: radial-gradient(circle at 50% 30%, rgba(92,200,255,.1), transparent 60%), #070b14;
}

/* Barra date */
.date-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    margin-top: 1rem;
    padding: .6rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}
.date-nav .date-field { grid-column: 1 / -1; order: -1; }
.date-nav .btn { width: 100%; }
.date-nav .btn.is-disabled { opacity: .35; pointer-events: none; }
.date-field {
    position: relative;
    display: flex; align-items: center;
}
.date-field svg { position: absolute; left: .9rem; color: var(--sky); pointer-events: none; }
input[type="date"] {
    width: 100%;
    min-height: 44px;
    padding: .55rem .9rem .55rem 2.6rem;
    border-radius: 999px;
    font: inherit; font-size: .95rem; font-weight: 600;
    color: var(--text);
    background: rgba(0,0,0,.25);
    border: 1px solid var(--line);
    outline: none;
    color-scheme: dark;
    -webkit-appearance: none; appearance: none;
}
input[type="date"]:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(92,200,255,.18); }

/* Striscia galleria */
.gallery-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin: 1.6rem 0 .75rem; }
.gallery-head h2 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.gallery-strip {
    display: flex; gap: .6rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    scroll-behavior: smooth;
    margin: 0 calc(var(--gutter) * -1);
    padding: .25rem var(--gutter) .9rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.gallery-strip::-webkit-scrollbar { height: 6px; }
.gallery-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 6px; }
.gallery-thumb {
    flex: 0 0 auto;
    width: 118px;
    scroll-snap-align: start;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.gallery-thumb .thumb-img {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: #0a0f1c;
    border: 2px solid transparent;
    transition: border-color .2s, transform .2s var(--ease);
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb:hover .thumb-img { transform: translateY(-2px); }
.gallery-thumb .thumb-time {
    display: block; text-align: center;
    margin-top: .3rem;
    font-size: .76rem; font-weight: 600; color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.gallery-thumb.active .thumb-img { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(92,200,255,.2); }
.gallery-thumb.active .thumb-time { color: var(--sky); }

/* ── Timelapse ──────────────────────────────────────────────────────────── */
.timelapse-player {
    margin: 0 calc(var(--gutter) * -1) 1.5rem;
    overflow: hidden;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.timelapse-player video { width: 100%; aspect-ratio: 16 / 9; max-height: 75vh; background: #000; }
.player-info {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: .75rem;
    padding: .9rem 1rem;
}
.player-date { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.player-stats { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .2rem; font-size: .8rem; color: var(--text-3); }
.player-stats span { display: inline-flex; align-items: center; gap: .3rem; }

.timelapse-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .6rem;
}
.timelapse-item {
    display: flex; align-items: center; gap: .9rem;
    padding: .75rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color .2s, background .2s;
}
.timelapse-item:hover { border-color: var(--line-strong); }
.timelapse-item.active { border-color: rgba(92,200,255,.55); background: rgba(92,200,255,.07); }
.tl-date {
    flex-shrink: 0;
    width: 54px; height: 58px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 12px;
    background: var(--surface-2);
    line-height: 1;
}
.timelapse-item.active .tl-date { background: var(--grad); color: #fff; }
.tl-date .d { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.tl-date .m { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-top: .2rem; opacity: .8; }
.timelapse-info { flex: 1; min-width: 0; }
.timelapse-info strong { display: block; font-size: .95rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timelapse-info .meta { font-size: .78rem; color: var(--text-3); margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Stati vuoti / footer ──────────────────────────────────────────────── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
    text-align: center;
    padding: 3rem 1.5rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    color: var(--text-2);
}
.empty-state .empty-icon {
    width: 72px; height: 72px;
    display: grid; place-items: center;
    border-radius: 22px;
    background: var(--surface-2);
    color: var(--sky);
}
.empty-state p { max-width: 36ch; font-size: .95rem; }

.site-footer {
    margin-top: 3rem;
    padding: 1.75rem 0 1.5rem;
    border-top: 1px solid var(--line);
    color: var(--text-3);
    font-size: .82rem;
}
.footer-inner { display: flex; flex-direction: column; gap: .75rem; align-items: center; text-align: center; }
.footer-links { display: flex; gap: 1.1rem; }
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--text); }

/* Toast (usato da app.js) */
#toast-container {
    position: fixed; z-index: 9999;
    left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px);
    display: flex; flex-direction: column; gap: .5rem;
    width: min(92vw, 360px);
}
.toast {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
}
.toast-success { border-left: 3px solid var(--ok); }
.toast-error   { border-left: 3px solid var(--bad); }
.toast-info    { border-left: 3px solid var(--sky); }

/* Animazione ingresso */
.reveal { animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ═════════════════════════ BREAKPOINT ═════════════════════════════════ */

/* Telefoni piccoli */
@media (max-width: 380px) {
    :root { --gutter: 12px; }
    .brand-sub { display: none; }
    .clock .clock-date { display: none; }
    .gallery-thumb { width: 100px; }
    .tl-date { width: 48px; }
    .hero-actions .btn { width: 100%; }
}

/* ≥ 600px — tablet verticale */
@media (min-width: 600px) {
    :root { --gutter: 24px; }
    .stations-grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
    .hero-actions .btn { flex: 0 0 auto; }
    .date-nav { display: flex; flex-wrap: wrap; align-items: center; }
    .date-nav .date-field { order: 0; flex: 0 1 220px; }
    .date-nav .btn { width: auto; }
    .gallery-thumb { width: 138px; }
    .timelapse-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}

/* ≥ 900px — desktop: via la tab bar, nav nell'header */
@media (min-width: 900px) {
    :root { --header-h: 72px; --gutter: 32px; }
    body { padding-bottom: 0; }
    .tabbar { display: none; }
    .nav-desktop { display: flex; }
    #toast-container { left: auto; right: 1.5rem; transform: none; bottom: 1.5rem; }

    .hero {
        margin: 1.5rem 0 0;
        min-height: 540px;
        border-radius: 28px;
        border: 1px solid var(--line);
        box-shadow: var(--shadow);
    }
    .hero::after {
        background:
            linear-gradient(180deg, rgba(6,10,19,.1) 0%, rgba(6,10,19,0) 40%, rgba(6,10,19,.75) 100%),
            linear-gradient(90deg, rgba(6,10,19,.7) 0%, rgba(6,10,19,0) 65%);
    }
    .hero-content { padding: 3rem 3rem 2.75rem; }
    .section { padding-top: 2.5rem; }

    .stations-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }
    .stations-grid.layout-list .card-thumb { max-width: 260px; aspect-ratio: 16 / 9; }

    .main-viewer, .timelapse-player {
        margin-left: 0; margin-right: 0;
        border-radius: 22px;
        border: 1px solid var(--line);
    }
    .main-viewer:fullscreen { border-radius: 0; border: 0; }
    .main-viewer .viewer-nav { opacity: 0; }
    .main-viewer:hover .viewer-nav { opacity: 1; }
    .viewer-top { padding: 1rem; }

    .chips { margin-left: 0; margin-right: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
    .gallery-strip { margin: 0; padding-left: 0; padding-right: 0; }
    .timelapse-list { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
    .page-head { padding: 2rem 0 1.25rem; }
}

@media (min-width: 1200px) {
    .gallery-thumb { width: 150px; }
}

/* Schermo orizzontale su telefono: viewer a tutta altezza */
@media (max-width: 899px) and (orientation: landscape) {
    .main-viewer { max-height: calc(100svh - var(--header-h) - var(--tabbar-h)); }
    .hero { min-height: 88svh; }
}

@media (hover: none) {
    .card-play { display: none; }
    .station-card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.hide-sm { display: none; }
@media (min-width: 600px) { .hide-sm { display: inline; } }
@media (min-width: 900px) { .gallery-strip { scroll-padding-inline: 0; } }

@media (max-width: 599px) { .tl-actions .tl-watch-btn { padding: .4rem .75rem; } .timelapse-item { gap: .7rem; } }
