/* =========================================
   HOME.CSS
   ========================================= */

/* --- HERO REVEAL ANIMATION (JS CONTROLLED) --- */
.hero-reveal-pending {
    transform: scale(0);
    opacity: 0;
}

.hero-reveal-active {
    transform: scale(1);
    opacity: 1;
}

.hero-wrap {
    height: 185vh;
    position: relative;
    z-index: 2;
}

.hero-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-container {
    width: clamp(320px, 55vmin, 750px);
    height: clamp(320px, 55vmin, 750px);
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    background: #1a1c1e;
    
    /* Pre-calculate hardware rendering for smooth JS size scaling without paint flicker */
    transform: translateZ(0);
    transform-origin: center center;
    will-change: width, height, border-radius, transform;
    /* Optional: helps fix iOS masking glitches */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    will-change: transform, opacity;
    opacity: 1;
    transform: scale(1.37);
}

.hero-content {
    position: absolute;
    z-index: 10;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo-badge {
    width: 180px;
    height: 180px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 1;
    transform: scale(1);
    animation: badgeFadeIn .2s ease-out, badgeScale 1.75s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.hero-logo {
    width: auto;
    height: auto;
    max-width: 60%;
    display: block;
    transform: none;
}

@keyframes badgeFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes badgeScale {
    from {
        transform: scale(1.12);
    }

    to {
        transform: scale(1);
    }
}

/* --- SECTION 1.5: BIG TITLE --- */
.section-big-title {
    height: 170vh;
    /* Provides natural scroll space for morph without GSAP pin */
    display: block;
    background: transparent;
    position: relative;
    overflow: visible;
    margin-top: -25vh;
    z-index: 5;
}

/* Sticky centering wrapper — injected by BigTitleGravityEngine.js */
.section-big-title-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1500px;
    z-index: 5;
    padding: 0 5vw 3vh;
}

#bigTitleHeader,
#bigTitleScroll,
#bigTitleGravity {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: clamp(4rem, 15vw, 10rem);
    letter-spacing: -0.04em;
    margin: 0;
    padding-bottom: 0.25em;
    line-height: 1.3;
    text-align: center;
    color: var(--text);
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.4) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transform-style: preserve-3d;
    will-change: transform, opacity, filter, letter-spacing;
    cursor: default;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- GRAVITY ENGINE LAYERS --- */
.gravity-primary {
    display: inline-flex;
    justify-content: center;
    align-items: flex-end;
    white-space: nowrap;
    transform-style: preserve-3d;
    padding-bottom: 0.22em;
    /* Room for descenders like g, p, y */
}

.gravity-secondary {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    display: block;
    text-align: center;
    font-size: clamp(1.3rem, 2.8vw, 2.8rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: none;
    transform-style: preserve-3d;
    visibility: hidden;
    line-height: 1.3;
    white-space: nowrap;
}


.gravity-word {
    display: inline;
}


.gravity-space {
    display: inline-block;
    width: 3rem;
}

.gravity-char {
    display: inline-block;
    will-change: transform, opacity, filter;
    transform-style: preserve-3d;
}

/* --- SECTION 2: EDITORIAL INTRO --- */
.section-who {
    padding: 0vh 5vw 5vh 5vw;
    margin-top: -25vh;
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 10;
}

.editorial-text {
    font-family: var(--font-sans);
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    line-height: 1.05;
    font-weight: 400;
}

.editorial-word {
    display: inline-block;
    opacity: 0;
    filter: blur(20px);
    transform: scale(1.1);
    will-change: opacity, filter, transform;
    transition: opacity 0.8s ease-out, filter 0.8s ease-out, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    margin-right: 0.25em;
    white-space: pre;
}

.editorial-word.is-visible {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
}

.inline-mask {
    display: inline-block;
    width: 160px;
    height: 85px;
    border-radius: 60px;
    overflow: hidden;
    vertical-align: middle;
    margin: 0 0.8rem;
    position: relative;
}

.inline-mask img {
    width: 100%;
    height: 160%;
    object-fit: cover;
    position: absolute;
    top: -100%;
    will-change: transform;
}

/* --- SECTION 3: THE COLLABORATION LENS --- */
.collab-mobile-wrap {
    display: none;
}

.collab-desktop-wrap {
    display: flex;
    width: 100%;
    position: relative;
}

.section-collab {
    position: relative;
    background: var(--bg-alt);
    padding: 0 5vw;
    display: flex;
    min-height: 400vh;
    margin-bottom: 10vh;
}

.section-collab::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

.collab-sticky-area {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 48%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 2;
}

.collab-sticky-area h2 {
    font-family: var(--font-sans);
    font-size: clamp(3rem, 5vw, 5rem);
    line-height: 1;
    margin-bottom: 2rem;
}

.collab-number-wrap {
    font-family: var(--font-sans);
    font-size: clamp(7rem, 13vw, 11rem);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.15);
    position: relative;
    height: 11rem;
    overflow: hidden;
    filter: grayscale(100%);
}

.collab-number-strip {
    position: absolute;
    top: 0;
    transition: transform var(--transition-collab);
    display: flex;
    flex-direction: column;
}

.collab-scroll-area {
    width: 52%;
    padding-top: 30vh;
    position: relative;
}

.collab-img-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.collab-step {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.8s ease;
    filter: blur(12px);
    opacity: 0.1;
    transform: scale(0.85);
    will-change: filter, opacity, transform;
    position: relative;
    z-index: 10;
    mix-blend-mode: difference;
    /* Added blend mode */
    color: #fff;
    /* Ensure text is white for 'difference' to invert it over images */
}

.collab-step.is-active {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
}

.collab-img-sticky {
    position: sticky;
    top: 55vh;
    height: 35vh;
    width: 90%;
    border-radius: 12px;
    z-index: 1;
    /* Changed from -1 to 1 */
    overflow: hidden;
    background: #111;
    /* Fallback background to see the box */
}

.step-fade-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 1s ease;
    /* Slightly slower for better effect */
    z-index: 2;
}

.step-fade-img.is-active {
    opacity: 1;
    z-index: 3;
}

.collab-step h3 {
    font-family: var(--font-sans);
    font-size: clamp(2rem, 3vw, 3rem);
    margin-bottom: 2rem;
    color: var(--text);
}

.collab-step p {
    font-family: var(--font-sans);
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    line-height: 1.4;
    color: var(--text);
    font-weight: 400;
    max-width: 680px;
    color: var(--gray-1);
}

.collab-step p b {
    font-weight: 600;
    color: var(--text);
}

/* --- HEADLINE REEL (Slot-Machine Second Line) --- */
.headline-reel-window {
    display: block;
    overflow: hidden;
    height: 1.05em;
    line-height: 1.05;
    position: relative;
}

.headline-reel {
    display: flex;
    flex-direction: column;
    transition: transform 0.55s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.headline-reel-phrase {
    display: block;
    height: 1.05em;
    line-height: .85;
    white-space: nowrap;
    -webkit-text-fill-color: initial;
    color: var(--text, #fff);
}

@media (prefers-reduced-motion: reduce) {
    .headline-reel {
        transition: none;
    }
}

/* --- VISUAL CONFIDENCE TITLE EFFECT --- */
.visual-confidence-title .vc-line {
    overflow: hidden;
    display: block;
}

.visual-confidence-title .vc-line-inner {
    display: inline-block;
    opacity: 0;
    transform: translateY(120%) rotateX(-25deg);
    transform-origin: center bottom;
    will-change: opacity, transform;
    transition:
        opacity 1.2s cubic-bezier(0.19, 1, 0.22, 1),
        transform 1.4s cubic-bezier(0.19, 1, 0.22, 1);

    /* Elegant gradient text effect */
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 1) 25%,
            rgba(255, 255, 255, 1) 75%,
            rgba(255, 255, 255, 0.6) 100%);
    background-size: 200% 100%;
    background-position: 100% center;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    /* Subtle glow effect */
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
}

.visual-confidence-title .vc-line-inner.is-revealed {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
    background-position: 0% center;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.2));
}

/* Animate the gradient sweep */
@keyframes gradientSweep {
    0% {
        background-position: 100% center;
    }

    100% {
        background-position: 0% center;
    }
}

/* --- SECTION 4: HIGHLIGHTED PROJECTS (GIULIA STYLE) --- */
.section-highlight {
    height: 105vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    perspective: 1500px;
    overflow: hidden;
    background: #0a0b0c;
    padding: clamp(2.4rem, 4.8vh, 4.2rem) 4vw 4vw;
}

.highlight-header {
    text-align: center;
    margin-bottom: 6rem;
    z-index: 10;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.highlight-header h2 {
    font-family: var(--font-sans);
    font-size: clamp(3rem, 5vw, 5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    margin: 0;
}

/* Portfolio Highlights Effect: "Architectural Skew-Up" (Optional/Disabled via JS) */
.highlight-header h2 .title-char {
    display: inline-block;
    opacity: 0;
    transform-origin: bottom center;
    transform: translateY(120%) skewY(10deg);
    will-change: opacity, transform;
    transition:
        opacity 0.8s ease-out,
        transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.highlight-header h2 .title-char.is-visible {
    opacity: 1;
    transform: translateY(0) skewY(0);
}

.collage-canvas {
    position: relative;
    width: 100%;
    max-width: 1100px;
    height: 58vh;
    transform-style: preserve-3d;
    transition: transform var(--transition-tilt);
    display: flex;
    align-items: center;
    justify-content: center;
}

.collage-item {
    position: absolute;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
    transition: transform 0.25s ease-out;
    will-change: transform;
}

a.collage-item:hover {
    opacity: 1;
}

.item-main {
    width: 65%;
    height: 85%;
    z-index: 2;
}

.item-tr {
    width: 25%;
    height: 65%;
    top: -12%;
    right: -7%;
    z-index: 1;
}

.item-bl {
    width: 45%;
    height: 50%;
    bottom: -5%;
    left: -5%;
    z-index: 3;
}

.item-br {
    width: 35%;
    height: 45%;
    bottom: -15%;
    right: -10%;
    z-index: 4;
}

.collage-item img {
    width: 120%;
    height: 120%;
    object-fit: cover;
    margin-left: -10%;
    transition: transform 0.2s ease-out;
}

/* --- RESPONSIVE ADJUSTMENTS --- */

@media (min-width: 1920px) {
    .hero-container {
        width: clamp(320px, 60vmin, 860px);
        height: clamp(320px, 60vmin, 860px);
    }

    .section-big-title {
        margin-top: -30vh;
    }

    .editorial-text {
        font-size: clamp(2.2rem, 5.5vw, 4.5rem);
    }

    .collab-sticky-area {
        width: 45%;
    }

    .collab-scroll-area {
        width: 55%;
    }

    .collab-number-wrap {
        font-size: clamp(8rem, 15vw, 12rem);
        height: 12rem;
    }

    .collage-canvas {
        height: 65vh;
    }

    .section-highlight {
        padding: 3vw 5vw 5vw;
    }

    .gravity-secondary {
        font-size: clamp(1.4rem, 3.2vw, 3.2rem);
    }

    .item-bl {
        left: -10%;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {

    /* --- SECTION 1: HERO --- */
    .hero-wrap {
        height: 175vh;
    }

    .hero-container {
        width: 85vw;
        height: 85vw;
    }

    .hero-logo-badge {
        width: 120px;
        height: 120px;
    }

    /* --- SECTION 1.5: BIG TITLE --- */
    .section-big-title {
        height: 170vh;
        margin-top: -20vh;
    }

    .section-big-title-sticky {
        padding: 0 5vw 2vh;
    }

    .gravity-secondary {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        font-size: clamp(3.6rem, 7.5vw, 7.2rem);
        line-height: 1;
    }

    .gravity-word {
        display: block;
    }

    .gravity-space {
        display: none;
    }

    /* --- SECTION 2: EDITORIAL --- */
    .section-who {
        padding: 15vh 5vw;
    }

    .editorial-text {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    .inline-mask {
        width: 70px;
        height: 40px;
        margin: 0 0.25rem;
        border-radius: 30px;
    }

    .inline-mask img {
        top: -150%;
    }

    /* --- SECTION 3: COLLABORATION (MOBILE) --- */
    .collab-desktop-wrap {
        display: none;
    }

    .collab-mobile-wrap {
        display: block;
        padding-top: 5vh;
        position: relative;
    }

    .section-collab {
        display: block;
        height: auto;
        min-height: auto;
        padding-bottom: 15vh;
    }

    .collab-mobile-sticky-top {
        position: sticky;
        top: 12vh;
        z-index: 2;
        padding-top: 2rem;
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }

    .collab-mobile-sticky-top::before {
        content: "";
        position: absolute;
        top: 0;
        left: -5vw;
        right: -5vw;
        bottom: 0;
        z-index: -1;
        background: rgba(10, 11, 12, 0.65);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
        mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
    }

    .collab-mobile-dock-space {
        height: 15vh;
    }

    .architect-flow {
        margin-top: 0;
    }

    .collab-headline-mobile {
        font-family: var(--font-sans);
        font-size: 2.2rem;
        line-height: 1.1;
        margin-bottom: 0;
        color: var(--text);
    }

    .collab-mobile-flow {
        display: flex;
        flex-direction: column;
        gap: 6rem;
    }

    .collab-mobile-flow-item {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .headline-reel-phrase-m {
        display: block;
        font-family: var(--font-sans);
        font-size: 2.5rem;
        font-weight: 600;
        line-height: 1.1;
        color: var(--text);
    }

    .collab-mobile-flow-item h3 {
        font-family: var(--font-sans);
        font-size: 2rem;
        color: var(--text);
        margin: 0;
    }

    .collab-mobile-flow-item p {
        font-family: var(--font-sans);
        font-size: 1.5rem;
        line-height: 1.4;
        color: var(--gray-1);
        margin: 0;
    }

    .mobile-flow-img {
        width: 100%;
        height: auto;
        border-radius: 12px;
        object-fit: cover;
    }


    /* --- SECTION 4: HIGHLIGHTS --- */
    .section-highlight {
        height: auto;
        padding: 6vh 5vw 10vh;
    }

    .highlight-header {
        margin-bottom: 3rem;
    }

    .highlight-header h2 {
        font-size: 2.4rem;
    }

    .collage-canvas {
        height: auto;
        transform: none !important;
        margin-bottom: 2rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .collage-item {
        position: relative;
        width: 100%;
        height: 50vh;
        transform: none !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    }

    .collage-item img {
        width: 100%;
        height: 100%;
        margin: 0;
        object-fit: cover;
        transform: none !important;
    }

    .item-main,
    .item-tr,
    .item-bl,
    .item-br {
        display: block;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        margin: 0;
        z-index: 1;
    }

}

:root {
  --bg: #000;
  --bg-alt: #000;
}

html,
body,
#main,
main,
section,
#header,
#footer,
.site-footer,
.hero-container,
.section-collab,
.collab-img-sticky,
.section-testimonials-stack,
.section-highlight {
  background: #000 !important;
  background-color: #000 !important;
}

.collab-mobile-sticky-top::before {
  background: #000 !important;
}
