/* Motion & feel layer (branch motion-redesign).
   Slow, smooth transitions, scroll-triggered reveals, parallax heroes, a lighter large type scale and a
   dark footer, in the site's own blue (#0d4676) and logo yellow (#fecd2a). Loaded after screen_main.css.
   Everything that starts hidden is scoped to html.js (set only when the browser can run the effects),
   and prefers-reduced-motion turns the movement off. */

:root {
    --blue: #0d4676;
    --blue-deep: #0a3559;
    --yellow: #fecd2a;
    --mist: #f3f6f9;
    --soft-blue: rgba(13, 70, 118, 0.6); /* the nav bar's see-through blue, used for every blue fill */
    --soft-blur: blur(6px);
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}


/* ---- Intro: the logo over the page in a light soft blue and blur, lifted away once the page has loaded ---- */
#intro_curtain {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(13, 70, 118, 0.35); /* lighter than the nav's blue, so more of the page shows through */
    -webkit-backdrop-filter: var(--soft-blur);
    backdrop-filter: var(--soft-blur);
    transition: transform 1s var(--ease-in-out), visibility 0s linear 1s;
}

#intro_curtain img {
    height: clamp(7.5rem, 20vh, 11rem); /* larger than the header logo on the loading screen, scaled to the window */
    opacity: 0;
    animation: intro_logo 2s var(--ease) 0.1s forwards; /* slow, gentle fade-in; motion.js waits for it before lifting */
}

@keyframes intro_logo {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

html.loaded #intro_curtain {
    transform: translateY(-100%);
    visibility: hidden;
}

html:not(.js) #intro_curtain {
    display: none;
}


/* ---- Nav: soft, see-through blue with a blur everywhere on the page; thin underline on hover/active ---- */
nav {
    opacity: 1;
    background-color: transparent;
}

/* the bar's soft blue and blur live on a layer behind it rather than on the bar itself: an element with a
   backdrop blur stops anything inside it (the phone menu) from blurring the page, so this keeps both working */
nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-color: var(--soft-blue);
    -webkit-backdrop-filter: var(--soft-blur);
    backdrop-filter: var(--soft-blur);
}


/* ---- Every other blue fill gets the same soft, see-through blue and blur as the nav ---- */
button.scroll_hint,
a.hero_button.primary:hover, a.hero_button.primary:focus-visible,
button.show_on_map:hover, button.show_on_map:focus-visible,
.form_field label.choice:has(input:checked),
.form_buttons,
footer.site_footer {
    background-color: var(--soft-blue);
    -webkit-backdrop-filter: var(--soft-blur);
    backdrop-filter: var(--soft-blur);
}

.form_field label.choice:has(input:checked) {
    border-color: transparent;
}

/* submit buttons keep their yellow hover */
.form_actions .form_buttons:hover, .form_actions .form_buttons:focus-visible {
    background-color: var(--yellow);
}

nav ul li:hover {
    background-color: transparent;
}

nav ul li a {
    position: relative;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    transition: color 0.3s var(--ease);
}

nav ul li a::after {
    content: '';
    position: absolute;
    left: 50%;
    right: 50%;
    bottom: 0.55rem;
    height: 2px;
    background-color: var(--yellow);
    transition: left 0.4s var(--ease), right 0.4s var(--ease);
}

nav ul li a:hover, nav ul li.active a, nav ul li.active a:hover {
    color: white;
}

nav ul li a:hover::after, nav ul li.active a::after {
    left: 28%;
    right: 28%;
}


/* ---- Type: larger, lighter headings with tighter tracking ---- */
div.hero_text :is(h1, h2) {
    font-size: clamp(2.6rem, 5.2vw, 4.75rem);
    font-weight: 300;
    line-height: 1.04;
    letter-spacing: -0.03em;
    text-transform: none;
}

p.hero_subtitle {
    max-width: 32rem;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    font-weight: 300;
}

section#reasons h2, header.service_header h3, .glass_card h3 {
    font-weight: 400;
    letter-spacing: -0.02em;
}

section#reasons h2 {
    font-size: clamp(2rem, 3.6vw, 3.2rem);
}

/* light grey sections behind white cards, with more breathing room */
#home div.content, #services div.content, #portfolio div.content {
    background-color: var(--mist);
}

div.content section#reasons {
    padding-top: 2rem;
    padding-bottom: 6rem;
}

div.content section#service_container {
    padding-top: 6rem;
    padding-bottom: 6rem;
}


/* ---- Heroes: deeper tint for contrast, slow zoom-out on load, parallax while scrolling (motion.js) ---- */
div.hero {
    overflow: hidden;
}

div.text_hero::before {
    background: linear-gradient(90deg, rgba(10, 35, 60, 0.72) 0%, rgba(10, 35, 60, 0.4) 50%, rgba(10, 35, 60, 0.15) 100%);
}

/* home hero: dark behind the text on the left, fading out so the right side of the photo stays bright */
#home div.text_hero::before {
    background: linear-gradient(90deg, rgba(10, 35, 60, 0.75) 0%, rgba(10, 35, 60, 0.5) 30%, rgba(10, 35, 60, 0.12) 55%, rgba(10, 35, 60, 0) 70%);
}

div.hero img.slide {
    scale: 1.18; /* extra room so the parallax drift never shows an edge */
    will-change: translate;
}

html.js div.text_hero img.slide {
    scale: 1.3;
    transition: scale 2.6s var(--ease);
}

html.js.loaded div.text_hero.is_shown img.slide {
    scale: 1.18;
}

/* Services banner: show the lower part of the photo (the floor and the cleaner), not the ceiling.
   Anchoring the extra parallax zoom at the bottom keeps that part in view too. */
#services div.text_hero img.slide {
    object-position: center 85%;
    transform-origin: center bottom;
}

/* hero headline: words rise in one after another, then the subtitle and buttons */
.hero_text :is(h1, h2) span.word, p.statement span.word {
    font-size: inherit; /* the site styles every span small; word spans must match their heading */
    letter-spacing: inherit;
}

.hero_text :is(h1, h2) .word {
    display: inline-block;
}

html.js .hero_text :is(h1, h2) .word {
    opacity: 0;
    transform: translateY(0.55em);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms + 150ms);
}

html.js .hero_text p.hero_subtitle, html.js .hero_text .hero_actions {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.9s var(--ease) 0.75s, transform 0.9s var(--ease) 0.75s;
}

html.js .hero_text .hero_actions {
    transition-delay: 0.95s;
}

html.js .is_shown .hero_text :is(h1, h2) .word,
html.js .is_shown .hero_text p.hero_subtitle,
html.js .is_shown .hero_text .hero_actions {
    opacity: 1;
    transform: none;
}

/* squarer, quieter hero buttons */
a.hero_button, button.hero_button {
    padding: 0.95rem 1.6rem;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-radius: 2px;
    transition: background-color 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease);
}


/* ---- Statement band: words light up as it scrolls through the screen; a yellow slash draws in ---- */
div.statement_band {
    position: relative;
    box-sizing: border-box;
    width: 92%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 7rem 0 5rem 7rem;
}

p.statement {
    margin: 0;
    font-size: clamp(1.6rem, 3.2vw, 2.8rem);
    font-weight: 300;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--blue);
}

p.statement .word {
    transition: opacity 0.45s var(--ease);
}

html.js p.statement .word {
    opacity: 0.16;
}

html.js p.statement .word.lit {
    opacity: 1;
}

span.statement_slash {
    position: absolute;
    top: 5.5rem;
    left: 2.5rem;
    width: 2px;
    height: 9rem;
    background-color: var(--yellow);
    transform: rotate(24deg) scaleY(1);
    transform-origin: bottom center;
    transition: transform 1.4s var(--ease) 0.2s;
}

html.js div.statement_band:not(.in_view) span.statement_slash {
    transform: rotate(24deg) scaleY(0);
}


/* ---- Reveals: content glides up and fades in as it enters the screen (staggered in groups) ---- */
.reveal_item {
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

html.js .reveal_item:not(.in_view) {
    opacity: 0;
    transform: translateY(32px);
}

/* project photos fade in from a washed-out, slightly zoomed state */
.project_media > img, .project_media > .project_placeholder {
    transition: opacity 1.1s var(--ease), transform 1.6s var(--ease);
}

html.js .reveal_item:not(.in_view) .project_media > img,
html.js .reveal_item:not(.in_view) .project_media > .project_placeholder {
    opacity: 0.25;
    transform: scale(1.08);
}

figure.project, figure.reasons_item, article.service_card {
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), box-shadow 0.4s var(--ease);
}

/* hover: deeper shadow and a slow photo zoom instead of a quick lift */
figure.project:hover, figure.reasons_item:hover, article.service_card:hover {
    transform: none;
    box-shadow: 0 18px 40px rgba(13, 70, 118, 0.16);
}

figure.project .project_media img {
    transition: opacity 1.1s var(--ease), transform 1.6s var(--ease);
}

figure.project:hover .project_media img {
    transform: scale(1.04);
}


/* ---- Quote section: no background photo; solid white cards on the light grey used by the other sections ---- */
#quote div.hero.form_hero {
    min-height: 0;
    background-color: var(--mist);
}

#quote div.form_overlay {
    padding-bottom: 6rem;
}

#quote .glass_card {
    border-color: #e3e9ef;
    background-color: white;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 2px 10px rgba(13, 70, 118, 0.12);
}


/* ---- Thank-you and error pages: the message heading is the page's h1 ---- */
h1.message_heading {
    margin: 0 0 1rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.2;
}


/* ---- Arrow links: text, a circled arrow and an underline that sweeps across on hover ---- */
a.arrow_link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    max-width: 26rem;
    padding: 0 0 0.9rem;
    font-size: 1.15rem;
    color: var(--blue);
    border-bottom: 1px solid rgba(13, 70, 118, 0.25);
}

a.arrow_link > span:first-child {
    font-size: 1.1rem; /* override the site-wide small span size */
}

a.arrow_link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background-color: var(--yellow);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.6s var(--ease);
}

a.arrow_link:hover::after, a.arrow_link:focus-visible::after {
    transform: scaleX(1);
}

span.arrow_circle {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgba(13, 70, 118, 0.5);
    border-radius: 50%;
    transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}

span.arrow_circle svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: var(--blue);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.35s var(--ease);
}

a.arrow_link:hover span.arrow_circle, a.arrow_link:focus-visible span.arrow_circle {
    border-color: var(--yellow);
    background-color: var(--yellow);
}

a.arrow_link:hover span.arrow_circle svg {
    transform: translateX(3px);
}

a.arrow_link:focus-visible {
    outline: none;
}


/* ---- Footer: dark blue with the logo, contact details and links ---- */
footer.site_footer {
    min-height: 0;
    color: rgba(255, 255, 255, 0.9);
}

div.footer_inner {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    width: 92%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 4.5rem 0 3.5rem;
}

div.footer_brand img {
    height: 4.5rem;
    margin-bottom: 1.25rem;
}

div.footer_brand p {
    max-width: 22rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.6;
}

div.footer_col h4 {
    margin: 0 0 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--yellow);
}

div.footer_col p, ul.footer_links li {
    margin: 0 0 0.7rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

ul.footer_links {
    margin: 0;
    padding: 0;
    list-style: none;
}

footer.site_footer a {
    color: white;
    background: linear-gradient(var(--yellow), var(--yellow)) left bottom / 0 1px no-repeat;
    transition: background-size 0.5s var(--ease), color 0.3s var(--ease);
}

footer.site_footer a:hover {
    color: var(--yellow);
    background-size: 100% 1px;
}

div.footer_bottom {
    padding: 1.25rem 4%;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

footer.site_footer small.copyright {
    margin: 0;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
}

@media screen and (max-width: 800px) {
    div.footer_inner {
        grid-template-columns: 1fr;
        gap: 2.25rem;
        padding: 3.5rem 0 2.5rem;
    }
}


/* ---- Phones ---- */
@media screen and (max-width: 560px) {
    /* hero text sits at the bottom on phones, so darken from the bottom up instead of from the left */
    div.text_hero::before, #home div.text_hero::before {
        background: linear-gradient(0deg, rgba(10, 35, 60, 0.75) 0%, rgba(10, 35, 60, 0.35) 45%, rgba(10, 35, 60, 0) 70%);
    }

    /* the drop-down menu: the same soft blue and blur as the bar */
    nav ul {
        background-color: var(--soft-blue);
        -webkit-backdrop-filter: var(--soft-blur);
        backdrop-filter: var(--soft-blur);
    }

    nav ul li a::after {
        display: none;
    }

    /* larger, easy-to-tap links in the phone menu */
    nav ul li a {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
        line-height: 1.4;
    }

    /* no underline in the phone menu, so the current section is shown in yellow */
    nav ul li.active a {
        color: var(--yellow);
    }

    nav ul {
        box-shadow: 0 14px 28px rgba(5, 25, 45, 0.2);
    }

    div.statement_band {
        padding: 4rem 0 3rem 3rem;
    }

    span.statement_slash {
        top: 3.5rem;
        left: 0.75rem;
        height: 6rem;
    }

    footer.site_footer div.footer_col p, footer.site_footer ul.footer_links li, div.footer_brand p {
        font-size: 0.9rem;
    }

    footer.site_footer div.footer_col h4 {
        font-size: 0.7rem;
    }
}


/* ---- Phones and short screens (e.g. a phone held sideways): the hero text joins the normal flow at the
   bottom of the photo, and the photo grows if the text needs more room, so it never runs under the header
   or out of the photo. ---- */
@media screen and (max-width: 560px), screen and (max-height: 500px) {
    div.hero.text_hero {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        box-sizing: border-box;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 11.25rem 0 4.5rem; /* top: clears the header and nav; bottom: room for the scroll chevron */
    }

    .page_section:not(#home) div.hero.text_hero {
        height: auto;
        min-height: 70vh;
        min-height: 70dvh;
        padding-top: 5rem; /* mid-page only the nav overlaps the photo */
    }

    div.hero.text_hero img.slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    div.hero_text {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        width: auto;
        max-width: 36rem;
        margin: 0 1rem 0 5%;
    }
}

@media screen and (max-height: 500px) {
    div.hero_text :is(h1, h2) {
        font-size: clamp(1.8rem, 4vw, 2.6rem);
    }
}

/* on short screens the hero is taller than the window anyway, and the chevron would sit on the hero buttons */
@media screen and (max-height: 600px) {
    button#scroll_hint {
        display: none;
    }
}


/* ---- Reduced motion: keep the look, drop the movement ---- */
@media (prefers-reduced-motion: reduce) {
    #intro_curtain { display: none; }

    html.js .reveal_item:not(.in_view),
    html.js .hero_text :is(h1, h2) .word,
    html.js .hero_text p.hero_subtitle,
    html.js .hero_text .hero_actions,
    html.js .reveal_item:not(.in_view) .project_media > img,
    html.js .reveal_item:not(.in_view) .project_media > .project_placeholder {
        opacity: 1;
        transform: none;
    }

    html.js p.statement .word { opacity: 1; }
    html.js div.statement_band:not(.in_view) span.statement_slash { transform: rotate(24deg); }
    div.hero img.slide, html.js div.text_hero img.slide { scale: 1; translate: none !important; transition: none; }
}
