/* =========================================================
   MEGHALAYA SIGN-LEX — DBIM THEME
   DESIGN TOKENS: the one place for colours and font sizes.

   Load order:
     1. bootstrap.min.css
     2. dbim-theme.css        <-- this file
     3. base.css
     4. main.css
     5. page CSS (dashboard.css, style.css, style2.css)

   base.css, main.css, dashboard.css and style2.css only use these
   variables: change a colour or size here and it changes everywhere.

   Sizes are rem on a 16px root (1rem = 16px). The px scale is the
   same as the DBIM reference sheet (36 / 24 / 20 / 18 / 16 / 14 / 12),
   but the root stays at 100% so Bootstrap 5 spacing, gutters and
   components keep their normal size. Changing html font-size (A+ / A-
   buttons) scales all text together.
   ========================================================= */


/* ---------- Noto Sans (self-hosted, static/webfonts/) ---------- */

/* Noto Sans — normal */
@font-face {
    font-family: "Noto Sans";
    src: url("../webfonts/NotoSans-VariableFont_wdth,wght.ttf") format("truetype");
    font-style: normal;
    font-weight: 100 900;
    font-stretch: 62.5% 100%;
    font-display: swap;
}

/* Noto Sans — italic */
@font-face {
    font-family: "Noto Sans";
    src: url("../webfonts/NotoSans-Italic-VariableFont_wdth,wght.ttf") format("truetype");
    font-style: italic;
    font-weight: 100 900;
    font-stretch: 62.5% 100%;
    font-display: swap;
}


:root {
    /* ---------- Primary palette (DBIM teal) ---------- */
    --dbim-teal-900: #0F5757;   /* key colour, darkest — 8.3:1 on white. Text, buttons, links */
    --dbim-teal-950: #0A4141;   /* key colour, hover / pressed — 11.4:1 */
    --dbim-teal-700: #2D8686;   /* icons, borders, large headings only — 4.3:1, not for small text */
    --dbim-teal-500: #75BDBD;   /* accents, decoration — never text */
    --dbim-teal-300: #A6D9D9;   /* hover fills, dividers */
    --dbim-teal-100: #D9F2F2;   /* light panels */
    --dbim-shadow-rgb: 15, 87, 87;  /* key colour as RGB, for shadows and overlays */

    /* ---------- Functional palette (DBIM 2.2) ---------- */
    --dbim-white: #FFFFFF;
    --dbim-black: #000000;
    --dbim-dark-text: #150202;
    --dbim-deep-earthy-brown: #150202;
    --dbim-linen: #EBEAEA;
    --dbim-liberty-green: #198754;   /* success — 4.5:1 on white */
    --dbim-mustard-yellow: #FFC107;  /* warning — background only, use dark text on it */
    --dbim-coral-red: #DC3545;       /* error — 4.5:1 on white */
    --dbim-info-blue: #0D6EFD;
    --dbim-grey-01: #C6C6C6;         /* light borders */
    --dbim-grey-02: #8E8E8E;         /* borders */
    --dbim-grey-03: #606060;         /* strong borders, form fields */

    /* ---------- Text, lines and surfaces (built from the palette) ---------- */
    --dbim-text-strong: var(--dbim-dark-text);  /* headings — 20:1 */
    --dbim-charcoal: #22242A;                   /* body text, dark UI and icons — 15:1 */
    --dbim-text: var(--dbim-charcoal);
    --dbim-text-secondary: #3D4043;             /* secondary text — 10:1 */
    --dbim-text-muted: #4A4A4A;                 /* hints, dates, captions — 8.9:1 */
    --dbim-border: #C4DEDE;                     /* card and field borders */
    --dbim-border-subtle: #E1EFEF;              /* table rules */
    --dbim-surface: color-mix(in srgb, var(--dbim-teal-100) 30%, var(--dbim-white));
    --dbim-surface-grey: #F5F5F5;
    --dbim-focus-halo: #FFBF47;                 /* yellow focus halo */
    --dbim-mark-bg: #FFE58A;                    /* search highlight */

    /* Status (mapped to the functional palette) */
    --dbim-danger: var(--dbim-coral-red);
    --dbim-danger-hover: #B02A37;
    --dbim-danger-bg: #F8D7DA;
    --dbim-success: var(--dbim-liberty-green);
    --dbim-success-bg: #D1E7DD;
    --dbim-warning: var(--dbim-mustard-yellow);
    --dbim-warning-bg: #FFF3CD;

    /* ---------- Typography ---------- */
    --dbim-font-family: "Noto Sans", sans-serif;
    --dbim-font: var(--dbim-font-family);
    --dbim-fs-h1: 2.25rem;       /* 36px page title */
    --dbim-fs-h1-md: 2rem;       /* 32px */
    --dbim-fs-h1-sm: 1.625rem;   /* 26px page title on phones */
    --dbim-fs-h2: 1.5rem;        /* 24px */
    --dbim-fs-h2-sm: 1.375rem;   /* 22px */
    --dbim-fs-h3: 1.25rem;       /* 20px */
    --dbim-fs-h4: 1.125rem;      /* 18px */
    --dbim-fs-lead: 1.0625rem;   /* 17px */
    --dbim-fs-p1: 1rem;          /* 16px body text */
    --dbim-fs-label: 0.9375rem;  /* 15px */
    --dbim-fs-p2: 0.875rem;      /* 14px secondary text */
    --dbim-fs-caption: 0.8125rem;/* 13px */
    --dbim-fs-small: 0.75rem;    /* 12px — smallest size used for text */
    --dbim-fs-xs: 0.625rem;      /* 10px — badges only, never body text */
    --dbim-font-weight-regular: 400;
    --dbim-font-weight-medium: 500;
    --dbim-font-weight-semibold: 600;
    --dbim-font-weight-bold: 700;
    --dbim-font-weight-extrabold: 800;
    --dbim-line-height: 1.6;

    /* ---------- Shape, depth, motion, spacing ---------- */
    --dbim-border-radius-sm: 0.25rem;  /* 4px */
    --dbim-border-radius-md: 0.5rem;   /* 8px */
    --dbim-border-radius-lg: 0.75rem;  /* 12px */
    --dbim-radius-sm: var(--dbim-border-radius-sm);
    --dbim-radius-md: var(--dbim-border-radius-md);
    --dbim-radius-lg: var(--dbim-border-radius-lg);
    --dbim-shadow-soft: 0 2px 8px rgba(var(--dbim-shadow-rgb), .08);
    --dbim-shadow-card: 0 4px 12px rgba(var(--dbim-shadow-rgb), .12);
    --dbim-shadow-sm: var(--dbim-shadow-soft);
    --dbim-shadow-md: var(--dbim-shadow-card);
    --dbim-transition-fast: .15s ease;
    --dbim-section-gap: 2.5rem;
    --dbim-focus-ring: 0 0 0 3px var(--dbim-focus-halo), 0 0 0 5px var(--dbim-black);

    /* ---------- Compatibility aliases used by older components ---------- */
    --primary: var(--dbim-teal-900);
    --primary-light: var(--dbim-teal-700);
    --primary-dark: var(--dbim-teal-950);
    --accent: var(--dbim-teal-700);
    --accent-light: var(--dbim-teal-100);
    --secondary: var(--dbim-teal-500);
    --secondary-light: var(--dbim-teal-100);
    --page-bg: var(--dbim-surface);
    --text-dark: var(--dbim-text-strong);
    --text-body: var(--dbim-text);
    --text-muted: var(--dbim-text-muted);
    --border: var(--dbim-border);
    --danger: var(--dbim-danger);
    --danger-light: var(--dbim-danger-bg);
    --success: var(--dbim-success);
    --hero-text: var(--dbim-text);
    --color-text-primary: var(--dbim-dark-text);
    --color-bg-primary: var(--dbim-white);
    --default-font: var(--dbim-font-family);
    --heading-font: var(--dbim-font-family);
    --nav-font: var(--dbim-font-family);

    /* ---------- Bootstrap variables ---------- */
    --bs-primary: #0F5757;
    --bs-success: #198754;
    --bs-info: #2D8686;
    --bs-danger: #DC3545;
    --bs-font-sans-serif: var(--dbim-font-family);
}


/* =========================================================
   BASE TYPOGRAPHY
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 100%;
}

body {
    margin: 0;
    font-family: var(--dbim-font-family);
    font-size: var(--dbim-fs-p1);
    font-weight: var(--dbim-font-weight-regular);
    line-height: var(--dbim-line-height);
    color: var(--dbim-text);
    background-color: var(--dbim-surface);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--dbim-font-family);
    font-weight: var(--dbim-font-weight-bold);
    line-height: 1.25;
    color: var(--dbim-text-strong);
}

h1, .h1 { font-size: var(--dbim-fs-h1); }
h2, .h2 { font-size: var(--dbim-fs-h2); }
h3, .h3 { font-size: var(--dbim-fs-h3); }
h4, .h4 { font-size: var(--dbim-fs-h4); }
h5, .h5 { font-size: var(--dbim-fs-p1); }
h6, .h6 { font-size: var(--dbim-fs-p2); }

@media (max-width: 991.5px) {
    h1, .h1 { font-size: var(--dbim-fs-h1-sm); }
    h2, .h2 { font-size: var(--dbim-fs-h2-sm); }
    h3, .h3 { font-size: var(--dbim-fs-h4); }
}

p,
li,
td,
input,
select,
textarea {
    font-size: var(--dbim-fs-p1);
}

small,
.small {
    font-size: var(--dbim-fs-small);
}

.lead {
    font-size: var(--dbim-fs-lead);
    font-weight: var(--dbim-font-weight-regular);
}

label,
.form-label {
    font-size: var(--dbim-fs-label);
}

mark,
.mark {
    padding: 0 .125rem;
    color: var(--dbim-dark-text);
    background: var(--dbim-mark-bg);
}

a {
    color: var(--dbim-teal-900);
    text-underline-offset: 2px;
}

a:hover {
    color: var(--dbim-teal-950);
}

::selection {
    background: var(--dbim-teal-300);
    color: var(--dbim-text-strong);
}


/* =========================================================
   KEYBOARD FOCUS — yellow halo with a black edge,
   visible on white, teal and dark backgrounds alike.
   ========================================================= */

:focus-visible {
    outline: 3px solid var(--dbim-focus-halo) !important;
    outline-offset: 0;
    box-shadow: 0 0 0 5px var(--dbim-black) !important;
}

#main:focus,
#maincontent:focus {
    outline: none !important;
    box-shadow: none !important;
}


/* =========================================================
   SKIP LINK
   <a class="skip-to-content" href="#main">Skip to main content</a>
   ========================================================= */

.skip-to-content {
    position: absolute;
    top: -100px;
    left: 12px;
    z-index: 100000;
    padding: 10px 16px;
    color: var(--dbim-white);
    background: var(--dbim-teal-900);
    border-radius: var(--dbim-radius-md);
    font-size: var(--dbim-fs-p1);
    font-weight: var(--dbim-font-weight-semibold);
    text-decoration: none;
}

.skip-to-content:focus {
    top: 12px;
    color: var(--dbim-white);
}


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


/* =========================================================
   BOOTSTRAP 5.0.2 OVERRIDES (blue → DBIM teal)
   ========================================================= */

/* Component font sizes on the token scale */
.btn,
.form-control,
.form-select,
.input-group-text,
.dropdown-item,
.nav-link,
.page-link,
.list-group-item,
.alert,
.accordion-button,
.table {
    font-size: var(--dbim-fs-p1);
}

.btn-sm,
.form-control-sm,
.form-select-sm,
.pagination-sm .page-link {
    font-size: var(--dbim-fs-p2);
}

.btn-lg,
.form-control-lg,
.form-select-lg {
    font-size: var(--dbim-fs-h4);
}

.badge,
.form-text,
.invalid-feedback,
.valid-feedback {
    font-size: var(--dbim-fs-small);
}

.modal-title {
    font-size: var(--dbim-fs-h3);
}

/* Buttons */
.btn:focus,
.btn-check:focus + .btn {
    box-shadow: none;
}

.btn-primary,
.btn-primary.disabled,
.btn-primary:disabled {
    color: var(--dbim-white);
    background-color: var(--dbim-teal-900);
    border-color: var(--dbim-teal-900);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-check:focus + .btn-primary,
.btn-check:active + .btn-primary,
.btn-check:checked + .btn-primary,
.btn-primary.active,
.btn-primary:active,
.show > .btn-primary.dropdown-toggle {
    color: var(--dbim-white);
    background-color: var(--dbim-teal-950);
    border-color: var(--dbim-teal-950);
}

.btn-outline-primary {
    color: var(--dbim-teal-900);
    border-color: var(--dbim-teal-900);
}

.btn-outline-primary:hover,
.btn-check:active + .btn-outline-primary,
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active,
.btn-outline-primary:active {
    color: var(--dbim-white);
    background-color: var(--dbim-teal-900);
    border-color: var(--dbim-teal-900);
}

.btn-success {
    color: var(--dbim-white);
    background-color: var(--dbim-liberty-green);
    border-color: var(--dbim-liberty-green);
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    color: var(--dbim-white);
    background-color: #146C43;
    border-color: #146C43;
}

.btn-danger {
    color: var(--dbim-white);
    background-color: var(--dbim-danger);
    border-color: var(--dbim-danger);
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
    background-color: var(--dbim-danger-hover);
    border-color: var(--dbim-danger-hover);
}

.btn-warning {
    color: var(--dbim-dark-text);
    background-color: var(--dbim-mustard-yellow);
    border-color: var(--dbim-mustard-yellow);
}

.btn-link {
    color: var(--dbim-teal-900);
}

.btn-link:hover {
    color: var(--dbim-teal-950);
}

/* Utilities */
.text-primary { color: var(--dbim-teal-900) !important; }
.text-success { color: var(--dbim-liberty-green) !important; }
.text-danger  { color: var(--dbim-danger) !important; }
.text-muted   { color: var(--dbim-text-muted) !important; }
.bg-primary   { background-color: var(--dbim-teal-900) !important; }
.bg-success   { background-color: var(--dbim-liberty-green) !important; }
.bg-light     { background-color: var(--dbim-teal-100) !important; }
.border-primary { border-color: var(--dbim-teal-900) !important; }
.link-primary,
.link-primary:hover { color: var(--dbim-teal-900); }

/* Forms */
.form-control,
.form-select {
    color: var(--dbim-text);
    border-color: var(--dbim-grey-03);
}

.form-control::placeholder {
    color: var(--dbim-text-muted);
    opacity: 1;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--dbim-black);
    box-shadow: var(--dbim-focus-ring);
}

.form-check-input {
    border-color: var(--dbim-grey-03);
}

.form-check-input:checked,
.form-check-input[type=checkbox]:indeterminate {
    background-color: var(--dbim-teal-900);
    border-color: var(--dbim-teal-900);
}

.form-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23606060'/%3e%3c/svg%3e");
}

.form-range::-webkit-slider-thumb { background-color: var(--dbim-teal-900); }
.form-range::-moz-range-thumb     { background-color: var(--dbim-teal-900); }

.is-invalid,
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--dbim-danger) !important;
}

.invalid-feedback {
    color: var(--dbim-danger);
}

/* Navigation */
.nav-link {
    color: var(--dbim-teal-900);
}

.nav-link:hover,
.nav-link:focus {
    color: var(--dbim-teal-950);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--dbim-teal-900);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--dbim-teal-900);
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--dbim-text-strong);
    background-color: var(--dbim-teal-100);
}

/* Pagination */
.page-link {
    color: var(--dbim-teal-900);
}

.page-link:hover,
.page-link:focus {
    color: var(--dbim-teal-950);
    background-color: var(--dbim-teal-100);
}

.page-link:focus {
    box-shadow: var(--dbim-focus-ring);
}

.page-item.active .page-link {
    background-color: var(--dbim-teal-900);
    border-color: var(--dbim-teal-900);
}

/* Components */
.progress-bar {
    background-color: var(--dbim-teal-900);
}

.list-group-item.active {
    background-color: var(--dbim-teal-900);
    border-color: var(--dbim-teal-900);
}

.accordion-button:not(.collapsed) {
    color: var(--dbim-teal-900);
    background-color: var(--dbim-teal-100);
}

.accordion-button:focus {
    border-color: var(--dbim-black);
    box-shadow: var(--dbim-focus-ring);
}

.alert-primary,
.alert-info {
    color: var(--dbim-teal-900);
    background-color: var(--dbim-teal-100);
    border-color: var(--dbim-teal-300);
}

.alert-success {
    color: #0F5132;
    background-color: var(--dbim-success-bg);
    border-color: #BADBCC;
}

.alert-danger {
    color: #842029;
    background-color: var(--dbim-danger-bg);
    border-color: #F5C2C7;
}

.alert-warning {
    color: #664D03;
    background-color: var(--dbim-warning-bg);
    border-color: #FFECB5;
}

.btn-close:focus {
    box-shadow: var(--dbim-focus-ring);
}

.modal-content {
    border-radius: var(--dbim-radius-lg);
}


/* =========================================================
   HIGH CONTRAST MODE
   Turned on by the "High contrast" button in the site header
   (main.js adds .high-contrast to <html>). Almost every colour
   in the site comes from these tokens, so swapping them here
   switches the whole page: black surfaces, white text, yellow
   for links, buttons and accents.
   ========================================================= */

html.high-contrast {
    --dbim-white: #000000;
    --dbim-surface: #000000;
    --dbim-surface-grey: #000000;
    --dbim-text-strong: #FFFFFF;
    --dbim-charcoal: #FFFFFF;
    --dbim-text: #FFFFFF;
    --dbim-text-secondary: #FFFFFF;
    --dbim-text-muted: #E6E6E6;
    --dbim-dark-text: #FFFFFF;

    --dbim-teal-900: #FFD400;
    --dbim-teal-950: #FFE866;
    --dbim-teal-700: #FFD400;
    --dbim-teal-500: #FFD400;
    --dbim-teal-300: #333333;
    --dbim-teal-100: #1A1A1A;

    --dbim-border: #FFFFFF;
    --dbim-border-subtle: #808080;
    --dbim-grey-03: #FFFFFF;

    --dbim-danger: #FF6B6B;
    --dbim-danger-bg: #1A0000;
    --dbim-success-bg: #001A0A;
    --dbim-focus-halo: #00E5FF;
    --dbim-shadow-rgb: 0, 0, 0;
}

html.high-contrast body,
html.high-contrast .page-main,
html.high-contrast .main-sign {
    background: #000000 !important;
    background-image: none !important;
    color: #FFFFFF;
}

html.high-contrast .main-sign::before,
html.high-contrast .main-sign::after,
html.high-contrast .main-sign-waves {
    display: none;
}

/* Buttons and filled controls: black text on yellow */
html.high-contrast .btn-primary,
html.high-contrast .b-btn,
html.high-contrast .login-link,
html.high-contrast .btn-get-started,
html.high-contrast .a11y-btn[aria-pressed="true"] {
    color: #000000 !important;
}

html.high-contrast .btn-primary i,
html.high-contrast .login-link i {
    color: #000000 !important;
}

html.high-contrast a:not(.btn):not(.nav-link):not(.btn-get-started):not(.site-brand) {
    color: #FFD400;
    text-decoration: underline;
}

html.high-contrast .form-control,
html.high-contrast .form-select {
    color: #FFFFFF;
    background-color: #000000;
}

html.high-contrast .form-control::placeholder {
    color: #CCCCCC;
}

html.high-contrast .site-footer .footer-logos {
    background: #FFFFFF;
}


/* Sign Bank page (signbank.html): moved here because the Content-Security-Policy
   (style-src 'self') blocks <style> blocks inside pages */
.embed-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.embed-card { width: min(100%, 1200px); height: 85vh; overflow: hidden; background: var(--dbim-white);
              border: 1px solid var(--dbim-border); border-radius: var(--dbim-radius-lg); box-shadow: var(--dbim-shadow-card); }
.embed-card iframe { display: block; width: 100%; height: 100%; border: 0; }
    


/* Field errors from js/validation.js (all pages) */
.field-error {
    margin-top: 4px;
    color: var(--dbim-danger);
    font-size: 0.875rem;
    font-weight: 600;
}

.field-error:empty {
    display: none;
}

.form-control.is-invalid,
.form-select.is-invalid,
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: var(--dbim-danger) !important;
    border-width: 2px;
}
