/*
 * buert-design.css — Unified design system for buert.nl
 *
 * Enqueue this ONCE in functions.php or header.php.
 * Both the main section and weather.php depend on these tokens and components.
 * Neither file should contain duplicate base card/bar/chip CSS anymore.
 *
 * Table of contents
 * ─────────────────
 *  1. CSS tokens (variables)
 *  2. Card shell
 *  3. Card title / section label
 *  4. Bar rows  (stat bars inside cards)
 *  5. Chip grid (postcodes, streets, etc.)
 *  6. Outer page grid  (.buert-grid)
 *  7. Weather-specific overrides stay in weather.php
 */


/* ══════════════════════════════════════════════════════════════
   1. CSS TOKENS
   All colours, radii and shadows in one place.
   Override per theme by redefining on :root or a wrapper class.
══════════════════════════════════════════════════════════════ */
html, body {
    background: #fff !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}


:root {
    /* backgrounds */
    --bd-bg-page:        #f5f5f5;
    --bd-bg-card:        #ffffff;
    --bd-bg-subtle:      #f7f7f7;
    --bd-bg-hover:       #f0f0f0;

    /* borders & shadows */
    --bd-border:         #e8e8e8;
    --bd-shadow-sm:      0 2px 8px rgba(0,0,0,.05);
    --bd-radius-lg:      12px;
    --bd-radius-md:      9px;
    --bd-radius-sm:      6px;

    /* text */
    --bd-text-primary:   #111111;
    --bd-text-secondary: #444444;
    --bd-text-muted:     #999999;

    /* bar track */
    --bd-bar-track:      #efefef;

    /* accent (links, progress fills that have no specific colour) */
    --bd-accent:         #0ea5e9;

    /* per-card bar colours — used by both the bar rows and weather */
    --bd-color-leeftijd:   #2563eb;
    --bd-color-bouwjaar:   #16a34a;
    --bd-color-herkomst:   #9333ea;
    --bd-color-huishouden: #ea580c;
    --bd-color-woning:     #0891b2;
    --bd-color-weather:    #0ea5e9;
}


/* ══════════════════════════════════════════════════════════════
   2. CARD SHELL
══════════════════════════════════════════════════════════════ */
.buert-card {
    background:    var(--bd-bg-card);
    border:        1px solid var(--bd-border);
    border-radius: var(--bd-radius-lg);
    padding:       20px 22px;
    box-shadow:    var(--bd-shadow-sm);
    box-sizing:    border-box;
    min-width:     0;         /* prevents grid blowout */
}


/* ══════════════════════════════════════════════════════════════
   3. CARD TITLE  &  SECTION LABEL
   .buert-card-title  → top label inside a card  (main section)
   .bw-section-label  → inline section divider   (weather)
   Both use the same visual rhythm.
══════════════════════════════════════════════════════════════ */
.buert-card-title,
.bw-section-label {
    font-family:    "Syne", sans-serif;
    font-size:      10px;
    font-weight:    800;
    text-transform: uppercase;
    letter-spacing: .10em;
    color:          var(--bd-text-muted);
    display:        block;
    margin:         0 0 14px;
}
.bw-section-label {
    margin: 18px 0 8px;     /* section labels need more breathing room */
}

/* The brand wordmark inside titles */
#buert-bold {
    font-style: italic;
    letter-spacing: -.01em;
}


/* ══════════════════════════════════════════════════════════════
   4. BAR ROWS
   Used by: age, building year, origin, households, housing type
   and by the weather extra cards (UV bar, AQI bar, sun bar).
══════════════════════════════════════════════════════════════ */

/* Stat bar row (full-width label + bar) */
.buert-bar-row {
    margin-bottom: 10px;
}
.buert-bar-row:last-child {
    margin-bottom: 0;
}
.buert-bar-label {
    display:         flex;
    justify-content: space-between;
    align-items:     baseline;
    gap:             8px;
    font-size:       12px;
    color:           var(--bd-text-secondary);
    margin-bottom:   4px;
    line-height:     1.3;
}
.buert-bar-label span:first-child {
    flex: 1;
    min-width: 0;
    /* allow long labels to wrap rather than pushing the % off-screen */
    overflow-wrap: break-word;
}
.buert-bar-label span:last-child {
    font-weight:   700;
    font-size:     12px;
    color:         var(--bd-text-primary);
    white-space:   nowrap;
    flex-shrink:   0;
}

/* The track + fill */
.buert-bar-track {
    width:         100%;
    height:        6px;
    background:    var(--bd-bar-track);
    border-radius: 99px;
    overflow:      hidden;
}
.buert-bar-fill {
    height:        100%;
    border-radius: 99px;
    transition:    width .5s ease;
}

/* Per-card fill colours */
.buert-card--leeftijd   .buert-bar-fill { background: var(--bd-color-leeftijd); }
.buert-card--bouwjaar   .buert-bar-fill { background: var(--bd-color-bouwjaar); }
.buert-card--herkomst   .buert-bar-fill { background: var(--bd-color-herkomst); }
.buert-card--huishouden .buert-bar-fill { background: var(--bd-color-huishouden); }
.buert-card--woning     .buert-bar-fill { background: var(--bd-color-woning); }

/* Shared weather bar (bw-ext-bar) uses same geometry */
.bw-ext-bar {
    height:        6px;           /* match main-section bar height */
    border-radius: 99px;
    margin-top:    8px;
    width:         100%;
    background:    var(--bd-bar-track);
    overflow:      hidden;
    flex-shrink:   0;
}
.bw-ext-bar-fill {
    height:        100%;
    border-radius: 99px;
    transition:    width .6s ease;
}


/* ══════════════════════════════════════════════════════════════
   5. CHIP GRID
   Used by: location data, postcodes, streets, neighbourhoods.
   .PC4-grid  → the grid wrapper
   .PC4-box   → individual chip
══════════════════════════════════════════════════════════════ */
.PC4-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap:                   5px;
    margin:                12px 0 0;
}
.PC4-box {
    display:       inline-flex;
    align-items:   center;
    background:    var(--bd-bg-subtle);
    border:        1px solid var(--bd-border);
    border-radius: var(--bd-radius-sm);
    padding:       4px 10px;
    font-size:     12px;
    color:         var(--bd-text-secondary);
    line-height:   1.4;
    transition:    background .15s, border-color .15s;
    text-decoration: none;
}
.PC4-box:hover {
    background:   var(--bd-bg-hover);
    border-color: #d0d0d0;
    color:        var(--bd-text-primary);
}

/* Location chips: label prefix + value inline */
.buert-locatie-chip {
    display:     inline-flex;
    align-items: baseline;
    gap:         5px;
}
.buert-locatie-label {
    font-size:      9px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color:          var(--bd-text-muted);
    flex-shrink:    0;
}

/* Address chips (slightly smaller) */
.bd-addr-grid  { gap: 4px; }
.bd-addr-chip  { font-size: 11px !important; padding: 3px 8px !important; }
.bd-addr-chip a { color: inherit; text-decoration: none; }
.bd-addr-chip a:hover { color: var(--bd-accent); }

/* Collapsible address list */
.bd-chip-details summary {
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    font-size:     12px;
    font-weight:   600;
    color:         var(--bd-accent);
    cursor:        pointer;
    padding:       2px 0 8px;
    list-style:    none;
    user-select:   none;
}
.bd-chip-details summary::-webkit-details-marker { display: none; }
.bd-chip-details summary::before {
    content:    "▶";
    font-size:  9px;
    transition: transform .2s;
}
.bd-chip-details[open] summary::before { transform: rotate(90deg); }


/* ══════════════════════════════════════════════════════════════
   6. OUTER PAGE GRID  (.buert-grid)
   Both the stat cards and the list cards (streets, postcodes…)
   use this grid as their outer wrapper.
══════════════════════════════════════════════════════════════ */
.buert-grid {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   18px;
    margin:                22px 0;
}

/* Two-column at tablet widths */
@media (max-width: 1024px) {
    .buert-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Single column on mobile */
@media (max-width: 600px) {
    .buert-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* List-card grid (streets, postcodes…) can go up to 4 columns on wide screens */
.buert-grid--lists {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}


/* ══════════════════════════════════════════════════════════════
   7. SMALL INLINE CHIP  (shared by weather current + main data)
══════════════════════════════════════════════════════════════ */
.bw-chip {
    display:       inline-block;
    background:    var(--bd-bg-subtle);
    border:        1px solid var(--bd-border);
    border-radius: 99px;
    padding:       2px 9px;
    font-size:     11px;
    color:         var(--bd-text-secondary);
    margin:        1px 2px;
    line-height:   1.5;
}


/* ── Ad rotator ── */
.buert-ad-rotator { min-height: 1.5em; }
.buert-ad-slide   { animation: buert-fadein .6s ease-in-out; }
@keyframes buert-fadein { from { opacity: 0; } to { opacity: 1; } }

/* ── Brand wordmark (replaces all id="buert-bold" usage) ── */
.buert-bold {
    font-style:     italic;
    letter-spacing: -.01em;
}

/* ── Page layout ── */
.content-wrapper {
    display:     flex;
    gap:         20px;
    align-items: flex-start;
}

.content-wrapper main {
    flex:      1;
    min-width: 0;   /* prevents flex children from overflowing their container */
}

.content-wrapper .sidebar {
    width:       320px;
    flex-shrink: 0;
}

/* An empty sidebar takes up no space at any screen size */
.content-wrapper .sidebar:empty { display: none; }

/* Stack vertically on tablet and below */
@media (max-width: 1024px) {
    .content-wrapper              { flex-direction: column; }
    .content-wrapper .sidebar     { width: 100%; margin-left: 0 !important; }
}

.container.page-container {
    max-width: 1600px !important;
}

/* Mobile */
body.body-adjusted {
    margin-left: 20px;
    margin-right: 20px;
}

/* Tablet & Desktop */
@media (min-width: 768px) {
    body.body-adjusted {
        margin-left: 200px;
        margin-right: 200px;
    }
}


/* ── Footer mobile layout ── */
@media (max-width: 767px) {
    #footer-row {
        display: flex !important;
        flex-wrap: wrap;
        margin-left: -15px;
        margin-right: -15px;
    }
    #footer-row > .footer-column {
        display: block !important;
        flex: 0 0 50%;
        max-width: 50%;
        width: 50%;
        padding: 15px;
    }
    #footer-row > .footer-column:nth-child(2) {
        display: none !important;
    }
    .footer-list {
        min-height: 0;
    }
}