/*------------------------------------------------------------------*\
    6. Pages - Single Portfolio
\*------------------------------------------------------------------*/

/* Scroll-reveal: hidden until GSAP animates */
.single-portfolio .js-reveal {
    opacity: 0;
}

.sp-gallery__image {
    clip-path: inset(100% 0 0 0);
}

/* Page Wrapper */
.single-portfolio {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background-color: var(--color-bg-surface);
}

/* ===== Hero ===== */
.sp-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 1920 / 1080;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-black);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: flex-end; /* heading sits at the bottom, like the home hero */
    justify-content: start;
}

.sp-hero__video-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.sp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.15) 40%, rgba(0, 0, 0, 0.75) 100%),
        rgba(0, 0, 0, 0.25);
    z-index: 1;
    pointer-events: none;
}

.sp-hero__video-wrapper iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-width: 177.78vh;
    min-height: 100vh;
    transform: translate(-50%, -50%);
    border: 0;
    pointer-events: none;
}

.sp-hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    /* Same heading spacing as the home hero (Elementor slide-heading): desktop */
    padding: 0vw 5.8vw 5.208vw 5.8vw;
}

/* Widescreen — match the home hero's widescreen padding */
@media screen and (min-width: 2400px) {
    .sp-hero__content {
        padding: 0vw 5.547vw 5.208vw 5.547vw;
    }
}

.sp-hero__title {
    color: var(--color-title);
    font-weight: 300;
    line-height: 1.1;
    margin-bottom: 12px;
    --underline-scale: 0;
    opacity: 0;
    transform: translateY(60px);
}

.sp-hero__title::after {
    content: '';
    display: block;
    width: 154px;
    height: 3px;
    background-color: var(--color-accent);
    margin-top: 12px;
    transform: scaleX(var(--underline-scale));
    transform-origin: left;
}

.sp-hero__subtitle {
    color: var(--color-text-soft);
    font-size: 1rem;
}

/* The hero parallax (transform on .sp-hero) creates a stacking context that
   would paint over the following section and eat its top spacing. Lift every
   section after the hero above it. */
.single-portfolio > section:not(.sp-hero) {
    position: relative;
    z-index: 1;
}

/* ===== Gallery ===== */
.sp-gallery {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sp-gallery__image {
    width: 100%;
    aspect-ratio: 1920 / 1080;
    object-fit: cover;
    will-change: opacity, transform;
    display: block;
    margin: 0;
}

/* ===== Floor Plan ===== */
.sp-floor-plan {
    background-color: var(--color-bg-surface);
    padding: 60px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.sp-floor-plan__image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ===== Logo ===== */
.sp-logo {
    background-color: var(--color-bg-surface-alt);
    padding: 60px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.sp-logo__image {
    max-width: 40%;
    max-height: 40vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ===== Content Website ===== */
.sp-website {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sp-website__block {
    width: 100%;
}

.sp-website__image {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

.sp-website__video {
    display: block;
    width: 100%;
    height: auto;
}

.sp-website__embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.sp-website__embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ===== Brochure Image (full width) ===== */
.sp-brochure-image {
    width: 100%;
}

.sp-brochure-image__img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

/* ===== Content Video ===== */
.sp-content-video {
    position: relative;
    width: 100%;
    aspect-ratio: 1920 / 1080;
    overflow: hidden;
    background-color: var(--color-black);
}

.sp-content-video__player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sp-content-video__wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.sp-content-video__wrapper iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ===== YouTube Video ===== */
.sp-content-video__youtube {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.sp-content-video__thumbnail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 1;
    transition: opacity 0.4s ease;
}

.sp-content-video__youtube.is-playing .sp-content-video__thumbnail {
    opacity: 0;
    pointer-events: none;
}

.sp-content-video__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    z-index: 2;
    cursor: pointer;
}

.sp-content-video__play svg {
    width: 35%;
    height: 35%;

}

.sp-content-video__play:hover {
    background: rgba(255, 185, 81, 0.3);
    border-color: var(--color-accent);
}

/* Hide button while playing, show on hover */
.sp-content-video__play.is-hidden {
    opacity: 0;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .sp-content-video__youtube.is-playing:hover .sp-content-video__play.is-hidden {
        opacity: 1;
        pointer-events: auto;
    }
}

.sp-content-video__youtube.is-playing {
    cursor: pointer;
    overflow: hidden;
}

.sp-content-video__youtube iframe {
    position: absolute;
    top: -60px;
    left: 0;
    width: 100%;
    height: calc(100% + 120px);
    border: 0;
    pointer-events: none;
}

/* ===== Overview ===== */
.sp-overview {
    display: flex;
    align-items: flex-start;
    gap: 60px;
    /* Left edge aligns with the hero title (5.8vw); right keeps the wider margin */
    padding: 80px 17.135vw 80px 5.8vw;
    background-color: var(--color-bg-surface);
}

/* Widescreen — match the hero title's left spacing */
@media screen and (min-width: 2400px) {
    .sp-overview {
        padding-left: 5.547vw;
    }
}

.sp-overview__left {
    flex: 0 0 40%;
}

.sp-overview .sp-overview__title {
    color: var(--color-title);
    font-size: var(--fluid-portfolio-overview) !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    margin-bottom: 0px;
}

.sp-overview__right {
    flex: 1;
    padding-top: 8px;
}

.sp-overview__description {
    color: var(--color-text-soft);
    font-size: var(--fluid-portfolio-overview-desc);
    font-weight: var(--font-medium);
    line-height: 1.3;
}

/* Service pills (global checkbox field) below the overview title */
.sp-overview__services {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sp-overview__tag {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.70em 1.8em;
    font-size: 0.875rem;
    line-height: 1;
    color: var(--color-text-soft);
    white-space: nowrap;
}

/* ===== Project Navigation ===== */

.sp-project-nav {
    display: flex;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-bg-surface);
}

.sp-project-nav__link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.0833vw, 5rem);
    padding: clamp(1.5rem, 4.1667vw, 10rem) clamp(1.5rem, 5.2083vw, 12.5rem);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.sp-project-nav__link--prev {
    border-right: 1px solid var(--color-border);
}

.sp-project-nav__link--next {
    justify-content: flex-end;
    text-align: right;
}

.sp-project-nav__link:hover {
    background-color: var(--color-bg-surface-alt);
}

.sp-project-nav__thumb {
    width: clamp(80px, 10.4167vw, 400px);
    aspect-ratio: 4 / 3;
    border-radius: var(--input-radius);
    overflow: hidden;
    flex-shrink: 0;
}

.sp-project-nav__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.sp-project-nav__link:hover .sp-project-nav__thumb img {
    transform: scale(1.08);
}

.sp-project-nav__info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sp-project-nav__label {
    font-family: var(--font-secondary);
    font-size: clamp(0.6875rem, 0.7292vw, 1.75rem);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sp-project-nav__title {
    font-family: var(--font-primary);
    font-size: var(--fluid-h5);
    font-weight: var(--font-semibold);
    color: var(--color-title);
    line-height: 1.2;
    transition: color 0.3s ease;
}

.sp-project-nav__link:hover .sp-project-nav__title {
    color: var(--color-accent);
}

.sp-project-nav__location {
    font-family: var(--font-secondary);
    font-size: var(--fluid-caption-text);
    color: var(--color-text-muted);
}

/* ===== Tablet 769–1024px ===== */
@media (min-width: 769px) and (max-width: 1024px) {

    .sp-hero {
        align-items: center; /* keep tablet vertically centred (base is bottom-aligned) */
        justify-content: center;
    }

    .sp-hero__content {
        text-align: center;
        padding: 0 17.135vw; /* keep tablet's previous side spacing */
    }

    .sp-hero__title {
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .sp-hero__title::after {
        width: 30%;
    }
}

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

    .sp-hero {
        align-items: start;
        padding-top: 156px;
    }

    .sp-hero__content {
        padding: 40px 6vw;
        text-align: left;
    }

    .sp-hero__title {
        margin-bottom: 8px;
        font-size: 52px !important;
        max-width: 100%;
        word-break: break-word;
    }

    .sp-overview {
        flex-direction: column;
        gap: 12px;
        padding: 48px 6vw;
    }

    .sp-overview__left {
        flex: none;
    }

    .sp-project-nav {
        flex-direction: column;
    }

    .sp-project-nav__link--prev {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .sp-project-nav__link--next {
        flex-direction: row-reverse;
        justify-content: flex-end;
        text-align: left;
    }

    .sp-content-video__play {
        width: 72px;
        height: 72px;
    }
}
