/* ============================================================
   HOME PAGE — HERO (hm-hero)
   Centred two-tone headline + subtitle at the top, brand blurb + CTAs
   bottom-left, video card bottom-right, over the dark brand banner.
   Home-only file with its own hm-hero* names: the old .hero-section
   class is shared with the contact and software pages.
   ============================================================ */

.hm-hero {
    --hm-hero-header-h: 124px; /* announcement bar + navbar overlay the hero */
    position: relative;
    display: flex;
    min-height: max(100vh, 680px);
    padding: calc(var(--hm-hero-header-h) + 28px) 0 40px;
    background-color: var(--bg-dark);
    overflow: hidden;
    isolation: isolate;
}

/* Background on its own layer (oversized a little) so home-hero.js can zoom
   and parallax it without moving the content */
.hm-hero__bg {
    position: absolute;
    inset: -6% -3%;
    z-index: -2;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    will-change: transform;
}

/* light shade so the centred headline and the bottom row stay readable */
.hm-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg,
            rgba(8, 10, 22, 0.35) 0%,
            rgba(8, 10, 22, 0.12) 45%,
            rgba(8, 10, 22, 0.55) 100%);
}

.hm-hero__inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
}

/* ── Headline block ── */
.hm-hero__head {
    text-align: center;
    margin-top: 3vh;
}

.hm-hero__title {
    margin: 0 auto;
    max-width: 1120px;
    color: var(--text-white);
    font-family: var(--font-secondary);
    font-size: clamp(2.4rem, 5.3vw, 5.2rem);
    font-weight: 500;
    line-height: 1.02;
    letter-spacing: -0.045em;
}

/* second half in a lighter brand tone, like the reference's two-tone headline */
.hm-hero__title-accent {
    display: block; /* two lines, second line in the lighter tone */
    background: linear-gradient(120deg, #c4b5fd 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Headline words (wrapped by home-hero.js): each word rises from behind a
   mask. Padding/negative margin keeps descenders (g, y, p) from clipping. */
.hm-hero__word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    /* room for descenders (g, p, y) and side bearings; offset by the negative
       margins so spacing is unchanged. The mask is removed after the rise. */
    padding: 0 0.1em 0.3em;
    margin: 0 -0.1em -0.3em;
}

.hm-hero__word-in {
    display: inline-block;
    /* Gradient words paint via background-clip:text, and a background only
       covers the element's box, so g/p/y tails below the line would be left
       unpainted (invisible). Extend the box past descenders/side bearings and
       offset it with negative margins so the layout doesn't move. */
    padding: 0 0.06em 0.28em;
    margin: 0 -0.06em -0.28em;
    will-change: transform;
}

/* accent words: per-word gradient, positioned by JS so it reads as one sweep */
.hm-hero__title-accent .hm-hero__word-in {
    background-image: linear-gradient(120deg, #c4b5fd 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Hidden start state — only while the entrance animation is pending (the
   html.hm-anim flag is removed if GSAP can't run, so content never stays hidden) */
.hm-anim .hm-hero__word-in,
.hm-anim .hm-hero__sub,
.hm-anim .hm-hero__brand-label,
.hm-anim .hm-hero__brand-text,
.hm-anim .hm-hero__ctas,
.hm-anim .hm-hero__work,
.hm-anim .hm-hero__work-cap {
    opacity: 0;
}

.hm-hero__sub {
    margin: 28px auto 0;
    max-width: 520px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.05rem;
    line-height: 1.6;
}

/* ── Bottom row ── */
.hm-hero__foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
}

.hm-hero__brand {
    max-width: 340px;
}

.hm-hero__brand-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-white);
    font-size: 0.9rem;
    font-weight: 600;
}

.hm-hero__brand-label i {
    color: #c4b5fd;
    font-size: 1rem;
}

.hm-hero__brand-text {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    line-height: 1.55;
}

.hm-hero__ctas {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-top: 32px;
}

.hm-hero__btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    border-radius: var(--radius-full, 999px);
    background: var(--text-white);
    color: var(--bg-dark);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.hm-hero__btn:hover {
    background: var(--gradient-primary);
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.hm-hero__link {
    color: var(--text-white);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease;
}

.hm-hero__link:hover {
    color: var(--text-white);
    border-bottom-color: rgba(255, 255, 255, 0.7);
}

/* ── Featured work card (bottom-right) ──
   Rotates through recent portfolio projects (home-hero.js); links to the
   Portfolio section. Slides are stacked and cross-fade. */
.hm-hero__media {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.hm-hero__work {
    position: relative;
    display: block;
    width: 290px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.hm-hero__work-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 0.9s ease, transform 4s ease;
}

.hm-hero__work-img.is-active {
    opacity: 1;
    transform: scale(1);
}

/* subtle bottom shade so the arrow and card edge read on bright shots */
.hm-hero__work::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 10, 22, 0) 55%, rgba(8, 10, 22, 0.35) 100%);
    pointer-events: none;
}

.hm-hero__work-arrow {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--bg-dark);
    font-size: 1rem;
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.hm-hero__work:hover .hm-hero__work-arrow {
    transform: rotate(45deg);
    background: var(--gradient-primary);
    color: var(--text-white);
}

.hm-hero__work:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.hm-hero__work-cap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
}

.hm-hero__work-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hm-hero__work-name {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.hm-hero__work-name.is-switching {
    opacity: 0;
}

.hm-hero__work-dots {
    display: inline-flex;
    gap: 5px;
    margin-left: 4px;
}

.hm-hero__work-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.3s ease, width 0.3s ease;
}

.hm-hero__work-dots i.is-active {
    width: 16px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .hm-hero {
        min-height: auto;
    }

    .hm-hero__work {
        width: 240px;
    }
}

@media (max-width: 767.98px) {
    .hm-hero {
        --hm-hero-header-h: 84px;
        padding-bottom: 36px;
    }

    .hm-hero__inner {
        gap: 56px;
    }

    .hm-hero__head {
        margin-top: 2vh;
    }

    .hm-hero__foot {
        flex-direction: column;
        align-items: stretch;
        gap: 36px;
    }

    .hm-hero__media {
        align-items: flex-start;
    }

    .hm-hero__work {
        width: 100%;
        max-width: 420px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hm-hero__work-img,
    .hm-hero__work-arrow,
    .hm-hero__btn {
        transition: none;
    }
}

/* ============================================================
   HOME — SECTION HEADINGS (word-rise, home-scroll.js)
   Each heading word rises from behind a mask. Padding/negative margin
   keeps descenders (g, y, p) from clipping.
   ============================================================ */
.hs-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    /* room for descenders (g, p, y) and side bearings; offset by the negative
       margins so spacing is unchanged. The mask is removed after the rise. */
    padding: 0 0.1em 0.3em;
    margin: 0 -0.1em -0.3em;
}

.hs-word-in {
    display: inline-block;
    /* Gradient words paint via background-clip:text, and a background only
       covers the element's box, so g/p/y tails below the line would be left
       unpainted (invisible). Extend the box past descenders/side bearings and
       offset it with negative margins so the layout doesn't move. */
    padding: 0 0.06em 0.28em;
    margin: 0 -0.06em -0.28em;
}

/* style.css paints a gradient on EVERY `.section-title span`, which would now
   match these word wrappers too and turn the whole title into gradient text.
   Cancel it here; words that belong to the original gradient span get their
   gradient back as inline styles from home-scroll.js. */
.section-title .hs-word,
.section-title .hs-word-in {
    background: none;
    -webkit-text-fill-color: currentColor;
}
