/*
Theme Name: BALLOT Journalist Resources
Author: Nascenia Ltd.
Description: A responsive, high-performance theme for journalist resources with plugin support.
Version: 1.2
*/

/* --- CSS VARIABLES --- */
:root {
    --brand-blue: #0077D4;       /* UN Blue */
    --brand-dark: #003359;
    --brand-accent: #009EDB;     /* Cyan Accent */

    --bg-color: #f9f9f9;         /* Very light grey background for contrast */
    --text-card: #ffffff;        /* White text for cards */
    --text-main: #333333;

    --radius: 12px;
    --container-width: 1200px;
    --card-shadow: 0 10px 20px rgba(0, 85, 150, 0.15);
}

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

body {
    /*font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; */
    font-family: Inter, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
ul, ol {
    margin-left: 20px;
}
/* --- HEADER --- */
header {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid #e1e1e1;
    position: sticky; top: 0; z-index: 1000;
}
.header-content { display: flex; justify-content: space-between; align-items: center; max-width: var(--container-width); margin: 0 auto; }
.un-logo-img { height: 50px; width: auto; display: block; }

/* --- HEADER MARQUEE TICKER --- */
.ballot-ticker-wrap {
    width: 100%;
    background: #005596; /* Brand Blue */
    color: #ffffff;
    overflow: hidden;
    white-space: nowrap;
    height: 45px; /* Height of the ticker */
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 999;
}

/* The Label (Optional: "Update:") */
.ballot-ticker-label {
    background: #003d6e; /* Darker Blue */
    color: #fff;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
    position: relative;
    z-index: 10;
}

.ballot-ticker-content {
    display: inline-block;
    padding-left: 100%; /* Start from right */
    animation: ballot-scroll 100s linear infinite; /* Adjust speed here (30s) */
}

/* Stop animation on hover so users can click */
.ballot-ticker-content:hover {
    animation-play-state: paused;
}

.ballot-ticker-item {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    margin-right: 50px; /* Space between items */
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

.ballot-ticker-item:hover {
    text-decoration: underline;
    color: #ffeb3b; /* Yellow on hover */
}

.ballot-ticker-item i {
    margin-right: 8px;
    font-size: 0.8em;
    opacity: 0.8;
}

@keyframes ballot-scroll {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Mobile Adjustment */
@media (max-width: 600px) {
    .ballot-ticker-label { display: none; } /* Hide label on mobile to save space */
}

/* --- LANGUAGE SWITCHER --- */
.lang-switcher-container {
    display: flex;
    justify-content: flex-end;
    padding: 10px 20px;
    gap: 10px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.lang-btn {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 5px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s;
}

.lang-btn.active, .lang-btn:hover {
    background-color: var(--brand-blue);
    color: #fff;
    border-color: var(--brand-blue);
}

/* --- HEADER PARTNER LINKS --- */
.header-links {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 0 20px;
    max-width: var(--container-width);
    margin: 0 auto 6px;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--brand-blue);
    transition: color 0.2s;
}

/* Partner marks sit beside their link label; heights are matched
   optically rather than by box size, since the UN emblem is wider. */
.header-link-logo {
    height: 40px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.header-link:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

.header-link-sep { color: #ccc; font-size: 0.95rem; }

/* --- RESPONSIVE HEADER (Mobile Layout) --- */
@media (max-width: 768px) {
    /* 1. Stack Logo and Buttons Vertically */
    .header-content {
        flex-direction: column;
        gap: 15px; /* Space between logo and buttons */
        padding-bottom: 10px;
    }

    /* 2. Center the Language Buttons */
    .lang-switcher-container {
        justify-content: center; /* Center align the buttons */
        margin: 0; /* Remove auto margins if set */
        padding: 0;
    }

    .header-links {
        justify-content: center;
        margin: 8px 0 0;
        padding: 0;
        text-align: center;
    }

    /* 3. Adjust Logo Spacing */
    .brand-container {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .un-logo-img {
        height: 45px; /* Slightly smaller logo on mobile if needed */
    }
}
/* --- INTRO --- */
.intro-box { text-align: justify; padding: 20px 0 40px; max-width: var(--container-width); margin: 0 auto; }
.intro-box h1 { font-size: 2.2rem; margin-bottom: 10px; color: var(--brand-blue); font-weight: 800; }

/* --- TAB INTRO ---
 * The standing introduction a tab can carry above its cards, from the term
 * description. It sits below the tab strip and above the grid.
 *
 * On white rather than a blue tint. The tint version put a third blue between
 * the blue tab pills and the blue cards, and its slate body colour only reached
 * about 8:1 against it — passing, but visibly washed out next to the solid cards
 * underneath. White carries near-black text at roughly 15:1 and lets the cards
 * be the only saturated thing in the column.
 *
 * The hairline and the soft shadow are what mark it as its own surface, in the
 * same idiom as the cards below, rather than reading as a second site intro:
 * .intro-box further up the page is plain justified copy on the page background.
 *
 * The first paragraph carries the lead at 1.1rem/500. Deliberately not bold —
 * this copy runs to three or four lines, and at 600 the whole opening block goes
 * heavy, which is worse in Bangla than in English.
 */
.tab-intro {
    max-width: var(--container-width);
    margin: 0 auto 38px;
    padding: 28px 32px;
    background: #ffffff;
    border: 1px solid #e4eaf0;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0, 51, 89, .04), 0 8px 24px rgba(0, 51, 89, .05);
    color: #1b2836;
    font-size: 1.02rem;
    line-height: 1.8;
}
.tab-intro p { margin: 0 0 15px; }
.tab-intro p:first-child {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.7;
    color: #0d1b27;
}
.tab-intro p:last-child { margin-bottom: 0; }
.tab-intro a { color: var(--brand-blue); }

/* --- TABS --- */
/*
 * One row, always. These used to wrap, which put the sixth tab on a line of its
 * own. The strip now scrolls sideways instead of breaking, and the pills below
 * are sized so the full set still fits without scrolling at container width.
 *
 * "safe center" keeps the centring while making the overflow reachable: plain
 * "center" pushes the first pill off the scrollable origin once the row is
 * wider than the strip, and there is no way to scroll back to it.
 */
.filter-container {
    display: flex;
    justify-content: center;
    justify-content: safe center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-bottom: 40px;
    overflow-x: auto;
    /* overflow-x:auto computes overflow-y to auto as well, which would clip the
       active pill's 2px lift and its shadow. The padding is that clearance. */
    padding: 8px 4px 12px;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    /* The bar itself is noise on a six-item strip; the pills bleeding off the
       edge are the affordance. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.filter-container::-webkit-scrollbar { display: none; }
.filter-btn {
    padding: 10px 25px;
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active {
    background: var(--brand-blue);
    color: #fff;
    border-color: var(--brand-blue);
    box-shadow: 0 4px 10px rgba(0,85,150,0.3);
}

/* --- GRID LAYOUT FIXES --- */
.content-container { padding: 0 20px; max-width: var(--container-width); margin: 0 auto; min-height: 500px; position: relative; }

h2 {
    font-size: 1rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--brand-blue); margin: 40px 0 20px;
    border-left: 5px solid var(--brand-accent); padding-left: 15px;
}

.card-grid {
    display: grid;
    gap: 25px;
    /* THIS FIXED THE STRETCHING ISSUE */
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    align-items: flex-start; /* Prevents neighbors from stretching */
}

/* --- RESOURCE CARD (Solid Color Style) --- */
.resource-card {
    background-color: var(--brand-blue);
    color: #fff;
    border-radius: var(--radius);
    padding: 30px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;

    /* Ensure card has a minimum height so they look uniform initially */
    min-height: 375px;
    display: flex;
    flex-direction: column;
}

/* Unified Hover for all colors */
.resource-card:hover {
    transform: translateY(-5px);
    filter: brightness(110%); /* Brightens the specific category color */
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    background-color: #004d88; /* Slightly darker on hover */
}

/* --- COVER IMAGE CARD (PDF first page as background) --- */
/* The scrim keeps the white card text readable over arbitrary cover art. */
.resource-card.has-cover {
    background-image:
        linear-gradient(180deg,
            rgba(0, 42, 76, 0.90) 0%,
            rgba(0, 42, 76, 0.74) 42%,
            rgba(0, 42, 76, 0.92) 100%),
        var(--card-cover);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
}

.resource-card.has-cover:hover {
    background-image:
        linear-gradient(180deg,
            rgba(0, 42, 76, 0.84) 0%,
            rgba(0, 42, 76, 0.64) 42%,
            rgba(0, 42, 76, 0.88) 100%),
        var(--card-cover);
}

/* The emoji watermark would fight the cover art. */
.resource-card.has-cover::before {
    content: none;
}

/* Watermark Icon (Background) */
.resource-card::before {
    content: var(--bg-icon, '📄'); /* Uses PHP variable */
    position: absolute;
    bottom: -15px;
    right: -15px;
    font-size: 9rem; /* Big vector look */
    opacity: 0.08;   /* Subtle transparent look */
    transform: rotate(-15deg);
    pointer-events: none; /* Allows clicking through it */
    filter: grayscale(100%) brightness(200%); /* Makes emoji look white/flat */
    z-index: 0;
}

/* Arrow Icon (Top Right) */
.resource-card::after {
    content: '\f061'; /* FontAwesome Unicode for Arrow Right */
    font-family: "Font Awesome 6 Free"; /* Important: Tells browser which font to use */
    font-weight: 900; /* Solid icons require weight 900 */

    position: absolute;
    top: 25px; right: 25px;
    font-size: 1rem;
    color: #fff;
    background: rgba(255,255,255,0.2);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    transition: all 0.3s ease;
}

/*
.resource-card.color-0 { background-color: #005596; }
.resource-card.color-0:hover { background-color: #00447a; }
.resource-card.color-1 { background-color: #00796B; }
.resource-card.color-1:hover { background-color: #004D40; }
.resource-card.color-2 { background-color: #4527A0; }
.resource-card.color-2:hover { background-color: #311B92; }
.resource-card.color-3 { background-color: #37474F; }
.resource-card.color-3:hover { background-color: #263238; }
*/

/* Variant 1: Brand Blue (Default) */
.resource-card.color-0 { background-color: #005596; }
.resource-card.color-0:hover { background-color: #00447a; }

/* Variant 2: Teal / Sea Green */
.resource-card.color-1 { background-color: #005596; }
.resource-card.color-1:hover { background-color: #00447a; }

/* Variant 3: Deep Indigo */
.resource-card.color-2 { background-color: #005596; }
.resource-card.color-2:hover { background-color: #00447a; }

/* Variant 4: Slate / Dark Grey-Blue */
.resource-card.color-3 { background-color: #005596; }
.resource-card.color-3:hover { background-color: #00447a; }

/* --- CARD CONTENT --- */
/* Z-Index ensures text sits ON TOP of the watermark */
.card-header, .card-desc, .card-logo-area { position: relative; z-index: 2; }

.card-logo-area { height: 40px; margin-bottom: 20px; }
.card-logo-img { height: 100%; width: auto; filter: brightness(0) invert(1); }

.card-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; line-height: 1.3; padding-right: 25px; }
.card-provider {
    font-size: 0.75rem; text-transform: uppercase; font-weight: 700;
    opacity: 0.8; margin-bottom: 15px; display: block;
}

.card-desc { font-size: 0.95rem; line-height: 1.6; opacity: 0.95; }

/* Read More Links */
.read-more-link {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 5px;
    display: inline-block;
}
.read-more-link:hover { text-decoration: none; opacity: 0.8; }

.excerpt-full { display: none; }

/* --- CONTACT CARDS (White Style) --- */
.contact-list { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.contact-card {
    background: #fff; border: 1px solid #ddd; border-radius: var(--radius);
    padding: 20px; display: flex; align-items: center; transition: all 0.2s;
}
.contact-card:hover { border-color: var(--brand-blue); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.contact-icon {
    width: 50px; height: 50px; background: #e7f1ff; color: var(--brand-blue);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin-right: 20px;
}
/* Organisation logo in place of the emoji. Swaps the blue tint for white so the
   artwork sits on its own background, and never squashes next to a long title.
   Squared off rather than round: most hotline logos are wide badges, and a
   circle clips their left and right edges. Wider and taller than the 50px emoji
   circle because these badges carry readable text — at icon size the numbers
   and organisation names inside them were illegible. */
.contact-icon.has-logo {
    width: 84px; height: 64px; background: #fff; border: 1px solid #e7f1ff;
    border-radius: 8px; padding: 3px; flex-shrink: 0; margin-right: 16px;
}
.contact-icon.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
@media (max-width: 480px) {
    .contact-icon.has-logo { width: 64px; height: 50px; margin-right: 12px; }
}
.contact-details h3 { font-size: 1.1rem; font-weight: 700; color: #333; }
.contact-details p { font-size: 0.9rem; color: #666; }
.contact-details .phone { color: var(--brand-blue); font-weight: 700; }

/* Loader & Search */
.loading-overlay { position: absolute; top:0; left:0; width:100%; height:100%; background:rgba(255,255,255,0.8); z-index:10; display:none; justify-content:center; align-items:center; }
.loading-overlay.active { display:flex; }
.spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--brand-blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.search-group { display: flex; border: 2px solid #ddd; border-radius: 50px; overflow: hidden; max-width: 500px; margin: 0 auto 30px; }
.search-field { flex: 1; border: none; padding: 12px 20px; outline: none; }
.search-submit { background: var(--brand-blue); border: none; padding: 0 25px; color: #fff; cursor: pointer; }

/* --- FOOTER STYLES --- */
footer {
    background: #f8f9fa;
    padding: 60px 20px;
    margin-top: auto; /* Final safeguard for positioning */
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.sponsor-strip {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap; /* Wraps logos on small screens */
    margin-bottom: 30px;
}

.sponsor-img {
    height: 65px;
    width: auto;
    transition: all 0.3s ease;
}

.sponsor-img:hover {
    filter: none; /* Shows color on hover */
    opacity: 1;
    transform: scale(1.05); /* Subtle pop effect */
}

.footer-disclaimer {
    max-width: 700px;
    margin: 0 auto;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
}
a.glink {
    text-decoration: none;
    padding: 0 3px;
}

/* --- INTRO TOGGLE BUTTON --- */
.intro-toggle-btn {
    background: transparent;
    border: 2px solid var(--brand-blue);
    color: var(--brand-blue);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.intro-toggle-btn:hover {
    background: #e7f1ff;
    transform: translateY(-2px);
}

.intro-toggle-btn.active {
    background: var(--brand-blue);
    color: #fff;
}

/* Ensure the lead text looks nice */
.intro-lead {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* --- ACCESSIBILITY FIXES (WCAG 2.1) --- */

/* 1. Visible Focus Indicators (Critical for Keyboard Users) */
button:focus-visible,
a:focus-visible,
input:focus-visible,
.filter-btn:focus-visible {
    outline: 0px solid #FFD700; /* High contrast Gold */
    outline-offset: 2px;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    z-index: 100;
}

/* 2. Fix "Read More" Button styling (since we changed it to a <button>) */
.read-more-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    margin-left: 5px;
}
.read-more-btn:hover {
    text-decoration: none;
    opacity: 0.9;
}

/* 3. Screen Reader Only Class (for hidden labels) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- UNESCO STYLE BUTTONS --- */

/* 1. Filter Tabs (Pill Style) */
.filter-btn {
    padding: 9px 15px;
    background-color: #fff;
    color: var(--text-main);
    border: 1px solid #e1e1e1; /* Subtle grey border initially */
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smooth "UNESCO" ease */
    position: relative;
    overflow: hidden;
    z-index: 1;

    /* A pill is never squeezed and never broken across lines: the row scrolls
       instead. Without flex-basis:auto the longer labels get compressed first. */
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: center;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 85, 150, 0.2); /* Soft blue shadow */
    transform: translateY(-2px); /* Slight lift */
}

/* 2. Intro Toggle Button (Outline Style) */
.intro-toggle-btn {
    background-color: transparent;
    border: 2px solid var(--brand-blue); /* Thicker border for action buttons */
    color: var(--brand-blue);
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Space for the arrow */
}

.intro-toggle-btn:hover {
    background-color: var(--brand-blue);
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(0, 85, 150, 0.15);
}

/* 3. Search Button (Solid to Darker) */
.search-submit {
    background-color: var(--brand-blue);
    border: 2px solid var(--brand-blue); /* Match border to bg */
    color: #fff;
    padding: 0 30px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.search-submit:hover {
    background-color: var(--brand-dark); /* Darker blue on hover */
    border-color: var(--brand-dark);
}

/* 4. Read More Button (Text Link Style) */
.read-more-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent; /* Invisible border for animation */
    padding-bottom: 2px;
    font: inherit;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    margin-left: 5px;
    transition: all 0.2s ease;
    display: inline-block;
}

.read-more-btn:hover {
    border-bottom-color: #fff; /* Underline slides in or appears */
    transform: translateX(3px); /* Subtle shift right */
}

/* --- CLEANUP FOR EMPTY FIELDS --- */

/* If provider is missing, remove the margin from title so it sits nicely */
.card-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 60px; /* Ensure consistent header height even if provider is missing */
}

.card-title {
    margin-bottom: 5px; 
}

/* If no provider, the title can take up more space if needed */
.card-title:last-child {
    margin-bottom: 0;
}

/* Mobile Fix: Ensure intro text doesn't touch the edges */
@media (max-width: 768px) {
    .intro-box {
        padding: 20px 15px; /* Slightly less padding on mobile */
    }
    
    .intro-lead {
        font-size: 1rem; /* Readable size */
    }

    .tab-intro {
        padding: 20px 18px;
        margin-bottom: 28px;
        font-size: 0.97rem;
    }

    .tab-intro p:first-child {
        font-size: 1.04rem;
    }
}

/* Read More Button Styling */
.card-desc .excerpt-short,
.card-desc .excerpt-full,
.contact-desc .excerpt-short,
.contact-desc .excerpt-full {
    display: block; /* Ensures <p> tags inside render correctly */
}

.card-desc p:last-child,
.contact-desc p:last-child {
    margin-bottom: 5px; /* Reduce bottom margin so button sits closer */
    display: inline; /* Attempt to keep button inline with last paragraph */
}

.read-more-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-left: 5px;
    display: inline-block;
}

/* FIX: Force long URLs to wrap inside the card */
.card-desc a, 
.contact-desc a {
    word-break: break-word; /* Breaks long words/URLs */
    overflow-wrap: break-word; /* Modern standard */
    display: inline-block; /* Helps with layout */
    max-width: 100%; /* Ensures it never exceeds container */
}

/* --- TEXT BRANDING STYLES --- */

/* Remove default link underline */
a.brand-link {
    text-decoration: none;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Main Title Style */
.site-title {
    font-size: 2.2rem; /* Large and bold */
    font-weight: 800;
    color: var(--brand-blue); /* Uses your theme color */
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Tagline Style */
.site-tagline {
    font-size: 1rem;
    color: #555; /* Dark grey for readability */
    margin: 6px 0 0 0;
    font-weight: 500;
}

/* Mobile Adjustments (Center align on phones) */
@media (max-width: 768px) {
    .brand-container {
        width: 100%;
        display: flex;
        justify-content: center;
        text-align: center;
    }

    .site-title {
        font-size: 1.8rem; /* Slightly smaller on mobile */
    }

    .site-tagline {
        font-size: 0.85rem;
        padding: 0 10px; /* Prevent text touching edges */
    }
}

/* Change #888 to #636363 or darker */
.site-footer-credits {
    color: #595959 !important; 
}

.copyright, .developer {
    color: #595959 !important;
}

.card-provider {
    font-weight: 500;
}

.developer a {
    color: #0056b3 !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   CORNER VIDEO PANEL
   A YouTube-style "up next" list docked bottom-right. Collapsible so it
   never blocks the resource grid; players open in a modal on click.
   ========================================================================== */

.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bv-corner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.bv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--brand-blue);
}

.bv-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.bv-heading i { opacity: 0.9; }

.bv-count {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.bv-toggle {
    background: transparent;
    border: 0;
    color: #fff;
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 4px;
    line-height: 1;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.bv-toggle:hover { background: rgba(255, 255, 255, 0.18); }
.bv-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bv-toggle i { display: block; transition: transform 0.25s ease; }
.bv-corner.is-collapsed .bv-toggle i { transform: rotate(180deg); }

.bv-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 420px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.bv-corner.is-collapsed .bv-list {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
}

.bv-item + .bv-item { margin-top: 2px; }

.bv-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.bv-card:hover { background: #f2f6fa; }
.bv-card:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: -2px; }

.bv-thumb {
    position: relative;
    flex: 0 0 128px;
    width: 128px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.bv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.bv-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.bv-card:hover .bv-play,
.bv-card:focus-visible .bv-play { opacity: 1; }

.bv-play i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    padding-left: 2px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
}

.bv-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.bv-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.32;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bv-source { font-size: 0.72rem; color: #666; }

/* --- lightbox --- */
.bv-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bv-modal[hidden] { display: none; }

.bv-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }

.bv-modal-inner {
    position: relative;
    width: 100%;
    max-width: 900px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.bv-modal-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    background: #111;
}

.bv-modal-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    color: #fff;
}

.bv-modal-close {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.bv-modal-close:hover { background: rgba(255, 255, 255, 0.16); }
.bv-modal-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.bv-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.bv-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

body.bv-modal-open { overflow: hidden; }

@media (max-width: 768px) {
    .bv-corner { right: 12px; left: 12px; bottom: 12px; width: auto; max-width: none; }
    .bv-list { max-height: 50vh; }
    .bv-thumb { flex: 0 0 112px; width: 112px; }
}

@media (prefers-reduced-motion: reduce) {
    .bv-toggle i, .bv-list, .bv-card, .bv-play { transition: none; }
}
/* ---------------------------------------------------------------------------
 * TYPED RESOURCE CARDS
 *
 * A card whose resource has a 'resource_kind' meta says what it is before you
 * click it, and ends on the action rather than trailing off into whitespace.
 * Everything here is scoped to .has-kind, so untyped cards are untouched.
 * ------------------------------------------------------------------------- */

/* The description takes the slack so the action always sits on the baseline,
   which is what makes a row of cards line up regardless of text length. */
.resource-card.has-kind .card-desc { flex: 1 1 auto; }

/* .card-grid sets align-items:flex-start so cards size to their own content.
   Overriding it per item, rather than on the grid, squares off a row of typed
   cards without stretching the untyped ones elsewhere on the site. */
.resource-card.has-kind { align-self: stretch; }

/* The arrow bubble in the corner duplicates the action row below it. */
.resource-card.has-kind::after { content: none; }

.card-kind {
    display: inline-flex;
    align-items: center;
    /* .card-header is a column flex container, so without this the badge is
       stretched to the full card width instead of hugging its label. */
    align-self: flex-start;
    gap: 7px;
    padding: 5px 12px 5px 10px;
    margin-bottom: 14px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    /* Sits above the emoji watermark, like the rest of the card content. */
    position: relative;
    z-index: 2;
}
.card-kind i { font-size: 0.85rem; }

/* A cover image makes the translucent badge muddy; on those cards it goes
   solid so the label stays legible over arbitrary artwork. */
.resource-card.has-cover .card-kind {
    background: rgba(0, 32, 58, 0.72);
    border-color: rgba(255, 255, 255, 0.42);
}

/* A typed card leads with the badge, so the title no longer has to reserve
   room for the corner arrow. */
.resource-card.has-kind .card-title { padding-right: 0; }

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    margin-top: 22px;
    padding: 11px 20px;
    border-radius: 50px;
    background: #fff;
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    position: relative;
    z-index: 2;
}
.card-action i { font-size: 0.8rem; transition: transform 0.2s ease; }

.card-action:hover,
.card-action:focus-visible {
    background: var(--brand-accent);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.card-action:hover i,
.card-action:focus-visible i { transform: translateX(4px); }

/* Hovering anywhere on the card should advertise the action too. */
.resource-card.has-kind:hover .card-action i { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
    .card-action,
    .card-action i { transition: none; }
    .card-action:hover i,
    .card-action:focus-visible i,
    .resource-card.has-kind:hover .card-action i { transform: none; }
}
