/* ==========================================================================
   TebZone brand layer, phase 1 (colours, fonts, focus, main call to action)

   Loaded after the theme stylesheet and after the colours saved in the admin
   theme settings, so the values below win. Palette sampled from the TebZone
   identity sheet. The compiled theme CSS takes every colour from CSS variables,
   so changing the variables re-colours the whole site; nothing else is
   hard-coded to the old blue.

   Light mode only is re-coloured here. In dark mode only the primary colour
   changes (bright teal with dark text on buttons).
   ========================================================================== */

/* ---- Fonts ---------------------------------------------------------------
   Conto Bold (headings, bold text) and Nexa Book (body) are declared in
   tebzone-fonts.css, which is separate because their web licence is still to
   be confirmed. Without that file the stacks below fall back to the theme font.
   Neither brand font has Arabic letters, so Arabic uses Cairo (open licence,
   declared here). */
@font-face {
    font-family: "Cairo";
    src: url("../fonts/cairo-arabic-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
    font-family: "Cairo";
    src: url("../fonts/cairo-arabic-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}

:root {
    /* Brand tokens (use these in new CSS instead of raw hex values) */
    --tz-deep: #075167;
    --tz-mid: #158893;
    --tz-bright: #15D1C8;
    --tz-gold: #F9BD3A;
    --tz-amber: #CC6600;
    --tz-amber-text: #A65200;
    --tz-ink: #061A22;

    --tz-font-body: "Nexa Book", "Cairo", "main-font-family", Arial, sans-serif;
    --tz-font-head: "Conto Bold", "Cairo", "main-font-family", Arial, sans-serif;

    /* The theme sets body and form text from these two variables (body uses !important),
       so the brand font is applied by replacing the variables, not by a body rule. */
    --font-family-base: var(--tz-font-body);
    --font-family-rtl: "Cairo", "Nexa Book", "rtl-font-family", Arial, sans-serif;

    /* Shape: controls 12px, panels 16px, cards 24px, chips full */
    --tz-radius-control: 12px;
    --tz-radius-panel: 16px;
    --tz-radius-card: 24px;

    --tz-focus: 0 0 0 3px rgba(21, 136, 147, .45);
}

/* ---- Colours (light mode) ------------------------------------------------
   Same variable names the theme and the admin colour settings use, including
   the derived hover / border / button-text values (hover = 10% darker). */
body:not(.dark-mode) {
    --primary: #075167;
    --primary-hover: #06495d;
    --primary-border: #075167;
    --primary-hover-border: #06495d;
    --primary-btn-color: #ffffff;
    --primary-btn-hover-color: #ffffff;
    --primary-saturated: #158893;

    --secondary: #061A22;
    --secondary-hover: #05171f;
    --secondary-border: #061A22;
    --secondary-hover-border: #05171f;
    --secondary-btn-color: #ffffff;
    --secondary-btn-hover-color: #ffffff;

    /* Amber used as a background behind white text: 5.5:1 (the brand amber #CC6600 gives 3.8:1) */
    --accent: #A65200;
    --accent-hover: #954a00;
    --accent-border: #A65200;
    --accent-hover-border: #954a00;
    --accent-btn-color: #ffffff;
    --accent-btn-hover-color: #ffffff;

    --dark: #061A22;

    /* Secondary text: was #97A7BF (2.4:1 on white), now 4.8:1 */
    --gray-500: #64748B;
}

/* ---- Colours (dark mode: primary only) ---------------------------------- */
body.dark-mode {
    --primary: #15D1C8;
    --primary-hover: #13bcb4;
    --primary-border: #15D1C8;
    --primary-hover-border: #13bcb4;
    --primary-btn-color: #061A22;
    --primary-btn-hover-color: #061A22;
}

/* ---- Typography ---------------------------------------------------------- */
input,
select,
textarea,
button {
    font-family: var(--tz-font-body);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.font-weight-bold,
.font-weight-bolder,
b, strong, th,
.btn {
    font-family: var(--tz-font-head);
    font-weight: 700;
}

/* Arabic letters join: letter-spacing breaks them */
body.rtl,
body.rtl * {
    letter-spacing: normal;
}

/* ---- Focus ----------------------------------------------------------------
   The theme sets "* { outline: none !important }", so keyboard focus had no
   visible outline. !important is needed to override that rule. Only keyboard
   focus (:focus-visible) shows the ring, mouse clicks do not. */
:focus-visible {
    outline: 3px solid var(--primary-saturated) !important;
    outline-offset: 2px !important;
    /* white gap between the element and the ring, so the ring also reads on the dark teal top bar and dark bands */
    box-shadow: 0 0 0 2px #fff;
}

body.dark-mode :focus-visible {
    outline-color: var(--tz-bright) !important;
    box-shadow: 0 0 0 2px var(--tz-ink);
}

/* ---- Main call to action --------------------------------------------------
   One gold-to-amber button per screen: ink text, 4.6:1 at the amber end.
   Add class "tz-cta" to any .btn, or rely on the two places below:
     - the home hero button (landing builder "two columns hero")
     - the enrol / add-to-cart button on the course page (when it is enabled)
   Everything else stays teal. */
.tz-cta,
.tz-cta:hover,
.tz-cta:focus,
.two-columns-hero-section__content .btn-primary,
.two-columns-hero-section__content .btn-primary:hover,
.two-columns-hero-section__content .btn-primary:focus,
.js-enroll-actions-card .btn-primary:not(.disabled):not(:disabled),
.js-enroll-actions-card .btn-primary:not(.disabled):not(:disabled):hover,
.js-enroll-actions-card .btn-primary:not(.disabled):not(:disabled):focus {
    background: linear-gradient(90deg, var(--tz-gold) 0%, var(--tz-amber) 100%);
    border-color: transparent;
    color: var(--tz-ink) !important; /* also colours the flip-effect ::after text, which inherits */
}

.tz-cta:hover,
.two-columns-hero-section__content .btn-primary:hover,
.js-enroll-actions-card .btn-primary:not(.disabled):not(:disabled):hover {
    filter: brightness(.96);
}

.tz-cta .btn-flip-effect__text,
.tz-cta svg,
.two-columns-hero-section__content .btn-primary .btn-flip-effect__text,
.two-columns-hero-section__content .btn-primary svg,
.js-enroll-actions-card .btn-primary svg {
    color: var(--tz-ink) !important;
}

/* ---- Header (header_1), narrow screens -----------------------------------
   Below the large breakpoint the theme puts the navigation links and the
   account button in two half-width columns; six links do not fit in half a
   phone, so they ran underneath the button. The links now get their own row
   (scrolling sideways if needed) and the button gets a row of its own. */
@media (max-width: 991.98px) {
    #themeHeaderSticky .row > .col-6:nth-child(3),
    #themeHeaderSticky .row > .col-6:nth-child(4) {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #themeHeaderSticky .row > .col-6:nth-child(3) > div {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    #themeHeaderSticky .row > .col-6:nth-child(4) .btn {
        width: 100%;
    }
}
