/* Container: use full width, child items positioned absolutely for pixel-accurate layout */
.grid-best-portfolio {
    position: relative;
    width: 100%;
    max-width: 93vw;
    margin: 0 auto;
    padding: 50px 40px 160px 0px; /* top padding keeps left column spacing */
    color: var(--white, #ffffff);
    box-sizing: border-box;
    min-height: 740px; /* ensures enough vertical space for absolute positioned items */
}

/* Left text column (sticky-like appearance) */
.grid-hero-con {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 220px; /* place the text under the top images */
    /* width: 64%; */
    max-width: 77rem;
}

.grid-project-content {
    position: relative;
}

.center-align-title {
    margin-bottom: 18px;
    text-align: center;
}

/* Large hero title - tuned to match the reference (very large, multi-line) */
.best-work-name {
    font-size: 4rem; /* big and bold like reference */
    line-height: 0.95;
    font-weight: 600;
    margin: 0 0 10px 0;
    font-family: 'Monument Extended', sans-serif;
    text-transform: none;
    letter-spacing: -2px;
    color: transparent;
    background: linear-gradient(180deg, #ffffff 0%, #e6e6e6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 2px 30px rgba(0,0,0,0.12);
}

.center-paragraph {
    margin-bottom: 36px;
}

.large-text {
    font-size: 16px;
    line-height: 1.9;
    color: rgba(255,255,255,0.75);
    max-width: 77rem;
    /* margin: 1.5rem; */
    left: 0%;
    position: relative;
    /* max-width: 619px; */
    text-align: center;
}

.white-span {
    color: var(--white, #ffffff);
}

/* .hero-link-wrapper { margin-top: 18px; text-align: center; } */

.underline-main-link {
    display: inline-flex;
    left: 32%;
    align-items: center;
    text-decoration: none;
    color: var(--white, #ffffff);
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    transition: color 0.3s ease;
    font-family: 'Chakra Petch', sans-serif;
}

.arrow-clip-wrap {
    position: relative;
    width: 24px;
    height: 24px;
    margin-left: 15px;
    overflow: hidden;
}

.clip-arrow-2 {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.bottom-arrow {
    transform: translateY(100%);
}

.hover-line {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    overflow: hidden;
}

.hover-line-fill {
    width: 100%;
    height: 100%;
    background-color: var(--white, #ffffff);
    transform: translateX(-101%);
    transition: transform 0.3s ease;
}


/* Images: absolute positioned boxes to match the reference positions exactly */
.hero-spin-image {
    position: absolute;
    width: 160px; /* base size for top thumbnails */
    height: 160px;
    overflow: visible;
    will-change: transform;
}

.spin-wrap {
    position: relative;
    width: 15rem;
    height: 100%;
    perspective: 1200px;
}

.spin-outside {
    width: 15rem !important;
    height: 100%;
    transform-style: preserve-3d;
    position: relative;
}

[class^="spin-inside-"] {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform;
    position: absolute;
}

/* Default automatic rotation for some items; each spin-inside gets its own speed/direction to create the staggered look */
/* .spin-inside-001 { animation: rotateYslow 22s linear infinite; }
.spin-inside-002 { animation: rotateYfast 14s linear infinite reverse; }
.spin-inside-003 { animation: rotateYmed 18s linear infinite; }
.spin-inside-004 { animation: rotateYslow 26s linear infinite reverse; } */

@keyframes rotateYfast { to { transform: rotateY(360deg); } }
@keyframes rotateYmed  { to { transform: rotateY(360deg); } }
@keyframes rotateYslow { to { transform: rotateY(360deg); } }

.rotate-photo {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}
.rotate-photo img {
    width: 25rem !important;
    height: 14rem !important;
}
.rotate-photo.back { transform: rotateY(180deg); }

.image-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* hover: pause rotation and slightly scale up */
/* .hero-spin-image:hover .spin-inside-001,
.hero-spin-image:hover .spin-inside-002,
.hero-spin-image:hover .spin-inside-003,
.hero-spin-image:hover .spin-inside-004 {
    animation-play-state: paused;
} */

/* .hero-spin-image:hover .image-cover { transform: scale(1.03); } */

.image-ov { position: absolute; inset: 0; border-radius: 8px; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,0.08), rgba(0,0,0,0.26)); }

.order-wrapper { position: absolute; left: 8px; bottom: 8px; }
.small-order-text { font-size: 12px; color: rgba(255,255,255,0.85); font-family: 'Rajdhani', sans-serif; }

/* Pixel-accurate positions for the 4 images to match the reference layout */
.hero-spin-image:nth-of-type(1) { /* top-left */
    width: 150px; height: 150px; top: 48px; left: 56px; z-index: 40; box-shadow: 0 10px 30px rgba(0,0,0,0.45); border-radius: 8px;
}
.hero-spin-image:nth-of-type(2) { /* top-right */
    width: 150px; height: 150px; top: 48px; right: 56px; z-index: 40; box-shadow: 0 10px 30px rgba(0,0,0,0.45); border-radius: 8px;
}
.hero-spin-image:nth-of-type(3) { /* bottom-left - reduced to match top thumbnails */
    width: 150px; height: 150px; left: 23%; top: 579px; z-index: 35; box-shadow: 0 12px 30px rgba(0,0,0,0.45); border-radius: 8px;
}
.hero-spin-image:nth-of-type(4) { /* bottom-right - reduced to match top thumbnails */
    width: 150px; height: 150px; right: 23%; top: 579px; z-index: 35; box-shadow: 0 12px 30px rgba(0,0,0,0.45); border-radius: 8px;
}

/* Slight tilt offsets so each image has a different visible angle (matching reference) */
.spin-inside-001 { transform-origin: center; }
.spin-inside-002 { transform-origin: center; }
.spin-inside-003 { transform-origin: center; }
.spin-inside-004 { transform-origin: center; }

/* Animations */
@keyframes spin {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hover Effects */
.underline-main-link:hover {
    color: var(--main-color, #ff3d29);
}

/* .underline-main-link:hover .clip-arrow-2 {
    transform: translateY(-100%);
}

.underline-main-link:hover .bottom-arrow {
    transform: translateY(0);
}

.underline-main-link:hover .hover-line-fill {
    transform: translateX(0);
} */

/* Responsive Design */
/* Responsive: stack on smaller viewports, center everything */
/* @media screen and (max-width: 1200px) {
    .grid-best-portfolio { padding: 80px 24px 120px 24px; min-height: auto; }
    .grid-hero-con { left: 24px; top: 80px; width: calc(100% - 48px); }
    .hero-spin-image:nth-of-type(1), .hero-spin-image:nth-of-type(2) { width: 100px; height: 100px; top: 20px; }
    .hero-spin-image:nth-of-type(1) { left: 24px; }
    .hero-spin-image:nth-of-type(2) { right: 24px; }
    .hero-spin-image:nth-of-type(3), .hero-spin-image:nth-of-type(4) { width: 150px; height: 150px; bottom: 24px; }
    .hero-spin-image:nth-of-type(3) { left: 20%; }
    .hero-spin-image:nth-of-type(4) { right: 20%; }
    .best-work-name { font-size: 64px; }
}

@media screen and (max-width: 768px) {
    .grid-hero-con { position: relative; left: 0; top: 0; width: 100%; padding: 40px 20px; text-align: center; }
    .best-work-name { font-size: 36px; }
    .hero-spin-image { position: relative; width: 100%; height: auto; margin: 0 auto 24px auto; }
    .hero-spin-image:nth-of-type(1), .hero-spin-image:nth-of-type(2) { width: 140px; height: 140px; margin: 0 auto; }
    .hero-spin-image:nth-of-type(3), .hero-spin-image:nth-of-type(4) { width: calc(50% - 32px); height: auto; display: inline-block; margin: 0 12px; }
    .order-wrapper { left: 12px; bottom: 12px; }
} */

@media screen and (max-width: 991px) {
    /* .grid-best-portfolio {
        grid-template-columns: 1fr;
        gap: 60px;
        padding: 60px 20px;
    } */

    .best-work-name {
        font-size: 42px;
        letter-spacing: -0.5px;
    }

    .large-text {
        font-size: 18px;
    }

    .hero-spin-image {
        max-width: 400px;
    }
}

@media screen and (max-width: 767px) {
    /* .grid-best-portfolio {
        padding: 40px 20px;
        gap: 40px;
    } */
    
    .best-work-name {
        font-size: 32px;
    }

    .large-text {
        font-size: 16px;
    }

    .hero-spin-image {
        max-width: 320px;
    }

    .center-paragraph {
        margin-bottom: 40px;
    }

    .order-wrapper {
        bottom: -20px;
    }
}