/* Otvoreno — Layout system extending PicoCSS
   Spacing scale: xs=0.5rem  sm=1rem  md=1.5rem  lg=2.5rem  xl=4rem  2xl=6rem
   Line-height:   tight=1.15  body=1.6
*/

/* Tokens */
:root {
    --font-serif: "Baskerville", "Palatino Linotype", "DejaVu Serif", "Liberation Serif", Georgia, serif;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

    --pico-font-family-sans-serif: var(--font-sans);

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    --space-2xl: 6rem;

    --lh-tight: 1.15;
    --lh-heading: 1.25;
    --lh-body: 1.6;

    /* Chrome-strip dark palette */
    --chrome-bg: #1a2e3d;
    --chrome-border: #243447;
    --chrome-text: #f0f4f8;
    --chrome-muted: rgba(240, 244, 248, 0.6);
    --chrome-faint: rgba(240, 244, 248, 0.15);

    /* Header height — referenced by sticky sidebar */
    --header-height: 4rem;
}

/* Typography system */
/* h1, h2, h3 → serif display  (editorial, distinctive)         */
/* h4, h5, h6 → sans-serif     (UI, cards, labels)              */
/* body        → sans-serif     (clean, readable)                */

h1,
h2,
h3 {
    font-family: var(--font-serif);
    font-weight: 400; /* Playfair reads heavier than it looks */
    letter-spacing: -0.01em;
    line-height: var(--lh-heading);
}

h4,
h5,
h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: var(--lh-tight);
}

/* Section subtitles feel editorial when italic serif */
hgroup p {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.1rem;
    line-height: var(--lh-body);
}

/* Labels, metadata, nav → always sans-serif */
small,
time,
label,
nav a,
nav li,
.stat-label,
.dataset-featured-meta,
.footer-grid h4 {
    font-family: var(--font-sans);
}

/* Page chrome (header & footer only) */
/* Scoped to body > to avoid hitting <header>/<footer> inside <article> */
body > header,
body > footer {
    background-color: var(--chrome-bg) !important;
    color: var(--chrome-text) !important;
    border-color: var(--chrome-border) !important;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
}

body > header a,
body > footer a {
    color: var(--chrome-muted) !important;
}

body > header a:hover,
body > footer a:hover {
    color: var(--chrome-text) !important;
    text-decoration: none;
}

body > header strong a {
    color: var(--chrome-text) !important;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.theme-toggle {
    background: none !important;
    border: 1px solid var(--chrome-faint) !important;
    border-radius: var(--pico-border-radius);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--chrome-text) !important;
}

/* Breadcrumb */
.breadcrumb {
    border-top: 1px solid var(--chrome-faint);
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    font-size: 0.8rem;
}

.breadcrumb ol li {
    color: var(--chrome-muted);
    padding: 1rem 0;
}

.breadcrumb ol li + li::before {
    content: "/";
    margin: 0 0.4rem;
    opacity: 0.4;
}

.breadcrumb ol li a {
    color: var(--chrome-muted) !important;
    text-decoration: none;
}

.breadcrumb ol li a:hover {
    color: var(--chrome-text) !important;
}

/* Hero */
.hero {
    padding: var(--space-2xl) 0 var(--space-lg);
    max-width: 640px;
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.8rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: var(--lh-tight);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-md);
}

.hero-lead {
    font-size: 1.15rem;
    line-height: var(--lh-body);
    color: var(--pico-muted-color);
    margin-bottom: var(--space-md);
    max-width: 520px;
}

.hero-cta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

/* Stats strip */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: var(--space-lg) 0;
    border-top: 1px solid var(--pico-muted-border-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    margin-bottom: var(--space-xl);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-number {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: var(--lh-tight);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

/* City teaser */
.city-teaser {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: var(--space-xl);
    align-items: start;
    padding: var(--space-xl) 0;
    margin-bottom: var(--space-xl);
    border-top: 1px solid var(--pico-muted-border-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.city-teaser-coat {
    display: flex;
    justify-content: center;
    padding-top: var(--space-xs);
}

.city-teaser-coat svg {
    width: 120px;
    height: auto;
    opacity: 0.9;
}

.city-teaser-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--pico-muted-color);
    margin-bottom: var(--space-xs);
}

.city-teaser-name {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: var(--lh-heading);
    margin-bottom: var(--space-sm);
}

.city-teaser-desc {
    color: var(--pico-muted-color);
    line-height: var(--lh-body);
    font-size: 0.95rem;
    max-width: 560px;
    margin-bottom: var(--space-lg);
}

.city-teaser-datasets-label {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pico-muted-color);
    margin-bottom: var(--space-sm);
}

.city-teaser-datasets ul {
    list-style: none !important;
    padding-inline-start: 0 !important;
    margin-bottom: var(--space-md);
}

.city-teaser-datasets ul li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-md);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-size: 0.9rem;
}

.city-teaser-datasets ul li:first-child {
    border-top: 1px solid var(--pico-muted-border-color);
}

.city-teaser-datasets ul li a {
    font-weight: 500;
    flex-shrink: 0;
}

.city-teaser-datasets ul li span {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    text-align: right;
}

@media (max-width: 768px) {
    .city-teaser {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .city-teaser-coat {
        justify-content: flex-start;
    }

    .city-teaser-coat svg {
        width: 80px;
    }
}

/* Datasets section */
.section-datasets {
    margin-bottom: var(--space-2xl);
}

.section-datasets hgroup {
    margin-bottom: var(--space-lg);
}

.section-datasets hgroup h2 {
    margin-bottom: var(--space-xs);
}

.section-datasets hgroup p {
    color: var(--pico-muted-color);
    margin: 0;
}

/* Featured dataset */
.dataset-featured {
    padding: var(--space-lg);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    margin-bottom: var(--space-md);
}

.dataset-featured-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

.dataset-featured h3 {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 400;
    line-height: var(--lh-heading);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.01em;
}

.dataset-featured > p {
    color: var(--pico-muted-color);
    line-height: var(--lh-body);
    margin-bottom: var(--space-md);
    max-width: 640px;
}

/* article > footer inside featured card — reset PicoCSS article-footer styling */
.dataset-featured > footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding-top: var(--space-sm);
    margin-top: 0;
    border-top: 1px solid var(--pico-muted-border-color);
}

.dataset-featured > footer small {
    color: var(--pico-muted-color);
}

.dataset-featured > footer a {
    font-weight: 500;
}

/* Dataset cards grid */
.datasets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-sm);
}

/* article > header/footer inside cards — reset PicoCSS article chrome styling */
.datasets-grid article > header {
    padding-bottom: var(--space-xs);
    margin-bottom: var(--space-xs);
    border-bottom: none;
}

.datasets-grid article > header small {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

.datasets-grid article h4 {
    font-size: 1rem;
    font-weight: 600;
    line-height: var(--lh-tight);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.01em;
}

.datasets-grid article > p {
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    line-height: var(--lh-body);
    margin-bottom: 0;
}

.datasets-grid article > footer {
    padding-top: var(--space-xs);
    margin-top: var(--space-sm);
    border-top: 1px solid var(--pico-muted-border-color);
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

/* About section */
.section-about {
    margin-bottom: var(--space-2xl);
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-xl);
    align-items: start;
}

.about-header {
    position: sticky;
    top: calc(var(--header-height) + var(--space-md));
}

.about-header h2 {
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.about-header > p {
    color: var(--pico-muted-color);
    line-height: var(--lh-body);
    margin: 0;
}

.features-list {
    display: flex;
    flex-direction: column;
}

.feature-row {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    align-items: flex-start;
}

.feature-row:first-child {
    padding-top: 0;
}

.feature-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.feature-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
    line-height: var(--lh-body);
}

.feature-row h4 {
    font-size: 1rem;
    font-weight: 600;
    line-height: var(--lh-tight);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.01em;
}

.feature-row > div > p {
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    line-height: var(--lh-body);
    margin: 0;
}

/* Footer chrome */
body > footer > .container {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-lg);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--chrome-faint);
    margin-bottom: var(--space-md);
}

.footer-grid h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--chrome-muted);
}

.footer-grid ul {
    list-style: none !important;
    padding-inline-start: 0 !important;
    margin: 0;
}

.footer-grid ul li {
    margin-bottom: var(--space-xs);
    font-size: 0.9rem;
}

body > footer > .container > small {
    display: block;
    font-size: 0.8rem;
    color: var(--chrome-faint);
}

/* Responsive */
@media (max-width: 768px) {
    .section-about {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .about-header {
        position: static;
    }

    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .datasets-grid {
        grid-template-columns: 1fr;
    }

    .hero-cta {
        flex-direction: column;
    }

    .dataset-featured > footer {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
    }
}

/* Budget index page */
.budget-group {
    margin-bottom: var(--space-xl);
}

.budget-group h2 {
    font-size: 1rem;
    margin-bottom: var(--space-md);
}

.budget-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.budget-grid article {
    margin-bottom: 0;
    padding: var(--space-sm) var(--space-md);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.budget-grid article a {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--pico-color);
}

.budget-grid article:hover {
    border-color: var(--pico-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.budget-grid article:hover a {
    color: var(--pico-primary);
}

@media (max-width: 768px) {
    .budget-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .budget-grid {
        grid-template-columns: 1fr;
    }
}

/* Table */
table {
    font-size: 0.875rem;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.year-col {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Striped table contrast — light mode */
:root {
    --pico-table-row-stripped-background-color: rgba(0, 0, 0, 0.07);
}

/* Striped table contrast — dark mode */
[data-theme="dark"] {
    --pico-table-row-stripped-background-color: rgba(255, 255, 255, 0.09);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
