/*
 * Global layout + calculator styles (formerly inline in base.html).
 * Linked from base.html AFTER each page's {% block head %} stylesheets, so it
 * keeps the same cascade position the inline block had.
 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}
.page-shell {
    max-width: 1700px;
    margin: 0 auto;
    padding: 0 24px;
}
.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 30px;
}
.page-layout {
    width: 100%;
    margin: 0 auto;
}
.page-content {
    min-width: 0;
}
h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 10px;
}
.subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 30px;
    font-size: 0.95rem;
}
.form-group {
    margin-bottom: 20px;
}
label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}
.hint {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 4px;
}
input[type="number"], input[type="text"], select {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
}
select {
    background: white;
    cursor: pointer;
}
#baseCurrencyContainer input {
    width: 100%;
}
button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 20px;
}
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.result {
    margin-top: 30px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    display: none;
}
.result.show {
    display: block;
}
.result-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    gap: 12px;
}
.result-row:last-child {
    border-bottom: none;
}
.result-label {
    color: #718096;
    min-width: 0;
}
.result-value {
    font-weight: 600;
    color: #4a5568;
    text-align: right;
    justify-self: end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.result-value-deduction {
    color: #9f7aea;
}
.debts-row .result-label {
    color: #9f7aea;
}
.zakat-due {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
}
.zakat-due-gold {
    display: inline-block;
    position: relative;
    white-space: nowrap;
    background-image:
        linear-gradient(135deg, #7a5a00 0%, #ffd36b 20%, #fff2b3 45%, #d3a11f 70%, #7a5a00 100%),
        linear-gradient(120deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.35) 45%, rgba(255, 255, 255, 0) 70%);
    background-size: 100% 100%, 220% 100%;
    background-position: 0 0, -200% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.12);
    animation: zakat-sheen 4.2s ease-in-out infinite;
}
.zakat-due-value {
    font-size: 1.5rem;
}
@keyframes zakat-sheen {
    0%, 70% {
        background-position: 0 0, -200% 0;
    }
    85%, 100% {
        background-position: 0 0, 200% 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .zakat-due-gold {
        animation: none;
        background-position: 0 0, 0 0;
    }
}
.info-box {
    background: #ebf8ff;
    border-left: 4px solid #4299e1;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 25px;
}
.info-box p {
    color: #2c5282;
    font-size: 0.9rem;
}
.section-title {
    font-size: 1.1rem;
    color: #667eea;
    margin: 25px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}
.section-note {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #667eea;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    margin-left: 6px;
    position: relative;
}
.section-note:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.4;
    width: 280px;
    white-space: normal;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
}
.section-note:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2d3748;
    z-index: 100;
}
.section-title-debts {
    color: #9f7aea;
    border-bottom-color: #e9d8fd;
}
.subsection-title {
    font-size: 0.95rem;
    color: #718096;
    margin: 15px 0 10px;
    font-weight: 600;
}
.asset-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    min-width: 0;
}
.group-name {
    flex: 1 1 220px;
    min-width: 200px;
    order: 10;
}
.group-name .input-name {
    width: 100%;
}
.group-middle {
    flex: 1 1 260px;
    min-width: 220px;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    order: 20;
    min-width: 0;
}
.group-middle-secondary {
    flex: 1 1 240px;
    min-width: 220px;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    order: 30;
    min-width: 0;
}
.group-value {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    order: 90;
    white-space: nowrap;
}
.group-remove {
    flex: 0 0 auto;
    margin-left: auto;
    order: 100;
}
.asset-row .input-name {
    min-width: 160px;
}
.asset-row .input-weight {
    width: 120px;
    min-width: 100px;
    max-width: 120px;
}
.asset-row .input-amount {
    width: 130px;
    min-width: 110px;
    max-width: 130px;
}
.asset-row .input-karat {
    width: 80px;
    min-width: 72px;
    flex-shrink: 0;
}
.asset-row .input-currency {
    width: 70px;
}
.asset-row .input-frequency {
    width: 110px;
    min-width: 100px;
    flex-shrink: 0;
}
.btn-remove {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    padding: 4px 8px;
    opacity: 0.7;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}
.btn-remove:hover {
    opacity: 1;
}
/* Base value pill styling */
.base-value-pill {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 16px;
    min-width: 48px;
    max-width: 100px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.25);
    flex-shrink: 0;
}
.base-value-pill.pill-empty {
    justify-content: center;
    text-align: center;
}
/* Weight grams pill styling */
.weight-grams-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #4a5568;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 50px;
    max-width: 80px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.asset-row[data-type="gold"] .weight-grams-pill,
.asset-row[data-type="metal"] .weight-grams-pill {
    margin-right: 6px;
}
/* Weight unit selector styling */
.asset-row .input-weight-unit {
    width: 80px;
    min-width: 72px;
    flex-shrink: 0;
}
/* Consistent height for all asset row inputs */
.asset-row input,
.asset-row select {
    height: 48px;
    box-sizing: border-box;
}
/* Section helper text */
.section-helper {
    color: #718096;
    font-size: 0.875rem;
    margin: -8px 0 12px 0;
}
.btn-add {
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 15px;
}
.btn-add:hover {
    background: #38a169;
}
.error-message {
    background: #fed7d7;
    border-left: 4px solid #e53e3e;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-top: 15px;
    color: #742a2a;
}
.warning-message {
    background: #fefcbf;
    border-left: 4px solid #d69e2e;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    margin-top: 15px;
    color: #744210;
}
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}
.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}
input[type="date"] {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    width: 100%;
    transition: border-color 0.2s;
}
input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}
.effective-date-notice {
    background: #e6fffa;
    border-left: 4px solid #38b2ac;
    padding: 10px 15px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
    color: #234e52;
    font-size: 0.9rem;
}
.result h2 {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 1.1rem;
}
.result-section {
    margin-bottom: 16px;
}
.result-section h3 {
    color: #667eea;
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.grand-total {
    position: relative;
    padding: 10px 0;
    border-radius: 4px;
}
.grand-total::before {
    content: '';
    position: absolute;
    inset: 0 -16px;
    background: #f0f5ff;
    border-radius: 4px;
    pointer-events: none;
    z-index: 0;
}
.grand-total > * {
    position: relative;
    z-index: 1;
}
.grand-total .result-value {
    font-size: 1.1rem;
}
.zakat-row {
    position: relative;
    padding: 12px 0;
    border-radius: 4px;
}
.zakat-row::before {
    content: '';
    position: absolute;
    inset: 0 -16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 4px;
    pointer-events: none;
    z-index: 0;
}
.zakat-row > * {
    position: relative;
    z-index: 1;
}
.asset-row .input-metal {
    width: 80px;
    min-width: 72px;
}
.asset-row .currency-autocomplete {
    flex: 1 1 180px;
    min-width: 160px;
}
.asset-row .crypto-autocomplete {
    width: 160px;
    min-width: 140px;
    max-width: 160px;
    flex: 0 0 auto;
}
.asset-row .currency-autocomplete.currency-compact {
    width: 110px;
    min-width: 90px;
    max-width: 120px;
}
/* Cadence info banner styles */
.cadence-banner {
    background: #e6fffa;
    border-left: 4px solid #38b2ac;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}
.cadence-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.cadence-banner-icon {
    width: 24px;
    height: 24px;
    background: #38b2ac;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.cadence-banner-message {
    flex: 1;
    color: #234e52;
    font-size: 0.9rem;
}
.cadence-note {
    display: block;
    font-size: 0.85rem;
    color: #319795;
    margin-top: 4px;
}
.app-grid,
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}
.sidebar,
.calculator-results {
    display: grid;
    gap: 16px;
    min-width: 0;
}
.sidebar *,
.calculator-results * {
    max-width: 100%;
}
.card,
.sidebar,
.main,
.calculator-results .result,
.nisab-indicator {
    box-sizing: border-box;
}
.sidebar {
    position: static;
    transform: none !important;
    margin: 0 !important;
}
/* Keep results in view while scrolling long input lists on tall desktops */
@media (min-width: 1280px) and (min-height: 760px) {
    .calculator-results.sidebar {
        position: sticky;
        top: 20px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        padding: 2px 6px 8px 2px;
    }
}
.main {
    min-width: 0;
}

/* Full Desktop - prevent excessive whitespace between fields (>=1750px) */
@media (min-width: 1750px) {
    .group-name {
        flex: 0 0 auto;
        min-width: 200px;
        max-width: 260px;
    }
    .group-middle {
        flex: 0 0 auto;
        min-width: 0;
    }
    .group-middle-secondary {
        flex: 0 0 auto;
        min-width: 0;
    }
    .group-value {
        flex: 0 0 auto;
        margin-left: auto;
        margin-right: -2px;
    }
    .group-remove {
        margin-left: 0;
    }
    .asset-row .input-weight {
        width: 200px;
        max-width: 200px;
    }
    .asset-row .input-amount {
        width: 200px;
        max-width: 200px;
    }
    .asset-row .input-metal {
        width: 120px;
        min-width: 100px;
    }
    /* Advanced rows (property, retirement; stocks/payables in French) have more
       fields than fit in the ~816px column; let them wrap instead of running
       under the results sidebar. */
    .asset-row[data-type="stock"],
    .asset-row[data-type="retirement"],
    .asset-row[data-type="receivable"],
    .asset-row[data-type="property"],
    .asset-row[data-type="payable"] {
        flex-wrap: wrap;
    }
}

/* Desktop two-column layout (>=1280px) */
@media (min-width: 1280px) {
    body {
        padding: 30px;
    }
    .page-shell {
        padding: 0 32px;
    }
    .page-layout {
        width: 100%;
    }
    .container {
        max-width: 1320px;
    }
    .page-content {
        width: 100%;
        margin: 0;
    }
    .app-grid,
    .calculator-layout {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    }
    .calculator-inputs {
        /* Left column - form inputs */
        min-width: 0; /* Prevent grid blowout */
    }
    .calculator-results .result {
        margin-top: 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e2e8f0;
    }
}

@media (max-width: 1279px) {
    :root {
        --compact-field-width: 300px;
    }
    .app-grid,
    .calculator-layout {
        grid-template-columns: 1fr;
    }
    .asset-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .asset-row::after {
        content: "";
        flex-basis: 100%;
        order: 70;
        height: 0;
    }
    .group-middle-secondary {
        order: 80;
    }
    .asset-row[data-type="gold"] .group-middle-secondary,
    .asset-row[data-type="metal"] .group-middle-secondary,
    .asset-row[data-type="crypto"] .group-middle-secondary {
        flex: 0 1 auto;
    }
    .group-value {
        order: 90;
    }
    .group-remove {
        margin-left: 0;
        order: 100;
    }
    #baseCurrencyContainer,
    #baseCurrencyContainer input,
    #calculationDate,
    .asset-row .crypto-autocomplete {
        max-width: var(--compact-field-width);
    }
    #baseCurrencyContainer input,
    #calculationDate {
        width: 100%;
    }
}

@media (min-width: 1280px) and (max-width: 1749px) {
    :root {
        --compact-field-width: 300px;
    }
    /* Calculator only: shrink to its two columns (leaves room for ads).
       On other pages fit-content made /charities ~2600px wide (its tab row
       is max-content) and squeezed the /guides grid to one narrow column. */
    .container:has(> .calculator-layout) {
        width: fit-content;
        max-width: none;
        margin: 0 auto;
    }
    .app-grid,
    .calculator-layout {
        grid-template-columns: minmax(auto, max-content) minmax(340px, 1fr);
    }
    .calculator-inputs {
        max-width: 520px;
    }
    .asset-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .asset-row::after {
        content: "";
        flex-basis: 100%;
        order: 70;
        height: 0;
    }
    .group-name {
        flex: 0 0 auto;
        min-width: 180px;
        max-width: 240px;
    }
    .group-middle {
        flex: 0 0 auto;
        min-width: 0;
    }
    .group-middle-secondary {
        flex: 0 0 auto;
        min-width: 0;
        order: 80;
    }
    .asset-row[data-type="gold"] .group-middle-secondary,
    .asset-row[data-type="metal"] .group-middle-secondary,
    .asset-row[data-type="crypto"] .group-middle-secondary {
        flex: 0 1 auto;
    }
    .group-value {
        flex: 0 0 auto;
        order: 90;
    }
    .group-remove {
        margin-left: 0;
        order: 100;
    }
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    #baseCurrencyContainer,
    #baseCurrencyContainer input,
    #calculationDate,
    .asset-row .crypto-autocomplete {
        max-width: var(--compact-field-width);
    }
    #baseCurrencyContainer input,
    #calculationDate {
        width: 100%;
    }
}

@media (max-width: 1023px) {
    .page-shell {
        max-width: none;
        padding: 0;
    }
}


/* Mobile (<768px) */
@media (max-width: 767px) {
    .container {
        padding: 15px;
        border-radius: 0;
        margin: 0;
    }
    body {
        padding: 0;
    }
}

@media (max-width: 640px) {
    :root {
        --compact-field-width: 230px;
    }
    .group-name {
        flex: 1 1 160px;
        min-width: 140px;
    }
    .group-middle,
    .group-middle-secondary {
        flex: 1 1 170px;
        min-width: 150px;
    }
    .asset-row {
        gap: 6px;
    }
    .group-value {
        order: 90;
    }
    .group-remove {
        margin-left: 0;
        order: 100;
    }
}

@media (max-width: 600px) {
    :root {
        --compact-field-width: 210px;
    }
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    .group-name {
        flex: 1 1 150px;
        min-width: 120px;
    }
    .group-middle,
    .group-middle-secondary {
        flex: 1 1 150px;
        min-width: 120px;
    }
    .asset-row .currency-autocomplete,
    .asset-row .crypto-autocomplete {
        flex: 1 1 140px;
        min-width: 120px;
    }
    .asset-row .input-name {
        min-width: 120px;
    }
    .asset-row .input-weight {
        width: 100px;
        min-width: 85px;
        max-width: 110px;
    }
    .asset-row .input-amount {
        min-width: 110px;
    }
    .asset-row .input-weight-unit,
    .asset-row .input-karat {
        width: 64px;
        min-width: 64px;
    }
    .asset-row .input-metal {
        width: 80px;
        min-width: 80px;
    }
    .asset-row .currency-autocomplete.currency-compact {
        width: 100px;
        min-width: 85px;
        max-width: 110px;
    }
    .group-value {
        order: 90;
    }
    .group-remove {
        margin-left: 0;
        order: 100;
    }
    .base-value-pill {
        min-width: 42px;
    }
    .sync-banner-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .btn-sync {
        width: 100%;
        text-align: center;
    }
}
/* Header + navigation */
.site-header {
    max-width: 1320px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.site-nav a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.site-nav a:hover {
    background: rgba(255, 255, 255, 0.18);
    color: white;
}
.site-nav a.active {
    background: rgba(255, 255, 255, 0.95);
    color: #5a67d8;
}
.site-nav .contribute-btn {
    background: #f6e05e;
    color: #744210;
    font-weight: 700;
    margin-left: 6px;
}
.site-nav .contribute-btn:hover {
    background: #ecc94b;
    color: #5f370e;
}
@media (max-width: 1023px) {
    .site-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 12px;
        padding: 12px 16px 0;
    }
    /* Single scrollable row instead of 3 wrapped rows of buttons */
    .site-nav {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        margin: 0 -16px;
        padding-left: 16px;
        padding-right: 16px;
        scroll-padding-inline: 16px;
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 24px), transparent 100%);
    }
    .site-nav::-webkit-scrollbar {
        display: none;
    }
    .site-nav a {
        padding: 7px 12px;
        font-size: 0.88rem;
        background: rgba(255, 255, 255, 0.12);
    }
    .site-nav .contribute-btn {
        order: 99;
        margin-left: 0;
    }
}
@media (min-width: 1024px) and (max-width: 1279px) {
    .site-header {
        padding: 0 4px;
    }
}

/* Language switcher (EN | FR) */
.lang-switch {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
}
.lang-option {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}
a.lang-option:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.lang-option.is-current {
    background: rgba(255, 255, 255, 0.95);
    color: #5a67d8;
}
@media (max-width: 1023px) {
    /* Phones/tablets: scrollable nav row with the switcher pinned on its right */
    .site-header {
        flex-direction: row;
        align-items: center;
    }
    .site-nav {
        flex: 1 1 auto;
        min-width: 0;
        margin-right: 0;
        padding-right: 8px;
    }
    .lang-switch {
        margin-bottom: 4px;
    }
}

.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;
}

/* Footer */
.site-footer {
    max-width: 1320px;
    margin: 28px auto 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    text-align: center;
}
.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
    margin-bottom: 8px;
}
.site-footer a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
}
.site-footer a:hover {
    text-decoration: underline;
}
.site-footer .footer-disclaimer {
    max-width: 640px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}
@media (max-width: 767px) {
    .site-footer {
        padding: 0 16px 24px;
    }
}

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.55);
    outline-offset: 2px;
}
.site-header a:focus-visible,
.site-footer a:focus-visible {
    outline-color: #fff;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
