/* =========================================
   fritts — Shared Styles
   Applies to all pages. Loaded after design.css.
   ========================================= */

/* Base Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Strip Elementor's default container chrome around every fritts widget so
   absolutely-positioned children (accordion sidebar, hero overlays, etc.)
   anchor to the widget root, not to a padded wrapper. */
[class*="elementor-widget-fritts_"] > .elementor-widget-container {
    padding: 0 !important;
    margin: 0 !important;
}

/* Same idea, one level up: any Elementor section / column / container that
   *contains* a fritts widget must be full-width with no gutter. The boxed
   default caps the inner container at ~1140px which leaves big teal gaps
   on either side of our sections. */
.elementor-section:has(> .elementor-container > .elementor-column [class*="elementor-widget-fritts_"]),
.elementor-section:has([class*="elementor-widget-fritts_"]) {
    padding: 0 !important;
}
.elementor-section:has([class*="elementor-widget-fritts_"]) > .elementor-container,
.elementor-section:has([class*="elementor-widget-fritts_"]) > .elementor-container > .elementor-column,
.elementor-section:has([class*="elementor-widget-fritts_"]) > .elementor-container > .elementor-column > .elementor-widget-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}
/* Elementor v3 container element (e-con) variant, same idea. */
.e-con:has([class*="elementor-widget-fritts_"]),
.e-con:has([class*="elementor-widget-fritts_"]) > .e-con-inner {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
}

/* Root font scales with viewport — pixel-perfect at 1644px (16px base).
   Use html:root (specificity 0,0,2) so an Elementor kit's `html { font-size: … }`
   injected after this stylesheet still loses on specificity. No !important —
   parity with the static site is the acceptance bar (Task 03, work item B). */
html:root {
    font-size: calc(16 * var(--frame-w) / 1644);
}

body {
    font-family: var(--font-family-primary);
    background-color: var(--color-brand-dark-teal);
    overflow-x: hidden;
}

/* =========================================
   App-frame clamp for Elementor pages
   Mirrors the static HTML's <div class="app-frame">: above 2.5:1
   aspect ratio, every Elementor page wrapper is clamped to
   var(--frame-w) (= 2.5 * 100vh) and centered. Letterbox bars and
   --frame-w / --frame-offset values are already defined in
   design.css; this just applies the wrapper width so widgets and
   fixed chrome (header, side menu) align to the clamped frame.
   ========================================= */
@media (min-aspect-ratio: 2.5 / 1) {
    /* Clamp the body itself — guarantees every theme wrapper,
       every Elementor section, every header/footer is contained
       in one shot, regardless of the theme's outer DOM structure.
       html background is letterbox color (set in design.css). */
    html {
        background: var(--color-letterbox) !important;
    }
    body {
        width: var(--frame-w) !important;
        margin-left: var(--frame-offset) !important;
        margin-right: var(--frame-offset) !important;
        overflow-x: clip;
    }

    /* Elementor full-width sections normally break out with
       `width: 100vw; margin-left: calc(-50vw + 50%)` to span the
       viewport. Inside a clamped body that produces a left-aligned
       3000-px overflow instead of centered 2000-px content. Force
       every Elementor wrapper back to 100% of the clamped body
       so columns/sections/containers center properly. */
    .elementor,
    .elementor-section,
    .elementor-container,
    .elementor-row,
    .elementor-column,
    .elementor-column-wrap,
    .elementor-widget-wrap,
    .elementor-element,
    .e-con,
    .e-con-inner,
    [data-elementor-type] {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        left: auto !important;
        right: auto !important;
    }
}

/* =========================================
   Header
   ========================================= */
header {
    position: fixed;
    top: 0;
    left: var(--frame-offset);
    right: var(--frame-offset);
    width: var(--frame-w);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: var(--header-padding-block) var(--header-padding-inline);
    z-index: 100;
    background-color: transparent;
    transition: background-color 0.4s ease;
}

header > .logo {
    justify-self: start;
}

header > .header-left {
    justify-self: stretch;
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.2em;
    padding-left: 2em;
}

.header-left .logo {
    flex-shrink: 0;
}

.header-left .header-contact-item,
.header-right .header-contact-item {
    white-space: nowrap;
}

header > .nav-links {
    justify-self: center;
}

.header-right {
    justify-self: stretch;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2em;
    padding-right: 2em;
}

/* Hide the mobile-only contact circle on desktop */
.contact-fab {
    display: none;
}

header.header-solid {
    background-color: var(--color-brand-dark-teal);
}

.logo img {
    width: var(--logo-width);
    height: var(--logo-height);
    object-fit: contain;
}

/* =========================================
   Nav Pill
   ========================================= */
.nav-links {
    background: var(--nav-pill-bg);
    backdrop-filter: blur(var(--nav-pill-blur));
    padding: var(--nav-pill-padding-block) var(--nav-pill-padding-inline);
    border-radius: var(--nav-pill-radius);
    display: flex;
    gap: var(--nav-pill-gap);
    margin: 0 1em;
}

.nav-links a {
    color: var(--color-brand-white);
    text-decoration: none;
    font-size: var(--nav-font-size);
    font-weight: var(--nav-font-weight);
    font-style: var(--nav-font-style);
    line-height: var(--nav-line-height);
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.8;
}

.nav-links a.active {
    font-weight: var(--nav-font-weight-active);
}

/* =========================================
   Header Contact (phone + email)
   ========================================= */
.header-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35em;
    line-height: 1.2;
}

.header-contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    color: var(--color-brand-white);
    text-decoration: none;
        font-size: 0.85em;
    font-weight: 700;
    font-family: var(--font-family-primary);
    transition: opacity 0.2s ease;
}

.header-contact-item:hover {
    opacity: 0.75;
}

.header-contact-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    display: block;
}

/* =========================================
   Primary Button
   ========================================= */
.btn-primary {
    background-color: var(--color-brand-red);
    color: var(--color-brand-white);
    border: none;
    padding: var(--nav-btn-padding-block) var(--nav-btn-padding-inline);
    border-radius: var(--nav-pill-radius);
    font-size: var(--nav-font-size);
    font-weight: var(--nav-font-weight);
    font-style: var(--nav-font-style);
    line-height: var(--nav-line-height);
    cursor: pointer;
    transition: transform 0.2s ease;
    font-family: var(--font-family-primary);
}

.btn-primary:hover {
    transform: scale(1.05);
}

a.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* =========================================
   Hamburger — hidden on desktop, shown on mobile
   ========================================= */
.hamburger {
    display: none;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px !important;
    width: 2.8em !important;
    height: 2.8em !important;
    min-width: 0 !important;
    min-height: 0 !important;
    z-index: 1100;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    appearance: none;
    -webkit-appearance: none;
}

.hamburger-line {
    display: block !important;
    width: 100% !important;
    height: 2px !important;
    background: var(--color-brand-white) !important;
    border-radius: 2px !important;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
    margin: 0 !important;
    padding: 0 !important;
}

.hamburger.is-open .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.is-open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.is-open .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =========================================
   Mobile
   ========================================= */
@media (max-width: 768px) {
    html {
        font-size: calc(16px * 100vw / 390);
    }

    header {
        left: 0;
        right: 0;
        width: 100%;
        padding: 1em 1.2em;
        display: flex;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .logo img {
        width: 100px;
        height: 25px;
    }

    .nav-links,
    .header-right .btn-primary {
        display: none !important;
    }

    .hamburger {
        display: flex !important;
        width: 33px !important;
        height: 33px !important;
        min-width: 33px !important;
        flex: 0 0 33px !important;
        gap: 8px !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .hamburger .hamburger-line {
        width: 100% !important;
        height: 2px !important;
        background: #ffffff !important;
        border-radius: 2px !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .header-right {
        gap: 0.6em;
        margin-left: auto;
        margin-right: 0.8em;
    }

    .header-contact {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25em;
    }

    .header-contact-item {
        gap: 0.45em;
        padding: 0.3em 0;
        font-size: 2em;
    }

    .header-contact-icon {
        width: 1.1em;
        height: 1.1em;
    }
}

/* =========================================
   Loading Overlay (shared across pages)
   Sits below #rotate-device-prompt (z: 999999)
   and above everything else on the page.
   ========================================= */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: var(--color-brand-dark-teal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3em;
    opacity: 1;
    transition: opacity 0.6s ease;
    font-family: var(--font-family-primary);
}

#loading-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-overlay.is-done {
    visibility: hidden;
}

.loading-overlay__icon {
    width: min(18em, 28vw);
    height: auto;
    display: block;
}

.loading-overlay__bar {
    width: min(24em, 40vw);
    height: 0.5em;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50px;
    overflow: hidden;
}

.loading-overlay__fill {
    width: 0%;
    height: 100%;
    background: var(--color-brand-red);
    border-radius: 50px;
    transition: width 0.25s ease-out;
}
