/* ═══════════════════════════════════════════
   vehicles.opendata.cat
   Design system: opendata.cat editorial
   ═══════════════════════════════════════════ */

/* ─── BASE ─── */
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 88px; }

::selection { background: rgba(15, 118, 110, 0.15); color: #1a1a1a; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #faf7f2; }
::-webkit-scrollbar-thumb { background: #0f766e; border-radius: 2px; }

/* ─── GRAIN OVERLAY ─── */
.grain {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 9999; opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── HERO WORD ANIMATION ─── */
.hero-word {
    display: block; opacity: 0; transform: translateY(50px);
    animation: word-up 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes word-up {
    to { opacity: 1; transform: translateY(0); }
}
.hero-info {
    opacity: 0; transform: translateY(30px);
    animation: word-up 1s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
}

/* ─── MARQUEE ─── */
.marquee-track {
    display: flex; gap: 0;
    animation: marquee 40s linear infinite;
    width: max-content;
}
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ─── SCROLL REVEAL ─── */
.reveal {
    opacity: 0; transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ─── STAT NUMBER ─── */
.stat-num {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

/* ─── DATA TABLE ─── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 0.625rem 0.75rem;
    font-size: 0.6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: #9ca3af; border-bottom: 2px solid #e0dbd4;
    white-space: nowrap;
}
.data-table td {
    padding: 0.875rem 0.75rem; border-bottom: 1px solid #e0dbd4;
    font-size: 0.875rem; color: #5a6270;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table tbody tr {
    transition: padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.data-table tbody tr:hover {
    padding-left: 4px;
}
.data-table td:first-child { font-weight: 600; color: #1a1a1a; }

/* Prevent numeric columns from wrapping on mobile */
.data-table th[class*="text-right"],
.data-table td[class*="text-right"],
.data-table td.font-mono {
    white-space: nowrap;
    min-width: 5rem;
}

/* On very small screens, reduce table padding */
@media (max-width: 480px) {
    .data-table th, .data-table td { padding: 0.625rem 0.5rem; font-size: 0.8125rem; }
    .data-table th:first-child, .data-table td:first-child { padding-left: 0; }
    .data-table td.font-mono { min-width: 3.5rem; }
}

/* ─── CHART CONTAINER ─── */
.chart-box {
    position: relative;
    padding: 2rem 0;
}
.chart-box h3 {
    font-size: 0.6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: #9ca3af; margin-bottom: 1.5rem;
}

/* ─── SEARCH ─── */
.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 1px solid #e0dbd4; border-radius: 0;
    font-size: 0.9375rem; color: #1a1a1a;
    background: #ffffff; outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
}
.search-input::placeholder { color: #9ca3af; }
.search-input:focus {
    border-color: #0f766e;
}

/* ─── BREADCRUMB ─── */
.breadcrumb {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8125rem; color: #9ca3af;
}
.breadcrumb a { color: #5a6270; text-decoration: none; transition: color 0.15s; }
.breadcrumb a:hover { color: #0f766e; }
.breadcrumb .sep { color: #e0dbd4; }

/* ─── MAP ─── */
.map-container {
    overflow: hidden; border: 1px solid #e0dbd4;
}
.map-container .leaflet-container { min-height: 400px; font-family: inherit; }

/* ─── PERIOD TAG ─── */
.period-tag {
    display: inline-flex; align-items: center; gap: 0.375rem;
    font-size: 0.6875rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: #9ca3af;
}

/* ─── FOCUS ─── */
:focus-visible { outline: 2px solid #0f766e; outline-offset: 2px; }

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; transition: none; }
    .hero-word, .hero-info { opacity: 1; transform: none; animation: none; }
    .marquee-track { animation: none; }
}

/* ─── PRINT ─── */
@media print {
    .grain, header, footer, .no-print { display: none; }
    body { background: white; color: black; }
}
