/* =========================================================================
   EAOY Factory — header, footer, navigation, WordPress and plugin glue
   ========================================================================= */

/* -------------------------------------------------------------------------
   Site header
   ---------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

/* On the homepage the bar is meant to sit over the hero with no chrome, then
   take on the opaque treatment once the page scrolls. navigation.js sets
   `.is-solid`.

   This only works when the photograph really starts at y=0 behind the bar.
   The old rules declared the bar transparent and turned every label white,
   but the bar was still `position: sticky` — so it took up 83px of flow — and
   the first Elementor section carried the theme's `.section` rhythm on a white
   page. Measured on the live site the bar sat at 0–83 with `hero` starting at
   171 and the pixels behind the bar were rgb(255,255,255): white type on white
   paper, ratio 1:1, no menu visible at all.

   So the overlay is now opt-in through `body.eaoy-hero-under-header`, which
   header.php only prints on the front page, and the layout is corrected here:
   the bar leaves the flow and the hero is pulled up under it. Every white-text
   rule is scoped the same way, so a page that cannot paint a photo under the
   bar keeps the default opaque cream bar with dark type. */

body.eaoy-hero-under-header .site-header--over-hero {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
}

/* The hero must reach the top edge, otherwise the bar floats over white. The
   first section's 88px top rhythm is what pushed it down. */
body.eaoy-hero-under-header .site-main > .elementor > .elementor-top-section:first-child {
    padding-top: 0;
}

/* The bar is fixed, so it sits over the photo instead of above it. On wide
   screens the hero's own top padding (--section * 1.6) already clears an 83px
   bar, but the narrow breakpoints shrink that padding to 59.4px while the bar
   only drops to 69px — which buried the eyebrow line by 10px. Guarantee the
   clearance here instead of trusting each breakpoint's rhythm. */
body.eaoy-hero-under-header .hero__inner {
    padding-top: max(calc(var(--section) * 1.6), 104px);
}

@media (max-width: 980px) {
    body.eaoy-hero-under-header .hero__inner {
        padding-top: max(calc(var(--section) * 1.1), 100px);
    }
}

/* Below 620px the bar is 69px tall (68px inner + 1px rule) and the header CTA
   is hidden, so the brand block needs the room the bar height frees up. */
@media (max-width: 620px) {
    body.eaoy-hero-under-header .hero__inner {
        padding-top: max(calc(var(--section) * 1.1), 92px);
    }
}

/* A scrim across the top of the photograph so the nav still clears 4.5:1 over
   a bright sky. Appended to the media's existing gradient rather than drawn as
   a sibling, because `.hero__media` already owns the stacking context. */
body.eaoy-hero-under-header .hero__media::after {
    background:
        linear-gradient(to bottom,
            rgba(20, 33, 27, 0.66) 0,
            rgba(20, 33, 27, 0.34) 96px,
            rgba(20, 33, 27, 0) 172px),
        linear-gradient(to top,
            rgba(20, 33, 27, 0.86) 0%,
            rgba(20, 33, 27, 0.42) 42%,
            rgba(20, 33, 27, 0.12) 72%),
        linear-gradient(to right, rgba(20, 33, 27, 0.5), rgba(20, 33, 27, 0) 62%);
}

body.eaoy-hero-under-header .site-header--over-hero .site-header__name strong,
body.eaoy-hero-under-header .site-header--over-hero .menu a {
    color: #fff;
}

body.eaoy-hero-under-header .site-header--over-hero .site-header__name span {
    color: rgba(255, 255, 255, 0.78);
}

body.eaoy-hero-under-header .site-header--over-hero .site-header__brand img {
    filter: brightness(0) invert(1);
}

body.eaoy-hero-under-header .site-header--over-hero .menu a:hover,
body.eaoy-hero-under-header .site-header--over-hero .menu .current-menu-item > a,
body.eaoy-hero-under-header .site-header--over-hero .menu .current_page_item > a {
    color: #fff;
    border-bottom-color: #fff;
}

body.eaoy-hero-under-header .site-header--over-hero .site-header__cta {
    background: #fff;
    border-color: #fff;
    color: var(--ink);
}

body.eaoy-hero-under-header .site-header--over-hero .site-header__cta:hover {
    background: var(--clay);
    border-color: var(--clay);
    color: #fff;
}

body.eaoy-hero-under-header .site-header--over-hero .lang-switch a {
    color: rgba(255, 255, 255, 0.82);
}

body.eaoy-hero-under-header .site-header--over-hero .lang-switch .current-lang a,
body.eaoy-hero-under-header .site-header--over-hero .lang-switch a:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

body.eaoy-hero-under-header .site-header--over-hero .nav-toggle {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.34);
}

body.eaoy-hero-under-header .site-header--over-hero .nav-toggle span,
body.eaoy-hero-under-header .site-header--over-hero .nav-toggle span::before,
body.eaoy-hero-under-header .site-header--over-hero .nav-toggle span::after {
    background: #fff;
}

/* Once scrolled the bar is always opaque, including over a hero. */
.site-header--over-hero.is-solid {
    background: rgba(255, 255, 255, 0.96);
    border-bottom-color: var(--line);
    box-shadow: 0 1px 0 rgba(29, 26, 23, 0.04);
}

.site-header--over-hero.is-solid .site-header__name strong,
.site-header--over-hero.is-solid .menu a {
    color: var(--ink);
}

.site-header--over-hero.is-solid .site-header__name span {
    color: var(--muted);
}

.site-header--over-hero.is-solid .site-header__brand img {
    filter: none;
}

.site-header--over-hero.is-solid .menu a:hover,
.site-header--over-hero.is-solid .menu .current-menu-item > a {
    color: var(--clay);
    border-bottom-color: var(--clay);
}

.site-header--over-hero.is-solid .site-header__cta {
    background: var(--pine);
    border-color: var(--pine);
    color: #fff;
}

.site-header--over-hero.is-solid .lang-switch a {
    color: var(--muted);
}

.site-header--over-hero.is-solid .lang-switch .current-lang a,
.site-header--over-hero.is-solid .lang-switch a:hover {
    background: var(--sand);
    color: var(--ink);
}

.site-header--over-hero.is-solid .nav-toggle {
    background: #fff;
    border-color: var(--line);
}

.site-header--over-hero.is-solid .nav-toggle span,
.site-header--over-hero.is-solid .nav-toggle span::before,
.site-header--over-hero.is-solid .nav-toggle span::after {
    background: var(--ink);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 36px;
    min-height: 82px;
}

.site-header__brand {
    display: flex;
    align-items: center;
    gap: 13px;
    /* Allow shrinking below the wordmark's intrinsic width; the ellipsis on
       `.site-header__name strong` then shortens the name instead of pushing
       the actions off-screen. flex-shrink must be 1 for min-width to bite. */
    flex: 0 1 auto;
    min-width: 0;
}

.site-header__brand img {
    max-height: 42px;
    width: auto;
    flex: 0 0 auto;
}

.site-header__name {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.site-header__name strong {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink);
    transition: color 0.22s ease;
    /* One line, clipped with an ellipsis, so the bar never grows wider than
       the viewport. */
    display: block;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.site-header__name span {
    font-size: 10px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.22s ease;
}

.site-header__nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
}

.site-header__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

/* Primary menu */
.menu {
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu li {
    margin: 0;
    position: relative;
}

.menu a {
    display: inline-block;
    padding: 6px 0;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink);
    border-bottom: 1px solid transparent;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.menu a:hover,
.menu .current-menu-item > a,
.menu .current_page_item > a {
    color: var(--clay);
    border-bottom-color: var(--clay);
}

/* Sub menu */
.menu .sub-menu {
    position: absolute;
    top: 100%;
    left: -18px;
    min-width: 230px;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.menu li:hover > .sub-menu,
.menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu .sub-menu a {
    display: block;
    padding: 8px 20px;
    border-bottom: 0;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0.01em;
}

.menu .sub-menu a:hover {
    background: var(--sand);
}

/* Mobile toggle */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    transition: background 0.22s ease, border-color 0.22s ease;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.22s ease;
}

.nav-toggle span {
    position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
    content: '';
    position: absolute;
    left: 0;
}

.nav-toggle span::before {
    top: -6px;
}

.nav-toggle span::after {
    top: 6px;
}

.nav-toggle[aria-expanded="true"] span {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] span::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Language switch */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 12px;
}

.lang-switch li {
    margin: 0;
}

.lang-switch a {
    padding: 5px 9px;
    border-radius: 2px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.08em;
    transition: background 0.18s ease, color 0.18s ease;
}

.lang-switch .current-lang a,
.lang-switch a:hover {
    background: var(--sand);
    color: var(--ink);
}

/* Polylang's own flag list, if the widget is used */
.widget_polylang ul {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.widget_polylang li {
    margin: 0;
}

@media (max-width: 1080px) {
    .site-header__nav {
        position: fixed;
        top: 82px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 82px);
        overflow-y: auto;
        padding: 24px var(--pad) 32px;
        background: #fff;
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }
    .site-header__nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .site-header__nav .menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    .site-header__nav .menu a {
        display: block;
        padding: 15px 0;
        border-bottom: 1px solid var(--line);
        font-size: 15px;
        color: var(--ink) !important;
    }
    .site-header__nav .menu .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        min-width: 0;
        padding: 0 0 8px 16px;
        border: 0;
        box-shadow: none;
        background: transparent;
    }
    .nav-toggle {
        display: inline-flex;
    }
}

@media (max-width: 620px) {
    .site-header__actions .button {
        display: none;
    }
    .site-header__inner {
        min-height: 68px;
        gap: 12px;
    }
    .site-header__nav {
        top: 68px;
        max-height: calc(100vh - 68px);
    }
    /* At this width the full legal name cannot fit beside a 42px mark and the
       menu button, so the wordmark gives way instead of overflowing. */
    .site-header__name strong {
        font-size: 14px;
        letter-spacing: 0;
    }
    .site-header__name span {
        display: none;
    }
}

/* Very small screens: 44px mark + gap + a 15-character wordmark + a 44px
   button still exceeds 320px, so drop to the mark and the short brand name. */
@media (max-width: 400px) {
    .site-header__brand img {
        max-height: 34px;
    }
    .site-header__name strong {
        font-size: 13px;
    }
}

/* -------------------------------------------------------------------------
   Site footer
   ---------------------------------------------------------------------- */

.site-footer {
    background: var(--pine);
    color: rgba(255, 255, 255, 0.76);
    padding: calc(var(--section) * 0.85) 0 32px;
    font-size: 14px;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.76);
}

.site-footer a:hover {
    color: #fff;
}

.site-footer h3,
.site-footer h4 {
    margin: 0 0 18px;
    color: #fff;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.site-footer__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.site-footer__brand img {
    max-height: 46px;
    width: auto;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
}

.site-footer__brand p {
    margin: 0 0 16px;
    max-width: 36ch;
    line-height: 1.7;
}

.site-footer__address {
    color: rgba(255, 255, 255, 0.55);
}

.site-footer__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer__list li {
    margin: 0 0 11px;
}

.site-footer__count {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.site-footer__terms {
    margin: 20px 0 0;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.55);
}

.site-footer__terms abbr {
    text-decoration: none;
    letter-spacing: 0.08em;
}

.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding-top: 28px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.55);
}

.site-footer__bottom p {
    margin: 0;
}

.footer-legal a + a::before {
    content: '·';
    margin: 0 10px;
    color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 980px) {
    .site-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 34px;
    }
}

@media (max-width: 560px) {
    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* -------------------------------------------------------------------------
   Elementor compatibility
   ---------------------------------------------------------------------- */

/* Sections carry the .section primitive, so the theme's own padding and
   background already apply. Stop Elementor adding a second gutter on top. */
.elementor-section.elementor-section-boxed > .elementor-container {
    max-width: var(--wrap);
}

.elementor-section.section {
    padding-left: 0;
    padding-right: 0;
}

.elementor-section.section > .elementor-container {
    padding-left: var(--pad);
    padding-right: var(--pad);
}

/* Boxed sections must not double up the container padding. */
.elementor-section.section > .elementor-container > .elementor-column > .elementor-element-populated {
    padding: 0;
}

/* Newsletter/hero style sections that ask for full bleed keep it. */
.elementor-section.section--full > .elementor-container,
.elementor-section.section--flush > .elementor-container {
    max-width: none;
    padding: 0;
}

/* Widgets stack with the section rhythm, not Elementor's 10px default. */
.elementor-widget:not(:last-child) {
    margin-bottom: 0;
}

.elementor-widget-container > .section:first-child,
.elementor-widget-container > .page-header:first-child {
    padding-top: 0;
}

.elementor-widget-container > .section:last-child {
    padding-bottom: 0;
}

/* Headings and text inside Elementor should inherit the theme font. */
.elementor-widget-heading .elementor-heading-title,
.elementor-widget-text-editor,
.elementor-widget-button .elementor-button {
    font-family: var(--font);
}

/* Elementor's own button widget adopts the theme button. */
.elementor-button {
    border-radius: var(--radius);
    text-decoration: none;
}

/* Keep the editor canvas readable. */
body.elementor-editor-active .site-header {
    position: static;
}

/* The EAOY data blocks need the plugin stylesheet; it is only printed when
   a block is present, so nothing extra loads on a plain page. */
.eaoy-reg,
.eaoy-facts,
.eaoy-bars,
.eaoy-table,
.eaoy-flow,
.eaoy-shots,
.eaoy-review,
.eaoy-docs,
.eaoy-strip,
.eaoy-workforce,
.eaoy-turnover,
.eaoy-customers {
    margin: 0;
}

/* -------------------------------------------------------------------------
   WordPress core blocks and plugin glue
   ---------------------------------------------------------------------- */

.alignwide {
    width: min(100%, var(--wrap));
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
}

.alignleft {
    float: left;
    margin: 0 32px 20px 0;
}

.alignright {
    float: right;
    margin: 0 0 20px 32px;
}

.aligncenter {
    margin-left: auto;
    margin-right: auto;
}

.wp-caption-text,
figcaption {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

/* Pagination */
.pagination,
.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 60px;
}

.pagination .page-numbers,
.nav-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.pagination .page-numbers:hover,
.nav-links .page-numbers:hover {
    border-color: var(--pine);
}

.pagination .page-numbers.current,
.nav-links .page-numbers.current {
    background: var(--pine);
    border-color: var(--pine);
    color: #fff;
}

/* Forms — used by the contact and quote pages */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 20px;
}

.field label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.field .req {
    color: var(--clay);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font-family: var(--font);
    font-size: 15px;
    color: var(--ink);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: var(--pine);
    box-shadow: 0 0 0 3px rgba(160, 77, 86, 0.14);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

.form-notice {
    padding: 15px 19px;
    border-radius: var(--radius);
    border-left: 3px solid var(--clay);
    background: var(--sand);
    font-size: 14px;
}

.form-notice--error {
    border-left-color: #b3261e;
    background: #fdf1f0;
}

/* Search form */
.search-form {
    display: flex;
    gap: 10px;
}

.search-form input[type="search"] {
    flex: 1 1 auto;
}

/* -------------------------------------------------------------------------
   Print
   ---------------------------------------------------------------------- */

@media print {
    .site-header,
    .site-footer,
    .nav-toggle,
    .buttons,
    .pagination,
    .filter-bar {
        display: none !important;
    }
    .section {
        padding: 20px 0;
    }
    body {
        font-size: 12pt;
    }
}
