/* ============================================================================
   MARKETING HEADER — Combined single header
   Logo spans full height on desktop, text centered, nav full-width bottom
   ============================================================================
   KNOWN LIMITATION — HARDCODED COLOURS — DO NOT UPDATE
   This file is loaded on the PUBLIC site which does NOT load palette.css.
   Palette vars (--white-text, --hover-lift etc.) are UNDEFINED here.
   All colours MUST be hardcoded. Do NOT replace with palette CSS variables.
   ============================================================================ */

/* =============================================================================
   STICKY WRAPPER
   ============================================================================= */

.mk-header-sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* =============================================================================
   LAYOUT — Two rows, logo overlays both via absolute positioning on desktop
   ============================================================================= */

/* --mk-logo-chosen is written inline by marketing_header.html from Company
   Details > "Header size". Everything below reads --mk-logo-h, which the
   breakpoints are free to override -- an inline style would outrank them. */
.mk-header-grid {
    --mk-logo-h: var(--mk-logo-chosen, 100px);
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--mkt-header-background);
    background-image: var(--mkt-header-background-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Top row: centered text + actions right-aligned.

   Its height is the logo's, because the logo is pinned to this row (below) and
   the row grows to hold it. border-box so the declared minimum is the finished
   height rather than the height before padding; the 0.5rem is the logo image's
   own vertical padding, which has to be inside the row for the two to agree. */
.mk-header-toprow {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem 2rem 0.5rem 0;
    min-height: calc(var(--mk-logo-h) + 0.5rem + max(var(--mk-logo-dy, 0px), 0px));
    position: relative;
}

/* =============================================================================
   LOGO — absolutely positioned, confined to the top row
   =============================================================================
   It used to run bottom: 0, spanning the whole header so it overlaid the nav.
   Being absolute it was also invisible to the nav's centring, which laid its
   links out across the full width as though the logo were not there -- so on a
   tenant with enough pages the left-hand links ended up beneath it. They still
   read fine through the transparent artwork, which is why this went unnoticed
   for so long, but they were not clickable: the hit area was the logo's <a>.

   bottom: auto plus an explicit height stops the logo at the top row, and the
   row grows to fit it instead. The logo now cannot reach the nav AT ANY SIZE,
   which is what makes "Header size" safe to hand to the tenant.

   The height has to be stated rather than left at 100%: with bottom: auto the
   area has no resolved height to inherit from, so the image would fall back to
   its natural size and spill over the nav again. */

.mk-header-logo-area {
    position: absolute;
    left: 0.25rem;
    /* Company Details > "Logo Drop". The AREA moves, not just the image, so the
       logo's link travels with it -- shifting the artwork alone would leave the
       clickable box behind, which is the whole bug this header just lost. A
       downward nudge grows .mk-header-toprow by the same amount (above), so the
       logo still cannot reach the nav. */
    top: var(--mk-logo-dy, 0px);
    bottom: auto;
    height: calc(var(--mk-logo-h) + 0.5rem);
    display: flex;
    align-items: center;
    z-index: 15;
}

/* Company Details > "Centre the logo". Branding zeroes LogoIndent when this is
   on, so there is no margin left to fight the transform.

   left + translateX rather than left: 0; right: 0; justify-content: center.
   Stretching the area across the header would look identical and then swallow
   every click on the phone number and the Book Now button, because the area
   sits at z-index 15 and .mk-header-actions at 10. Shrink-to-fit keeps the box
   no wider than the logo, so the rest of the top row stays reachable. */
.mk-header-grid.mk-logo-centred .mk-header-logo-area {
    left: 50%;
    transform: translateX(-50%);
}

.mk-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.mk-logo-link:hover {
    text-decoration: none;
    color: inherit;
}

/* height is stated outright rather than left at 100%. The percentage resolves
   against .mk-logo-link, which is itself an unstretched flex item, so its own
   height comes from this image -- circular, and the browser falls back to the
   file's intrinsic height. The effect was that "Header size" could only ever
   shrink a logo: pick a size above the artwork's natural height and the row
   grew while the logo sat unchanged in the middle of the gap. */
.mk-header-logo {
    height: var(--mk-logo-h);
    max-height: var(--mk-logo-h);
    width: auto;
    padding: 0.25rem 0;
    border: none;
}

/* =============================================================================
   TEXT AREA — centered company name + tagline
   ============================================================================= */

.mk-header-text-area {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.mk-text-link {
    display: flex;
    flex-direction: column;
    text-align: center;
    text-decoration: none;
    color: inherit;
    pointer-events: auto;
}

.mk-text-link:hover {
    text-decoration: none;
    color: inherit;
}

.mk-company-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--mkt-header-text);
}

.mk-company-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--mkt-header-tagline);
    opacity: 0.7;
}

/* =============================================================================
   ACTIONS — top right
   ============================================================================= */

.mk-header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 10;
}

.mk-phone {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 1px;
    color: var(--mkt-header-phone);
    text-decoration: none;
}

.mk-phone:hover {
    color: var(--mkt-header-text);
    text-decoration: none;
}

.mk-btn-book {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: var(--mkt-book-background);
    color: var(--mkt-book-text);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.mk-btn-book:hover {
    background: var(--mkt-book-hover-background);
    color: var(--mkt-book-text);
    text-decoration: none;
}

/* =============================================================================
   NAV — full-width bottom row
   ============================================================================= */

.mk-header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: 0;
    min-height: 2.5rem;
    background-color: var(--mkt-nav-background);
    background-image: var(--mkt-nav-background-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: none;
    position: relative;
    z-index: 10;
}

.mk-nav-links {
    display: flex;
    align-items: center;
    gap: 0;
}

.mk-nav-links a {
    display: block;
    padding: 0.85rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--mkt-nav-text);
    text-decoration: none;
    border: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.mk-nav-links a:hover {
    color: var(--mkt-nav-hover-text);
    background: rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

.mk-nav-links a.active {
    background: rgba(0, 0, 0, 0.1);
    color: var(--mkt-nav-active-text);
}

/* BOOK NOW link inside nav — hidden on desktop, shown in mobile hamburger menu */
.mk-nav-book-link {
    display: none !important;
}

/* =============================================================================
   HAMBURGER — Hidden on desktop
   ============================================================================= */

.mk-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 1rem;
}

.mk-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--mkt-hamburger);
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mk-hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mk-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.mk-hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =============================================================================
   RESPONSIVE — Tablet
   ============================================================================= */

@media (max-width: 1024px) {
    /* Cap the logo rather than pin it: a tenant who chose a small size keeps it
       here instead of being scaled back up on a narrower screen. The area's
       height and the top row's follow from the variable. */
    .mk-header-grid {
        --mk-logo-h: min(var(--mk-logo-chosen, 56px), 56px);
    }

    .mk-header-logo-area {
        position: absolute;
        left: 0.75rem;
        top: var(--mk-logo-dy, 0px);
        z-index: 15;
    }

    .mk-header-logo {
        padding: 0.25rem 0;
    }

    .mk-company-name {
        font-size: 1.15rem;
        letter-spacing: 1.5px;
    }

    .mk-company-subtitle {
        font-size: 0.65rem;
    }
}

/* =============================================================================
   RESPONSIVE — Mobile
   ============================================================================= */

@media (max-width: 768px) {
    /* Logo goes inline, centered above text */
    .mk-header-grid {
        align-items: center;
    }

    .mk-header-grid {
        --mk-logo-h: min(var(--mk-logo-chosen, 48px), 48px);
    }

    /* height: auto is load-bearing. The area is back in flow and carries its own
       padding here, so the desktop rule's calc() height would fight it. */
    /* The logo already has its own full-width row here, and the phone and
       hamburger are position: fixed over the top right, so centring would slide
       it under them. Left-aligned on phones whatever the setting says -- the
       help text says so. Needs the compound selector: .mk-logo-centred's rule
       outranks a bare .mk-header-logo-area even inside this media query. */
    .mk-header-grid.mk-logo-centred .mk-header-logo-area {
        left: auto;
        transform: none;
    }

    .mk-header-logo-area {
        position: relative;
        left: auto;
        top: auto;
        bottom: auto;
        height: auto;
        justify-content: flex-start;
        width: 100%;
        padding: 0.75rem 0 0.25rem 0.75rem;
    }

    .mk-header-logo {
        height: var(--mk-logo-h);
        max-height: var(--mk-logo-h);
        padding: 0;
        /* Phone + hamburger are position:fixed top-right on mobile, so they
           are out of flow and cannot push the logo. Reserve their width here
           (12rem covers an 11-digit number, the gap and the burger) and let
           object-fit shrink a wide logo inside the 48px band rather than
           squashing it, since height is pinned. */
        max-width: calc(100vw - 12rem);
        object-fit: contain;
        object-position: left center;
    }

    /* Text area goes inline, centered */
    .mk-header-text-area {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        pointer-events: auto;
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    .mk-text-link {
        text-align: center;
    }

    .mk-header-toprow {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 1rem;
        min-height: auto;
    }

    .mk-company-name {
        font-size: 1.05rem;
        letter-spacing: 1px;
        white-space: nowrap;
    }

    .mk-company-subtitle {
        font-size: 0.65rem;
        letter-spacing: 1px;
        white-space: normal;
        line-height: 1.4;
    }

    .mk-header-actions {
        position: fixed;
        right: 0.75rem;
        top: 0.75rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex-shrink: 0;
        z-index: 1001;
    }

    /* Phone stays visible on the RH side of the Company line on every
       breakpoint whenever a number is entered (sits left of the hamburger). */
    .mk-phone {
        display: inline;
        font-size: 0.85rem;
        letter-spacing: 0.5px;
        white-space: nowrap;
    }

    /* Hamburger moves into top row, nav bar collapses */
    .mk-header-nav {
        min-height: 0;
        background-color: var(--mkt-nav-background);
        background-image: var(--mkt-nav-background-image, none);
        background-repeat: repeat;
    }

    .mk-hamburger {
        display: block;
        padding: 0.5rem;
        margin: 0;
    }

    .mk-nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--mkt-nav-background);
        background-image: var(--mkt-nav-background-image, none);
        background-repeat: repeat;
    }

    .mk-nav-links.active {
        display: flex;
    }

    .mk-nav-links a {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
        border-top: 1px solid var(--subtle-border);
    }

}

/* =============================================================================
   RESPONSIVE — Phone only
   ============================================================================= */

@media (max-width: 768px) {
    .mk-btn-book {
        display: none;
    }

    /* Show BOOK NOW in hamburger menu */
    .mk-nav-book-link {
        display: block !important;
        background: var(--mkt-book-background);
        font-weight: 500;
        letter-spacing: 2px;
    }
}

/* =============================================================================
   ACCESSIBILITY THEMES — override marketing header colours
   ============================================================================= */

body[data-theme="highcontrast"] .mk-header-grid {
    background: #000000;
}

body[data-theme="highcontrast"] .mk-company-name,
body[data-theme="highcontrast"] .mk-company-subtitle,
body[data-theme="highcontrast"] .mk-phone {
    color: #ffffff;
}

/* .mk-nav-links is listed with the nav because on mobile it is the dropdown
   the burger opens, and it paints --mkt-nav-background itself -- theming only
   the nav row leaves the open menu on brand colours. Same in each theme. */
body[data-theme="highcontrast"] .mk-header-nav,
body[data-theme="highcontrast"] .mk-nav-links {
    background: #1a1a1a;
}

body[data-theme="highcontrast"] .mk-nav-links a {
    color: #ffffff;
}

body[data-theme="highcontrast"] .mk-nav-links a:hover {
    color: #000000;
    background: #ffffff;
}

body[data-theme="highcontrast"] .mk-nav-links a.active {
    background: #333333;
    color: #ffffff;
}

body[data-theme="highcontrast"] .mk-btn-book,
body[data-theme="highcontrast"] .mk-nav-links .mk-nav-book-link {
    background: #ffffff;
    color: #000000;
}

body[data-theme="highcontrast"] .mk-btn-book:hover {
    background: #cccccc;
    color: #000000;
}

body[data-theme="highcontrast"] .mk-hamburger span {
    background: #ffffff;
}

/* Tinted from the active dyslexia scheme (101/103/104/105) so the header
   follows the chosen tint instead of being fixed beige. */
body[data-theme^="dyslexic"] .mk-header-grid {
    background: var(--background-color, #faf8f5);
}

body[data-theme^="dyslexic"] .mk-company-name,
body[data-theme^="dyslexic"] .mk-company-subtitle,
body[data-theme^="dyslexic"] .mk-phone {
    color: #333333;
}

body[data-theme^="dyslexic"] .mk-header-nav,
body[data-theme^="dyslexic"] .mk-nav-links {
    background: var(--hero-background, #e8e4dc);
}

body[data-theme^="dyslexic"] .mk-nav-links a {
    color: #333333;
}

body[data-theme^="dyslexic"] .mk-nav-links a:hover {
    color: #000000;
    background: rgba(0, 0, 0, 0.08);
}

body[data-theme^="dyslexic"] .mk-nav-links a.active {
    background: rgba(0, 0, 0, 0.1);
    color: #333333;
}

body[data-theme^="dyslexic"] .mk-btn-book,
body[data-theme^="dyslexic"] .mk-nav-links .mk-nav-book-link {
    background: #333333;
    color: #faf8f5;
}

body[data-theme^="dyslexic"] .mk-btn-book:hover {
    background: #555555;
    color: #faf8f5;
}

body[data-theme^="dyslexic"] .mk-hamburger span {
    background: #333333;
}

/* Colour-vision schemes (106/107). Same shape as the dyslexia block above,
   but every colour is read from the scheme instead of being hardcoded. The
   four tints share one grey chrome, so hardcoding it there is harmless; these
   two each carry their own accent -- blue for red-green, red for blue-yellow --
   and the header has to pick up whichever is active. */
body[data-theme^="cvd"] .mk-header-grid {
    background: var(--background-color, #ffffff);
}

body[data-theme^="cvd"] .mk-company-name,
body[data-theme^="cvd"] .mk-company-subtitle,
body[data-theme^="cvd"] .mk-phone {
    color: var(--body-text, #1c1f23);
}

body[data-theme^="cvd"] .mk-header-nav,
body[data-theme^="cvd"] .mk-nav-links {
    background: var(--hero-background, #e3ebf3);
}

body[data-theme^="cvd"] .mk-nav-links a {
    color: var(--body-text, #1c1f23);
}

body[data-theme^="cvd"] .mk-nav-links a:hover {
    color: var(--link-text, #0b4f9e);
    background: rgba(0, 0, 0, 0.08);
}

body[data-theme^="cvd"] .mk-nav-links a.active {
    background: rgba(0, 0, 0, 0.1);
    color: var(--link-text, #0b4f9e);
}

body[data-theme^="cvd"] .mk-btn-book,
body[data-theme^="cvd"] .mk-nav-links .mk-nav-book-link {
    background: var(--button-background-color, #0b4f9e);
    color: var(--button-text-color, #ffffff);
}

body[data-theme^="cvd"] .mk-btn-book:hover {
    background: var(--button-hover-background, #073a76);
    color: var(--button-text-color, #ffffff);
}

body[data-theme^="cvd"] .mk-hamburger span {
    background: var(--body-text, #1c1f23);
}

/* =============================================================================
   LOGO — accessibility swap
   =============================================================================
   The header emits the accessibility logo alongside the brand one only when the
   tenant has uploaded it; otherwise the brand logo carries .mk-logo-autofilter.
   The theme is a client-side preference, so the choice has to be made here in
   CSS rather than in the template.

   brightness(0) collapses every opaque pixel to black and leaves the alpha
   channel alone — a faithful result on a single-tone mark, a silhouette on
   anything with internal structure, which is exactly why the uploaded file wins
   when there is one. invert(1) on black-with-alpha is exactly white, so High
   Contrast needs no second upload.
   ============================================================================= */

.mk-logo-a11y {
    display: none;
}

body[data-theme^="cvd"] .mk-logo-brand:not(.mk-logo-autofilter),
body[data-theme^="dyslexic"] .mk-logo-brand:not(.mk-logo-autofilter),
body[data-theme="highcontrast"] .mk-logo-brand:not(.mk-logo-autofilter) {
    display: none;
}

body[data-theme^="cvd"] .mk-logo-a11y,
body[data-theme^="dyslexic"] .mk-logo-a11y,
body[data-theme="highcontrast"] .mk-logo-a11y {
    display: block;
}

/* Uploaded accessibility logo is supplied black; invert it for the black header. */
body[data-theme="highcontrast"] .mk-logo-a11y {
    filter: invert(1);
}

/* No accessibility logo uploaded — blacken the brand one as the empty state. */
body[data-theme^="cvd"] .mk-logo-autofilter,
body[data-theme^="dyslexic"] .mk-logo-autofilter {
    filter: brightness(0);
}

body[data-theme="highcontrast"] .mk-logo-autofilter {
    filter: brightness(0) invert(1);
}
