/* ==========================================================================
   Site-wide polish layer
   Loaded on every page after the page stylesheets. Only normalises spacing,
   button interaction, typography rendering and responsiveness — colours,
   fonts, content and layouts stay as defined by each page.
   ========================================================================== */

:root {
    --wh-red: #bc2125;
    --wh-section-y: clamp(36px, 4.5vw, 56px);
    --wh-focus: 0 0 0 3px rgba(188, 33, 37, .28);
}

/* --------------------------------------------------------------------------
   Base rendering & responsiveness
   -------------------------------------------------------------------------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 90px;
}

html,
body {
    overflow-x: clip;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

img {
    height: auto;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    text-wrap: balance;
    overflow-wrap: break-word;
}

h1, h2 {
    letter-spacing: -.01em;
}

p,
li {
    text-wrap: pretty;
    overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   Equal vertical rhythm for top-level content sections.
   Excludes the header, the first block after it (hero / inner banner),
   the footer and every overlay, modal, popup or floating element.
   -------------------------------------------------------------------------- */
body > header ~ :is(section, div):not(header + *):not(
    .modal, .modal-backdrop, .audit-overlay, .go-top, .lightbox, .album-modal,
    [class*="overlay"], [class*="popup"], [class*="lightbox"], [class*="modal"],
    [class*="float"], [class*="sticky"], [id*="chat"], [id*="tawk"],
    .footer-area, .copyright-area,
    .call-to-action /* mobile layout relies on its own padding to clear the background photo */
) {
    padding-top: var(--wh-section-y) !important;
    padding-bottom: var(--wh-section-y) !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Remove stray outer margins that add uneven gaps inside those sections */
body > header ~ :is(section, div) > :first-child,
body > header ~ :is(section, div) > .container > :first-child,
body > header ~ :is(section, div) > .container > .row:first-child > [class*="col"] > :first-child,
body > header ~ :is(section, div) .section-title:first-child {
    margin-top: 0;
}

/* Section headings that open a section carry their own top margin on most templates */
body > header ~ :is(section, div) > .section-title:first-child,
body > header ~ :is(section, div) > .container:first-child > .section-title:first-child,
body > header ~ :is(section, div) > .container:first-child > .row:first-child > .section-title:first-child {
    margin-top: 0 !important;
}

body > header ~ :is(section, div) > :last-child,
body > header ~ :is(section, div) > .container > :last-child,
body > header ~ :is(section, div) > .container > .row:last-child > [class*="col"] > :last-child:not(:only-child) {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Buttons — interaction polish only (colours, sizes and shapes unchanged)
   -------------------------------------------------------------------------- */
:is(a, button):is(.default-btn, .cta-btn, .theme-btn, .btn, [class*="-btn"], [class*="btn-"]):not(.navbar-toggler, .btn-close, .audit-close-btn, .mean-expand) {
    cursor: pointer;
    font-weight: 600;
    letter-spacing: .01em;
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease, opacity .2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (hover: hover) {
    :is(a, button):is(.default-btn, .cta-btn, .theme-btn, .btn, [class*="-btn"], [class*="btn-"]):not(.navbar-toggler, .btn-close, .audit-close-btn, .mean-expand, .go-top):hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 22px -10px rgba(188, 33, 37, .55);
    }
}

:is(a, button):is(.default-btn, .cta-btn, .theme-btn, .btn, [class*="-btn"], [class*="btn-"]):active {
    transform: translateY(0);
    box-shadow: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--wh-focus);
}

button:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: .6;
    transform: none !important;
}

/* Form fields: consistent, comfortable touch targets */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]),
select,
textarea {
    transition: border-color .2s ease, box-shadow .2s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):focus,
select:focus,
textarea:focus {
    border-color: var(--wh-red);
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .container,
    .container-fluid {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

@media (pointer: coarse) {
    :is(a, button):is(.default-btn, .cta-btn, .theme-btn, .btn, [class*="-btn"], [class*="btn-"]):not(.navbar-toggler, .btn-close, .audit-close-btn, .mean-expand) {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }

    :is(a, button):is(.default-btn, .cta-btn, .theme-btn, .btn, [class*="-btn"], [class*="btn-"]) {
        transition: none;
    }

    :is(a, button):is(.default-btn, .cta-btn, .theme-btn, .btn, [class*="-btn"], [class*="btn-"]):hover {
        transform: none;
    }
}
