/* ================================================================
   SETUSPAIN - PRODUCTION CSS
   Clean, organized, mobile-first approach
   ================================================================ */

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

:root {
    /* --------------------------------------------------------------
       Brand palette sampled directly from the SetuSpain logo:
       navy bridge #011A30, Bangladesh green #02522F
       Spanish red #E3081C, Spanish gold #F9AB0D
       -------------------------------------------------------------- */
    --brand-navy: #0F2C4D;
    --brand-navy-deep: #071A2F;
    --brand-green: #02522F;
    --brand-green-soft: #40705B;
    --brand-red: #E3081C;
    --brand-gold: #F9AB0D;

    --primary-color: #0F2C4D;   /* navy: links, buttons, structure */
    --secondary-color: #02522F; /* green: secondary accents */
    --accent-color: #E3081C;    /* red: highlights, hover */
    --highlight-color: #F9AB0D; /* gold: badges, underlines */

    --text-dark: #16202B;
    --text-light: #EDF1F5;
    --text-muted: #5B6B7C;
    --bg-dark: #0C1826;
    --bg-dark-soft: #132537;
    --bg-light: #ffffff;
    --bg-tint: #F5F8FA;
    --border-color: #DCE3EA;
    --border-dark: #24384D;
    --success-color: #02522F;
    
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Measured, not guessed: logo 60px + 1.5rem padding top and bottom + 1px
       border. Used by scroll-padding-top and by anything that has to sit clear
       of the header. */
    --nav-h: 109px;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
}

html {
    scroll-behavior: smooth;
}

/* The navbar is sticky, so an anchor jump scrolls the target to y=0, which is
   underneath it. scroll-padding-top pushes every anchored scroll down by the
   header height plus a little breathing room, which is what makes "Categories",
   "Latest" and the skip link land where the reader expects. */
html {
    scroll-padding-top: calc(var(--nav-h) + var(--spacing-sm));
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    transition: background-color 0.3s, color 0.3s;
}

/* Dark mode */
body.dark-mode {
    background-color: var(--bg-dark);
    color: var(--text-light);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ================================================================
   NAVBAR
   ================================================================ */

.navbar {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s;
}

body.dark-mode .navbar {
    background: var(--bg-dark);
    border-bottom-color: #374151;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img {
    height: 50px;
    width: auto;
    display: block;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: var(--spacing-lg);
    margin: 0;
}

.nav-menu a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* ================================================================
   NAV DROPDOWN (Categories)

   One toggle, two presentations: a floating panel below the button on a
   wide screen where .nav-menu is a horizontal row, an inline accordion
   that expands in place on a narrow screen where .nav-menu is already a
   vertical stack (a floating panel would run off the edge of a phone
   screen there, or sit disconnected from the button that opened it).
   Both driven by the same .open class toggled in main.js; only the CSS
   differs per breakpoint, not the interaction.
   ================================================================ */

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}
.nav-dropdown-toggle:hover { color: var(--primary-color); }

.nav-dropdown-arrow {
    display: inline-block;
    font-size: 0.7em;
    transition: transform 0.2s ease;
}
.nav-dropdown.open .nav-dropdown-arrow { transform: rotate(180deg); }

.nav-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-bn {
    font-size: 0.82em;
    font-weight: 400;
    color: var(--text-muted);
}

@media (min-width: 1025px) {
    .nav-dropdown { position: relative; }
    .nav-submenu {
        position: absolute;
        top: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%);
        min-width: 260px;
        background: var(--bg-light);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        box-shadow: 0 15px 35px rgba(15, 44, 77, 0.18);
        padding: var(--spacing-sm);
        display: none;
        z-index: 500;
    }
    body.dark-mode .nav-submenu {
        background: var(--bg-dark-soft);
        border-color: var(--border-dark);
    }
    .nav-dropdown.open .nav-submenu { display: block; }
    .nav-submenu li a {
        display: flex;
        align-items: baseline;
        gap: 0.4rem;
        padding: 0.5rem 0.75rem;
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }
    .nav-submenu li a:hover { background: var(--bg-tint); }
    body.dark-mode .nav-submenu li a:hover { background: rgba(255,255,255,0.06); }
}

/* Theme Button */
.theme-btn {
    background: none;
    border: 2px solid var(--primary-color);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    gap: 6px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: all 0.3s;
}

body.dark-mode .menu-toggle span {
    background: var(--text-light);
}

/* ================================================================
   HERO SECTION
   ================================================================ */

/* The original hero block is gone: it centred everything with flex and used
   the pre-brand purple gradient. Its replacement is in the HERO section near
   the end of this file. Leaving both in place meant the new rules were fighting
   a stale text-align: center that the cascade kept winning. */

.hero-content {
    max-width: 700px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

body.dark-mode .hero p {
    color: #9ca3af;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* ================================================================
   CATEGORIES
   ================================================================ */

.categories {
    padding: var(--spacing-xl) var(--spacing-md);
    background: var(--bg-light);
}

body.dark-mode .categories {
    background: #111827;
}

.categories h2,
.latest h2,

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.category-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s, opacity 0.5s ease;
    text-align: center;
}

body.dark-mode .category-card {
    background: #1f2937;
    border-color: #374151;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

body.dark-mode .category-card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

/* A quick scale-down on touch, the tactile "this responded to me" feedback
   a hover-only effect can't give on a phone, since there is no hover
   there to begin with. */
.category-card:active { transform: scale(0.96); }

/* Cards fade and slide up into place as CategoryReveal (main.js) adds
   .in-view once each one scrolls into the viewport, staggered slightly
   per card via the --reveal-delay custom property it sets. Scoped to
   .js specifically (added to <html> before first paint, see head() in
   build.mjs) so a visitor without JavaScript, or JS that fails to load,
   sees every card immediately rather than permanently hidden -- this is
   a visual entrance, not something the content should ever depend on to
   become visible at all. */
.js .category-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s, border-color 0.3s;
    transition-delay: var(--reveal-delay, 0s);
}
.js .category-card.in-view { opacity: 1; transform: translateY(0); }
.js .category-card.in-view:hover { transform: translateY(-5px); }
.js .category-card.in-view:active { transform: scale(0.96); }

.category-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: var(--reveal-delay, 0s);
}
.js .category-card:not(.in-view) .category-icon { transform: scale(0.4); }

.category-card h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.category-card p {
    color: #666;
    font-size: 0.95rem;
}

body.dark-mode .category-card p {
    color: #9ca3af;
}

/* ================================================================
   ARTICLES SECTION
   ================================================================ */

.latest {
    padding: var(--spacing-xl) var(--spacing-md);
    background: #f9fafb;
}

body.dark-mode .latest {
    background: #1f2937;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.article-card {
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all 0.3s;
}

body.dark-mode .article-card {
    background: #111827;
}

.article-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.article-card:active { transform: scale(0.97); }

/* Same entrance-animation treatment as .category-card above, and the
   same reasoning: scoped to .js so a visitor without JavaScript sees
   every card immediately, never depending on a script to become visible
   at all. */
.js .article-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s;
    transition-delay: var(--reveal-delay, 0s);
}
.js .article-card.in-view { opacity: 1; transform: translateY(0); }
.js .article-card.in-view:hover { transform: translateY(-5px); }
.js .article-card.in-view:active { transform: scale(0.97); }

body.dark-mode .article-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.article-card h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.article-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

body.dark-mode .article-meta {
    color: #9ca3af;
}

.article-card p {
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.read-more:hover {
    color: var(--secondary-color);
}

/* ================================================================
   FOOTER
   ================================================================ */

.footer {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: var(--spacing-xl) var(--spacing-md);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-section h4 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
}

/* Looks and behaves like the plain h4 it wraps until the mobile+JS scope
   further down turns it into a real accordion control -- reset here so
   desktop and no-JS visitors see no visual or functional difference at
   all from before this existed. */
.footer-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: default;
}

.footer-toggle h4 { margin-bottom: var(--spacing-md); }

.footer-chevron { display: none; }

.footer-panel { display: block; }

/* Below this width, with JS available to actually drive the toggle: the
   three link-list sections become real accordions, collapsed by default,
   and sit as an explicit 3-column grid rather than each stacking full-
   width -- the two changes reported together (the footer reading as one
   long, undifferentiated scroll). About is deliberately excluded: it has
   no list to hide behind a tap, so it keeps spanning full width above
   the row of three as its own, non-interactive section. Scoped to .js
   specifically so a no-JS visitor -- who would have no way to open a
   collapsed panel -- instead sees every link already expanded, same as
   before this existed. */
@media (max-width: 768px) {
    .js .footer-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-md);
    }

    .js .footer-grid > .footer-section:not(.footer-fold) {
        grid-column: 1 / -1;
    }

    .js .footer-toggle {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--spacing-xs);
    }

    .js .footer-toggle h4 {
        font-size: 0.92rem;
        margin-bottom: 0;
    }

    .js .footer-chevron {
        display: block;
        flex-shrink: 0;
        width: 9px;
        height: 9px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.2s ease;
        margin-top: -3px;
    }

    .js .footer-toggle[aria-expanded="true"] .footer-chevron {
        transform: rotate(-135deg);
        margin-top: 3px;
    }

    .js .footer-panel {
        display: none;
        margin-top: var(--spacing-sm);
    }

    .js .footer-panel.open {
        display: block;
    }

    .js .footer-section.footer-fold ul li {
        font-size: 0.88rem;
    }
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-sm);
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* ================================================================
   RESPONSIVE DESIGN - MOBILE
   ================================================================ */

/* Phone menu (hamburger) up to 1024px: covers phones held sideways and small
   tablets, where the desktop menu does not fit in one row. */
@media (max-width: 1024px) {
    :root { --nav-h: 89px; }

    .logo-img {
        height: 40px;
    }

    .nav-menu {
        gap: var(--spacing-md);
    }

    .menu-toggle {
        display: flex;
    }

    /* top: 100% pins the panel to the bottom edge of the navbar whatever its
       height turns out to be. The previous value was a hard-coded 70px against
       an 89px navbar, so the panel sat 19px too high and covered the logo. */
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-light);
        flex-direction: column;
        align-items: stretch;
        padding: 0 var(--spacing-lg);
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 24px rgba(15, 44, 77, 0.12);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        gap: 0;
    }

    body.dark-mode .nav-menu {
        background: var(--bg-dark);
        border-bottom-color: #374151;
    }

    /* A fixed pixel cap silently clips whatever is added last. This menu grew
       from three items to six and the theme button, 56px past the old 300px
       limit, ended up cut in half. Bounded by the viewport instead, and
       scrollable if it ever outgrows even that. */
    .nav-menu.open {
        max-height: min(75vh, 520px);
        overflow-y: auto;
        padding: var(--spacing-sm) var(--spacing-lg);
        overscroll-behavior: contain;
    }

    /* Full-width rows give a proper touch target rather than a text-sized one.
       A hairline divider between rows replaces what used to be a 24px gap on
       top of an already-generous 44px-tall row: the row height alone already
       meets the touch-target guidance (WCAG 2.5.5, Apple HIG), so that gap
       was pure dead space between items, not anything doing real work, and
       reads as broken rather than spacious once there are six of them. */
    .nav-menu li { width: 100%; border-bottom: 1px solid var(--border-color); }
    .nav-menu li:last-child { border-bottom: none; }
    body.dark-mode .nav-menu li { border-bottom-color: #374151; }

    .nav-menu a {
        display: block;
        padding: 0;
        min-height: 44px;
        line-height: 44px;
    }

    .nav-menu .theme-btn { margin: var(--spacing-xs) 0; }

    /* Mobile: the submenu expands in place, an accordion within the
       already-vertical menu, rather than the floating panel used at
       desktop width (see the min-width: 1025px block above) -- a floating
       panel would either run off the edge of the screen here or sit
       disconnected from the button that opened it. */
    .nav-dropdown-toggle {
        display: flex;
        width: 100%;
        justify-content: space-between;
        min-height: 44px;
        line-height: 44px;
    }
    .nav-submenu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .nav-dropdown.open .nav-submenu { max-height: 600px; }
    .nav-submenu li { border-bottom: none; padding-left: var(--spacing-md); }
    .nav-submenu li:not(:last-child) { border-bottom: 1px solid var(--border-color); }
    body.dark-mode .nav-submenu li:not(:last-child) { border-bottom-color: #374151; }
    .nav-submenu a { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
    .nav-search span { display: inline; }
}

@media (max-width: 768px) {

    .hero {
        padding: var(--spacing-lg) var(--spacing-md);
        min-height: 400px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

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

    .btn {
        width: 100%;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--spacing-md);
    }

    .categories h2,
    .latest h2,
    .contribute h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    :root { --nav-h: 84px; }

    .logo-img {
        height: 35px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .category-card {
        padding: var(--spacing-sm) var(--spacing-xs);
    }

    .category-icon {
        font-size: 1.8rem;
        margin-bottom: 0.35rem;
    }

    .category-card h3 {
        font-size: 0.88rem;
        line-height: 1.25;
        margin-bottom: 0.2rem;
    }

    /* The blurb sentence wraps to several lines at this width and makes
       cards tall and uneven side by side; icon, title and count alone
       read as a clean, scannable grid tile instead. */
    .category-card p { display: none; }

    .category-count { font-size: 0.7rem; }

    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .article-card {
        padding: var(--spacing-sm) var(--spacing-xs);
    }

    .article-card h3 {
        font-size: 0.92rem;
        line-height: 1.3;
        margin-bottom: 0.3rem;
    }

    .article-meta {
        font-size: 0.72rem;
        margin-bottom: 0.4rem;
    }

    /* The description is a full sentence that wraps to several lines at
       this width and makes cards tall and uneven side by side, the same
       reasoning as hiding .category-card p above; title, meta and the
       read-more link alone read as a clean, scannable tile. */
    .article-card p { display: none; }

    .read-more { font-size: 0.85rem; }

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

    .categories h2,
    .latest h2,
    .contribute h2 {
        font-size: 1.5rem;
    }
}

/* ================================================================
   COOKIE BANNER
   ================================================================ */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    color: var(--text-light);
    padding: var(--spacing-lg);
    z-index: 9999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.cookie-notice {
    flex: 1;
    min-width: 300px;
}

.cookie-notice a {
    color: var(--primary-color);
    text-decoration: none;
}

.cookie-notice a:hover {
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: var(--spacing-md);
    white-space: nowrap;
}

.cookie-close {
    background: transparent;
    color: var(--text-light);
    border-color: var(--text-light);
}

.cookie-close:hover {
    background: var(--text-light);
    color: var(--bg-dark);
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-actions {
        width: 100%;
    }

    .cookie-actions button {
        flex: 1;
    }

    .cookie-banner {
        padding: var(--spacing-md);
    }
}

/* ================================================================
   COOKIE CHOICE (js/main.js ConsentWall)
   Covers the page until the visitor answers; on the legal pages it
   docks at the bottom (.is-docked) so the policy can be read first.
   ================================================================ */

.consent-wall {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    background: rgba(7, 26, 47, 0.78);
    backdrop-filter: blur(3px);
}
.consent-wall[hidden] { display: none; }
.consent-now { font-weight: 700; }
.consent-more { margin: 0.4rem 0 0.2rem; font-size: 0.9rem; }
.consent-more summary { cursor: pointer; font-weight: 700; color: var(--highlight-color, #F9AB0D); }
.consent-more dl { margin: 0.5rem 0 0; }
.consent-more dt { font-weight: 700; margin-top: 0.4rem; }
.consent-more dd { margin: 0.1rem 0 0; opacity: 0.8; }
.cookie-live { list-style: none; padding: 0.6rem 0.9rem; border: 1px solid var(--border-color); border-radius: 12px; }
.cookie-live li { padding: 0.25rem 0; border-bottom: 1px dashed var(--border-color); }
.cookie-live li:last-child { border-bottom: 0; }
.consent-wall.is-docked {
    inset: auto 0 0 0;
    padding: 0;
    background: none;
    backdrop-filter: none;
}
.consent-box {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--brand-navy-deep);
    color: var(--text-light);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.consent-wall.is-docked .consent-box {
    max-width: none;
    border-radius: 0;
    border-width: 1px 0 0;
    max-height: 60vh;
}
.consent-box h2 { font-size: 1.15rem; margin: 0 0 0.6rem; color: #fff; }
.consent-box h2 span { font-size: 0.85rem; font-weight: 400; opacity: 0.8; }
.consent-box p { margin: 0 0 0.6rem; font-size: 0.95rem; line-height: 1.6; }
.consent-box a { color: var(--brand-gold); }
.consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}
/* Both answers look the same: refusing must be as easy as accepting. */
.consent-box .consent-btn {
    width: 100%;
    min-height: 48px;
    background: #fff;
    color: var(--brand-navy-deep);
    border: 2px solid #fff;
    font-weight: 600;
}
.consent-box .consent-btn:hover, .consent-box .consent-btn:focus-visible { background: var(--brand-gold); border-color: var(--brand-gold); color: var(--brand-navy-deep); }
html.consent-open, html.consent-open body { overflow: hidden; }
@media (max-width: 420px) {
    .consent-actions { grid-template-columns: 1fr; }
}

/* ================================================================
   LOGO VARIATIONS & STYLING
   ================================================================ */

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.9;
}

.logo-img {
    height: 60px;
    width: auto;
    display: block;
    object-fit: contain;
    object-position: center left;
    transition: filter 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.05);
}

/* The wordmark is real text, not baked into the image: it stays crisp at
   any zoom level, follows the theme's colours automatically instead of
   needing a second raster asset, and gives the link a real accessible name
   (the icon itself is alt="", decorative, so a screen reader announces
   "SetuSpain" once, not the icon's description and then the visible text
   again). */
.logo-wordmark {
    margin-left: 10px;
    font-family: system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.logo-setu { color: var(--brand-navy); }
.logo-spain { color: var(--brand-red); }

body.dark-mode .logo-setu { color: var(--text-light); }
body.dark-mode .logo-spain { color: #ff5468; } /* brand-red brightened; the
    base red reads muddy against a dark background at text size, where the
    icon's red (much larger and outlined) does not have the same problem. */

/* Responsive logo sizing */
@media (max-width: 768px) {
    .logo-img {
        height: 50px;
    }
    .logo-wordmark {
        font-size: 1.25rem;
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .logo-img {
        height: 40px;
    }
    .logo-wordmark {
        font-size: 1.05rem;
        margin-left: 6px;
    }
}

/* Below this, the wordmark plus the hamburger button plus the search icon
   no longer fit on one line without wrapping. The icon alone still reads as
   the site mark; the wordmark reappears the moment there is room again. */
@media (max-width: 360px) {
    .logo-wordmark { display: none; }
}

/* ================================================================
   NAVBAR LOGO CONTAINER
   ================================================================ */

/* Smooth transitions */
* {
    transition-property: background-color, color, border-color;
    transition-duration: 0.3s;
}

/* Skip transitions for specific elements to avoid flickering */
.theme-btn,
.btn,
.category-card,
.article-card {
    transition-property: all;
    transition-duration: 0.3s;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ================================================================
   LANGUAGE HANDLING
   The page is declared Bangla (lang="bn" on <html>) because most of the
   text is Bangla; interface chrome is marked lang="en". Only elements
   marked lang="bn" (not the <html> root itself)
   use the Bangla font stack.
   ================================================================ */

[lang="bn"]:not(html) {
    font-family: 'Noto Sans Bengali', 'Hind Siliguri', 'SolaimanLipi',
                 'Nirmala UI', 'Shonar Bangla', system-ui, sans-serif;
    line-height: 1.9;
}

.navbar, .footer, .breadcrumb, .cookie-banner,
.article-meta, .article-item-meta, .article-disclaimer, .article-nav {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ================================================================
   BREADCRUMB
   ================================================================ */

.breadcrumb {
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.breadcrumb-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    flex-wrap: wrap;
    color: #6b7280;
}

.breadcrumb a { color: var(--primary-color); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
body.dark-mode .breadcrumb-inner { color: #9ca3af; }

/* ================================================================
   CATEGORY PAGES
   ================================================================ */

.category-header {
    background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.08));
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-xl);
}

.category-header h1 { font-size: 2.25rem; margin-bottom: var(--spacing-sm); }
.category-header p { color: #4b5563; font-size: 1.05rem; margin: 0; }
body.dark-mode .category-header p { color: #9ca3af; }

.category-main { padding-bottom: var(--spacing-xl); }
.category-main h2 { font-size: 1.4rem; margin-bottom: var(--spacing-lg); }
.category-main .count { color: #6b7280; font-weight: 400; }

.category-count {
    display: inline-block;
    margin-top: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.articles-list { display: grid; gap: var(--spacing-md); }

/* The exams hub used to list every quiz from every category on one page,
   reported as having grown too large as content deepened. Each category
   now has its own dedicated page (exams/{category-slug}.html); this hub
   just links out via one card per category, styled close to the
   existing article-card look (background, radius, hover lift) but as a
   single clickable link like category-card, since the whole card should
   navigate, not just a "read more" line inside it. */
.exams-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.exams-hub-card {
    display: block;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

body.dark-mode .exams-hub-card {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

.exams-hub-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

body.dark-mode .exams-hub-card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.exams-hub-card:active { transform: scale(0.97); }

.exams-hub-card h2 { font-size: 1.3rem; margin-bottom: var(--spacing-sm); }
.exams-hub-card p { margin-bottom: var(--spacing-sm); line-height: 1.5; }
.exams-hub-card .exams-hub-stats { color: var(--text-muted); font-size: 0.88rem; margin-bottom: var(--spacing-md); }

/* These cards lost their description paragraph specifically so they could
   go compact and sit several to a row -- unlike the plain .articles-list
   cards elsewhere (regular category listings, search results), which
   keep a full description and stay single-column since a grid of tall,
   uneven text blocks reads worse than a clean list. Reuses the exact
   auto-fit pattern already proven on .articles-grid rather than a new one. */
.articles-list.quiz-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.quiz-grid .article-item { padding: var(--spacing-md); }
.quiz-grid .article-item h4 { font-size: 1.05rem; }
.quiz-grid .article-item-meta { font-size: 0.78rem; gap: var(--spacing-sm); }

/* Placed here, right after the base rule, deliberately: this selector has
   the same specificity as the one above, so with an earlier media query
   the base rule (being later in the file) would keep winning regardless
   of viewport width. Source order after the rule it overrides is what
   actually makes the override take effect, not the media query alone. */
@media (max-width: 480px) {
    .articles-list.quiz-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .quiz-grid .article-item { padding: var(--spacing-sm) var(--spacing-xs); }
    .quiz-grid .article-item h4 { font-size: 0.88rem; line-height: 1.3; }
    .quiz-grid .article-item-meta { font-size: 0.7rem; gap: 0.35rem; }
    .quiz-grid .quiz-number { font-size: 0.85em; }
}

.article-item {
    display: block;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.article-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.article-item h3 { font-size: 1.3rem; margin: 0 0 var(--spacing-sm); }
/* Same visual treatment for a card title one level deeper in the
   hierarchy: used specifically when the card sits under a subsection
   heading (category h2 > subsection h3 > card h4) rather than directly
   under the category itself, so heading levels nest correctly instead of
   reusing h3 for two different levels of the same page. */
.article-item h4 { font-size: 1.3rem; margin: 0 0 var(--spacing-sm); font-weight: 700; }

.article-item-meta {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 0.85rem;
    margin-bottom: var(--spacing-sm);
}
body.dark-mode .article-item-meta { color: #9ca3af; }

.article-item-desc { margin: 0 0 var(--spacing-sm); }
.read-more-btn { color: var(--primary-color); font-weight: 600; }

.no-articles {
    text-align: center;
    padding: var(--spacing-xl);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: #6b7280;
}
body.dark-mode .no-articles { color: #9ca3af; }

/* ================================================================
   ARTICLE PAGES
   ================================================================ */

.article-container {
    max-width: 820px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
}

.article-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.article-title { font-size: 2rem; line-height: 1.4; margin-bottom: var(--spacing-md); }

.article-meta {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 0.9rem;
}
body.dark-mode .article-meta { color: #9ca3af; }

.article-body h2 { font-size: 1.5rem; margin: var(--spacing-xl) 0 var(--spacing-md); }
.article-body h3 { font-size: 1.2rem; margin: var(--spacing-lg) 0 var(--spacing-sm); }
.article-body p { margin-bottom: var(--spacing-md); }
.article-body ul, .article-body ol { margin: 0 0 var(--spacing-lg) var(--spacing-lg); }
.article-body li { margin-bottom: var(--spacing-xs); }
/* A web address or other long string with no spaces would otherwise push
   the whole page sideways on a phone (cita-previa's icp... address did). */
.article-body p, .article-body li, .article-body dd { overflow-wrap: anywhere; }

.info-box, .tip-box, .warning-box {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin: var(--spacing-lg) 0;
}

.info-box { background: #eff6ff; border-color: #2563eb; }
.tip-box { background: #f0fdf4; border-color: #16a34a; }
.warning-box { background: #fef2f2; border-color: #dc2626; }

.info-box p:last-child,
.tip-box p:last-child,
.warning-box p:last-child { margin-bottom: 0; }

body.dark-mode .info-box { background: rgba(37, 99, 235, 0.12); }
body.dark-mode .tip-box { background: rgba(22, 163, 74, 0.12); }
body.dark-mode .warning-box { background: rgba(220, 38, 38, 0.12); }

.article-source {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.article-disclaimer {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(107, 114, 128, 0.08);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: #4b5563;
}
body.dark-mode .article-disclaimer { color: #9ca3af; }

.article-nav {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-xl);
}

.article-nav .btn { text-decoration: none; display: inline-block; }

@media (max-width: 768px) {
    .article-title { font-size: 1.5rem; }
    .category-header h1 { font-size: 1.75rem; }
}

/* ================================================================
   BRAND THEME OVERRIDES  (logo-derived)
   Loaded last so it wins over earlier generic rules.
   ================================================================ */

/* --- Dark mode surfaces tuned to the navy in the logo --- */
body.dark-mode {
    --primary-color: #7FB0E0;
    --secondary-color: #5FA97F;
    --accent-color: #FF5A63;
    --border-color: var(--border-dark);
    --text-muted: #93A5B8;
    /* Never redefined for dark mode anywhere before this: every one of
       its ~16 uses site-wide (search-box hover, card backgrounds, and
       figures such as nuss-vs-alta.svg already shipped) stayed at its
       light-mode value regardless of theme. Reusing --bg-dark-soft since
       that's already the established "light background area" colour for
       dark mode elsewhere (see .fig's own dark-mode override). */
    --bg-tint: var(--bg-dark-soft);
    background-color: var(--bg-dark);
}

body.dark-mode .navbar,
body.dark-mode .footer,
body.dark-mode .breadcrumb {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

body.dark-mode .category-card,
body.dark-mode .article-card,
body.dark-mode .article-item {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

/* --- Navbar: gold hairline echoes the ribbon in the logo --- */
.navbar {
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(249, 171, 13, 0.35);
}

.nav-menu a {
    color: var(--text-dark);
    font-weight: 500;
}

body.dark-mode .nav-menu a { color: var(--text-light); }
.nav-menu a:hover { color: var(--accent-color); }

/* --- Buttons --- */
.btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease, color 0.2s ease,
                border-color 0.2s ease, transform 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--brand-navy);
    color: #fff;
    border: 2px solid var(--brand-navy);
}

.btn-primary:hover {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: #fff;
}

.btn-secondary {
    background: transparent;
    color: var(--brand-navy);
    border: 2px solid var(--brand-navy);
}

.btn-secondary:hover {
    background: var(--brand-navy);
    color: #fff;
}

body.dark-mode .btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
}

body.dark-mode .btn-secondary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

body.dark-mode .btn-secondary:hover {
    background: var(--primary-color);
    color: var(--bg-dark);
}

/* --- Section headings get a gold underline --- */
.categories h2,
.latest h2,
.category-main h2 {
    position: relative;
    padding-bottom: var(--spacing-xs);
}

.categories h2::after,
.latest h2::after,
.category-main h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 3px;
    background: var(--brand-gold);
    border-radius: 2px;
}

/* --- Cards --- */
.category-card,
.article-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    border-top: 3px solid var(--brand-navy);
    background: var(--bg-light);
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.category-card:hover,
.article-card:hover {
    transform: translateY(-3px);
    border-top-color: var(--brand-red);
    box-shadow: 0 8px 22px rgba(15, 44, 77, 0.12);
}

body.dark-mode .category-card:hover,
body.dark-mode .article-card:hover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.article-item { border-left: 3px solid var(--brand-green); }
.article-item:hover { border-left-color: var(--brand-red); }

/* --- Category header banner --- */
.category-header {
    background: linear-gradient(135deg,
        rgba(2, 82, 47, 0.10), rgba(15, 44, 77, 0.10) 55%, rgba(227, 8, 28, 0.10));
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .category-header {
    background: linear-gradient(135deg,
        rgba(2, 82, 47, 0.28), rgba(15, 44, 77, 0.28) 55%, rgba(227, 8, 28, 0.20));
}

.category-header h1 { color: var(--brand-navy); }
body.dark-mode .category-header h1 { color: var(--text-light); }

/* --- Content boxes recoloured to brand --- */
.info-box   { background: rgba(15, 44, 77, 0.06);  border-color: var(--brand-navy); }
.tip-box    { background: rgba(2, 82, 47, 0.07);   border-color: var(--brand-green); }
.warning-box{ background: rgba(227, 8, 28, 0.06);  border-color: var(--brand-red); }

body.dark-mode .info-box    { background: rgba(127, 176, 224, 0.12); border-color: var(--primary-color); }
body.dark-mode .tip-box     { background: rgba(95, 169, 127, 0.12);  border-color: var(--secondary-color); }
body.dark-mode .warning-box { background: rgba(255, 90, 99, 0.12);   border-color: var(--accent-color); }

/* --- Footer --- */
.footer {
    background: var(--brand-navy-deep);
    color: var(--text-light);
    border-top: 3px solid var(--brand-gold);
    padding: var(--spacing-xl) 0 var(--spacing-lg);
}

.footer h4 { color: #fff; margin-bottom: var(--spacing-sm); }
.footer p, .footer li { color: #C4D0DC; }
.footer ul { list-style: none; }
.footer a { color: #C4D0DC; text-decoration: none; }
.footer a:hover { color: var(--brand-gold); text-decoration: underline; }

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
}

.footer-bottom {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    text-align: center;
    font-size: 0.9rem;
}

/* The human-check result, one quiet line under the copyright. */
.human-status {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}
.human-status.is-machine { color: var(--brand-gold); }

/* Turnstile, when configured, is invisible unless Cloudflare needs the
   visitor to click; then it appears bottom-centre, above everything. */
.human-turnstile {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 10000;
}
.human-turnstile:empty { display: none; }

/* --- Cookie banner --- */
.cookie-banner { background: var(--brand-navy-deep); color: var(--text-light); }
.cookie-banner a { color: var(--brand-gold); }

/* --- Focus visibility (accessibility) --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--brand-gold);
    outline-offset: 2px;
    border-radius: 3px;
}

/* --- Skip link --- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--brand-navy);
    color: #fff;
    padding: 0.75rem 1rem;
    z-index: 2000;
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus { left: 0; }

/* --- Print --- */
@media print {
    .navbar, .footer, .cookie-banner, .article-nav,
    .contribute, .breadcrumb, .menu-toggle { display: none !important; }
    body { color: #000; background: #fff; }
    .article-container { max-width: 100%; }
}

/* Print watermark: a real <img>, not a CSS background-image, since many
   browsers suppress background images by default in print output unless
   the reader specifically enables "background graphics" in the print
   dialog, which most people never touch. An actual image element is
   real content as far as the print engine is concerned, so it renders
   regardless of that setting. Hidden on screen always; only shown, and
   only positioned, inside the print media query below. position: fixed
   is the only way to place it independent of document flow across a
   print engine, but fixed elements repeating on every printed page
   (rather than only the first) is a real, browser-dependent limitation
   of CSS print rendering, not something this rule alone controls. */
.print-watermark { display: none; }

@media print {
    .print-watermark {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-30deg);
        opacity: 0.08;
        z-index: 9999;
        pointer-events: none;
    }
    .print-watermark img { width: 260px; height: 260px; }
    .print-watermark span {
        font-family: system-ui, sans-serif;
        font-size: 1.4rem;
        font-weight: 800;
        color: #0F2C4D;
        letter-spacing: 0.05em;
    }
}

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

/* ================================================================
   ARTICLE COVER IMAGE (used by posts made in the composer)
   ================================================================ */

.article-cover {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: block;
    border-bottom: 3px solid var(--brand-gold);
}

@media (max-width: 768px) {
    .article-cover { max-height: 260px; }
}

/* Screen-reader-only utility */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ================================================================
   CONTRIBUTE / COMPOSE ENTRY POINTS
   ================================================================ */

.contribute {
    background: linear-gradient(135deg,
        rgba(2, 82, 47, 0.10), rgba(15, 44, 77, 0.10) 55%, rgba(227, 8, 28, 0.08));
    padding: var(--spacing-xl) 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

body.dark-mode .contribute {
    background: linear-gradient(135deg,
        rgba(2, 82, 47, 0.25), rgba(15, 44, 77, 0.25) 55%, rgba(227, 8, 28, 0.16));
    border-color: var(--border-dark);
}

.contribute h2 { margin-bottom: var(--spacing-xs); }
.contribute p {
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto var(--spacing-md);
}
body.dark-mode .contribute p { color: #B6C4D2; }

.footer-cta {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    text-align: center;
}

.footer-cta p { margin: 0; color: #C4D0DC; }

.btn-compose {
    background: var(--brand-gold);
    color: #1a1205;
    border: 2px solid var(--brand-gold);
    padding: 0.6rem 1.2rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius-md);
    display: inline-block;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-compose:hover {
    background: #fff;
    border-color: #fff;
    color: var(--brand-navy-deep);
}

.btn-compose:active { transform: translateY(1px); }

/* `.footer a` is more specific than `.btn-compose` and was repainting the
   footer copy of this button's text pale (and gold-on-gold on hover), which
   made it unreadable. */
.footer a.btn-compose { color: #1a1205; text-decoration: none; }
.footer a.btn-compose:hover { color: var(--brand-navy-deep); text-decoration: none; }

/* ================================================================
   POLICY TABLES
   ================================================================ */

.policy-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0 var(--spacing-lg);
    font-size: 0.9rem;
}

.policy-table th,
.policy-table td {
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

.policy-table th {
    background: var(--bg-tint);
    font-weight: 700;
}

body.dark-mode .policy-table th { background: var(--bg-dark-soft); }
body.dark-mode .policy-table th,
body.dark-mode .policy-table td { border-color: var(--border-dark); }

.policy-table code {
    font-size: 0.85em;
    background: rgba(15, 44, 77, 0.08);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    word-break: break-all;
}

body.dark-mode .policy-table code { background: rgba(255, 255, 255, 0.1); }

/* Tables scroll rather than overflow on small screens */
@media (max-width: 640px) {
    .policy-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ================================================================
   AD SLOTS
   Reserved height prevents the page jumping when an ad loads, which
   is both a Core Web Vitals problem and an accidental-click problem.
   ================================================================ */

.ad-slot {
    display: block;
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-sm) 0;
    min-height: 100px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

.ad-label {
    display: block;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.ad-slot .adsbygoogle { min-height: 90px; }

/* Keep a clear gap from real links so no one taps an ad by accident */
.ad-slot + *, * + .ad-slot { margin-top: var(--spacing-xl); }

/* ================================================================
   ABOUT / CONTACT / AUTHOR
   ================================================================ */

.author-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0 var(--spacing-lg);
}

.author-card {
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-green);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

body.dark-mode .author-card { border-color: var(--border-dark); border-left-color: var(--secondary-color); }

.author-card h3 { margin-bottom: 0.15rem; font-size: 1.05rem; }

.author-role {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.author-box {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-gold);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
}

body.dark-mode .author-box { border-color: var(--border-dark); border-left-color: var(--brand-gold); }

.author-box h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.author-box p { margin-bottom: var(--spacing-xs); }

.contact-email {
    font-size: 1.3rem;
    font-weight: 700;
    margin: var(--spacing-md) 0 var(--spacing-lg);
    word-break: break-all;
}

.policy-table .table-section {
    background: var(--bg-tint);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

body.dark-mode .policy-table .table-section { background: var(--bg-dark-soft); }

.policy-table .muted, .muted-note { color: var(--text-muted); font-size: 0.85rem; }

.linklike {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: #C4D0DC;
    cursor: pointer;
    text-decoration: none;
}

.linklike:hover { color: var(--brand-gold); text-decoration: underline; }

@media print { .ad-slot { display: none !important; } }

/* Transparent PNG logos: nothing behind them, so no background bleed */
.logo-img {
    background: transparent;
    image-rendering: -webkit-optimize-contrast;
}

.big-404 {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 0.5rem;
    color: var(--brand-navy);
}

body.dark-mode .big-404 { color: var(--primary-color); }

.legal-content .big-404 + h2 { margin-top: 0; }

.legal-content.text-center { text-align: center; }

/* ================================================================
   ARTICLE AUDIO PLAYER
   ================================================================ */

.listen {
    --played: 0%;
    margin: var(--spacing-lg) 0 var(--spacing-xl);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-gold);
    border-radius: var(--radius-md);
    background: var(--bg-tint);
}

body.dark-mode .listen {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
    border-left-color: var(--brand-gold);
}

.listen-head {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    font-size: 0.92rem;
}

.listen-icon { font-size: 1.1rem; }
.listen-title { font-weight: 600; }

.listen-time {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Three states, in order of how the page can actually fail:

   no `js` class          scripting is off or blocked before paint, so the
                          browser's own controls stay visible
   `js`                   scripting is alive, hide the native controls before
                          first paint so they never flash
   `js player-fallback`   main.js never initialised within 4 seconds, or the
                          file failed to load, so put the native controls back  */

.listen-audio { width: 100%; display: block; }
.js .listen-audio { display: none; }
.js.player-fallback .listen-audio { display: block; }

.listen-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-wrap: nowrap;
}

.listen-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

body.dark-mode .listen-btn {
    background: var(--bg-dark);
    color: var(--text-light);
    border-color: var(--border-dark);
}

.listen-btn:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
}

body.dark-mode .listen-btn:hover {
    background: var(--primary-color);
    color: var(--bg-dark);
    border-color: var(--primary-color);
}

.listen-btn.play {
    min-width: 48px;
    height: 48px;
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
    font-size: 1rem;
}

.listen-btn.play:hover { background: var(--brand-red); border-color: var(--brand-red); }

body.dark-mode .listen-btn.play {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
}

.btn-num { font-size: 0.62rem; font-weight: 700; }

/* Seek bar. The filled portion is driven by --played from the script. */
.listen-seek {
    flex: 1 1 auto;
    min-width: 60px;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 3px;
    background: linear-gradient(to right,
        var(--brand-red) 0%, var(--brand-red) var(--played),
        var(--border-color) var(--played), var(--border-color) 100%);
    cursor: pointer;
}

body.dark-mode .listen-seek {
    background: linear-gradient(to right,
        var(--primary-color) 0%, var(--primary-color) var(--played),
        var(--border-dark) var(--played), var(--border-dark) 100%);
}

.listen-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--brand-navy);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: grab;
}

.listen-seek::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--brand-navy);
    cursor: grab;
}

body.dark-mode .listen-seek::-webkit-slider-thumb { background: var(--primary-color); border-color: var(--bg-dark); }
body.dark-mode .listen-seek::-moz-range-thumb { background: var(--primary-color); border-color: var(--bg-dark); }

.listen-btn.rate { font-variant-numeric: tabular-nums; font-size: 0.82rem; }

.listen.is-playing { border-left-color: var(--brand-red); }
body.dark-mode .listen.is-playing { border-left-color: var(--accent-color); }

.listen-error { margin: 0; color: var(--brand-red); font-size: 0.88rem; }

/* On narrow screens drop the least essential buttons rather than wrapping
   into a cramped second row. */
@media (max-width: 560px) {
    .listen-btn { min-width: 36px; height: 36px; padding: 0 0.35rem; }
    .listen-btn.play { min-width: 44px; height: 44px; }
}

@media (max-width: 400px) {
    .listen-btn.mute { display: none; }
}

/* Docked: once playing, the player is a bar along the bottom of the screen
   (see AudioPlayer.dock in main.js). Under the notice banner and the
   back-to-top button in the stacking order, above the content. */
.listen-spot { margin: var(--spacing-lg) 0 var(--spacing-xl); }

.listen.is-docked {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--dock-bottom, 0px);
    z-index: 840;
    margin: 0;
    padding: var(--spacing-sm) max(var(--spacing-md), calc((100% - 760px) / 2));
    padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 3px solid var(--brand-gold);
    border-radius: 0;
    background: var(--bg-light);
    box-shadow: 0 -4px 16px rgba(15, 44, 77, 0.15);
}
.listen.is-docked.is-playing { border-top-color: var(--brand-red); }
body.dark-mode .listen.is-docked { background: var(--bg-dark-soft); border-top-color: var(--brand-gold); }
body.dark-mode .listen.is-docked.is-playing { border-top-color: var(--accent-color); }
.listen.is-docked .listen-head { margin-bottom: var(--spacing-xs); }
.listen.is-docked .listen-hint,
.listen.is-docked .listen-credit { display: none; }

.listen-btn.undock { min-width: 32px; height: 32px; margin-left: var(--spacing-xs); font-size: 0.9rem; }
.listen-btn.undock[hidden] { display: none; }
.listen-btn.totop { min-width: 32px; height: 32px; margin-left: var(--spacing-xs); font-size: 1rem; }
.listen-btn.totop[hidden] { display: none; }

/* The page ends above the bar. Back-to-top moves into the bar while it is
   docked, so it stays at the bottom of the screen. */
body.has-dock { padding-bottom: calc(var(--dock-h, 0px) + var(--dock-bottom, 0px)); }
body.has-dock .to-top { display: none; }

@media print { .listen { display: none !important; } }

/* ================================================================
   SEARCH
   ================================================================ */

.search-main { padding-bottom: var(--spacing-xl); }
.search-hint { color: var(--text-muted); margin-bottom: var(--spacing-md); }

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 620px;
    margin-bottom: var(--spacing-sm);
}

.search-box input {
    width: 100%;
    padding: 0.85rem 2.6rem 0.85rem 1rem;
    font-size: 1.05rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    color: var(--text-dark);
}

body.dark-mode .search-box input {
    background: var(--bg-dark-soft);
    color: var(--text-light);
    border-color: var(--border-dark);
}

.search-box input:focus { outline: none; border-color: var(--brand-navy); }
body.dark-mode .search-box input:focus { border-color: var(--primary-color); }

.search-box input::-webkit-search-cancel-button { display: none; }

.search-box button {
    position: absolute;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.search-box button:hover { background: var(--bg-tint); color: var(--brand-red); }
body.dark-mode .search-box button:hover { background: var(--bg-dark); }

.search-count {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: var(--spacing-md);
}

.nav-search { display: inline-flex; align-items: center; gap: 0.3rem; }

@media (min-width: 1025px) {
    .nav-search span { display: none; }
    .nav-search { font-size: 1.05rem; }
}

/* ================================================================
   RELATED ARTICLES
   ================================================================ */

.related {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

body.dark-mode .related { border-color: var(--border-dark); }

.related h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: var(--spacing-sm);
}

.related-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--brand-green);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

body.dark-mode .related-item { border-color: var(--border-dark); border-top-color: var(--secondary-color); }

.related-item:hover {
    transform: translateY(-2px);
    border-top-color: var(--brand-red);
    box-shadow: 0 6px 16px rgba(15, 44, 77, 0.1);
}

.related-cat, .related-meta { font-size: 0.75rem; color: var(--text-muted); }
.related-title { font-weight: 600; line-height: 1.5; }

@media print { .related, .search-box { display: none !important; } }

/* ================================================================
   STICKY HEADER CLEARANCE
   ================================================================ */

#main,
#categories,
#latest,
.article-header,
.category-header,
[id^="related"] {
    scroll-margin-top: calc(var(--nav-h) + var(--spacing-sm));
}

/* The skip link moves focus rather than scrolling, so the browser may place
   the target flush against the top. This keeps it clear of the header. */
#main:focus,
#main:target {
    scroll-margin-top: calc(var(--nav-h) + var(--spacing-sm));
    outline: none;
}

/* Sticky panels inside the page must clear the header too, or they slide
   underneath it as you scroll. */
.compose-wrap > .panel[style*="sticky"],
.listen.is-sticky {
    top: calc(var(--nav-h) + var(--spacing-xs));
}

/* ================================================================
   VERIFIED DATE
   Signals to a reader that someone rechecked the government source,
   which is a different claim from "the file was edited".
   ================================================================ */

.verified-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.verified-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-green);
    flex: 0 0 auto;
}

body.dark-mode .verified-dot { background: var(--secondary-color); }

/* ================================================================
   LEGAL, ABOUT AND CONTACT PAGES

   These had no layout rules at all, so they rendered full-bleed with
   default margins: text ran the entire window width, which on a desktop
   monitor is roughly 200 characters a line. Comfortable reading is
   nearer 65 to 75, and legal text is exactly the kind nobody rereads
   when they lose their place.
   ================================================================ */

.legal-content {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md) var(--spacing-xl);
    font-size: 1.03rem;
    line-height: 1.75;
}

.legal-content h1 {
    font-size: 2.1rem;
    line-height: 1.25;
    margin-bottom: var(--spacing-xs);
}

.legal-content .last-updated {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
}

body.dark-mode .legal-content .last-updated { border-color: var(--border-dark); }

/* Generous space above a heading, tight below it, so each heading reads as
   belonging to the text that follows rather than floating between blocks. */
.legal-content h2 {
    font-size: 1.35rem;
    line-height: 1.35;
    margin: var(--spacing-xl) 0 var(--spacing-sm);
    padding-top: var(--spacing-xs);
    scroll-margin-top: calc(var(--nav-h) + var(--spacing-md));
}

.legal-content h3 {
    font-size: 1.08rem;
    margin: var(--spacing-lg) 0 var(--spacing-xs);
    color: var(--brand-navy);
}

body.dark-mode .legal-content h3 { color: var(--primary-color); }

.legal-content p { margin-bottom: var(--spacing-md); }

.legal-content ul,
.legal-content ol {
    margin: 0 0 var(--spacing-md) 1.35rem;
    padding: 0;
}

.legal-content li { margin-bottom: 0.5rem; }
.legal-content li::marker { color: var(--brand-gold); }

.legal-content a { text-decoration: underline; text-underline-offset: 2px; }

/* First paragraph after the date line carries the summary, so give it weight */
.legal-content .info-box p { font-size: 1.05rem; }

/* --- section anchors --- */

.legal-h2 { position: relative; }

.legal-h2 .anchor {
    position: absolute;
    left: -1.1rem;
    text-decoration: none;
    color: var(--brand-gold);
    opacity: 0;
    transition: opacity 0.2s ease;
    font-weight: 400;
}

.legal-h2:hover .anchor,
.legal-h2 .anchor:focus { opacity: 1; }

/* Never hide the anchor off-screen on narrow viewports */
@media (max-width: 860px) {
    .legal-h2 .anchor { display: none; }
}

/* --- table of contents --- */

.toc {
    margin: var(--spacing-lg) 0 var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tint);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--brand-navy);
}

body.dark-mode .toc {
    background: var(--bg-dark-soft);
    border-left-color: var(--primary-color);
}

.toc h2 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 0 var(--spacing-sm);
    padding: 0;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: var(--spacing-lg);
}

@media (max-width: 620px) {
    .toc-list { columns: 1; }
    .toc { padding: var(--spacing-md); }
}

.toc-list li {
    margin-bottom: 0.4rem;
    break-inside: avoid;
}

.toc-list a {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-dark);
}

body.dark-mode .toc-list a { color: var(--text-light); }
.toc-list a:hover { color: var(--brand-red); text-decoration: underline; }
body.dark-mode .toc-list a:hover { color: var(--accent-color); }

.toc-num {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--brand-gold);
    font-weight: 700;
    padding-top: 0.1rem;
}

/* Highlight the section the reader is currently in */
.toc-list a.current {
    color: var(--brand-red);
    font-weight: 600;
}

body.dark-mode .toc-list a.current { color: var(--accent-color); }

/* --- back to top --- */

.back-to-top {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.88rem;
}

body.dark-mode .back-to-top { border-color: var(--border-dark); }
.back-to-top a { color: var(--text-muted); text-decoration: none; }
.back-to-top a:hover { color: var(--brand-red); text-decoration: underline; }

/* --- 404 is centred and has no contents list --- */

.legal-content.text-center { max-width: 560px; }
.legal-content.text-center ul,
.legal-content.text-center ol { margin-left: 0; list-style-position: inside; }

@media (max-width: 768px) {
    .legal-content {
        padding: var(--spacing-lg) var(--spacing-md);
        font-size: 1rem;
    }
    .legal-content h1 { font-size: 1.7rem; }
    .legal-content h2 { font-size: 1.2rem; }
}

@media print {
    .toc, .back-to-top, .legal-h2 .anchor { display: none !important; }
    .legal-content { max-width: 100%; }
}

/* ================================================================
   ABOUT AND CONTACT SPECIFICS
   ================================================================ */

/* Author cards sit inside the reading column, so a single card should not
   stretch to full width and look like a banner. */
.legal-content .author-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin: var(--spacing-md) 0 var(--spacing-lg);
}

.legal-content .author-card {
    background: var(--bg-tint);
    border-color: transparent;
    border-left-width: 3px;
}

body.dark-mode .legal-content .author-card {
    background: var(--bg-dark-soft);
    border-color: transparent;
    border-left-color: var(--secondary-color);
}

/* The contact address is the whole point of the page, so it gets treated as
   an action rather than a line of body text. */
.contact-email {
    display: block;
    margin: var(--spacing-md) 0 var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg,
        rgba(2, 82, 47, 0.08), rgba(15, 44, 77, 0.08) 60%, rgba(227, 8, 28, 0.06));
    border-radius: var(--radius-md);
    border-left: 3px solid var(--brand-gold);
    text-align: center;
}

body.dark-mode .contact-email {
    background: linear-gradient(135deg,
        rgba(2, 82, 47, 0.22), rgba(15, 44, 77, 0.22) 60%, rgba(227, 8, 28, 0.14));
}

.contact-email a {
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--brand-navy);
    word-break: break-word;
}

body.dark-mode .contact-email a { color: var(--primary-color); }
.contact-email a:hover { color: var(--brand-red); text-decoration: underline; }
body.dark-mode .contact-email a:hover { color: var(--accent-color); }

@media (max-width: 480px) {
    .contact-email { padding: var(--spacing-md) var(--spacing-sm); }
    .contact-email a { font-size: 1.05rem; }
}

/* On the contact page each h3 introduces a reason to write, so give them a
   marker that reads as a list of options rather than document sections. */
.legal-content h3 {
    position: relative;
    padding-left: 0.9rem;
}

.legal-content h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand-gold);
}

/* Boxes inside the reading column should breathe more than they do in an
   article, where they interrupt a narrative rather than a reference list. */
.legal-content .info-box,
.legal-content .tip-box,
.legal-content .warning-box {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md) var(--spacing-lg);
}

/* Tables inside the reading column */
.legal-content .policy-table { font-size: 0.88rem; }

/* ================================================================
   LINK COLOURS

   Links had no colour rule anywhere, so they fell back to the browser
   default #0000EE. Against the dark background that is a contrast ratio
   of 1.9:1, where WCAG AA asks for 4.5:1 on body text. It was close to
   unreadable in dark mode and it affected every page, not just these.
   ================================================================ */

a {
    color: var(--brand-navy);
    text-decoration-color: rgba(15, 44, 77, 0.35);
}

a:hover { color: var(--brand-red); text-decoration-color: currentColor; }

body.dark-mode a {
    color: var(--primary-color);
    text-decoration-color: rgba(127, 176, 224, 0.4);
}

body.dark-mode a:hover { color: var(--accent-color); }

/* Elements that carry their own colour must not be overridden by the above. */
.logo, .btn, .nav-menu a, .footer a, .toc-list a,
.article-item, .related-item, .category-card, .article-card,
.skip-link, .listen-btn, .read-more, .read-more-btn {
    text-decoration-color: currentColor;
}

/* ================================================================
   BUTTON VARIANTS

   btn-ghost is for secondary actions that should be reachable but not
   compete with the primary one. The composer previously showed five
   equally-weighted buttons, which gives no indication of what to do
   first.
   ================================================================ */

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-ghost:hover {
    background: var(--bg-tint);
    color: var(--text-dark);
    border-color: var(--text-muted);
}

body.dark-mode .btn-ghost { border-color: var(--border-dark); }

body.dark-mode .btn-ghost:hover {
    background: var(--bg-dark-soft);
    color: var(--text-light);
}

.btn-ghost.btn-danger:hover {
    background: rgba(227, 8, 28, 0.08);
    color: var(--brand-red);
    border-color: var(--brand-red);
}

body.dark-mode .btn-ghost.btn-danger:hover {
    background: rgba(255, 90, 99, 0.14);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* ================================================================
   COMPOSER SEND STEPS
   ================================================================ */

.send-steps {
    display: grid;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.send-step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: var(--spacing-sm);
    align-items: start;
}

.send-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--brand-navy);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
}

body.dark-mode .send-num { background: var(--primary-color); color: var(--bg-dark); }

.send-note {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.send-note code {
    background: rgba(15, 44, 77, 0.08);
    padding: 0.05rem 0.28rem;
    border-radius: 3px;
}

body.dark-mode .send-note code { background: rgba(255, 255, 255, 0.1); }

.actions-minor {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

body.dark-mode .actions-minor { border-color: var(--border-dark); }

/* Search result term highlighting */
.article-item mark {
    background: rgba(249, 171, 13, 0.35);
    color: inherit;
    padding: 0 0.12em;
    border-radius: 2px;
    font-weight: 600;
}

body.dark-mode .article-item mark {
    background: rgba(249, 171, 13, 0.3);
    color: var(--text-light);
}

/* ================================================================
   PRONUNCIATION CHIPS
   ================================================================ */

.say {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    white-space: nowrap;
}

.say-text {
    font-weight: 700;
    color: var(--brand-navy);
    white-space: normal;
}

body.dark-mode .say-text { color: var(--primary-color); }

.say-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    flex: 0 0 auto;
    align-self: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--brand-navy);
    font-size: 0.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease,
                border-color 0.15s ease, transform 0.12s ease;
}

body.dark-mode .say-btn {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
    color: var(--primary-color);
}

.say-btn:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
    transform: scale(1.08);
}

body.dark-mode .say-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
}

.say-btn.speaking {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: #fff;
    animation: sayPulse 1s ease-in-out infinite;
}

@keyframes sayPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(227, 8, 28, 0.4); }
    50%      { box-shadow: 0 0 0 6px rgba(227, 8, 28, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .say-btn.speaking { animation: none; }
}

.say-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-tint);
    border-left: 3px solid var(--brand-gold);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

body.dark-mode .say-hint { background: var(--bg-dark-soft); }

/* A list of vocabulary reads better with room to breathe */
.article-body li .say { margin-right: 0.15rem; }

@media print { .say-btn, .say-hint { display: none !important; } }

/* ================================================================
   HERO

   The old hero said "Your Guide. Your Community. Your Bridge." and
   nothing else. That is a slogan, not an answer: someone landing from a
   WhatsApp group has a specific word in mind, usually NIE or padrón, and
   the page gave them no sign it covered that. This one names the topics,
   states the language, and offers four direct entry points.
   ================================================================ */

.hero {
    position: relative;
    overflow: hidden;
    padding: var(--spacing-xl) var(--spacing-md);
    background:
        radial-gradient(1100px 420px at 12% -10%, rgba(2, 82, 47, 0.10), transparent 60%),
        radial-gradient(900px 420px at 88% 0%, rgba(227, 8, 28, 0.08), transparent 60%),
        var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .hero {
    background:
        radial-gradient(1100px 420px at 12% -10%, rgba(95, 169, 127, 0.16), transparent 60%),
        radial-gradient(900px 420px at 88% 0%, rgba(255, 90, 99, 0.12), transparent 60%),
        var(--bg-dark);
    border-color: var(--border-dark);
}

/* The three-colour bridge ribbon, carried over from the logo */
.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--brand-green) 0%, var(--brand-green) 33%,
        var(--brand-navy) 33%, var(--brand-navy) 66%,
        var(--brand-red) 66%, var(--brand-red) 100%);
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    /* The stats column used to be auto, sized purely by its own content
       with no ceiling: fine while every line inside it was short, but the
       moment the note text grew to a full sentence, that one line forced
       the whole column wide on a single line, which stole width from the
       first column (minmax(0, 1fr) can shrink to make room for a sibling
       that grows, which is exactly what minmax(0, ...) is for) and
       collapsed the headline down to one word per line. Capping this
       column's width directly, not just the box inside it, is what
       actually stops a future longer note from doing the same thing
       again, rather than only patching the one width that broke this
       time. */
    grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
    gap: var(--spacing-xl);
    align-items: center;
}

.hero-content { max-width: 640px; margin: 0; text-align: left; }

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 var(--spacing-sm);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Bangladesh green and red, then Spanish red and gold */
.hero-flag {
    width: 34px;
    height: 12px;
    border-radius: 2px;
    background: linear-gradient(90deg,
        var(--brand-green) 0 45%, var(--brand-red) 45% 72%, var(--brand-gold) 72% 100%);
}

.hero h1 {
    font-size: clamp(2rem, 4.4vw, 3.1rem);
    line-height: 1.14;
    letter-spacing: -0.02em;
    margin: 0 0 var(--spacing-sm);
    color: var(--brand-navy);
}

body.dark-mode .hero h1 { color: var(--text-light); }

.hero-bn {
    color: var(--brand-red);
    font-family: 'Noto Sans Bengali', 'Hind Siliguri', 'Nirmala UI', system-ui, sans-serif;
}

body.dark-mode .hero-bn { color: var(--accent-color); }

.hero-sub {
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text-muted);
    margin: 0 0 var(--spacing-lg);
    max-width: 54ch;
}

/* Bangla conjuncts and matras sit taller than Latin letterforms, so the
   Bangla intro gets more line-height. The English line under it is the
   second half of one intro: tighter top margin, a little smaller. */
.hero-sub[lang="bn"] { line-height: 1.8; }
.hero-sub-en {
    margin-top: calc(-1 * var(--spacing-md));
    font-size: 0.95rem;
}
.hero h1[lang="bn"] { line-height: 1.3; letter-spacing: 0; }
.hero-eyebrow[lang="bn"] { text-transform: none; letter-spacing: 0; font-size: 0.9rem; }

body.dark-mode .hero-sub { color: #A9BACB; }

.hero-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
}

.hero-buttons .btn { padding: 0.7rem 1.4rem; font-size: 0.98rem; }

.hero-chips {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.hero-chips-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-right: 0.15rem;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.34rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-dark);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    transition: background-color 0.18s ease, color 0.18s ease,
                border-color 0.18s ease, transform 0.15s ease;
}

body.dark-mode .hero-chip {
    background: var(--bg-dark-soft);
    color: var(--text-light);
    border-color: var(--border-dark);
}

.hero-chip:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
    transform: translateY(-1px);
}

body.dark-mode .hero-chip:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
}

/* --- the at-a-glance panel ---
   A deep navy card that reads the same in light and dark mode: two soft
   glows in the Bangladesh green and Spanish red/gold, a faint dot grid, and
   a thin ribbon of the site's three colours along the top. All decoration
   is CSS backgrounds, so there is nothing extra to download. */

.hero-stats {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-sm);
    padding: calc(var(--spacing-lg) + 4px) var(--spacing-md) var(--spacing-lg);
    max-width: 460px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 18%, rgba(2, 130, 74, 0.55), transparent 55%),
        radial-gradient(circle at 92% 88%, rgba(227, 8, 28, 0.42), transparent 55%),
        radial-gradient(circle at 70% 10%, rgba(249, 171, 13, 0.28), transparent 45%),
        linear-gradient(145deg, #173A63 0%, #0F2C4D 55%, #0A1F38 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: calc(var(--radius-md) + 4px);
    box-shadow: 0 18px 40px rgba(10, 31, 56, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-stats::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1.2px);
    background-size: 14px 14px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
    pointer-events: none;
}

.hero-stats::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}

body.dark-mode .hero-stats {
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero-stat {
    text-align: center;
    padding: var(--spacing-sm) var(--spacing-xs);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(2px);
}

.hero-stat-n {
    display: block;
    font-size: clamp(1.3rem, 1rem + 1.2vw, 1.85rem);
    white-space: nowrap;
    font-weight: 800;
    line-height: 1.1;
    color: #fff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.hero-stat-sep {
    margin: 0 0.15em;
    color: var(--brand-gold);
    font-weight: 600;
}

.hero-stat-l {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.78);
}

.hero .hero-stats .hero-stat-note,
.hero-stat-note {
    grid-column: 1 / -1;
    margin: 0;
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
}

/* --- responsive --- */

@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; gap: var(--spacing-lg); }
    .hero-stats {
        max-width: none;
        padding: calc(var(--spacing-md) + 4px) var(--spacing-md) var(--spacing-md);
    }
}

@media (max-width: 560px) {
    .hero { padding: var(--spacing-lg) var(--spacing-md); }
    .hero-sub { font-size: 0.98rem; }
    /* Full-width buttons: a thumb should not have to aim on a phone. */
    .hero-buttons { flex-direction: column; align-items: stretch; }
    .hero-buttons .btn { width: 100%; }
    .hero-chips-label { width: 100%; margin-bottom: 0.15rem; }
}

/* ================================================================
   SCROLL TO TOP
   ================================================================ */

.to-top {
    position: fixed;
    right: var(--spacing-md);
    bottom: var(--spacing-md);
    z-index: 850;              /* under the notice banner, over the content */
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--brand-navy);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(15, 44, 77, 0.18);

    /* Hidden by default and kept out of hit testing, so it cannot swallow a
       tap meant for whatever sits underneath it. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

body.dark-mode .to-top {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
    color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.to-top:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
    transform: translateY(-2px);
}

body.dark-mode .to-top:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
}

.to-top:active { transform: translateY(0); }

/* The notice banner sits along the bottom on the first visit, so lift the
   button clear of it while that is on screen. */
body:has(#cookieBanner[style*="block"]) .to-top { bottom: calc(var(--spacing-md) + 120px); }

@media (max-width: 560px) {
    .to-top {
        width: 42px;
        height: 42px;
        right: var(--spacing-sm);
        bottom: var(--spacing-sm);
    }
}

@media (prefers-reduced-motion: reduce) {
    .to-top { transition: opacity 0.01ms, visibility 0.01ms; transform: none; }
    .to-top.visible { transform: none; }
    .to-top:hover { transform: none; }
}

@media print { .to-top { display: none !important; } }

/* ================================================================
   READ ALONG

   The highlight has to be visible without being loud: it moves every
   few seconds for ten minutes, so anything strong becomes exhausting.
   A soft background and a left edge, nothing that shifts layout.
   ================================================================ */

.article-body .s {
    border-radius: 3px;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Only offer the pointer while the narration plays: that is the only time
   a tap on a sentence does anything (jump there). */
[data-sentences].is-listening .s { cursor: pointer; }

[data-sentences].is-listening .s:hover {
    background: rgba(249, 171, 13, 0.14);
}

.article-body .s-now {
    background: rgba(249, 171, 13, 0.28);
    box-shadow: -0.35em 0 0 rgba(249, 171, 13, 0.28),
                 0.35em 0 0 rgba(249, 171, 13, 0.28);
}

body.dark-mode .article-body .s-now {
    background: rgba(249, 171, 13, 0.26);
    box-shadow: -0.35em 0 0 rgba(249, 171, 13, 0.26),
                 0.35em 0 0 rgba(249, 171, 13, 0.26);
}

/* Paused keeps the place visible but stops it competing for attention. */
.article-body .s-paused {
    background: rgba(249, 171, 13, 0.14);
    box-shadow: -0.35em 0 0 rgba(249, 171, 13, 0.14),
                 0.35em 0 0 rgba(249, 171, 13, 0.14);
}

.listen-btn.follow { font-size: 0.9rem; opacity: 0.45; }
.listen-btn.follow.is-on { opacity: 1; }

.listen-btn.follow.is-on {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: #fff;
}

body.dark-mode .listen-btn.follow.is-on {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
}

.icon-wait { letter-spacing: 0.1em; }

.listen-hint {
    margin: var(--spacing-xs) 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.listen-credit {
    margin: var(--spacing-xs) 0 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.listen-credit a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
    .article-body .s { transition: none; }
}

@media print {
    .article-body .s-now,
    .article-body .s-paused { background: none; box-shadow: none; }
}

/* ================================================================
   FIGURES

   Diagrams are inlined as SVG rather than linked as images, so they
   inherit the page's colour variables and follow dark mode instead of
   sitting on a white rectangle in a dark article.
   ================================================================ */

.fig {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    overflow-x: auto;
}

body.dark-mode .fig {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

.fig svg {
    display: block;
    width: 100%;
    height: auto;
    /* Below this the labels stop being readable, so allow a sideways
       scroll rather than shrinking the drawing into illegibility. */
    min-width: 520px;
}

.fig figcaption {
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-xs);
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 0;
}

/* Inlined the same way and for the same reason as .fig above (inherits
   page colour variables, follows dark mode), but framed a step lighter
   since this sits inside a question a reader is actively answering,
   not standing alone as its own figure. */
.quiz-scenario-img {
    margin: var(--spacing-sm) 0 var(--spacing-md);
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    overflow-x: auto;
}

body.dark-mode .quiz-scenario-img {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

.quiz-scenario-img svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 420px;
    margin: 0 auto;
}

body.dark-mode .fig figcaption { border-color: var(--border-dark); }

/* Real photographs (images/photos/, credited from photos.json). Unlike the
   inlined SVG figures these are raster images, so they cannot follow dark
   mode; they sit in the same framed card instead, which reads correctly on
   both backgrounds. */
.photo {
    margin: var(--spacing-lg) 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    overflow: hidden;
}

body.dark-mode .photo {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

.photo img {
    display: block;
    width: 100%;
    height: auto;
    /* Portrait photos would otherwise fill more than a screen; shown whole
       (never cropped, since the licence credit is for the full picture) on
       the card's own background instead. */
    max-height: 560px;
    object-fit: contain;
}

.photo figcaption {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.88rem;
}

.photo-caption { display: block; }

.photo-credit {
    display: block;
    margin-top: 2px;
    font-size: 0.74rem;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.photo-credit a { color: inherit; }

.quiz-photo img {
    display: block;
    width: 100%;
    max-width: 520px;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-sm, 6px);
}

/* Official sign images are drawn on white, as on the real plate; kept small
   and on a white tile so they look like a sign rather than a photo, and so
   the white of the sign itself never melts into a dark-mode background. */
.quiz-photo-sign img {
    max-width: 180px;
    background: #fff;
    padding: 10px;
}

/* The credit is small print for the photo, not part of the question:
   tiny, faded and flush with the image's right edge. */
.quiz-photo .photo-credit, .sim-fig .photo-credit {
    max-width: 520px; margin: 3px auto 0; text-align: right;
    font-size: 0.64rem; line-height: 1.3; opacity: 0.7; font-style: normal;
}
.photo-credit a { text-decoration: none; }

/* The signs an answer explanation names, as small official images under it
   (quiz pages and the exam simulator). Same white tile as the sign photos. */
.sign-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.sign-ref {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.sign-ref img {
    width: auto;
    height: 72px;
    max-width: 150px;
    object-fit: contain;
    background: #fff;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.sign-ref figcaption {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
body.dark-mode .sign-ref img { border-color: var(--border-dark); }

.quiz-exam-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    font-size: 0.9rem;
}

body.dark-mode .quiz-exam-bar {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

/* DELE section mocks: a task heading, then the shared text or clip that the
   questions below it are about, printed once like on the exam paper. */
.quiz-task {
    margin: var(--spacing-lg) 0 var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 3px solid var(--secondary-color, #F9AB0D);
}

.quiz-task h2 {
    margin: 0 0 var(--spacing-xs);
    font-size: 1.15rem;
}

.quiz-task p { margin: 0 0 var(--spacing-xs); }

.quiz-passage,
.quiz-audio {
    margin: var(--spacing-sm) 0 var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color, #0F2C4D);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    overflow-wrap: anywhere;
}

.quiz-passage p { margin: 0 0 var(--spacing-xs); }
.quiz-passage p:last-child { margin-bottom: 0; }
.quiz-audio audio { width: 100%; }
.quiz-audio-note { margin: 0 0 var(--spacing-xs); font-size: 0.9rem; }
.quiz-transcript { margin-top: var(--spacing-xs); }
.quiz-transcript summary { cursor: pointer; font-weight: 600; }

body.dark-mode .quiz-passage,
body.dark-mode .quiz-audio {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

/* Matching tasks: the answer is just a letter (the texts are printed above),
   so the letters sit in one compact grid instead of nine full-width rows. */
.quiz-options-letters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
    gap: var(--spacing-xs);
}
.quiz-options-letters .quiz-opt { justify-content: center; font-weight: 800; }
.quiz-options-letters .quiz-opt::before { display: none; }

.quiz-timer {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.quiz-timer.low { color: #E3081C; }

.quiz-verdict {
    font-weight: 700;
    font-size: 1.05rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
}

.quiz-verdict.pass { background: rgba(2, 82, 47, 0.12); color: #02522F; }
.quiz-verdict.fail { background: rgba(227, 8, 28, 0.1); color: #B00617; }
body.dark-mode .quiz-verdict.pass { color: #6FD3A0; }
body.dark-mode .quiz-verdict.fail { color: #FF8A94; }

@media (max-width: 600px) {
    .fig { padding: var(--spacing-sm); }
    .fig figcaption { font-size: 0.8rem; }
}

@media print {
    .fig { break-inside: avoid; border-color: #999; }
}

/* ================================================================
   EXAMS / QUIZZES

   The base HTML already contains every question, option and explanation:
   nothing here is generated by JavaScript, only progressively revealed by
   it. The .js class is added to <html> before first paint (see head() in
   build.mjs); everything gated on ".js ..." below is therefore invisible
   to a crawler, a JS-disabled browser, or the brief instant before main.js
   runs, and all of those instead see a complete, correct study sheet with
   every answer and explanation already on the page.
   ================================================================ */

.quiz-header {
    background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.08));
    padding: var(--spacing-xl) 0;
    margin-bottom: var(--spacing-lg);
}
.quiz-header .container, .quiz-header { padding-left: var(--spacing-md); padding-right: var(--spacing-md); }
.quiz-header h1 { font-size: 2rem; margin: 0 0 var(--spacing-sm); color: var(--brand-navy); }
body.dark-mode .quiz-header h1 { color: var(--text-light); }
.quiz-intro { color: #4b5563; font-size: 1.05rem; margin: 0 0 var(--spacing-md); max-width: 62ch; }
body.dark-mode .quiz-intro { color: #9ca3af; }

.quiz-meta {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.quiz-meta a { color: var(--brand-navy); font-weight: 600; text-decoration: none; }
.quiz-meta a:hover { text-decoration: underline; }
body.dark-mode .quiz-meta a { color: var(--primary-color); }

.quiz-page { max-width: 760px; margin: 0 auto; padding: 0 var(--spacing-md) var(--spacing-xl); }

.quiz-scorebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    gap: 6px;
    align-items: baseline;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    font-weight: 700;
    font-size: 1.05rem;
}
body.dark-mode .quiz-scorebar { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.quiz-score-label { font-weight: 500; color: var(--text-muted); margin-right: 2px; }
.quiz-score-n { color: var(--brand-green); font-size: 1.2rem; }
body.dark-mode .quiz-score-n { color: var(--secondary-color); }

.quiz-q {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}
body.dark-mode .quiz-q { border-color: var(--border-dark); }
/* min-width: 0, or a fieldset refuses to shrink below its content and a
   diagram pushes the whole question past the edge of a phone screen. */
.quiz-q fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.quiz-q legend { padding: 0; font-weight: 700; font-size: 1.05rem; margin-bottom: var(--spacing-md); float: left; width: 100%; }

.quiz-options { display: grid; gap: var(--spacing-sm); clear: both; }

.quiz-opt {
    text-align: left;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
body.dark-mode .quiz-opt { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.quiz-opt:hover { border-color: var(--brand-navy); }
body.dark-mode .quiz-opt:hover { border-color: var(--primary-color); }
.quiz-opt:active { transform: translateY(1px); }

/* Feedback colours only make sense once JS has actually judged an answer;
   without JS every option just stays a plain, clickable-looking button,
   which is also the only sensible fallback state. */
.js .quiz-opt.correct {
    border-color: var(--brand-green);
    background: rgba(2, 82, 47, 0.09);
    font-weight: 700;
}
.js .quiz-opt.incorrect {
    border-color: var(--brand-red);
    background: rgba(227, 8, 28, 0.08);
}
body.dark-mode .quiz-opt.correct { background: rgba(95, 169, 127, 0.18); border-color: var(--secondary-color); }
body.dark-mode .quiz-opt.incorrect { background: rgba(255, 90, 99, 0.15); border-color: var(--accent-color); }

/* Marks which option a reader picked, without saying whether it was right:
   correct/incorrect only get added at reveal() time, when Submit is
   clicked, not here. A neutral navy highlight, not the exam-result colours,
   since this state exists specifically before those are known. */
.js .quiz-opt.selected {
    border-color: var(--brand-navy);
    background: rgba(15, 44, 77, 0.07);
    font-weight: 600;
}
body.dark-mode .js .quiz-opt.selected {
    border-color: var(--primary-color);
    background: rgba(127, 176, 224, 0.14);
}

/* Scoped to .quiz.revealed specifically, not just .quiz-q.answered: an
   answered-but-not-yet-submitted question still needs its other options
   to look and behave genuinely clickable, since a reader can change their
   pick right up until Submit (see answer() in main.js). These dimmed,
   non-interactive styles are for the final, scored state after reveal(),
   not the in-progress one. */
.js .quiz.revealed .quiz-q.answered .quiz-opt:not(.correct):not(.incorrect):not(.selected) { opacity: 0.55; }
.js .quiz.revealed .quiz-q.answered .quiz-opt { cursor: default; }

.quiz-explain {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.95rem;
}
body.dark-mode .quiz-explain { border-color: var(--border-dark); }
.js .quiz-explain { display: none; }
/* Gated on the whole quiz having been submitted, not on the individual
   question having been answered: every explanation appears together at
   Submit, matching how correct/incorrect are revealed together too,
   rather than leaking the answer to a question the moment it is picked. */
.js .quiz.revealed .quiz-explain { display: block; }

.quiz-results {
    border: 2px solid var(--brand-navy);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    margin-top: var(--spacing-lg);
}
body.dark-mode .quiz-results { border-color: var(--primary-color); }
.quiz-results h2 { margin: 0 0 var(--spacing-sm); }
.quiz-final-score { font-size: 2rem; font-weight: 800; color: var(--brand-navy); margin: 0 0 var(--spacing-sm); }
body.dark-mode .quiz-final-score { color: var(--primary-color); }
.quiz-final-msg { color: var(--text-muted); margin: 0 0 var(--spacing-md); }
.quiz-results-actions { display: flex; gap: var(--spacing-sm); flex-wrap: wrap; justify-content: center; }

/* Without JS, "results so far" has no meaning (nothing has been marked),
   and "retake" resets state that JS is the only thing tracking. Both stay
   hidden until scripting is confirmed active. */
.js .quiz-results { display: none; }
.js .quiz-results.visible { display: block; }
.quiz-retake { display: none; }
.js .quiz-retake { display: inline-block; }

.quiz-nav { display: flex; gap: var(--spacing-sm); flex-wrap: wrap; margin-top: var(--spacing-xl); }

/* Hub page cards: the existing .article-item styling, with a gold accent
   instead of the article list's green, so exams read as their own family
   at a glance rather than an unlabelled subset of articles. */
.quiz-item { border-left: 3px solid var(--brand-gold); }
.quiz-item:hover { border-left-color: var(--brand-red); }

/* A prominent, self-contained call to action, dropped into an article page
   automatically when that article has a matching quiz -- see relatedBlock's
   neighbour in build.mjs. Distinct from .related and .tip-box so it reads
   as an invitation to do something, not another paragraph to read. */
.quiz-cta {
    border: 2px dashed var(--brand-gold);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
    text-align: center;
}
.quiz-cta h2 { margin: 0 0 var(--spacing-xs); font-size: 1.2rem; }
.quiz-cta p { margin: 0 0 var(--spacing-md); color: var(--text-muted); }

@media (max-width: 600px) {
    .quiz-header h1 { font-size: 1.5rem; }
    .quiz-q { padding: var(--spacing-sm) var(--spacing-md); }
    .quiz-scorebar { font-size: 0.95rem; }
    .quiz-results-actions { flex-direction: column; }
    .quiz-results-actions .btn { width: 100%; }
}

/* Submit-gated results: answering a question still gives immediate
   correct/incorrect feedback (the whole point of that design), but the
   score summary and the results panel now only appear after an explicit
   click, both so a reader can review their answers before committing, and
   so the view-count endpoint has one unambiguous moment (this click, never
   an automatic trigger) that means "this person actually finished and
   wanted to see how they did" -- the count is supposed to answer, not
   "how many people started this quiz." */
.quiz-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}
body.dark-mode .quiz-submit-row { border-color: var(--border-dark); }
.quiz-progress { margin: 0; color: var(--text-muted); font-weight: 600; }
.quiz-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Without scripting the submit button can never do anything useful (there is
   no JS to compute a score from), but every question's explanation and the
   results panel's default text are already visible regardless -- see the
   .js-gated rules above -- so a disabled button here does not hide content,
   it just correctly says "this specific interaction is not available." */

.quiz-count { color: var(--text-muted); }
.quiz-count:empty { display: none; }

.quiz-results { position: relative; overflow: hidden; }
.quiz-results-h2 { margin: 0 0 var(--spacing-sm); }

/* Confetti: a fixed set of coloured rectangles, positioned and animated
   entirely with CSS custom properties set per-piece by JS (left offset,
   fall duration, rotation, colour), so the animation itself needs no
   per-frame JS at all, only the initial spawn. Removed from the DOM when
   the animation ends rather than left to accumulate across retakes. */
.quiz-celebrate { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.confetti-piece {
    position: absolute;
    top: -20px;
    left: var(--x, 50%);
    width: 8px;
    height: 14px;
    background: var(--c, var(--brand-gold));
    opacity: 0.9;
    animation: confetti-fall var(--dur, 2.2s) ease-in var(--delay, 0s) forwards;
}
@keyframes confetti-fall {
    /* --fall defaults to the small in-panel distance; the fullscreen
       overlay below overrides it to clear the whole viewport instead of
       stopping a third of the way down. */
    to { transform: translateY(var(--fall, 340px)) rotate(var(--rot, 360deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .confetti-piece { animation: none; display: none; }
}

.quiz-results.perfect { border-color: var(--brand-gold); border-width: 3px; }
.quiz-results.perfect .quiz-final-score { color: var(--brand-gold); }
body.dark-mode .quiz-results.perfect .quiz-final-score { color: var(--brand-gold); }

@media (max-width: 600px) {
    .quiz-submit-row { flex-direction: column; align-items: stretch; text-align: center; }
    .quiz-submit-row .btn { width: 100%; }
}

/* ================================================================
   FULLSCREEN CELEBRATION

   A separate, bigger moment from the in-panel confetti above (kept as it
   was, untouched): this covers the entire viewport with position:fixed +
   inset:0, which means "the whole screen" on a phone and "the whole
   window" on desktop without needing any device-specific logic at all --
   the same rule produces the right result on both. Hidden by default and
   shown only by JS adding .visible, so a JS-disabled or reduced-motion
   visitor never sees an overlay they have no way to dismiss with an
   animation they didn't ask for.
   ================================================================ */

.quiz-fs-celebrate {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(circle at 50% 40%, rgba(90,60,10,0.97), rgba(15,44,77,0.99) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.quiz-fs-celebrate.visible { display: flex; opacity: 1; }
.quiz-fs-celebrate.closing { opacity: 0; }

.quiz-fs-confetti { position: absolute; inset: 0; pointer-events: none; }
.quiz-fs-confetti .confetti-piece {
    width: 12px;
    height: 20px;
    top: -30px;
    --fall: 120vh;
}

.quiz-fs-message {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: var(--spacing-lg);
    transform: scale(0.7);
    opacity: 0;
    animation: quizFsPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s forwards;
}
.quiz-fs-emoji { font-size: 4rem; display: block; margin-bottom: var(--spacing-sm); }
.quiz-fs-message h2 {
    font-size: 3rem;
    margin: 0 0 var(--spacing-sm);
    color: var(--brand-gold);
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.quiz-fs-message p { font-size: 1.2rem; margin: 0; color: #fff; }

@keyframes quizFsPop {
    to { transform: scale(1); opacity: 1; }
}

.quiz-fs-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}
.quiz-fs-close:hover { background: rgba(255,255,255,0.25); }

@media (prefers-reduced-motion: reduce) {
    .quiz-fs-message { animation: none; transform: none; opacity: 1; }
    .quiz-fs-confetti { display: none; }
    .quiz-fs-celebrate { transition: none; }
}

@media (max-width: 480px) {
    .quiz-fs-emoji { font-size: 3rem; }
    .quiz-fs-message h2 { font-size: 2rem; }
    .quiz-fs-message p { font-size: 1rem; }
}

/* ================================================================
   QUIZ SERIES: exams hub compact block + article-page pill CTA

   A category with a long numbered series mixed in with standalone quizzes
   used to render every quiz as an identical full-width card, which gets
   repetitive fast once one series alone reaches a dozen entries. These
   rules give a series (grouped by build.mjs, above a size threshold) one
   compact block instead: a single description plus small numbered links,
   so twelve quizzes cost a few lines of layout, not twelve full cards.
   ================================================================ */

.exams-summary {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

.quiz-series-block {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-green);
    border-radius: var(--radius-md);
}
body.dark-mode .quiz-series-block {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
    border-left-color: var(--brand-green);
}
.quiz-series-block h3 { margin: 0 0 var(--spacing-xs); }
.quiz-series-desc { color: var(--text-muted); margin: 0 0 var(--spacing-xs); }
.quiz-series-stats { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 var(--spacing-md); }

.quiz-series-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.quiz-series-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    color: var(--text-dark);
    background: var(--bg-tint);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.quiz-series-item:hover {
    background: var(--brand-green);
    color: #fff;
    border-color: var(--brand-green);
    transform: translateY(-1px);
}
body.dark-mode .quiz-series-item {
    color: var(--text-light);
    background: rgba(255,255,255,0.05);
    border-color: var(--border-dark);
}

/* The article-side CTA equivalent: same pill shape, smaller block, used
   when a series is what quizCta() finds instead of one standalone quiz. */
.quiz-cta-series .quiz-cta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: var(--spacing-sm);
}
.quiz-cta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 0.45rem;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text-dark);
    background: var(--bg-tint);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.quiz-cta-pill:hover { background: var(--brand-gold); color: var(--text-dark); border-color: var(--brand-gold); transform: translateY(-1px); }
body.dark-mode .quiz-cta-pill {
    color: var(--text-light);
    background: rgba(255,255,255,0.05);
    border-color: var(--border-dark);
}

@media (max-width: 600px) {
    .quiz-series-item, .quiz-cta-pill { min-width: 2.1rem; height: 2.1rem; font-size: 0.85rem; }
}

/* ================================================================
   HERO STAT: LIVE VISIT COUNTER

   A small animated SVG sits behind just the visits number, distinguishing
   the one live, updating stat from the two static ones (guides, topics)
   beside it: radiating pings from a centre point out to four corner
   nodes, suggesting the count reaching out and connecting to sources
   rather than just being a static figure. Kept behind the number at low
   opacity throughout, so the number stays the actual focal point.
   ================================================================ */

.hero-stat-live {
    position: relative;
    z-index: 0;
}

.hero-stat-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    max-width: 130px;
    z-index: -1;
    overflow: visible;
    pointer-events: none;
}

.hero-stat-bg .hsb-line {
    stroke: var(--brand-gold);
    stroke-width: 0.6;
    opacity: 0.22;
    animation: hsbLineFlow 3.2s ease-in-out infinite;
}
.hero-stat-bg .hsb-line-2 { animation-delay: 0.5s; }
.hero-stat-bg .hsb-line-3 { animation-delay: 1s; }
.hero-stat-bg .hsb-line-4 { animation-delay: 1.5s; }

.hero-stat-bg .hsb-node {
    fill: var(--brand-gold);
    opacity: 0.35;
    animation: hsbNodePulse 3.2s ease-in-out infinite;
}
.hero-stat-bg .hsb-node-2 { animation-delay: 0.5s; }
.hero-stat-bg .hsb-node-3 { animation-delay: 1s; }
.hero-stat-bg .hsb-node-4 { animation-delay: 1.5s; }

.hero-stat-bg .hsb-ping {
    fill: none;
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 0.6;
    opacity: 0;
    transform-origin: 60px 35px;
    animation: hsbPing 2.4s ease-out infinite;
}

.hero-stat-bg .hsb-ping-2 { animation-delay: 0.8s; }
/* The visitors cell uses the green instead of the gold, so the two live
   cells read as two different numbers at a glance. */
.hero-stat-bg-alt .hsb-line,
.hero-stat-bg-alt .hsb-node { stroke: #3ddc97; fill: #3ddc97; }
.hero-stat-bg-alt .hsb-line { fill: none; }
.hero-stat-bg .hsb-ping-3 { animation-delay: 1.6s; }

@keyframes hsbPing {
    0%   { transform: scale(0.3); opacity: 0.5; }
    100% { transform: scale(9); opacity: 0; }
}
@keyframes hsbLineFlow {
    0%, 100% { opacity: 0.12; }
    50%      { opacity: 0.32; }
}
@keyframes hsbNodePulse {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(1.3); }
}

@media (prefers-reduced-motion: reduce) {
    .hero-stat-bg .hsb-ping,
    .hero-stat-bg .hsb-line,
    .hero-stat-bg .hsb-node {
        animation: none;
        opacity: 0.2;
    }
}

/* ================================================================
   QUIZ COMPLETION: per-browser "already done" indicators

   Two pieces. The prior-completion banner (quiz-prior-banner) appears at
   the top of a quiz page this browser has already finished before, with
   the previous score. The .quiz-link-done class (added by
   QuizCompletionBadges in main.js) marks a completed quiz wherever a link
   to it appears elsewhere: a small checkmark badge, styled differently
   for the small square pills (series blocks, article CTAs) than for the
   larger rectangular cards (exams hub standalone list), since a badge
   sized for one looks wrong on the other.
   ================================================================ */

.quiz-prior-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    padding: 0.65rem var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: var(--bg-tint);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--brand-green);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-dark);
}
body.dark-mode .quiz-prior-banner {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
    border-left-color: var(--brand-green);
    color: var(--text-light);
}
.quiz-prior-banner-close {
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    border-radius: var(--radius-sm);
}
.quiz-prior-banner-close:hover { opacity: 1; background: rgba(0,0,0,0.06); }
body.dark-mode .quiz-prior-banner-close:hover { background: rgba(255,255,255,0.08); }

/* Small pills: series blocks on the exams hub, and the article-side quiz
   CTA when it renders as a series. A tiny green checkmark badge in the
   top-right corner, overlapping the pill slightly rather than squeezing
   the number to make room, since these pills are already small. */
.quiz-series-item.quiz-link-done,
.quiz-cta-pill.quiz-link-done {
    position: relative;
}
.quiz-series-item.quiz-link-done::after,
.quiz-cta-pill.quiz-link-done::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 1.05rem;
    height: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    background: var(--brand-green);
    border: 2px solid var(--bg-light);
    border-radius: 50%;
    line-height: 1;
}
body.dark-mode .quiz-series-item.quiz-link-done::after,
body.dark-mode .quiz-cta-pill.quiz-link-done::after {
    border-color: var(--bg-dark);
}

/* Standalone cards on the exams hub: a small labelled badge in the
   top-right corner of the card, since there is room for the word itself
   here rather than just a checkmark. */
.article-item.quiz-item.quiz-link-done {
    position: relative;
}
.article-item.quiz-item.quiz-link-done::after {
    content: '✓ সম্পন্ন';
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: var(--brand-green);
    border-radius: 999px;
    line-height: 1.4;
}

/* ================================================================
   EXAMS HUB: quick-access TOC, subsection headings, quiz numbering

   The TOC exists specifically because the page grew past the point of
   being reasonably scannable by scrolling: several categories, one of
   them a 12-part series, others now split into named subsections. One
   block at the top, one line per category, each linking straight to
   that category's heading further down.

   Subsection headings (Permiso B, A1) sit one level below the category
   heading and above individual quiz cards, which is why quiz card
   titles inside a subsection are h4 rather than h3 elsewhere on this
   page (see .article-item h4 above): the heading levels need to nest
   correctly, category > subsection > card, not repeat a level.
   ================================================================ */

.exams-toc {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}
body.dark-mode .exams-toc {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}
.exams-toc h2 { margin: 0 0 var(--spacing-md); font-size: 1.1rem; }
.exams-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--spacing-sm); }
.exams-toc li {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tint);
    border-radius: var(--radius-sm);
}
body.dark-mode .exams-toc li { background: rgba(255,255,255,0.04); }
.exams-toc a { font-weight: 700; text-decoration: none; }
.exams-toc a:hover { text-decoration: underline; }
.exams-toc-desc {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quiz-subsection-heading { margin-top: var(--spacing-lg); font-size: 1.15rem; }
.quiz-subsection-stats { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 var(--spacing-md); }

.quiz-number {
    display: inline-block;
    color: var(--brand-green);
    font-weight: 800;
}
body.dark-mode .quiz-number { color: var(--brand-gold); }

/* ================================================================
   LEARNING PATH (category pages where every article has pathOrder)

   A vertical timeline rather than the flat list every other category
   uses: read in sequence, not browsed. Three states per step, filled in
   client-side by LearningPath in main.js from localStorage (the same
   per-browser pattern already used for quiz completion): done (a step
   this browser has visited before), next (the first not-yet-visited
   step, the one the reader should actually click), and the plain
   default for everything further down the path. Every step stays a
   real, clickable link regardless of state -- nothing is locked, since
   this is a reference site a reader can jump around in, not a course
   platform that gates progress.
   ================================================================ */

.learning-path-intro {
    max-width: 65ch;
    margin: 0 0 var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tint);
    border-left: 3px solid var(--brand-gold);
    border-radius: var(--radius-sm);
    line-height: 1.7;
}
body.dark-mode .learning-path-intro { background: rgba(255,255,255,0.04); }

.learning-path-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

/* The connecting line: one continuous element behind every step rather
   than a border on each list item, so it reads as a single path rather
   than a stack of separately-bordered boxes. */
.learning-path-steps::before {
    content: '';
    position: absolute;
    top: 28px;
    bottom: 28px;
    left: 27px;
    width: 2px;
    background: var(--border-color);
}
body.dark-mode .learning-path-steps::before { background: var(--border-dark); }

.path-step { position: relative; margin-bottom: var(--spacing-md); }

.path-step a {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
body.dark-mode .path-step a { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.path-step a:hover { box-shadow: 0 8px 20px rgba(15, 44, 77, 0.1); transform: translateY(-2px); }
body.dark-mode .path-step a:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.3); }

.path-step-number {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tint);
    border: 2px solid var(--border-color);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-dark);
    position: relative;
    z-index: 1;
}
body.dark-mode .path-step-number {
    background: var(--bg-dark);
    border-color: var(--border-dark);
    color: var(--text-light);
}

.path-step-title {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}
.path-step-desc {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Done: the number circle becomes a green checkmark, the card itself
   very slightly muted so the eye naturally moves past it toward
   whatever comes next, without hiding or graying out the text to the
   point of being hard to read. */
.path-step.done .path-step-number {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: #fff;
}
.path-step.done a { opacity: 0.75; }

/* Next: the one step actually highlighted, since this is the answer to
   "which one should I read now" the feature exists to give. */
.path-step.next a {
    border-color: var(--brand-gold);
    border-width: 2px;
    box-shadow: 0 4px 16px rgba(249, 171, 13, 0.2);
}
.path-step.next .path-step-number {
    background: var(--brand-gold);
    border-color: var(--brand-gold);
    color: var(--text-dark);
}
.path-step.next .path-step-title::after {
    content: 'পড়ুন এখন';
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-dark);
    background: var(--brand-gold);
    border-radius: 999px;
    vertical-align: middle;
}

@media (max-width: 480px) {
    .path-step a { padding: var(--spacing-sm); gap: var(--spacing-sm); }
    .path-step-number { width: 34px; height: 34px; font-size: 0.95rem; }
    .learning-path-steps::before { left: 24px; }
    .path-step-title { font-size: 0.95rem; }
    .path-step-desc { font-size: 0.83rem; }
}

/* ================================================================
   HERO LAYOUT (v1.91)

   Desktop: the text column on the left, and on the right a column that
   holds the stats card and the "Most looked up" card, so the two sides
   are of similar height instead of a small card floating in white space.
   Tablet: one column, with the two cards side by side underneath.
   Phone: one column throughout, buttons side by side, cards full width.
   Placed last so it settles the older hero rules above, including the
   original centred .hero-buttons that kept winning on wide screens.
   ================================================================ */

.hero-inner {
    /* Same content edge as the header and the sections below (.container is
       1200px with a spacing-md gutter; .hero already supplies the gutter). */
    max-width: calc(1200px - 2 * var(--spacing-md));
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
}

.hero-content { max-width: 620px; }

.hero-buttons {
    justify-content: flex-start;
    margin-bottom: 0;
}

.hero-side {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    min-width: 0;
}

.hero-side .hero-stats { max-width: none; width: 100%; }

/* The two live counts: hidden without JavaScript and when the Worker cannot
   be reached (VisitCounter sets .stats-off), a soft shimmer while loading. */
html:not(.js) .hero-stat-live,
.hero-stats.stats-off .hero-stat-live { display: none; }
.hero-stat-n:empty::before {
    content: "";
    width: 3.2em;
    height: 0.9em;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.10), rgba(255,255,255,0.28), rgba(255,255,255,0.10));
    background-size: 200% 100%;
    animation: stat-shimmer 1.4s linear infinite;
}
@keyframes stat-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .hero-stat-n:empty::before { animation: none; } }

.hero-stat-l { white-space: nowrap; }

/* Numbers that fit their cell. Each cell is a size container; the panel
   carries --stat-len, the character count of its longest number (set by
   fitHeroStats in main.js), and the font size is the cell width shared
   out over that many characters, between 1rem and 2rem. A fixed-height
   row keeps the labels lined up while totals load or grow. */
.hero-stat {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.hero-stat-n {
    --stat-fit: calc(100cqi / (var(--stat-len, 5) * 0.64 + 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 2.3rem;
    font-size: clamp(1rem, var(--stat-fit), 2rem);
    letter-spacing: -0.01em;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

.hero-popular {
    padding: var(--spacing-md);
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-color);
    border-radius: calc(var(--radius-md) + 4px);
    box-shadow: 0 8px 24px rgba(15, 44, 77, 0.06);
}

body.dark-mode .hero-popular {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
    box-shadow: none;
}

.hero .hero-popular-label {
    margin: 0 0 0.3rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Most read: a numbered list of five guides, title clamped to two lines,
   the topic under it. */
.most-read {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: mr;
}
.most-read li { counter-increment: mr; }
.most-read li + li { border-top: 1px solid var(--border-color); }
body.dark-mode .most-read li + li { border-color: var(--border-dark); }
.most-read a {
    display: grid;
    grid-template-columns: 1.6rem 1fr;
    column-gap: 0.5rem;
    padding: 0.55rem 0.15rem;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
}
.most-read a::before {
    content: counter(mr);
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--brand-red);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.dark-mode .most-read a::before { color: var(--accent-color); }
.most-read a:hover .mr-title, .most-read a:focus-visible .mr-title { text-decoration: underline; }
.mr-title {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mr-cat { font-size: 0.75rem; color: var(--text-muted); }

@media (max-width: 960px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-content { max-width: 720px; }
    .hero-side {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .hero { padding: var(--spacing-lg) var(--spacing-md) calc(var(--spacing-lg) + 4px); }
    .hero-eyebrow { font-size: 0.72rem; letter-spacing: 0.05em; }
    .hero-sub-en { margin-top: calc(-1 * var(--spacing-sm)); }
    .hero-side { display: flex; }
    .hero-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-sm);
    }
    .hero-buttons .btn { width: 100%; padding: 0.7rem 0.5rem; text-align: center; }
    .hero-stat { padding: var(--spacing-sm) 2px; }
    .hero-stat-l { font-size: 0.78rem; }
    .hero-stat-note { font-size: 0.8rem; }
}

@media (max-width: 360px) {
    .hero-buttons { grid-template-columns: 1fr; }
    .hero-stat-l { font-size: 0.7rem; }
}

/* ---- Latest Articles: a picked six, plus a way to everything else ---- */

.latest-grid .article-card[hidden] { display: none; }

.latest-more {
    margin: var(--spacing-lg) 0 0;
    text-align: center;
}

.article-meta time { white-space: nowrap; }

/* ---- Cookie notice: one compact strip, never a third of a phone ---- */

.cookie-banner { padding: 0.9rem var(--spacing-md); }
.cookie-notice { font-size: 0.9rem; line-height: 1.5; }

@media (max-width: 768px) {
    .cookie-banner { padding: 0.75rem var(--spacing-md); }
    .cookie-content {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: var(--spacing-sm);
    }
    .cookie-notice { min-width: 0; font-size: 0.82rem; line-height: 1.45; }
    .cookie-actions { width: auto; flex: none; }
    .cookie-actions button { width: auto; padding: 0.55rem 0.9rem; }
}

/* ---- Hero search box ---- */

.hero-search {
    display: flex;
    gap: var(--spacing-xs, 0.4rem);
    max-width: 520px;
    margin: 0 0 var(--spacing-md);
    padding: 0.35rem;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(15, 44, 77, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-search:focus-within {
    border-color: var(--brand-navy);
    box-shadow: 0 6px 24px rgba(15, 44, 77, 0.16);
}

body.dark-mode .hero-search {
    background: var(--bg-dark-soft);
    border-color: var(--border-dark);
}

.hero-search input {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.9rem;
    font: inherit;
    font-size: 1rem;      /* 16px: stops iOS zooming in on focus */
    color: inherit;
    background: transparent;
    border: 0;
    outline: none;
}

.hero-search input:focus-visible { outline: none; }

.hero-search .btn,
.hero-search button.btn {
    flex: none;
    width: auto;           /* beats the old phone rule .btn { width: 100% } */
    border-radius: 999px;
    padding: 0.6rem 1.3rem;
}

@media (max-width: 640px) {
    .hero-search { max-width: none; }
    .hero-search .btn { padding: 0.6rem 1rem; }
}

/* ---- Browse by Category: colour-coded cards (v1.95) ----
   Each topic gets its own accent (--cat), used for the icon tile, the
   Bangla name, the article-count pill, the arrow and a soft glow in the
   corner. The top bar grows across on hover and the arrow fills in, so
   the whole card reads as one thing to tap. */

.category-card[data-cat="documents"]        { --cat: #2563eb; }
.category-card[data-cat="living-in-spain"]  { --cat: #16a34a; }
.category-card[data-cat="work"]             { --cat: #b45309; }
.category-card[data-cat="health"]           { --cat: #e11d48; }
.category-card[data-cat="family"]           { --cat: #ea580c; }
.category-card[data-cat="immigration"]      { --cat: #7c3aed; }
.category-card[data-cat="transport"]        { --cat: #0891b2; }
.category-card[data-cat="citizenship"]      { --cat: #ca8a04; }
.category-card[data-cat="digital-services"] { --cat: #4f46e5; }
.category-card[data-cat="learning-spanish"] { --cat: #db2777; }

.category-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--spacing-md);
}

.category-card {
    --cat: var(--brand-navy);
    --cat-ink: color-mix(in srgb, var(--cat) 78%, #000);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    text-align: left;
    padding: 1.35rem 1.25rem 1rem;
    border: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-radius: 18px;
    background:
        linear-gradient(160deg, color-mix(in srgb, var(--cat) 8%, var(--bg-light)) 0%, var(--bg-light) 60%);
    box-shadow: 0 1px 2px rgba(15, 44, 77, 0.05), 0 6px 18px rgba(15, 44, 77, 0.05);
}

.category-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cat), color-mix(in srgb, var(--cat) 35%, #fff));
    transform: scaleX(0.22);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.category-card::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: -60px;
    right: -60px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--cat) 20%, transparent) 0%, transparent 70%);
    transition: transform 0.45s ease;
}

.category-card:hover,
.category-card:focus-visible {
    border-color: color-mix(in srgb, var(--cat) 45%, var(--border-color));
    border-top-color: color-mix(in srgb, var(--cat) 45%, var(--border-color));
    box-shadow: 0 16px 34px color-mix(in srgb, var(--cat) 20%, transparent);
}

.category-card:hover::before,
.category-card:focus-visible::before { transform: scaleX(1); }
.category-card:hover::after { transform: scale(1.4); }

.category-card:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--cat) 60%, transparent);
    outline-offset: 3px;
}

.category-top {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.category-card .category-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0;
    font-size: 1.85rem;
    line-height: 1;
    border-radius: 16px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--cat) 20%, #fff), color-mix(in srgb, var(--cat) 8%, #fff));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat) 25%, transparent),
                0 6px 14px color-mix(in srgb, var(--cat) 18%, transparent);
}

.js .category-card.in-view:hover .category-icon,
.category-card:hover .category-icon { transform: rotate(-6deg) scale(1.08); }

.category-names { min-width: 0; }

.category-card h3 {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.3;
    color: var(--text-dark);
}

.category-bn {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--cat-ink);
}

.category-card p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.category-foot {
    margin-top: auto;
    padding-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-top: 1px dashed color-mix(in srgb, var(--cat) 28%, var(--border-color));
}

.category-card .category-count {
    margin: 0;
    padding: 0.22rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--cat-ink);
    background: color-mix(in srgb, var(--cat) 11%, transparent);
    border-radius: 999px;
}

.category-go {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--cat-ink);
    background: color-mix(in srgb, var(--cat) 12%, transparent);
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.category-card:hover .category-go,
.category-card:focus-visible .category-go {
    color: #fff;
    background: var(--cat);
    transform: translateX(4px);
}

body.dark-mode .category-card {
    --cat-ink: color-mix(in srgb, var(--cat) 55%, #fff);
    border-color: var(--border-dark);
    background:
        linear-gradient(160deg, color-mix(in srgb, var(--cat) 16%, var(--bg-dark-soft)) 0%, var(--bg-dark-soft) 60%);
    box-shadow: none;
}

body.dark-mode .category-card:hover {
    border-color: color-mix(in srgb, var(--cat) 55%, var(--border-dark));
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

body.dark-mode .category-card h3 { color: var(--text-light); }
body.dark-mode .category-card p { color: #9fb0c2; }

body.dark-mode .category-card .category-icon {
    background: linear-gradient(145deg, color-mix(in srgb, var(--cat) 34%, var(--bg-dark-soft)), color-mix(in srgb, var(--cat) 14%, var(--bg-dark-soft)));
}

body.dark-mode .category-card .category-count,
body.dark-mode .category-go { background: color-mix(in srgb, var(--cat) 22%, transparent); }

/* Two tiles side by side on a phone: icon on top, names, then the count
   and arrow; the blurb stays hidden as before (it made tiles uneven). */
@media (max-width: 480px) {
    .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--spacing-sm); }
    .category-card { padding: 0.95rem 0.8rem 0.7rem; gap: 0.5rem; border-radius: 16px; }
    .category-top { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
    .category-card .category-icon { width: 44px; height: 44px; font-size: 1.45rem; border-radius: 13px; }
    .category-card h3 { font-size: 0.9rem; line-height: 1.25; }
    .category-bn { font-size: 0.84rem; }
    .category-foot { padding-top: 0.5rem; }
    .category-card .category-count { font-size: 0.68rem; padding: 0.18rem 0.5rem; }
    .category-go { width: 28px; height: 28px; }
    .category-go svg { width: 15px; height: 15px; }
}

.category-card .category-count { white-space: nowrap; }

/* Ten topics: on a wide screen five tiles a row (two even rows) with the
   icon above the names, instead of four a row and two left over. */
@media (min-width: 1100px) {
    .category-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .category-top { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .category-card { padding: 1.25rem 1.1rem 0.95rem; }
}

/* ================================================================
   PERMISO B EXAM SIMULATOR (exams/dgt-examen.html) AND BANGLA HELP
   ================================================================ */

.sim-page { max-width: 820px; margin: 0 auto; padding: var(--spacing-md) var(--spacing-md) var(--spacing-xl); }
.sim { scroll-margin-top: 80px; }

.sim-hero {
    position: relative;
    overflow: hidden;
    padding: calc(var(--spacing-lg) + 4px) var(--spacing-lg) var(--spacing-lg);
    color: #fff;
    border-radius: 18px;
    background:
        radial-gradient(circle at 10% 15%, rgba(2, 130, 74, 0.5), transparent 55%),
        radial-gradient(circle at 95% 90%, rgba(227, 8, 28, 0.38), transparent 55%),
        linear-gradient(145deg, #173A63 0%, #0F2C4D 55%, #0A1F38 100%);
    box-shadow: 0 16px 36px rgba(10, 31, 56, 0.3);
}
.sim-hero::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}
.sim-kicker { margin: 0 0 0.3rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-gold); }
.sim-hero h1 { margin: 0 0 0.75rem; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); color: #fff; }
.sim-rules { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.9rem; }
.sim-rules span {
    padding: 0.3rem 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.sim-bn { margin: 0; font-size: 0.95rem; line-height: 1.7; color: rgba(255, 255, 255, 0.86); }

.sim-form { display: grid; gap: var(--spacing-md); margin-top: var(--spacing-lg); }
.sim-modes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-sm); margin: 0; padding: 0; border: 0; }
.sim-modes legend, .sim-field > span { margin-bottom: 0.4rem; font-weight: 700; font-size: 0.9rem; color: var(--text-muted); }
.sim-mode { position: relative; display: block; cursor: pointer; }
.sim-mode input { position: absolute; opacity: 0; pointer-events: none; }
.sim-mode-box {
    display: grid;
    gap: 0.25rem;
    height: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-light);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.sim-mode-box strong { font-size: 1.05rem; }
.sim-mode-box small { font-size: 0.85rem; line-height: 1.5; color: var(--text-muted); }
.sim-mode input:checked + .sim-mode-box { border-color: var(--brand-green); box-shadow: 0 0 0 3px rgba(2, 82, 47, 0.12); }
.sim-mode input:focus-visible + .sim-mode-box { outline: 3px solid var(--brand-gold); outline-offset: 2px; }

.sim-field { display: grid; }
.sim-field select {
    width: 100%;
    padding: 0.7rem 0.8rem;
    font: inherit;
    color: inherit;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-light);
}

.sim-switch { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 600; width: fit-content; }
.sim-switch input { position: absolute; opacity: 0; pointer-events: none; }
.sim-switch-ui {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--border-color);
    transition: background 0.2s;
}
.sim-switch-ui::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}
.sim-switch input:checked + .sim-switch-ui { background: var(--brand-green); }
.sim-switch input:checked + .sim-switch-ui::after { transform: translateX(20px); }
.sim-switch input:focus-visible + .sim-switch-ui { outline: 3px solid var(--brand-gold); outline-offset: 2px; }
.sim-form.is-exam .sim-switch { opacity: 0.45; cursor: not-allowed; }
.sim-note { margin: -0.6rem 0 0; font-size: 0.85rem; line-height: 1.6; color: var(--text-muted); }
.sim-go { justify-self: start; min-width: 200px; font-size: 1.05rem; }
.sim-msg { margin: 0; min-height: 1.4em; font-weight: 600; color: var(--brand-red); }

.sim-history { margin-top: var(--spacing-lg); padding: var(--spacing-md); border: 1px solid var(--border-color); border-radius: 14px; }
.sim-history h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.sim-history .sim-note { margin: 0; }
.sim-history-list { list-style: none; margin: 0 0 0.6rem; padding: 0; display: grid; gap: 0.35rem; }
.sim-history-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.sim-h-when { min-width: 4.5rem; color: var(--text-muted); }
.sim-h-what { flex: 1; min-width: 10rem; }
.sim-h-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-h-verdict { padding: 0.1rem 0.5rem; font-size: 0.75rem; font-weight: 800; border-radius: 999px; color: #fff; }
.sim-history-list li.ok .sim-h-verdict { background: var(--brand-green); }
.sim-history-list li.ko .sim-h-verdict { background: var(--brand-red); }

/* --- the exam --- */
.sim-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    padding: 0.6rem 0.8rem;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #173A63, #0F2C4D);
}
.sim-tag { padding: 0.15rem 0.6rem; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; border-radius: 999px; background: var(--brand-gold); color: #0F2C4D; }
.sim-counter { font-weight: 600; font-variant-numeric: tabular-nums; }
.sim-timer { margin-left: auto; font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.sim-timer.is-low { color: #FFB3B8; animation: sim-pulse 1s ease-in-out infinite alternate; }
@keyframes sim-pulse { to { opacity: 0.55; } }
.sim-bar .sim-finish { width: auto; padding: 0.45rem 0.9rem; background: var(--brand-gold); color: #0F2C4D; border-color: var(--brand-gold); }

.sim-card {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-light);
    box-shadow: 0 6px 20px rgba(15, 44, 77, 0.06);
}
.sim-qnum { margin: 0 0 0.3rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.sim-q { margin: 0 0 var(--spacing-sm); font-size: 1.15rem; font-weight: 600; line-height: 1.55; }

.sim-fig { margin: 0 0 var(--spacing-sm); text-align: center; }
/* In the question card the picture slot has one fixed height, picture or
   not, so the answers always start at the same place. */
.sim { --sim-fig-h: 300px; }
.sim-card .sim-q { min-height: calc(1.55em * 3); }
.sim-card .sim-fig { height: var(--sim-fig-h); display: flex; flex-direction: column; justify-content: center; }
.sim-card .sim-fig img { max-height: calc(var(--sim-fig-h) - 18px); width: auto; max-width: 100%; }
.sim-card .sim-fig.is-sign img { max-height: calc(var(--sim-fig-h) - 40px); }
.sim-card .sim-fig.is-svg svg { max-height: var(--sim-fig-h); }
@media (max-width: 560px) { .sim { --sim-fig-h: 210px; } }
@media (max-height: 500px) and (orientation: landscape) { .sim { --sim-fig-h: 160px; } }

/* Quiz pages: pictures get the same height limit (tap one for full screen),
   so a question with a picture is not three screens tall and the Next
   button can keep one place. */
.quiz { --q-fig-h: 320px; }
.quiz .quiz-scenario-img {
    height: var(--q-fig-h); display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.quiz .quiz-scenario-img img, .quiz .quiz-scenario-img svg {
    max-height: calc(var(--q-fig-h) - 22px); width: auto; max-width: 100%; min-height: 0; flex: 0 1 auto;
}
.quiz .quiz-scenario-img svg { height: 100%; }
.quiz .quiz-photo-sign img { max-height: calc(var(--q-fig-h) - 60px); }
.quiz .quiz-scenario-img .photo-credit { width: 100%; }
@media (max-width: 560px) { .quiz { --q-fig-h: 220px; } }
@media (max-height: 500px) and (orientation: landscape) { .quiz { --q-fig-h: 170px; } }
@media (max-width: 560px) { .sim-card .sim-q { min-height: calc(1.55em * 4); } }
.sim-fig img { display: block; width: 100%; max-width: 520px; max-height: 340px; object-fit: contain; height: auto; margin: 0 auto; border-radius: 10px; }
.sim-fig.is-sign img { max-width: 190px; padding: 10px; background: #fff; }
.sim-fig.is-svg svg { width: 100%; max-width: 520px; height: auto; }
.sim-fig.is-small img, .sim-fig.is-small.is-svg svg { max-width: 260px; max-height: 180px; }
.sim-fig.is-small.is-sign img { max-width: 110px; }

.sim-opts { display: grid; gap: 0.6rem; }
.sim-opt {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.8rem 0.9rem;
    font: inherit;
    font-size: 1rem;
    line-height: 1.45;
    text-align: left;
    color: inherit;
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-light);
    transition: border-color 0.15s, background 0.15s;
}
.sim-opt:hover:not(:disabled) { border-color: var(--brand-navy); }
.sim-opt:disabled { cursor: default; color: inherit; opacity: 1; }
.sim-letter {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    font-weight: 800;
    font-size: 0.9rem;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.8;
}
.sim-opt.is-chosen { border-color: var(--brand-navy); background: rgba(15, 44, 77, 0.07); }
.sim-opt.is-chosen .sim-letter { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; opacity: 1; }
.sim-opt.is-right { border-color: var(--brand-green); background: rgba(2, 82, 47, 0.09); }
.sim-opt.is-right .sim-letter { background: var(--brand-green); border-color: var(--brand-green); color: #fff; opacity: 1; }
.sim-opt.is-wrong { border-color: var(--brand-red); background: rgba(227, 8, 28, 0.07); }
.sim-opt.is-wrong .sim-letter { background: var(--brand-red); border-color: var(--brand-red); color: #fff; opacity: 1; }

.sim-feedback { margin-top: var(--spacing-sm); padding: var(--spacing-sm) var(--spacing-md); border-radius: 12px; border-left: 4px solid; }
.sim-feedback.ok { border-color: var(--brand-green); background: rgba(2, 82, 47, 0.07); }
.sim-feedback.ko { border-color: var(--brand-red); background: rgba(227, 8, 28, 0.06); }
.sim-verdict { margin: 0 0 0.4rem; font-weight: 800; }
.sim-explain { margin: 0 0 0.4rem; line-height: 1.75; }
.sim-lesson { font-weight: 600; font-size: 0.92rem; }

.sim-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: var(--spacing-sm); }
.sim-nav .btn { width: auto; }
.sim-flag {
    padding: 0.5rem 0.8rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
    border: 2px dashed var(--border-color);
    border-radius: 999px;
    background: transparent;
}
.sim-flag[aria-pressed="true"] { border-style: solid; border-color: var(--brand-gold); background: rgba(249, 171, 13, 0.15); }

.sim-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.35rem; margin-top: var(--spacing-md); }
.sim-cell {
    position: relative;
    padding: 0.45rem 0;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: inherit;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
}
.sim-cell.is-answered { background: rgba(15, 44, 77, 0.12); border-color: rgba(15, 44, 77, 0.3); }
.sim-cell.is-right { background: rgba(2, 82, 47, 0.16); border-color: var(--brand-green); }
.sim-cell.is-wrong { background: rgba(227, 8, 28, 0.13); border-color: var(--brand-red); }
.sim-cell.is-current { outline: 3px solid var(--brand-gold); outline-offset: 1px; }
.sim-cell.is-flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-gold); }

.sim-confirm {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    border: 2px solid var(--brand-gold);
    border-radius: 14px;
    background: rgba(249, 171, 13, 0.08);
}
.sim-confirm p { margin: 0 0 0.75rem; font-weight: 600; }
.sim-confirm-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sim-confirm-actions .btn, .sim-res-actions .btn { width: auto; }

/* --- result and review --- */
.sim-res-head { padding: var(--spacing-lg); text-align: center; color: #fff; border-radius: 18px; }
.sim-res-head.is-pass { background: linear-gradient(145deg, #03703F, #02522F); }
.sim-res-head.is-fail { background: linear-gradient(145deg, #C5121F, #8E0A15); }
.sim-res-head.is-score { background: linear-gradient(145deg, #173A63, #0F2C4D); }
.sim-verdict-big { margin: 0; font-size: clamp(2.2rem, 1.6rem + 3vw, 3.4rem); font-weight: 900; letter-spacing: 0.03em; outline: none; }
.sim-res-line { margin: 0.3rem 0 0; font-weight: 600; }
.sim-res-bn { margin: 0.75rem auto 0; max-width: 560px; line-height: 1.7; color: rgba(255, 255, 255, 0.9); }
.sim-res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: var(--spacing-md) 0; }

.sim-weak, .sim-review { margin-top: var(--spacing-lg); }
.sim-weak h2, .sim-review h2 { font-size: 1.2rem; margin: 0 0 0.6rem; }
.sim-weak ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.sim-weak li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem; border: 1px solid var(--border-color); border-radius: 10px; }
.sim-weak-n { display: inline-grid; place-items: center; min-width: 1.8rem; height: 1.8rem; font-weight: 800; color: #fff; background: var(--brand-red); border-radius: 50%; }
.sim-weak-name { flex: 1; font-weight: 600; }
.sim-weak a { font-size: 0.9rem; font-weight: 600; }

.sim-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: var(--spacing-sm); }
.sim-filter {
    padding: 0.4rem 0.8rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-light);
}
.sim-filter[aria-pressed="true"] { color: #fff; background: var(--brand-navy); border-color: var(--brand-navy); }

.sim-review-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--spacing-sm); }
.sim-rev { padding: var(--spacing-md); border: 1px solid var(--border-color); border-left: 4px solid; border-radius: 12px; background: var(--bg-light); }
.sim-rev.ok { border-left-color: var(--brand-green); }
.sim-rev.ko { border-left-color: var(--brand-red); }
.sim-rev::before { content: "Pregunta " attr(value); display: block; margin-bottom: 0.25rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.sim-rev-q { margin: 0 0 0.6rem; font-weight: 600; line-height: 1.55; }
/* How hard the question was for everyone (from real exam-mode answers). */
.sim-level { margin: -0.3rem 0 0.6rem; font-size: 0.85rem; color: var(--text-muted); }
.sim-level-tag { font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.sim-level.is-easy .sim-level-tag { color: #1d7a3e; }
.sim-level.is-mid .sim-level-tag { color: #9a6700; }
.sim-level.is-hard .sim-level-tag { color: #b42318; }
body.dark-mode .sim-level.is-easy .sim-level-tag { color: #6fd18f; }
body.dark-mode .sim-level.is-mid .sim-level-tag { color: #e8b85a; }
body.dark-mode .sim-level.is-hard .sim-level-tag { color: #f28b82; }
.sim-rev-mark { font-weight: 900; }
.sim-rev.ok .sim-rev-mark { color: var(--brand-green); }
.sim-rev.ko .sim-rev-mark { color: var(--brand-red); }
.sim-rev-opts { list-style: none; margin: 0 0 0.6rem; padding: 0; display: grid; gap: 0.3rem; }
.sim-rev-opts li { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.35rem 0.5rem; border-radius: 8px; line-height: 1.45; }
.sim-rev-opts .sim-letter { width: 1.5rem; height: 1.5rem; font-size: 0.78rem; }
.sim-rev-opts li.is-right { background: rgba(2, 82, 47, 0.1); font-weight: 600; }
.sim-rev-opts li.is-wrong { background: rgba(227, 8, 28, 0.08); }
.sim-rev-opts em { font-style: normal; font-size: 0.82rem; color: var(--text-muted); }
.sim-rev-blank { margin: 0 0 0.4rem; font-weight: 700; color: var(--brand-red); }
.sim-rev-none { padding: var(--spacing-md); text-align: center; color: var(--text-muted); }

/* --- links into the simulator --- */
.sim-feature {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: 0 0 var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    color: #fff;
    text-decoration: none;
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 20%, rgba(249, 171, 13, 0.35), transparent 50%),
        linear-gradient(135deg, #173A63, #0F2C4D);
    box-shadow: 0 12px 28px rgba(10, 31, 56, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}
.sim-feature:hover { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(10, 31, 56, 0.32); color: #fff; }
.sim-feature-icon { font-size: 2.4rem; line-height: 1; }
.sim-feature-text { display: grid; gap: 0.25rem; flex: 1; }
.sim-feature-text strong { font-size: 1.2rem; }
.sim-feature-text span { font-size: 0.92rem; line-height: 1.6; color: rgba(255, 255, 255, 0.85); }
.sim-feature-go { flex: none; padding: 0.55rem 1rem; font-weight: 800; color: #0F2C4D; background: var(--brand-gold); border-radius: 999px; }


/* --- Bangla help (glossary) --- */
.gl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin-bottom: var(--spacing-sm); }
.gl-toggle {
    padding: 0.45rem 0.9rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-light);
}
.gl-toggle[aria-pressed="true"] { color: #fff; background: var(--brand-green); border-color: var(--brand-green); }
.gl-bar-note { font-size: 0.85rem; color: var(--text-muted); }

.gl-word {
    display: inline;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: help;
    background: none;
    border: 0;
    border-bottom: 2px dotted rgba(2, 82, 47, 0.55);
    border-radius: 0;
}
.gl-word:hover, .gl-word:focus-visible { background: rgba(2, 82, 47, 0.1); border-bottom-style: solid; outline: none; }

.gl-pop {
    position: absolute;
    z-index: 1100;
    display: grid;
    gap: 0.15rem;
    max-width: min(320px, calc(100vw - 16px));
    padding: 0.5rem 0.75rem;
    color: #fff;
    background: #0F2C4D;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}
.gl-pop[hidden] { display: none; }
.gl-pop strong { font-size: 0.85rem; color: var(--brand-gold); }
.gl-pop span { font-size: 1rem; line-height: 1.5; }

.gl-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.7rem 0 0; padding: 0; }
.gl-list li { padding: 0.2rem 0.55rem; font-size: 0.82rem; line-height: 1.5; border-radius: 8px; background: rgba(2, 82, 47, 0.08); border: 1px solid rgba(2, 82, 47, 0.18); }
.gl-list b { font-weight: 700; }
.gl-list span { color: var(--text-muted); }

/* --- dark mode --- */
body.dark-mode .sim-mode-box,
body.dark-mode .sim-field select,
body.dark-mode .sim-card,
body.dark-mode .sim-opt,
body.dark-mode .sim-cell,
body.dark-mode .sim-filter,
body.dark-mode .sim-rev,
body.dark-mode .gl-toggle { background: var(--bg-dark-soft); border-color: var(--border-dark); }
body.dark-mode .sim-history, body.dark-mode .sim-weak li { border-color: var(--border-dark); }
body.dark-mode .sim-opt.is-chosen { border-color: #7FB0E0; background: rgba(127, 176, 224, 0.12); }
body.dark-mode .sim-opt.is-chosen .sim-letter { background: #7FB0E0; border-color: #7FB0E0; color: #0C1826; }
body.dark-mode .sim-opt.is-right { border-color: #3ddc97; background: rgba(61, 220, 151, 0.12); }
body.dark-mode .sim-opt.is-wrong { border-color: #ff6b75; background: rgba(255, 107, 117, 0.12); }
body.dark-mode .sim-cell.is-answered { background: rgba(127, 176, 224, 0.18); border-color: rgba(127, 176, 224, 0.45); }
body.dark-mode .sim-cell.is-right { background: rgba(61, 220, 151, 0.2); border-color: #3ddc97; }
body.dark-mode .sim-cell.is-wrong { background: rgba(255, 107, 117, 0.2); border-color: #ff6b75; }
body.dark-mode .sim-filter[aria-pressed="true"] { color: #0C1826; background: #7FB0E0; border-color: #7FB0E0; }
body.dark-mode .gl-word { border-bottom-color: rgba(61, 220, 151, 0.6); }
body.dark-mode .gl-list li { background: rgba(61, 220, 151, 0.08); border-color: rgba(61, 220, 151, 0.2); }
body.dark-mode .gl-pop { background: #1d3a5c; }

@media (max-width: 640px) {
    .sim-page { padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-xl); }
    .sim-hero { padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md); }
    .sim-modes { grid-template-columns: 1fr; }
    .sim-go { justify-self: stretch; }
    .sim-card { padding: var(--spacing-sm); }
    .sim-q { font-size: 1.05rem; }
    .sim-counter { font-size: 0.85rem; }
    .sim-bar .sim-finish { margin-left: auto; }
    .sim-timer { margin-left: 0; }
    .sim-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .sim-nav .btn { padding: 0.6rem 0.7rem; }
    .sim-feature { flex-wrap: wrap; padding: var(--spacing-md); }
    .sim-feature-go { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .sim-timer.is-low { animation: none; }
}


/* Mock test pages: the exam runs one question per screen (DgtSim); the
   full question list underneath is only for readers without JavaScript. */
.js .sim-fallback { display: none; }
.sim-mock { margin-bottom: var(--spacing-lg); }
.sim-mock .sim-form { margin-top: var(--spacing-md); }
.sim-rules-light span { color: var(--brand-navy); background: rgba(15, 44, 77, 0.06); border-color: var(--border-color); }
body.dark-mode .sim-rules-light span { color: var(--text-light); background: rgba(127, 176, 224, 0.12); border-color: var(--border-dark); }
.sim-note-top { margin: 0; }

/* ================================================================
   SITE-WIDE DESIGN (v1.97): the homepage category-card language
   everywhere. Each topic has an accent (--cat), set on any element that
   names its topic (data-cat, or data-topic on <body> and on cards); cards
   get a tinted corner, a top bar that grows on hover and a round arrow;
   page headers get the dark gradient panel with the site's ribbon.
   ================================================================ */

[data-cat="documents"],        [data-topic="documents"]        { --cat: #2563eb; }
[data-cat="living-in-spain"],  [data-topic="living-in-spain"]  { --cat: #16a34a; }
[data-cat="work"],             [data-topic="work"]             { --cat: #b45309; }
[data-cat="health"],           [data-topic="health"]           { --cat: #e11d48; }
[data-cat="family"],           [data-topic="family"]           { --cat: #ea580c; }
[data-cat="immigration"],      [data-topic="immigration"]      { --cat: #7c3aed; }
[data-cat="transport"],        [data-topic="transport"]        { --cat: #0891b2; }
[data-cat="citizenship"],      [data-topic="citizenship"]      { --cat: #ca8a04; }
[data-cat="digital-services"], [data-topic="digital-services"] { --cat: #4f46e5; }
[data-cat="learning-spanish"], [data-topic="learning-spanish"] { --cat: #db2777; }
[data-topic="exams"] { --cat: #0F2C4D; }

/* --cat-ink is worked out where --cat is set, so it follows each card. */
[data-cat], [data-topic] { --cat-ink: color-mix(in srgb, var(--cat, #0F2C4D) 78%, #000); }
body.dark-mode[data-topic], body.dark-mode [data-cat], body.dark-mode [data-topic] {
    --cat-ink: color-mix(in srgb, var(--cat, #7FB0E0) 55%, #fff);
}

/* ---------- page headers ---------- */
.category-header {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: calc(var(--spacing-xl) + 4px) 0 var(--spacing-xl);
    color: #fff;
    border-bottom: 0;
    background:
        radial-gradient(circle at 10% 15%, color-mix(in srgb, var(--cat, #02824A) 60%, transparent), transparent 55%),
        radial-gradient(circle at 95% 95%, rgba(227, 8, 28, 0.32), transparent 55%),
        linear-gradient(145deg, #173A63 0%, #0F2C4D 55%, #0A1F38 100%);
}
body.dark-mode .category-header {
    background:
        radial-gradient(circle at 10% 15%, color-mix(in srgb, var(--cat, #02824A) 45%, transparent), transparent 55%),
        radial-gradient(circle at 95% 95%, rgba(227, 8, 28, 0.25), transparent 55%),
        linear-gradient(145deg, #132F51 0%, #0C2440 55%, #08182B 100%);
}
.category-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.2px);
    background-size: 14px 14px;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, transparent 70%);
    mask-image: linear-gradient(90deg, #000 0%, transparent 70%);
}
.category-header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 4px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}
.category-header h1,
body.dark-mode .category-header h1 { color: #fff; margin-bottom: 0.35rem; }
.category-header p { color: rgba(255, 255, 255, 0.84); max-width: 760px; }
.category-header .ch-bn {
    display: inline-block;
    margin: 0 0 0.6rem;
    padding: 0.2rem 0.8rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
}
.category-header .exams-summary {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.2rem 0.75rem;
    font-weight: 700;
    color: #0F2C4D;
    background: var(--brand-gold);
    border-radius: 999px;
}

/* ---------- homepage hero ---------- */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(15, 44, 77, 0.07) 1px, transparent 1.2px);
    background-size: 16px 16px;
    -webkit-mask-image: radial-gradient(ellipse at 20% 30%, #000 0%, transparent 65%);
    mask-image: radial-gradient(ellipse at 20% 30%, #000 0%, transparent 65%);
}
body.dark-mode .hero::before { background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1.2px); }
.hero > * { position: relative; z-index: 1; }
.hero-buttons .btn { border-radius: 999px; }
.hero-chip {
    color: var(--cat-ink, var(--text-dark));
    background: color-mix(in srgb, var(--cat, #0F2C4D) 7%, var(--bg-light));
    border-color: color-mix(in srgb, var(--cat, #0F2C4D) 28%, var(--border-color));
}
.hero-chip:hover { background: var(--cat, var(--brand-navy)); border-color: var(--cat, var(--brand-navy)); color: #fff; }
body.dark-mode .hero-chip {
    color: var(--cat-ink);
    background: color-mix(in srgb, var(--cat, #7FB0E0) 14%, var(--bg-dark-soft));
    border-color: color-mix(in srgb, var(--cat, #7FB0E0) 35%, var(--border-dark));
}

/* ---------- shared card look ---------- */
.article-card,
.exams-hub-card,
.related-item,
.lesson-nav a {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--cat, #0F2C4D) 8%, var(--bg-light)) 0%, var(--bg-light) 60%);
    box-shadow: 0 1px 2px rgba(15, 44, 77, 0.05), 0 6px 18px rgba(15, 44, 77, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.article-card::before,
.exams-hub-card::before,
.related-item::before,
.lesson-nav a::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cat, #0F2C4D), color-mix(in srgb, var(--cat, #0F2C4D) 35%, #fff));
    transform: scaleX(0.22);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.article-card:hover, .exams-hub-card:hover, .related-item:hover, .lesson-nav a:hover,
.article-card:focus-within, .exams-hub-card:focus-visible, .related-item:focus-visible, .lesson-nav a:focus-visible {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--cat, #0F2C4D) 45%, var(--border-color));
    box-shadow: 0 16px 34px color-mix(in srgb, var(--cat, #0F2C4D) 18%, transparent);
}
.article-card:hover::before, .exams-hub-card:hover::before, .related-item:hover::before, .lesson-nav a:hover::before,
.article-card:focus-within::before, .exams-hub-card:focus-visible::before { transform: scaleX(1); }
.article-card:hover .category-go, .exams-hub-card:hover .category-go,
.article-card:focus-within .category-go, .exams-hub-card:focus-visible .category-go {
    color: #fff;
    background: var(--cat, var(--brand-navy));
    transform: translateX(4px);
}
body.dark-mode .article-card, body.dark-mode .exams-hub-card, body.dark-mode .related-item, body.dark-mode .lesson-nav a {
    border-color: var(--border-dark);
    background: linear-gradient(160deg, color-mix(in srgb, var(--cat, #7FB0E0) 15%, var(--bg-dark-soft)) 0%, var(--bg-dark-soft) 60%);
    box-shadow: none;
}
body.dark-mode .article-card:hover, body.dark-mode .exams-hub-card:hover, body.dark-mode .related-item:hover, body.dark-mode .lesson-nav a:hover {
    border-color: color-mix(in srgb, var(--cat, #7FB0E0) 55%, var(--border-dark));
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

/* ---------- Latest Articles ---------- */
.article-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.3rem 1.25rem 1rem;
    text-align: left;
    border-top: 1px solid var(--border-color);
}
.ac-top { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.ac-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    font-size: 1.3rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--cat, #0F2C4D) 13%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat, #0F2C4D) 25%, transparent);
}
.ac-cat { min-width: 0; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; color: var(--cat-ink); }
.ac-cat-bn { display: block; font-size: 0.86rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.article-card h3 { margin: 0; font-size: 1.1rem; line-height: 1.5; }
.ac-link { color: inherit; text-decoration: none; }
.ac-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.ac-link:focus-visible { outline: none; }
.article-card:focus-within { outline: 3px solid color-mix(in srgb, var(--cat, #0F2C4D) 55%, transparent); outline-offset: 3px; }
.ac-desc {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
body.dark-mode .ac-desc { color: #9fb0c2; }
.ac-foot {
    margin-top: auto;
    padding-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    border-top: 1px dashed color-mix(in srgb, var(--cat, #0F2C4D) 28%, var(--border-color));
}
.ac-meta {
    padding: 0.15rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--cat-ink);
    background: color-mix(in srgb, var(--cat, #0F2C4D) 10%, transparent);
    border-radius: 999px;
}
.ac-foot .category-go, .eh-foot .category-go { margin-left: auto; }

/* ---------- Exams hub ---------- */
.exams-hub-card {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1.5rem 1.4rem 1.1rem;
}
.eh-icon {
    display: grid;
    place-items: center;
    width: 60px; height: 60px;
    font-size: 2rem;
    border-radius: 18px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--cat) 22%, #fff), color-mix(in srgb, var(--cat) 8%, #fff));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat) 25%, transparent), 0 6px 14px color-mix(in srgb, var(--cat) 18%, transparent);
}
body.dark-mode .eh-icon { background: linear-gradient(145deg, color-mix(in srgb, var(--cat) 34%, var(--bg-dark-soft)), color-mix(in srgb, var(--cat) 14%, var(--bg-dark-soft))); }
.exams-hub-card h2 { margin: 0; font-size: 1.25rem; line-height: 1.35; }
.exams-hub-card h2::after { display: none; }
.eh-bn { display: block; margin-top: 0.15rem; font-size: 1rem; font-weight: 600; color: var(--cat-ink); }
.exams-hub-card p { margin: 0; color: var(--text-muted); }
.eh-foot { margin-top: auto; padding-top: 0.8rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; border-top: 1px dashed color-mix(in srgb, var(--cat) 28%, var(--border-color)); }
.eh-stat { padding: 0.2rem 0.65rem; font-size: 0.8rem; font-weight: 700; color: var(--cat-ink); background: color-mix(in srgb, var(--cat) 11%, transparent); border-radius: 999px; }

/* ---------- lists: articles and quizzes ---------- */
.article-item {
    position: relative;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--cat, var(--brand-green));
    border-radius: 14px;
    background: linear-gradient(100deg, color-mix(in srgb, var(--cat, #02522F) 6%, var(--bg-light)) 0%, var(--bg-light) 45%);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.article-item:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--cat, #02522F) 40%, var(--border-color));
    border-left-color: var(--cat, var(--brand-green));
    box-shadow: 0 12px 26px color-mix(in srgb, var(--cat, #02522F) 15%, transparent);
}
body.dark-mode .article-item {
    border-color: var(--border-dark);
    border-left-color: var(--cat, var(--secondary-color));
    background: linear-gradient(100deg, color-mix(in srgb, var(--cat, #5FA97F) 14%, var(--bg-dark-soft)) 0%, var(--bg-dark-soft) 45%);
}
.article-item .read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    font-weight: 700;
    color: var(--cat-ink, var(--brand-navy));
    background: color-mix(in srgb, var(--cat, #0F2C4D) 10%, transparent);
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}
.article-item:hover .read-more-btn { color: #fff; background: var(--cat, var(--brand-navy)); }
.quiz-number {
    display: inline-grid;
    place-items: center;
    min-width: 1.7rem;
    height: 1.7rem;
    margin-right: 0.2rem;
    padding: 0 0.3rem;
    font-size: 0.85rem;
    color: #fff;
    background: var(--cat, var(--brand-navy));
    border-radius: 999px;
}
.quiz-subsection-heading, .quiz-topicgroup-heading { color: var(--cat-ink, inherit); }

/* ---------- reading path ---------- */
.learning-path .path-step-number {
    color: var(--cat-ink, var(--text-dark));
    background: color-mix(in srgb, var(--cat, #0F2C4D) 12%, var(--bg-light));
    border-color: color-mix(in srgb, var(--cat, #0F2C4D) 40%, var(--border-color));
}
.learning-path .path-step a:hover { border-color: color-mix(in srgb, var(--cat, #0F2C4D) 40%, var(--border-color)); }
body.dark-mode .learning-path .path-step-number { background: color-mix(in srgb, var(--cat, #7FB0E0) 20%, var(--bg-dark)); }

/* ---------- article pages ---------- */
.article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cat, #0F2C4D) 8%, transparent);
}
.toc { border-left: 4px solid var(--cat, var(--brand-navy)); border-radius: 14px; }
.toc-num { color: var(--cat-ink, inherit); }
.quiz-cta {
    border-radius: 18px;
    border-color: color-mix(in srgb, var(--cat, #F9AB0D) 45%, var(--border-color));
    background: linear-gradient(150deg, color-mix(in srgb, var(--cat, #F9AB0D) 10%, var(--bg-light)) 0%, var(--bg-light) 70%);
}
body.dark-mode .quiz-cta { background: linear-gradient(150deg, color-mix(in srgb, var(--cat, #F9AB0D) 18%, var(--bg-dark-soft)) 0%, var(--bg-dark-soft) 70%); }
.related-item { padding: 1.1rem 1rem 0.9rem; border-top: 1px solid var(--border-color); }
body.dark-mode .related-item { border-top-color: var(--border-dark); }
.related-cat { color: var(--cat-ink); font-weight: 700; }
.author-box { border-radius: 16px; }

/* previous / next lesson */
.lesson-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0;
}
.lesson-nav a { display: grid; gap: 0.3rem; padding: 1rem 1.1rem 0.9rem; }
.lesson-nav-next { text-align: right; }
.ln-dir { font-size: 0.82rem; font-weight: 800; color: var(--cat-ink); }
.ln-title { font-weight: 700; line-height: 1.45; }
.lesson-nav-hint { grid-column: 1 / -1; margin: 0; text-align: center; font-size: 0.8rem; color: var(--text-muted); }
@media (hover: hover) and (pointer: fine) { .lesson-nav-hint { display: none; } }

/* ---------- quiz pages ---------- */
.quiz-header {
    position: relative;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--cat, #0F2C4D) 9%, var(--bg-light)) 0%, var(--bg-light) 60%);
    overflow: hidden;
}
.quiz-header::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}
body.dark-mode .quiz-header { border-color: var(--border-dark); background: linear-gradient(160deg, color-mix(in srgb, var(--cat, #7FB0E0) 15%, var(--bg-dark-soft)) 0%, var(--bg-dark-soft) 60%); }
.quiz-q { border-radius: 16px; }
.quiz-options { counter-reset: quiz-opt; }
.quiz-opt { display: flex; align-items: flex-start; gap: 0.75rem; border-radius: 12px; }
.quiz-opt::before {
    counter-increment: quiz-opt;
    content: counter(quiz-opt, upper-alpha);
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.85rem;
    font-weight: 800;
    border: 2px solid currentColor;
    border-radius: 50%;
    opacity: 0.7;
}
.js .quiz-opt.selected::before { opacity: 1; color: #fff; background: var(--brand-navy); border-color: var(--brand-navy); }
.js .quiz-opt.correct::before { opacity: 1; color: #fff; background: var(--brand-green); border-color: var(--brand-green); }
.js .quiz-opt.incorrect::before { opacity: 1; color: #fff; background: var(--brand-red); border-color: var(--brand-red); }

/* ---------- "Share what you know" ---------- */
.contribute { background: none; border-top: 0; padding: var(--spacing-xl) var(--spacing-md); }
body.dark-mode .contribute { background: none; }
.contribute .container {
    position: relative;
    overflow: hidden;
    max-width: 1100px;
    padding: calc(var(--spacing-xl) + 4px) var(--spacing-lg) var(--spacing-xl);
    color: #fff;
    border-radius: 24px;
    background:
        radial-gradient(circle at 8% 15%, rgba(2, 130, 74, 0.5), transparent 50%),
        radial-gradient(circle at 92% 85%, rgba(249, 171, 13, 0.32), transparent 50%),
        linear-gradient(140deg, #173A63, #0F2C4D 60%, #0A1F38);
    box-shadow: 0 18px 40px rgba(10, 31, 56, 0.28);
}
.contribute .container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}
.contribute h2, body.dark-mode .contribute h2 { color: #fff; }
.contribute h2::after { display: none; }
.contribute p { color: rgba(255, 255, 255, 0.84); }
.contribute .btn-primary { color: #0F2C4D; background: var(--brand-gold); border-color: var(--brand-gold); border-radius: 999px; }
.contribute .btn-primary:hover { background: #ffc23d; border-color: #ffc23d; color: #0F2C4D; }

/* ---------- footer ---------- */
.footer {
    position: relative;
    border-top: 0;
    padding-top: calc(var(--spacing-xl) + 6px);
    background:
        radial-gradient(circle at 6% 0%, rgba(2, 130, 74, 0.28), transparent 38%),
        radial-gradient(circle at 96% 100%, rgba(227, 8, 28, 0.18), transparent 40%),
        linear-gradient(180deg, #0C2440 0%, #081A2E 100%);
}
.footer::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}
.footer-brand { display: inline-flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; text-decoration: none; }
.footer-brand img { border-radius: 10px; background: #fff; padding: 2px; }
.footer-brand .logo-wordmark { font-size: 1.35rem; font-weight: 800; }
.footer .footer-brand .logo-setu { color: #fff; }
.footer .footer-brand .logo-spain { color: #ff5a63; }
.footer-brand:hover { text-decoration: none; }
.footer-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.75rem; }
.footer-pills span {
    padding: 0.18rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}
.footer h4 { position: relative; padding-bottom: 0.45rem; }
.footer h4::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 28px; height: 3px;
    border-radius: 2px;
    background: var(--brand-gold);
}
.footer-panel a { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.18rem 0; transition: color 0.2s, transform 0.2s; }
.footer-panel a:hover { text-decoration: none; transform: translateX(3px); }
.footer-ico { width: 1.3rem; text-align: center; }
.footer-cta {
    border-radius: 18px;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.footer .btn-compose { border-radius: 999px; }

/* ---------- touch: feedback, targets, swipeable rows ---------- */
.article-card, .exams-hub-card, .article-item, .related-item, .lesson-nav a, .category-card, .hero-chip, .path-step a, .sim-opt, .quiz-opt {
    -webkit-tap-highlight-color: transparent;
}
@media (hover: none) {
    .article-card:active, .exams-hub-card:active, .article-item:active, .related-item:active,
    .lesson-nav a:active, .path-step a:active, .hero-chip:active { transform: scale(0.975); transition-duration: 0.08s; }
}
@media (max-width: 640px) {
    .breadcrumb-inner a { display: inline-block; padding: 0.35rem 0; }
    .footer-panel a { min-height: 40px; }
    .category-header { padding: var(--spacing-lg) 0; }
    .category-header h1 { font-size: 1.6rem; }

    /* Rows a thumb swipes through sideways, with the next card peeking in. */
    .swipe-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 0.8rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--spacing-sm);
        padding: 0.4rem var(--spacing-sm) 0.9rem;
        margin-inline: calc(-1 * var(--spacing-sm));
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .swipe-row::-webkit-scrollbar { display: none; }
    .swipe-row > * { flex: 0 0 84%; scroll-snap-align: start; }
    .swipe-row > [hidden] { display: none; }
    .hero-popular .hero-chips.swipe-row > * { flex: 0 0 auto; }
    .hero-popular .hero-chip:nth-child(n+8) { display: inline-flex; }
    .lesson-nav { grid-template-columns: 1fr 1fr; }
    .lesson-nav a { padding: 0.85rem 0.8rem; }
    .ln-title { font-size: 0.9rem; }
}
.swipe-dots { display: none; }
@media (max-width: 640px) {
    .swipe-dots { display: flex; justify-content: center; gap: 0.4rem; margin: 0 0 var(--spacing-sm); }
    .swipe-dots button {
        width: 8px; height: 8px;
        padding: 0;
        border: 0;
        border-radius: 999px;
        background: var(--border-color);
        transition: width 0.25s, background 0.25s;
        cursor: pointer;
    }
    .swipe-dots button[aria-current="true"] { width: 22px; background: var(--brand-navy); }
    body.dark-mode .swipe-dots button { background: var(--border-dark); }
    body.dark-mode .swipe-dots button[aria-current="true"] { background: #7FB0E0; }
}

/* exam screen: the card follows the finger, then slides in */
.sim-card { touch-action: pan-y; will-change: transform; }
.sim-card.is-dragging { transition: none; }
.sim-card.slide-from-right { animation: sim-in-right 0.22s ease-out; }
.sim-card.slide-from-left { animation: sim-in-left 0.22s ease-out; }
@keyframes sim-in-right { from { transform: translateX(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes sim-in-left { from { transform: translateX(-40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sim-swipe-hint { margin: 0.5rem 0 0; text-align: center; font-size: 0.8rem; color: var(--text-muted); }
@media (hover: hover) and (pointer: fine) { .sim-swipe-hint { display: none; } }

/* lesson swipe: an arrow that grows from the screen edge while dragging */
.edge-pull {
    position: fixed;
    top: 50%;
    z-index: 1200;
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    margin-top: -23px;
    color: #fff;
    background: var(--brand-navy);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
.edge-pull.is-left { left: 10px; }
.edge-pull.is-right { right: 10px; }
.edge-pull.is-ready { background: var(--brand-green); }

/* tap a photo to see it full screen */
.zoomable { cursor: zoom-in; }
.zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 3.5rem 0.75rem 1rem;
    background: rgba(5, 12, 22, 0.94);
    touch-action: pinch-zoom;
    animation: zoom-fade 0.18s ease-out;
}
.zoom-overlay img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 8px; background: #fff; transition: transform 0.15s; }
.zoom-overlay p { margin: 0; max-width: 680px; text-align: center; font-size: 0.82rem; color: rgba(255, 255, 255, 0.75); }
.zoom-overlay .zoom-close {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    width: 44px; height: 44px;
    font-size: 1.4rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
}
@keyframes zoom-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .sim-card.slide-from-right, .sim-card.slide-from-left, .zoom-overlay { animation: none; }
}

@media (max-width: 640px) {
    /* Quiz lists: one compact row per quiz on a phone, not two cramped columns. */
    .articles-list.quiz-grid { grid-template-columns: 1fr !important; gap: 0.6rem; }
    .quiz-grid .quiz-item { padding: 0.8rem 0.9rem; }
    .quiz-grid .quiz-item h4 { margin: 0 0 0.35rem; font-size: 1rem; }
    .quiz-grid .article-item-meta { margin: 0 0 0.45rem; }
    .quiz-grid .read-more-btn { padding: 0.22rem 0.7rem; font-size: 0.85rem; }
}

/* Dark mode: the general dark link colour must not recolour these. */
body.dark-mode .ac-link,
body.dark-mode .article-card h3 a { color: var(--text-light); }
body.dark-mode .footer a { color: #C4D0DC; }
body.dark-mode .footer a:hover { color: var(--brand-gold); }
body.dark-mode .footer .footer-brand .logo-setu { color: #fff; }
body.dark-mode .contribute .btn-primary { color: #0F2C4D; background: var(--brand-gold); border-color: var(--brand-gold); }
body.dark-mode .exams-hub-card h2 { color: var(--text-light); }

/* ---------- readiness card (simulator start, driving course home) ---------- */
.ready-card {
    position: relative;
    overflow: hidden;
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(8, 145, 178, 0.08) 0%, var(--bg-light) 60%);
    box-shadow: 0 8px 24px rgba(15, 44, 77, 0.06);
}
.ready-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #02522F 0 33.3%, #F9AB0D 33.3% 66.6%, #E3081C 66.6% 100%);
}
body.dark-mode .ready-card { border-color: var(--border-dark); background: linear-gradient(160deg, rgba(8, 145, 178, 0.16) 0%, var(--bg-dark-soft) 60%); box-shadow: none; }
.sim-start .ready-card { margin-top: var(--spacing-md); }
.ready-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ready-head h2 { margin: 0; font-size: 1.15rem; }
.ready-head h2::after { display: none; }
.ready-badge { padding: 0.25rem 0.8rem; font-weight: 800; font-size: 0.85rem; border-radius: 999px; color: #fff; background: #64748b; }
.level-1 .ready-badge { background: #b45309; }
.level-2 .ready-badge { background: #0891b2; }
.level-3 .ready-badge { background: var(--brand-green); }
.ready-text { margin: 0.6rem 0; line-height: 1.7; }
.ready-meter { height: 12px; border-radius: 999px; background: var(--border-color); overflow: hidden; }
body.dark-mode .ready-meter { background: var(--border-dark); }
.ready-meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #b45309, #F9AB0D 45%, #16a34a); transition: width 0.6s ease; }
.ready-sub { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.ready-fig { margin: var(--spacing-sm) 0 0; }
.ready-chart { display: block; width: 100%; max-width: 520px; height: auto; }
.ready-chart rect.ok { fill: #16a34a; }
.ready-chart rect.ko { fill: #e11d48; }
.ready-chart line.limit { stroke: var(--brand-gold); stroke-width: 2; stroke-dasharray: 5 4; }
.ready-fig figcaption { margin-top: 0.25rem; font-size: 0.78rem; color: var(--text-muted); }
.ready-card h3 { margin: var(--spacing-sm) 0 0.4rem; font-size: 1rem; }
.ready-weak { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.ready-weak li { display: flex; align-items: center; gap: 0.6rem; }
.ready-pct { min-width: 3.2rem; padding: 0.15rem 0.5rem; font-weight: 800; font-size: 0.82rem; text-align: center; color: #fff; background: #e11d48; border-radius: 999px; }
.ready-go { margin: var(--spacing-sm) 0 0.2rem; }
.ready-go .btn { width: auto; border-radius: 999px; }

/* ---------- 4-week study plan (driving course home) ---------- */
.study-plan { margin: var(--spacing-lg) 0; }
.study-plan h2 { margin-bottom: var(--spacing-sm); }
.study-plan-weeks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--spacing-sm); counter-reset: week; }
.study-week {
    position: relative;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--cat, var(--brand-navy));
    border-radius: 16px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--cat, #0F2C4D) 8%, var(--bg-light)) 0%, var(--bg-light) 60%);
}
body.dark-mode .study-week { border-color: var(--border-dark); border-top-color: var(--cat); background: linear-gradient(160deg, color-mix(in srgb, var(--cat, #7FB0E0) 14%, var(--bg-dark-soft)) 0%, var(--bg-dark-soft) 60%); }
.study-week h3 { margin: 0 0 0.4rem; font-size: 1.05rem; color: var(--cat-ink, inherit); }
.study-week p { margin: 0 0 0.6rem; font-size: 0.92rem; line-height: 1.7; }
.study-week-lessons { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; }
.study-week-lessons a {
    display: inline-grid;
    place-items: center;
    min-width: 2.2rem;
    height: 2.2rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--cat-ink, var(--brand-navy));
    background: color-mix(in srgb, var(--cat, #0F2C4D) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--cat, #0F2C4D) 30%, transparent);
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}
.study-week-lessons a:hover { color: #fff; background: var(--cat, var(--brand-navy)); }
.study-week-lessons a.is-done { color: #fff; background: var(--brand-green); border-color: var(--brand-green); }

/* ---- v1.100 lesson kit: the same four parts on every driving lesson ---- */
.article-body .kit {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    border-left: 4px solid;
}
.article-body .kit h2 { font-size: 1.2rem; margin: 0 0 var(--spacing-sm); }
.article-body .kit ul { margin: 0 0 0 var(--spacing-lg); }
.article-body .kit li:last-child { margin-bottom: 0; }
.kit-focus { background: #eff6ff; border-left-color: #2563eb !important; }
.kit-terms { background: #fffbeb; border-left-color: #d97706 !important; }
.kit-traps { background: #fef2f2; border-left-color: #dc2626 !important; }
.kit-summary { background: #f0fdf4; border-left-color: #16a34a !important; }
.kit-term-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-xs) var(--spacing-md);
    margin: 0;
}
.kit-term-list div { padding: 6px 0; border-bottom: 1px dashed var(--border-color); }
.kit-term-list dt { font-weight: 700; }
.kit-term-list dd { margin: 0; }
@media (max-width: 600px) {
    .article-body .kit { padding: var(--spacing-md); }
    .kit-term-list { grid-template-columns: 1fr; }
}
body.dark-mode .kit-focus { background: rgba(37, 99, 235, 0.12); }
body.dark-mode .kit-terms { background: rgba(217, 119, 6, 0.12); }
body.dark-mode .kit-traps { background: rgba(220, 38, 38, 0.12); }
body.dark-mode .kit-summary { background: rgba(22, 163, 74, 0.12); }
body.dark-mode .article-body .kit { border-color: var(--border-dark); }

/* ================================================================
   Folds: overview first, details on tap (course units, quiz groups,
   lesson sections). Native <details>, styled as one family.
   ================================================================ */
.fold {
    margin: 0 0 var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
}
body.dark-mode .fold { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.fold { scroll-margin-top: 100px; }
.fold > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    padding: 0.9rem 2.75rem 0.9rem var(--spacing-md);
    position: relative;
    cursor: pointer;
    list-style: none;
    min-height: 48px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
    content: "";
    position: absolute;
    right: 1.1rem;
    top: 1.15rem;
    width: 0.6rem;
    height: 0.6rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s;
    opacity: 0.6;
}
.fold[open] > summary::after { transform: rotate(-135deg); top: 1.4rem; }
.fold > summary:focus-visible { outline: 3px solid var(--brand-gold); outline-offset: 2px; border-radius: var(--radius-md); }
.fold-title { font-weight: 800; font-size: 1.08rem; }
.fold-meta { font-size: 0.88rem; color: var(--text-muted); }
body.dark-mode .fold-meta { color: #A9B7C6; }
.fold.is-complete > summary .fold-title::before { content: "✓ "; color: var(--brand-green); }
.fold[open] > summary { border-bottom: 1px solid var(--border-color); }
body.dark-mode .fold[open] > summary { border-bottom-color: var(--border-dark); }
.fold > :not(summary) { margin-left: var(--spacing-md); margin-right: var(--spacing-md); }
.fold > :last-child { margin-bottom: var(--spacing-md); }
.fold-inner { background: transparent; }
.fold-inner .fold-title { font-size: 1rem; }

/* course units */
.path-unit-note { margin-top: var(--spacing-sm); font-size: 0.92rem; color: var(--text-muted); }
.path-unit .learning-path-steps { margin-top: var(--spacing-sm); }
.path-unit .path-step { margin-bottom: var(--spacing-xs); }
.path-unit .path-step a { padding: 0.7rem var(--spacing-sm); gap: var(--spacing-sm); }
.path-unit .path-step-number { width: 34px; height: 34px; font-size: 0.95rem; }
.path-unit .learning-path-steps::before { left: 24px; }
.path-unit .path-step-title { font-size: 1rem; }
/* the description is the overview: two lines, the article has the rest */
.path-step-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* quiz groups on the exams pages */
.quiz-fold > summary .fold-title { font-size: 1.1rem; }
.quiz-fold .quiz-grid { margin-top: var(--spacing-sm); }
.quiz-fold .quiz-item .read-more-btn { display: none; }
.quiz-fold .quiz-item { padding: 0.8rem var(--spacing-md); }
.quiz-topic-fold { margin-top: var(--spacing-sm); }

/* lesson sections */
.fold-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-xs);
    margin: var(--spacing-md) 0 var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--text-muted);
}
.fold-bar-btn {
    min-height: 40px;
    padding: 0.35rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-light);
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
body.dark-mode .fold-bar-btn { background: var(--bg-dark-soft); border-color: var(--border-dark); color: var(--text-light); }
.art-fold > summary h2 { margin: 0; font-size: 1.15rem; line-height: 1.4; }
.art-fold > summary h2 .legal-h2-anchor, .art-fold > summary h2 a { pointer-events: none; }
.art-fold[open] > summary h2 { color: var(--brand-navy); }
body.dark-mode .art-fold[open] > summary h2 { color: var(--primary-color); }
.art-fold > :nth-child(2) { margin-top: var(--spacing-sm); }
.art-fold.kit { padding: 0; }

/* quiz, one question (or task) at a time */
.quiz-paged [hidden] { display: none !important; }
.quiz-pager {
    scroll-margin-top: 100px;
    margin: 0 0 var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    box-shadow: 0 6px 16px rgba(15, 44, 77, 0.08);
}
body.dark-mode .quiz-pager { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.quiz-pager.is-all { box-shadow: none; }
.quiz-pager-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.quiz-pager-label { font-weight: 700; }
.quiz-pager-mode {
    padding: 0.3rem 0.8rem;
    min-height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.quiz-pager-bar { height: 6px; margin: 0.5rem 0; border-radius: 3px; background: var(--border-color); overflow: hidden; }
body.dark-mode .quiz-pager-bar { background: var(--border-dark); }
.quiz-pager-bar span { display: block; height: 100%; width: 0; background: var(--brand-green); transition: width 0.25s; }
.quiz-pager-dots { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr)); gap: 0.35rem; }
.quiz-pager.is-all .quiz-pager-dots { display: none; }
.quiz-pager-dot {
    min-height: 36px;
    padding: 0 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.quiz-pager-dot.is-done { background: color-mix(in srgb, var(--brand-green) 14%, transparent); border-color: var(--brand-green); }
.quiz-pager-dot.is-now { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
body.dark-mode .quiz-pager-dot.is-now { background: var(--primary-color); border-color: var(--primary-color); color: #0A1F38; }
.quiz-pager-steps { display: flex; justify-content: space-between; gap: var(--spacing-sm); margin: var(--spacing-md) 0; }
.quiz-pager-steps .btn { flex: 1; min-height: 48px; }
.quiz-pager-steps .btn:disabled { opacity: 0.4; }
.quiz-paged .quiz-scorebar { display: none; }
.quiz-pager-map > summary { cursor: pointer; font-size: 0.88rem; font-weight: 700; padding: 0.25rem 0; min-height: 32px; }
.quiz-pager-map[open] > summary { margin-bottom: 0.4rem; }
.quiz-pager.is-all .quiz-pager-map { display: none; }
.toc-fold { margin: 0; border: 0; background: transparent; }
body.dark-mode .toc-fold { background: transparent; }
.toc-fold > summary { padding-left: 0; }
.toc-fold > summary h2 { margin: 0; }
.toc-fold > :not(summary) { margin-left: 0; margin-right: 0; }
.toc-fold[open] > summary { border-bottom: 0; }
/* the gold count pill keeps its dark text in dark mode too (it was washed out) */
body.dark-mode .category-header .exams-summary { color: #0F2C4D; }
/* task buttons ("কাজ ১") need more room than question numbers */
.quiz-pager-dots.is-tasks { grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); }

/* ---------- community: join box, footer row, nav item ----------
   Rendered only when site.json "community" has the matching link. */
.join-box {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: calc(var(--radius-md) + 4px);
    background: linear-gradient(135deg, rgba(2, 130, 74, 0.08), rgba(249, 171, 13, 0.08));
    border: 1px solid rgba(2, 130, 74, 0.25);
}
body.dark-mode .join-box { background: rgba(255, 255, 255, 0.04); border-color: rgba(61, 220, 151, 0.3); }
.join-box h2 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.join-box p { margin: 0 0 0.6rem; line-height: 1.7; }
.join-links { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); }
.join-links .btn { padding: 0.55rem 1rem; font-size: 0.92rem; }
.join-donate { font-size: 0.9rem; color: var(--text-muted); }
.join-donate:last-child { margin-bottom: 0; }
.quiz-results .join-box { text-align: left; }
.footer-social { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.social-btn {
    display: inline-flex; align-items: center; gap: 0.55rem;
    padding: 0.45rem 1rem 0.45rem 0.45rem; border-radius: 999px;
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff; font-weight: 600; font-size: 0.9rem; text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.social-btn:hover, .social-btn:focus-visible { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); transform: translateY(-1px); }
.social-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; flex: 0 0 auto; }
.social-ico svg { width: 20px; height: 20px; }
.social-facebook .social-ico { background: #1877F2; }
.social-whatsapp .social-ico { background: #25D366; }
.social-newsletter .social-ico { background: var(--brand-gold); color: #1b2a3a; }
@media (max-width: 640px) {
    .join-box { padding: var(--spacing-md); }
    .join-links .btn { flex: 1 1 100%; text-align: center; }
}

/* A paid or affiliate link in a guide: [text](partner:https://...) */
.partner-tag {
    display: inline-block;
    margin-left: 0.3em;
    padding: 0 0.45em;
    border-radius: 999px;
    font-size: 0.72em;
    font-weight: 700;
    line-height: 1.6;
    vertical-align: 0.1em;
    color: #7A4B00;
    background: rgba(249, 171, 13, 0.18);
    border: 1px solid rgba(249, 171, 13, 0.5);
    cursor: help;
}
body.dark-mode .partner-tag { color: #F9D27A; }

/* Trusted helpers page (only built when site.json has partners) */
.helper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--spacing-md); margin-bottom: var(--spacing-lg); }
.helper-card { padding: var(--spacing-md); border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-white, #fff); }
body.dark-mode .helper-card { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.helper-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.helper-card p { margin: 0 0 0.4rem; }
.helper-city { color: var(--text-muted); font-size: 0.9rem; }

/* Install as an app (shown by InstallApp in main.js) */
.install-card {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(15, 44, 77, 0.35);
    background: rgba(15, 44, 77, 0.04);
}
body.dark-mode .install-card { border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.04); }
.install-card p { margin: 0 0 0.5rem; line-height: 1.7; }
.install-card p:last-child { margin-bottom: 0; }
.install-card .install-btn { margin-bottom: 0.2rem; }
.install-card[hidden], .install-card [hidden] { display: none !important; }

/* ================================================================
   SHARE BOX (end of every guide)
   ================================================================ */
.share-box {
    margin: var(--spacing-xl) 0;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    background: linear-gradient(135deg, rgba(24, 119, 242, 0.06), rgba(37, 211, 102, 0.06)), var(--bg-light);
    text-align: center;
}
body.dark-mode .share-box { background: linear-gradient(135deg, rgba(24, 119, 242, 0.12), rgba(37, 211, 102, 0.10)), var(--bg-dark-soft); border-color: var(--border-dark); }
.share-box h2 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.share-sub { margin: 0 0 var(--spacing-md); color: var(--text-muted); font-size: 0.95rem; }
.share-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.share-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.95rem 0.4rem 0.4rem; border-radius: 999px;
    border: 1px solid var(--border-color); background: var(--bg-light); color: var(--text-dark, #1b2a3a);
    font: inherit; font-weight: 600; font-size: 0.9rem; line-height: 1; text-decoration: none; cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 44, 77, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
body.dark-mode .share-btn { background: var(--bg-dark); border-color: var(--border-dark); color: var(--text-light); }
.share-btn:hover, .share-btn:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 44, 77, 0.14); border-color: transparent; }
.share-btn[hidden] { display: none; }
.share-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; flex: 0 0 auto; }
.share-ico svg { width: 19px; height: 19px; }
.share-whatsapp .share-ico { background: #25D366; }
.share-facebook .share-ico { background: #1877F2; }
.share-telegram .share-ico { background: #229ED9; }
.share-x .share-ico { background: #0f1419; }
body.dark-mode .share-x .share-ico { background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.share-email .share-ico { background: var(--brand-navy); }
body.dark-mode .share-email .share-ico { background: #2f6db5; }
.share-copy .share-ico { background: #64748b; }
.share-copy.is-done .share-ico { background: var(--brand-green); }
.share-native .share-ico { background: var(--brand-red); }
.share-done { display: inline-flex; align-items: center; gap: 0.35rem; margin: var(--spacing-sm) 0 0; color: var(--brand-green); font-weight: 600; font-size: 0.9rem; }
.share-done[hidden] { display: none; }
.share-done svg { width: 18px; height: 18px; }
@media (max-width: 560px) {
    .share-box { padding: var(--spacing-md); }
    .share-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .share-btn { flex-direction: column; gap: 0.35rem; padding: 0.6rem 0.25rem; border-radius: 14px; font-size: 0.78rem; }
}
@media (prefers-reduced-motion: reduce) { .share-btn, .social-btn { transition: none; } .share-btn:hover, .social-btn:hover { transform: none; } }
@media print { .share-box { display: none !important; } }

/* ================================================================
   VOCABULARY (/spanish-shobdo, /shobdo-...)
   ================================================================ */
.vocab-main { max-width: 980px; margin: 0 auto; padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl); }
.vocab-head { margin-bottom: var(--spacing-lg); }
.vocab-kicker { margin: 0; color: var(--brand-red); font-weight: 700; letter-spacing: .02em; }
.vocab-head h1 { margin: .2rem 0 .4rem; }
.vocab-intro { color: var(--text-muted); max-width: 70ch; margin: 0 0 .6rem; }
.vocab-stats { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin: 0; }
.vocab-stats span, .vocab-stats a { padding: .2rem .7rem; border-radius: 999px; background: var(--bg-tint); border: 1px solid var(--border-color); font-size: .9rem; text-decoration: none; }
body.dark-mode .vocab-stats span, body.dark-mode .vocab-stats a { background: var(--bg-dark-soft); border-color: var(--border-dark); }

.vocab-tools { position: sticky; top: calc(var(--nav-h, 64px) + 4px); z-index: 4; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  padding: .6rem; margin: 0 0 .4rem; background: var(--bg-light); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: 0 4px 14px rgba(15, 44, 77, .06); }
body.dark-mode .vocab-tools { background: var(--bg-dark); border-color: var(--border-dark); }
.vocab-levels { display: flex; gap: .35rem; }
.vocab-levels .chip { font: inherit; padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--border-color); background: transparent; color: inherit; cursor: pointer; font-weight: 600; }
.vocab-levels .chip.is-on { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
body.dark-mode .vocab-levels .chip.is-on { background: var(--primary-color); color: var(--bg-dark); }
.vocab-search { flex: 1 1 220px; min-width: 0; font: inherit; padding: .5rem .8rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: transparent; color: inherit; }
.vocab-count { margin: .2rem 0 .8rem; color: var(--text-muted); font-size: .9rem; }

.vocab-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.vocab-card { display: grid; gap: .3rem; align-content: start; padding: .9rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-light); }
body.dark-mode .vocab-card { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.vocab-card[hidden] { display: none; }
.vocab-top { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.vocab-es { font-size: 1.2rem; font-weight: 700; color: var(--brand-navy); }
body.dark-mode .vocab-es { color: var(--primary-color); }
.vocab-tags { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.vocab-g, .vocab-lv { font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--border-color); white-space: nowrap; }
.vocab-g.g-m { color: #1d5fa8; border-color: #b9d1ee; }
.vocab-g.g-f { color: #b0306b; border-color: #efc2d7; }
.vocab-g.g-mf { color: #6a4fb0; border-color: #d6cbf0; }
.vocab-lv.lv-a1 { background: #e7f5ec; color: var(--brand-green); border-color: #bfe3cc; }
.vocab-lv.lv-a2 { background: #fff3dd; color: #8a5a00; border-color: #f1d9a6; }
body.dark-mode .vocab-g, body.dark-mode .vocab-lv { background: transparent; border-color: var(--border-dark); }
body.dark-mode .vocab-g.g-m { color: #8cb9ee; }
body.dark-mode .vocab-g.g-f { color: #f19ac3; }
body.dark-mode .vocab-g.g-mf { color: #c0aef0; }
body.dark-mode .vocab-lv.lv-a1 { color: #6fd18f; }
body.dark-mode .vocab-lv.lv-a2 { color: #f2c14e; }
.vocab-bn { margin: 0; font-size: 1.08rem; font-weight: 600; }
.vocab-say { margin: 0; color: var(--text-muted); font-size: .9rem; }
.vocab-say-label { font-weight: 600; }
.vocab-pos { opacity: .8; }
.vocab-ex { margin: .3rem 0 0; padding-top: .4rem; border-top: 1px dashed var(--border-color); font-size: .92rem; display: grid; gap: .15rem; }
.vocab-ex-bn { color: var(--text-muted); }

.vocab-practice { margin: var(--spacing-xl) 0; padding: var(--spacing-lg); border-radius: var(--radius-lg, 16px); border: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(15, 44, 77, .05), rgba(249, 171, 13, .08)), var(--bg-light); scroll-margin-top: calc(var(--nav-h, 64px) + 12px); }
body.dark-mode .vocab-practice { background: linear-gradient(135deg, rgba(76, 195, 154, .08), rgba(249, 171, 13, .06)), var(--bg-dark-soft); border-color: var(--border-dark); }
.vocab-practice h2 { margin-top: 0; }
.vp-tabs { display: flex; gap: .4rem; margin-bottom: var(--spacing-md); }
.vp-tab { font: inherit; font-weight: 700; padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--border-color); background: var(--bg-light); color: inherit; cursor: pointer; }
body.dark-mode .vp-tab { background: var(--bg-dark); border-color: var(--border-dark); }
.vp-tab.is-on { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
body.dark-mode .vp-tab.is-on { background: var(--primary-color); color: var(--bg-dark); }
.vp-panel[hidden] { display: none; }
.vp-progress { color: var(--text-muted); font-size: .9rem; margin: 0 0 .6rem; }
.vp-card { min-height: 190px; display: grid; place-items: center; text-align: center; gap: .6rem; padding: 1.4rem 1rem; border-radius: var(--radius-lg, 16px);
  background: var(--bg-light); border: 1px solid var(--border-color); box-shadow: 0 8px 24px rgba(15, 44, 77, .08); }
body.dark-mode .vp-card { background: var(--bg-dark); border-color: var(--border-dark); }
.vp-card.is-flipped { border-color: var(--brand-gold); }
.vp-front { display: grid; gap: .4rem; justify-items: center; }
.vp-es { font-size: 1.8rem; font-weight: 800; color: var(--brand-navy); }
body.dark-mode .vp-es { color: var(--primary-color); }
.vp-g { font-size: .8rem; color: var(--text-muted); }
.vp-back { display: grid; gap: .2rem; }
.vp-back[hidden] { display: none; }
.vp-bn { margin: 0; font-size: 1.35rem; font-weight: 700; }
.vp-say { margin: 0; color: var(--text-muted); }
.vp-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .8rem; }
.vp-actions [hidden], .vp-next[hidden] { display: none; }
.vp-hint { text-align: center; color: var(--text-muted); font-size: .88rem; }
.vp-done, .vp-result { text-align: center; display: grid; gap: .5rem; justify-items: center; }
.vp-q { display: grid; gap: .3rem; justify-items: center; text-align: center; margin-bottom: .8rem; }
.vp-q-label { margin: 0; color: var(--text-muted); }
.vp-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem; }
.vp-option { font: inherit; font-size: 1rem; text-align: left; padding: .75rem 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-light); color: inherit; cursor: pointer; }
body.dark-mode .vp-option { background: var(--bg-dark); border-color: var(--border-dark); }
.vp-option:hover:not(:disabled) { border-color: var(--brand-navy); }
.vp-option.is-right { background: #e3f3e8; border-color: var(--brand-green); color: #0d3d22; }
.vp-option.is-wrong { background: #fde8e7; border-color: var(--brand-red); color: #6b1010; }
.vp-feedback { min-height: 1.4em; font-weight: 700; margin: .6rem 0; }
.vp-feedback.ok { color: var(--brand-green); }
.vp-feedback.bad { color: var(--brand-red); }
body.dark-mode .vp-feedback.ok { color: #6fd18f; }
.vp-score { font-size: 2.2rem; font-weight: 800; margin: 0; }
.vp-best { color: var(--text-muted); margin: 0; }

.vocab-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: center; margin: var(--spacing-lg) 0; }
.vocab-pager a { text-decoration: none; font-weight: 600; }
.vocab-pager .vp-next { text-align: right; }
.vocab-pager .vp-all { padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--border-color); }
.vocab-note { color: var(--text-muted); font-size: .88rem; border-top: 1px solid var(--border-color); padding-top: var(--spacing-md); }

.vocab-topics { list-style: none; padding: 0; margin: 0 0 var(--spacing-lg); display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.vocab-topic { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-light); color: inherit; text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease; }
body.dark-mode .vocab-topic { background: var(--bg-dark-soft); border-color: var(--border-dark); }
.vocab-topic:hover, .vocab-topic:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 44, 77, .1); }
.vt-icon { font-size: 1.8rem; }
.vt-text { display: grid; flex: 1; min-width: 0; }
.vt-title { font-weight: 700; }
.vt-es { color: var(--text-muted); font-size: .88rem; }
.vt-count { font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; background: var(--bg-tint); white-space: nowrap; }
body.dark-mode .vt-count { background: var(--bg-dark); }
.vocab-howto { padding: var(--spacing-md) var(--spacing-lg); border-left: 4px solid var(--brand-gold); background: var(--bg-tint); border-radius: var(--radius-md); }
body.dark-mode .vocab-howto { background: var(--bg-dark-soft); }

.vocab-promo { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin: var(--spacing-lg) 0; padding: var(--spacing-lg);
  border-radius: var(--radius-lg, 16px); border: 1px solid var(--border-color); background: linear-gradient(135deg, rgba(249, 171, 13, .12), rgba(2, 82, 47, .08)), var(--bg-light); }
body.dark-mode .vocab-promo { background: linear-gradient(135deg, rgba(249, 171, 13, .1), rgba(76, 195, 154, .08)), var(--bg-dark-soft); border-color: var(--border-dark); }
.vocab-promo h2 { margin: 0 0 .3rem; font-size: 1.2rem; }
.vocab-promo p { margin: 0 0 .4rem; }
.vocab-promo-topics { display: flex; flex-wrap: wrap; gap: .35rem; }
.vocab-promo-topics a { font-size: .85rem; padding: .15rem .6rem; border-radius: 999px; background: var(--bg-light); border: 1px solid var(--border-color); text-decoration: none; }
body.dark-mode .vocab-promo-topics a { background: var(--bg-dark); border-color: var(--border-dark); }
@media (max-width: 560px) {
  .vocab-list { grid-template-columns: 1fr; }
  .vocab-pager { grid-template-columns: 1fr; text-align: center; }
  .vocab-pager .vp-next { text-align: center; }
  .vp-es { font-size: 1.5rem; }
}
@media print { .vocab-tools, .vocab-practice, .vocab-pager { display: none !important; } }

/* ---------------------------------------------------------------
   Learning path split into levels (Learning Spanish: A1 and A2).
   Two big buttons, one per level; the chosen one is filled in.
   --------------------------------------------------------------- */
.path-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin: 0 0 var(--spacing-lg); }
.path-switch-btn {
    display: flex; align-items: center; gap: 0.9rem; width: 100%; text-align: left; cursor: pointer;
    padding: 1.1rem 1.2rem; border-radius: 16px; border: 2px solid var(--border-color);
    background: var(--bg-light); color: var(--text-dark); font: inherit;
    box-shadow: 0 2px 8px rgba(15, 44, 77, 0.06); transition: border-color .2s, box-shadow .2s, transform .2s;
}
.path-switch-btn:hover { border-color: var(--primary-color); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 44, 77, 0.1); }
.path-switch-btn:focus-visible { outline: 3px solid var(--highlight-color); outline-offset: 2px; }
.path-switch-btn.is-on { border-color: var(--primary-color); background: var(--primary-color); color: #fff; }
.psw-icon { font-size: 2.2rem; line-height: 1; flex: none; }
.psw-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.psw-title { font-size: 1.3rem; font-weight: 800; letter-spacing: 0.01em; }
.psw-sub { font-size: 0.92rem; line-height: 1.35; opacity: 0.85; }
.psw-meta { font-size: 0.85rem; font-weight: 600; margin-top: 0.2rem; opacity: 0.9; }
.path-switch-btn.is-complete .psw-meta::after { content: ' ✓'; }
.path-section-head { margin: 0 0 var(--spacing-md); padding: 1rem 1.2rem; border-radius: 14px; background: var(--bg-tint); border-left: 5px solid var(--highlight-color); }
.path-section-head h3 { margin: 0 0 0.3rem; font-size: 1.35rem; }
.path-section-head p { margin: 0; color: var(--text-muted); line-height: 1.6; }
.path-section[hidden] { display: none; }
@media (max-width: 560px) {
    .path-switch { gap: 0.6rem; }
    .path-switch-btn { flex-direction: column; align-items: flex-start; gap: 0.45rem; padding: 0.9rem; }
    .psw-icon { font-size: 1.8rem; }
    .psw-title { font-size: 1.15rem; }
    .psw-sub { font-size: 0.82rem; }
}
body.dark-mode .path-switch-btn { background: var(--bg-dark-soft); color: var(--text-light); border-color: var(--border-dark); }
body.dark-mode .path-switch-btn.is-on { background: var(--highlight-color); color: var(--brand-navy-deep); border-color: var(--highlight-color); }
body.dark-mode .path-section-head { background: var(--bg-dark-soft); }
body.dark-mode .path-section-head p { color: #B8C4D0; }

/* ---------------------------------------------------------------
   Account: the header button and the "save your progress" window.
   --------------------------------------------------------------- */
.account-btn {
    order: 10; display: inline-flex; align-items: center; gap: 0.4rem; margin-left: 0.9rem;
    padding: 0.45rem 0.85rem; border-radius: 999px; border: 2px solid var(--border-color);
    background: var(--bg-light); color: var(--primary-color); font: inherit; font-weight: 700; font-size: 0.9rem;
    cursor: pointer; position: relative; white-space: nowrap; transition: border-color .2s, background .2s;
}
.account-btn:hover { border-color: var(--primary-color); }
.account-btn:focus-visible { outline: 3px solid var(--highlight-color); outline-offset: 2px; }
.account-btn.is-signed-in { border-color: var(--success-color); color: var(--success-color); }
.account-btn.is-signed-in::after {
    content: ''; position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%;
    background: #1DB954; border: 2px solid var(--bg-light);
}
/* A save just went through: the green dot pulses once. */
.account-btn.just-saved::after { animation: acct-saved 0.9s ease-out 2; }
@keyframes acct-saved { 0% { box-shadow: 0 0 0 0 rgba(29, 185, 84, 0.7); } 100% { box-shadow: 0 0 0 9px rgba(29, 185, 84, 0); } }
@media (prefers-reduced-motion: reduce) { .account-btn.just-saved::after { animation: none; } }
.sim-resumed { margin: 0 0 0.5rem; padding: 0.45rem 0.8rem; border-radius: 10px; background: rgba(29, 185, 84, 0.12); font-size: 0.88rem; }
.nav-container .nav-menu { margin-left: auto; }
@media (max-width: 1024px) {
    .account-btn { order: 0; margin-left: auto; margin-right: 0.6rem; padding: 0.4rem 0.6rem; }
    .account-btn-text { display: none; }
}
body.dark-mode .account-btn { background: var(--bg-dark-soft); color: var(--text-light); border-color: var(--border-dark); }
body.dark-mode .account-btn.is-signed-in { border-color: #1DB954; color: #7CE0A3; }

.acct-dialog {
    width: min(460px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: none; border-radius: 20px;
    background: var(--bg-light); color: var(--text-dark); box-shadow: 0 24px 60px rgba(7, 26, 47, 0.35); overflow: auto;
}
.acct-dialog::backdrop { background: rgba(7, 26, 47, 0.55); }
.acct-dialog[open]:not([role]) { position: fixed; inset: 0; margin: auto; z-index: 2000; }
.acct-box { padding: 1.4rem 1.4rem 1.2rem; }
.acct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; }
.acct-head h2 { margin: 0; font-size: 1.35rem; line-height: 1.35; color: var(--primary-color); }
.acct-close { border: none; background: var(--bg-tint); color: var(--text-dark); width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; cursor: pointer; flex: none; }
.acct-lead { margin: 0 0 1rem; line-height: 1.65; color: var(--text-muted); }
.acct-form { display: flex; flex-direction: column; gap: 0.85rem; margin: 0 0 0.8rem; }
.acct-form h3 { margin: 0.4rem 0 0; font-size: 1.05rem; }
.acct-field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
.acct-input {
    width: 100%; box-sizing: border-box; padding: 0.8rem 0.9rem; font: inherit; font-size: 1.05rem;
    border: 2px solid var(--border-color); border-radius: 12px; background: var(--bg-light); color: var(--text-dark);
}
.acct-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(15, 44, 77, 0.15); }
.acct-code { letter-spacing: 0.4em; font-size: 1.4rem; text-align: center; }
.acct-pass { position: relative; display: block; }
.acct-pass .acct-input { padding-right: 3rem; }
.acct-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none; font-size: 1.1rem; cursor: pointer; padding: 0.4rem; }
.acct-go { width: 100%; padding: 0.85rem; font-size: 1.05rem; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.4rem 0 0.8rem; }
.acct-actions .btn { flex: 1 1 auto; text-align: center; }
.acct-link { border: none; background: none; padding: 0; color: var(--primary-color); text-decoration: underline; cursor: pointer; font: inherit; }
.acct-note { margin: 0 0 0.6rem; font-size: 0.92rem; color: var(--text-muted); line-height: 1.6; }
.acct-fine { margin: 0.6rem 0 0; font-size: 0.82rem; color: var(--text-muted); line-height: 1.55; border-top: 1px solid var(--border-color); padding-top: 0.7rem; }
.acct-email { margin: 0 0 0.4rem; font-weight: 700; font-size: 1.05rem; word-break: break-all; }
.acct-saved { margin: 0 0 1rem; color: var(--success-color); font-weight: 600; }
.acct-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0 0 1rem; }
.acct-chip { background: var(--bg-tint); border-radius: 12px; padding: 0.6rem 0.3rem; text-align: center; display: flex; flex-direction: column; gap: 0.15rem; }
.acct-chip strong { font-size: 1.35rem; color: var(--primary-color); }
.acct-chip span { font-size: 0.78rem; color: var(--text-muted); }
.acct-msg { margin: 0 0 0.5rem; padding: 0.6rem 0.8rem; border-radius: 10px; font-size: 0.92rem; line-height: 1.5; }
.acct-msg.bad { background: #FDECEE; color: #9B0716; }
.acct-msg.good { background: #E6F4EC; color: #02522F; }
.acct-settings { margin-top: 0.4rem; border-top: 1px solid var(--border-color); padding-top: 0.8rem; }
.acct-settings summary { cursor: pointer; font-weight: 700; color: var(--primary-color); }
.acct-danger { background: #B00716; color: #fff; border: none; }
.acct-nudge { margin: 1.2rem 0 0; padding: 1rem 1.1rem; border-radius: 14px; background: #FFF8E6; border: 1px solid #F3D48A; }
.acct-nudge p { margin: 0 0 0.7rem; line-height: 1.6; }
@media (max-width: 420px) { .acct-chips { grid-template-columns: repeat(2, 1fr); } .acct-box { padding: 1.1rem; } }
body.dark-mode .acct-dialog { background: var(--bg-dark-soft); color: var(--text-light); }
body.dark-mode .acct-head h2, body.dark-mode .acct-chip strong, body.dark-mode .acct-link, body.dark-mode .acct-settings summary { color: var(--highlight-color); }
body.dark-mode .acct-input { background: var(--bg-dark); color: var(--text-light); border-color: var(--border-dark); }
body.dark-mode .acct-chip, body.dark-mode .acct-close { background: var(--bg-dark); color: var(--text-light); }
body.dark-mode .acct-lead, body.dark-mode .acct-note, body.dark-mode .acct-fine, body.dark-mode .acct-chip span { color: #B8C4D0; }
body.dark-mode .acct-nudge { background: #2A2410; border-color: #6B5A1E; }

/* ================================================================
   PHONE HERO: Search, Guides and Exams in one row (v1.119)
   The search field stays closed on phones until the Search button opens
   it (HeroSearchToggle in main.js), so it is never mistaken for something
   to fill in before using the site. Without JavaScript the field shows.
   ================================================================ */
.hero-search-toggle { display: none; }

@media (max-width: 640px) {
    .js .hero-search-toggle { display: inline-flex; }
    .js .hero-search:not(.is-open) { display: none; }
    .js .hero-search.is-open { display: flex; margin: 0 0 var(--spacing-sm); }
    .hero-buttons {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.5rem;
    }
    .hero-buttons .btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        justify-content: center;
        padding: 0.65rem 0.4rem;
        font-size: 0.92rem;
        white-space: nowrap;
    }
    .hero-search-toggle[aria-expanded="true"] { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
}

/* ================================================================
   PHONES HELD SIDEWAYS (v1.119)
   A wide but short screen: slimmer header, a smaller headline, and the
   hero in two columns (text beside the numbers) so the width is used
   instead of stacking everything under a tall header.
   ================================================================ */
@media (orientation: landscape) and (max-height: 520px) {
    :root { --nav-h: 60px; }
    .logo-img { height: 32px; }
    .nav-container { min-height: 60px; padding-top: 0.35rem; padding-bottom: 0.35rem; }
    .nav-menu.open { max-height: calc(100vh - 70px); }
    .hero { padding: var(--spacing-md) var(--spacing-md); min-height: 0; }
    .hero-inner {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        gap: var(--spacing-md);
        align-items: start;
    }
    .hero-content { max-width: none; }
    .hero h1 { font-size: clamp(1.4rem, 3.6vw, 1.9rem); line-height: 1.25; margin-bottom: 0.5rem; }
    .hero-sub { font-size: 0.95rem; margin-bottom: 0.6rem; }
    .hero-eyebrow { margin-bottom: 0.4rem; }
    .hero-buttons { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .hero-buttons .btn { width: auto; flex: 1 1 auto; }
    .hero-side { display: flex; flex-direction: column; gap: var(--spacing-sm); }
    .hero-stat { padding: var(--spacing-sm) 4px; }
    .hero-stat-l { font-size: 0.78rem; }
    .category-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .consent-wall:not(.is-docked) .consent-box { max-height: calc(100vh - 1rem); padding: var(--spacing-sm) var(--spacing-md); }
    .acct-dialog { max-height: calc(100vh - 16px); }
}

/* ---------- English quick guide + language switch ---------- */
.guide-en {
    margin: var(--spacing-md) 0 var(--spacing-lg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(15, 44, 77, 0.04), rgba(15, 44, 77, 0) 60%), var(--bg-light);
    box-shadow: 0 8px 24px rgba(15, 44, 77, 0.06);
    overflow: hidden;
    scroll-margin-top: 90px;
}
.guide-switch {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    margin: 10px; padding: 4px; border-radius: 999px;
    background: rgba(15, 44, 77, 0.07);
}
.guide-switch-btn {
    border: 0; border-radius: 999px; padding: 0.55rem 0.8rem; background: transparent;
    font: inherit; font-weight: 700; font-size: 0.92rem; color: var(--text-muted); cursor: pointer;
    transition: background .2s, color .2s, box-shadow .2s;
}
.guide-switch-btn span[aria-hidden] {
    display: inline-block; margin-right: 0.35rem; padding: 0 0.35rem; border-radius: 6px;
    font-size: 0.7rem; letter-spacing: 0.05em; background: rgba(15, 44, 77, 0.1);
}
.guide-switch-btn[aria-pressed="true"] { background: var(--bg-light); color: var(--primary-color); box-shadow: 0 2px 8px rgba(15, 44, 77, 0.12); }
.guide-switch-btn:focus-visible { outline: 3px solid var(--highlight-color); outline-offset: 2px; }
.guide-en-body { padding: 0 var(--spacing-md) var(--spacing-md); }
.guide-en-kicker { margin: 0.4rem 0 0.2rem; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-red, #E3081C); }
.guide-en-body h2 { margin: 0 0 0.6rem; font-size: 1.3rem; line-height: 1.35; }
.guide-en-body h3 { margin: 1.1rem 0 0.5rem; font-size: 1.02rem; }
.guide-en-body > p { margin: 0 0 0.8rem; line-height: 1.7; }
.guide-faq details { border-top: 1px solid var(--border-color); }
.guide-faq details:last-child { border-bottom: 1px solid var(--border-color); }
.guide-faq summary { cursor: pointer; padding: 0.7rem 0; font-weight: 700; list-style: none; position: relative; padding-right: 1.6rem; }
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-faq summary::after { content: '+'; position: absolute; right: 0.2rem; top: 0.55rem; font-size: 1.2rem; color: var(--text-muted); }
.guide-faq details[open] summary::after { content: '–'; }
.guide-faq details p { margin: 0 0 0.8rem; color: var(--text-muted); line-height: 1.65; }
.guide-en-note { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.guide-open-bn { width: 100%; margin-top: 0.4rem; }
.guide-bn { scroll-margin-top: 90px; }
/* Which half is open. Without the class (no script, crawlers) both are. */
html.guide-mode-en .guide-bn { display: none; }
html.guide-mode-bn .guide-en-body { display: none; }
html.guide-mode-bn .guide-en { margin-bottom: var(--spacing-md); box-shadow: none; }
body.dark-mode .guide-en { background: var(--bg-dark-soft); border-color: var(--border-dark); }
body.dark-mode .guide-switch { background: rgba(255, 255, 255, 0.07); }
body.dark-mode .guide-switch-btn[aria-pressed="true"] { background: var(--bg-dark, #0b1726); color: var(--text-light); }
body.dark-mode .guide-switch-btn span[aria-hidden] { background: rgba(255, 255, 255, 0.12); }
