:root {
    --font-scale: 1;
    --line-height: 1.6;

    /* Color system - use these throughout the site */
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #0b63d6;
    /* links, buttons */
    --card-bg: rgba(255, 255, 255, 0.9);
    --muted: rgba(0, 0, 0, 0.6);
}

/* Scale rem units site-wide: this ensures components using rem values (e.g., headings) scale when --font-scale changes */
html {
    font-size: calc(100% * var(--font-scale));
    /* 100% = browser default (typically 16px) */
}

body {
    font-size: 1rem;
    /* keep body at 1rem so rem units inside elements scale with html */
    line-height: var(--line-height);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.2s ease;
}

/* Mode adjustments using variables */
/* Dark Mode: comfortable low-light theme (preserves decoration) */
body.dark-mode {
    --bg-color: #121212;
    --text-color: #eaeaea;
    /* light gray */
    --accent-color: #6fb7ff;
    /* mild blue accent for dark mode */
    --card-bg: #1e1e1e;
    --muted: rgba(255, 255, 255, 0.65);
}

/* High-Contrast Mode: strict accessibility-first theme (black + yellow) */
body.high-contrast {
    --bg-color: #000000;
    --text-color: #ffff00;
    /* yellow for maximum contrast */
    --accent-color: #ffff00;
    /* accents also yellow */
    --card-bg: #000000;
    --muted: rgba(255, 255, 0, 0.8);
}

/* Safety overrides: dark-mode keeps decoration where possible; high-contrast strips decorations for legibility */
body.dark-mode [style] {
    color: var(--text-color) !important;
    /* preserve background images/gradients in dark mode where they don't affect readability */
}

body.high-contrast [style] {
    color: var(--text-color) !important;
    text-shadow: none !important;
}

/* Background handling: be gentle in dark-mode; strict in high-contrast */
body.dark-mode [style*="background"] {
    /* do not forcibly remove gradients in dark-mode; just ensure text color is readable */
    color: var(--text-color) !important;
}

body.high-contrast [style*="background"] {
    background: var(--card-bg) !important;
    background-image: none !important;
    border-color: var(--text-color) !important;
}

/* Ensure major site components follow the mode variables */
body.dark-mode .bank-header,
body.high-contrast .bank-header,
body.dark-mode .navbar,
body.high-contrast .navbar,
body.dark-mode .footer-premium,
body.high-contrast .footer-premium,
body.dark-mode .card,
body.high-contrast .card,
body.dark-mode .president-message-card,
body.high-contrast .president-message-card {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Accessibility toolbar buttons in dark/contrast: make buttons visible (yellow background with dark text) */
body.dark-mode .accessibility-bar button,
body.high-contrast .accessibility-bar button {
    background: var(--accent-color) !important;
    color: var(--bg-color) !important;
    border-color: var(--text-color) !important;
}

/* Ensure links are visible in high-contrast/dark */
body.dark-mode a,
body.high-contrast a,
body.dark-mode .nav-link,
body.high-contrast .nav-link,
body.dark-mode .dropdown-item,
body.high-contrast .dropdown-item {
    color: var(--accent-color) !important;
}

/* Make sure footer icons use mode text color for readability */
body.dark-mode .footer-premium .footer-icon,
body.high-contrast .footer-premium .footer-icon {
    color: var(--text-color) !important;
}


/* Keep line-height and colors inherited, but do not override explicit element font-size values (so rem and px sizes still scale via html font-size) */
body * {
    line-height: inherit;
    background-color: transparent;
    color: inherit;
}

body {
    font-size: calc(1rem * var(--font-scale));
    line-height: var(--line-height);
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Global component colors using variables */
a,
.nav-link,
.dropdown-item {
    color: var(--accent-color);
}

.navbar,
.bank-header {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.footer-premium {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.card,
.service-card {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.dropdown-menu {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: rgba(0, 0, 0, 0.06);
}

/* make sure buttons and controls remain visible in modes */
button,
.btn {
    color: var(--text-color);
}

/* Muted text */
.text-muted,
small {
    color: var(--muted);
}


.card,
.service-card {
    background-color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .card,
body.dark-mode .service-card {
    background-color: #1e1e1e;
}

/* Header & navbar overrides so the branded header doesn't clash with modes */
.bank-header {
    /* keep original gradient by default */
    background: linear-gradient(135deg, #ff0000, #0400ff, #ff0000);
}

/* When in dark-mode, slightly darken the branded header (keep a subtle gradient). High-contrast uses a solid background. */
body.dark-mode .bank-header {
    background: linear-gradient(135deg, #2b0000, #001022) !important;
    color: var(--text-color) !important;
}

body.high-contrast .bank-header {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .navbar {
    background: linear-gradient(180deg, rgba(18, 18, 18, 0.9), rgba(20, 20, 20, 0.8)) !important;
    color: var(--text-color) !important;
}

body.high-contrast .navbar {
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
}

/* High contrast link overrides to ensure readability */
body.high-contrast a,
body.high-contrast .nav-link,
body.high-contrast .dropdown-item {
    color: var(--accent-color) !important;
}

body.high-contrast .footer-premium {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* ========= Mode safety overrides ========= */
/* Ensure elements with inline styles (common across the site) adapt to the current mode for readability */
body.high-contrast [style] {
    color: var(--text-color) !important;
    background-color: transparent !important;
    border-color: var(--text-color) !important;
    text-shadow: none !important;
}

/* Dark mode: prefer site text color for inline-styled elements to avoid unreadable colors */
body.dark-mode [style] {
    color: var(--text-color) !important;
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
    text-shadow: none !important;
}

/* Additional safety: make headings and general text use the mode text color when necessary */
body.high-contrast h1,
body.high-contrast h2,
body.high-contrast h3,
body.high-contrast h4,
body.high-contrast h5,
body.high-contrast h6,
body.high-contrast p,
body.high-contrast span {
    color: var(--text-color) !important;
}

/* Improve keyboard focus visibility */
:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

body.high-contrast :focus {
    outline-color: var(--text-color);
    outline-offset: 2px;
}

/* ===== Dark-mode: neutralize decorative inline-colored spans for readability ===== */
/* Many pages use <span style="color:...; text-shadow:..."> for decorative headings.
   In dark-mode those can become hard to read. Force such spans to use the mode text color. */
body.dark-mode span[style*="color:"],
body.dark-mode [style*="text-shadow"] {
    color: var(--text-color) !important;
    text-shadow: none !important;
}

/* ===== Dropdown and Accordion (FAQ) mode rules ===== */
.dropdown-menu {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

.dropdown-item {
    color: var(--text-color) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(255, 255, 0, 0.12) !important;
    color: var(--bg-color) !important;
}

/* Accordion (FAQ) */
.accordion-button {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    box-shadow: none !important;
}

.accordion-button::after {
    filter: invert(100%);
    /* try to make chevron visible; browsers may vary */
}

/* Dark mode: subtle highlight */
body.dark-mode .accordion-button:not(.collapsed) {
    background-color: rgba(111, 183, 255, 0.06) !important;
    color: var(--bg-color) !important;
}

/* High-contrast: strong yellow highlight */
body.high-contrast .accordion-button:not(.collapsed) {
    background-color: var(--accent-color) !important;
    color: var(--bg-color) !important;
}

.accordion-body {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.04) !important;
}

/* Force section headings/trims that use gradients to be visible in modes */
body.dark-mode .mx-auto.mb-3,
body.high-contrast .mx-auto.mb-3 {
    background: linear-gradient(90deg, rgba(255, 255, 0, 0.10), rgba(255, 255, 0, 0.06)) !important;
}

/* Ensure any inline gradient bars are toned down in modes */
body.dark-mode [style*="linear-gradient"],
body.high-contrast [style*="linear-gradient"] {
    background: linear-gradient(90deg, rgba(255, 255, 0, 0.08), rgba(255, 255, 0, 0.04)) !important;
}

/* Extra safety: turn any white card-like sections dark in modes */
body.dark-mode .president-message-card,
body.dark-mode .ceo-message-card,
body.dark-mode .president-message-section,
body.high-contrast .president-message-card,
body.high-contrast .ceo-message-card,
body.high-contrast .president-message-section {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* ===== History page specific overrides ===== */
/* Replace light section background and text-dark with mode-safe colors */
body.dark-mode .bg-light,
body.high-contrast .bg-light {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .text-dark,
body.high-contrast .text-dark {
    color: var(--text-color) !important;
}

/* Nav tabs (History page) */
body.dark-mode .nav-tabs .nav-link,
body.high-contrast .nav-tabs .nav-link {
    color: var(--text-color) !important;
    background: transparent !important;
}

body.dark-mode .nav-tabs .nav-link.active::after,
body.high-contrast .nav-tabs .nav-link.active::after {
    background-color: var(--accent-color) !important;
}

/* Overlay text on banner */
body.dark-mode .overlay-text,
body.high-contrast .overlay-text {
    color: var(--text-color) !important;
    text-shadow: none !important;
}

/* Image tint for large banners to ensure readability */
body.dark-mode .image-text-full img,
body.high-contrast .image-text-full img {
    filter: brightness(0.35) contrast(0.9) !important;
}

/* Card containers used inside tabs */
body.dark-mode .tab-pane .p-4,
body.high-contrast .tab-pane .p-4 {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
}

/* ===== Branches page overrides ===== */
/* Inline gradient container (top section) */
body.dark-mode .container[style*="linear-gradient"],
body.high-contrast .container[style*="linear-gradient"] {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* Branch cards */
.branch-card {
    background: #f5f5f5;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
    /* visible border for normal mode */
}

body.dark-mode .branch-card,
body.high-contrast .branch-card {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--accent-color) !important;
    /* yellow border in modes */
}

/* Ensure headings and small text inside branch cards are visible */
body.dark-mode .branch-card h5,
body.high-contrast .branch-card h5,
body.dark-mode .branch-card p,
body.high-contrast .branch-card p {
    color: var(--text-color) !important;
}

/* Banner overlay colors */
body.dark-mode .overlay-text,
body.high-contrast .overlay-text {
    color: var(--text-color) !important;
}

/* Dim large banner images to keep overlay readable */
body.dark-mode .image-text-full img,
body.high-contrast .image-text-full img {
    filter: brightness(0.35) contrast(0.9) !important;
}

/* ===== Our Services adjustments ===== */
/* Make service-card headings and descriptions clearly visible in dark/high-contrast modes */
body.dark-mode #our-services .service-card h5,
body.dark-mode #our-services .service-card p,
body.dark-mode #our-services .service-card .text-muted {
    color: #ffffff !important;
    /* white in dark-mode */
}

body.high-contrast #our-services .service-card h5,
body.high-contrast #our-services .service-card p,
body.high-contrast #our-services .service-card .text-muted {
    color: var(--text-color) !important;
    /* yellow in high-contrast */
}

/* ===== Financial Status page overrides ===== */
/* Banner overlay color and image tint */
body.dark-mode .image-text-full .overlay-text,
body.high-contrast .image-text-full .overlay-text {
    color: var(--text-color) !important;
    text-shadow: none !important;
}

body.dark-mode .image-text-full img,
body.high-contrast .image-text-full img {
    filter: brightness(0.35) contrast(0.9) !important;
}

/* Table header (explicit inline background-color:#0a3d78) - make readable in modes */
body.dark-mode thead[style*="#0a3d78"],
body.high-contrast thead[style*="#0a3d78"],
body.dark-mode thead,
body.high-contrast thead {
    background-color: var(--accent-color) !important;
    color: var(--bg-color) !important;
}

body.dark-mode thead th,
body.high-contrast thead th {
    color: var(--bg-color) !important;
}

/* Table variants */
body.dark-mode .table-primary,
body.high-contrast .table-primary {
    background-color: rgba(255, 255, 0, 0.06) !important;
    color: var(--text-color) !important;
}

body.dark-mode .table-light,
body.high-contrast .table-light {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .table-bordered th,
body.high-contrast .table-bordered th,
body.dark-mode .table-bordered td,
body.high-contrast .table-bordered td {
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Header bars and footnote */
body.dark-mode .bg-primary,
body.high-contrast .bg-primary {
    background-color: var(--accent-color) !important;
    color: var(--bg-color) !important;
}

body.dark-mode .bg-light .text-muted,
body.high-contrast .bg-light .text-muted,
body.dark-mode .bg-light,
body.high-contrast .bg-light {
    background-color: var(--card-bg) !important;
    color: var(--muted) !important;
}

/* Ensure cards that contain tables are dark */
body.dark-mode .card,
body.high-contrast .card {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* ===== Financial table styling in modes: dark bg, yellow borders, yellow text ===== */
body.dark-mode .financial-table,
body.high-contrast .financial-table {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* Ensure all cells don't keep white backgrounds from Bootstrap */
/* Dark mode: subtle borders */
body.dark-mode .financial-table td,
body.dark-mode .financial-table th {
    background: transparent !important;
    color: var(--text-color) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* High-contrast: yellow borders */
body.high-contrast .financial-table td,
body.high-contrast .financial-table th {
    background: transparent !important;
    color: var(--text-color) !important;
    border-color: var(--accent-color) !important;
}

/* Override Bootstrap table row variation colors inside financial table */
body.dark-mode .financial-table .table-primary,
body.high-contrast .financial-table .table-primary {
    background-color: rgba(255, 255, 0, 0.06) !important;
    color: var(--text-color) !important;
}

body.dark-mode .financial-table .table-light,
body.high-contrast .financial-table .table-light {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* Make table header stand out slightly */
body.dark-mode .financial-table thead,
body.high-contrast .financial-table thead {
    background: rgba(255, 255, 0, 0.12) !important;
    color: var(--bg-color) !important;
}

/* Ensure table borders (outer) are visible */
body.dark-mode .financial-table.table-bordered,
body.high-contrast .financial-table.table-bordered {
    border: 2px solid var(--accent-color) !important;
}

/* Make sure number cells (text-end) follow the text color */
body.dark-mode .financial-table .text-end,
body.high-contrast .financial-table .text-end {
    color: var(--text-color) !important;
}

/* Ensure responsive wrapper doesn't show a white background */
body.dark-mode .table-responsive,
body.high-contrast .table-responsive {
    background: transparent !important;
}

/* Make table rows transparent by default to avoid stacked whites */
body.dark-mode .financial-table tbody tr,
body.high-contrast .financial-table tbody tr {
    background: transparent !important;
}

/* Final safety: force any inline style background on table elements to use the card bg */
body.dark-mode .financial-table [style*="background"],
body.high-contrast .financial-table [style*="background"] {
    background: var(--card-bg) !important;
}

/* ===== Team (Management) page styles ===== */
/* Force team member names and titles to be visible in dark and high-contrast modes */
body.dark-mode .team-card h5,
body.dark-mode .team-card p {
    color: #ffffff !important;
    /* white names and titles in dark mode */
}

body.high-contrast .team-card h5,
body.high-contrast .team-card p {
    color: var(--text-color) !important;
    /* yellow names and titles in high-contrast */
}

/* ===== Rates (Loans/Deposits) card styling ===== */
.rates-card {
    /* Use a CSS variable so the default color remains the branded blue, but modes can override */
    border: 2px solid var(--rates-border, #4a00e0) !important;
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

/* In dark-mode and high-contrast, use a white border for better visibility */
body.dark-mode .rates-card,
body.high-contrast .rates-card {
    border-color: #ffffff !important;
}

/* ===== Deposit page specific mode overrides ===== */
/* Ensure deposit page section, cards and tables follow the active mode variables */
body.dark-mode .deposit-schemes,
body.high-contrast .deposit-schemes {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .scheme-card,
body.high-contrast .scheme-card {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

body.dark-mode .scheme-body h6,
body.high-contrast .scheme-body h6 {
    color: var(--text-color) !important;
}

body.dark-mode .scheme-body ul li,
body.high-contrast .scheme-body ul li {
    color: var(--text-color) !important;
}

/* Card and table within deposit rates section */
body.dark-mode .deposit-rates-section .card,
body.high-contrast .deposit-rates-section .card {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

body.dark-mode .deposit-rates-section table,
body.high-contrast .deposit-rates-section table {
    background: transparent !important;
    color: var(--text-color) !important;
}

body.dark-mode .deposit-rates-section .table thead,
body.high-contrast .deposit-rates-section .table thead {
    background: rgba(255, 255, 0, 0.06) !important;
    color: var(--bg-color) !important;
}

body.dark-mode .deposit-rates-section .table.table-bordered td,
body.high-contrast .deposit-rates-section .table.table-bordered td,
body.dark-mode .deposit-rates-section .table.table-bordered th,
body.high-contrast .deposit-rates-section .table.table-bordered th {
    border-color: rgba(255, 255, 255, 0.06) !important;
}


/* Announcement modal (site-wide) */
#siteAnnouncementModal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

#siteAnnouncementModal[hidden] {
    display: none;
}

#siteAnnouncementModal .site-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

#siteAnnouncementModal .site-modal-body {
    position: relative;
    background: var(--card-bg);
    color: var(--text-color);
    padding: 20px;
    width: min(720px, 92%);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 20001;
    max-height: 90vh;
    overflow: auto;
    outline: none;
}

#siteAnnouncementModal .site-modal-close {
    position: absolute;
    right: 10px;
    top: 10px;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-color);
    cursor: pointer;
}

#siteAnnouncementModal h2 {
    margin-top: 0;
    color: var(--accent-color);
    font-size: 1.25rem;
}

#siteAnnouncementModal p {
    margin: 0.5rem 0;
    color: var(--text-color);
}

@media (max-width:520px) {
    #siteAnnouncementModal .site-modal-body {
        width: 96%;
        padding: 16px;
    }
}




/* Skip link - visible pill at top-left for quicker discovery */
.skip-link {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 99999;
    background: none;
    color: #ffffff;
    text-decoration: underline;
    font-size: 0.85rem;
    font-weight: normal;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.skip-link.hidden {
    opacity: 0;
    pointer-events: none;
}

.skip-link:hover,
.skip-link:focus,
.skip-link:active {
    color: #e0e0e0;
    outline: none;
    transform: none;
    opacity: 1;
}

@media (max-width:480px) {
    .skip-link {
        left: 8px;
        top: 8px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

body.high-contrast .skip-link {
    background: var(--text-color) !important;
    color: var(--bg-color) !important;
    border: 2px solid var(--text-color);
}

@media (prefers-reduced-motion: reduce) {

    .skip-link,
    .skip-link:hover,
    .skip-link:focus,
    .skip-link:active {
        transition: none;
        transform: none;
    }
}