/* ==========================================================================
   PROJECTS SECTION  —  [sy_projects]
   Markup: inc/shortcodes.php. Content: Customize > SY Sections > Projects.
   ========================================================================== */

.sy-projects {
    background: #ffffff;
    padding: clamp(60px, 8vw, 120px) clamp(20px, 4vw, 64px);
    text-align: center;
}

/* --- Eyebrow: "LATEST PROJECTS" (first word in <em>) --------------------- */
.sy-projects-eyebrow {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2.6px;
    text-transform: uppercase;
    color: #2c2520;
    margin-bottom: clamp(34px, 4vw, 56px);
}

.sy-projects-eyebrow em {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 2px;
    color: #8a7f70;
}

/* --- Grid ---------------------------------------------------------------- */
.sy-projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(16px, 2vw, 30px);
    max-width: 1600px;
    margin: 0 auto;
}

/* --- Card ---------------------------------------------------------------- */
.sy-project {
    display: block;
    text-decoration: none;
    /* Scroll reveal — the shortcode's observer adds .sy-project--visible */
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 1s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 1s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition-delay: calc((var(--sy-i, 1) - 1) * 0.14s);
}

.sy-project--visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Image + hover state -------------------------------------------------- */
.sy-project-media {
    display: block;
    position: relative;
    overflow: hidden;
    background: #efece7;
    /* Holds the tile's shape when a project has no featured image. */
    aspect-ratio: 4 / 5;
}

.sy-project-media img {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    transition: transform 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-project:hover .sy-project-media img {
    transform: scale(1.05);
}

/* Scrim + inset hairline frame */
.sy-project-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(38, 33, 28, 0.3);
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-project-hover::before {
    content: "";
    position: absolute;
    inset: clamp(12px, 1.4vw, 20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.sy-project:hover .sy-project-hover,
.sy-project:focus-visible .sy-project-hover {
    opacity: 1;
}

.sy-project-hover-label {
    position: relative;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 2.8px;
    text-transform: uppercase;
    transform: translateY(10px);
    transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-project:hover .sy-project-hover-label {
    transform: translateY(0);
}

/* --- Title + sub-label ---------------------------------------------------- */
.sy-project-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', Georgia, serif !important;
    /* 40px at full width, scaling down with the viewport. */
    font-size: clamp(32px, 2.8vw, 40px) !important;
    font-weight: 400 !important;
    line-height: 1.16 !important;
    letter-spacing: 0.01em !important;
    text-transform: uppercase;
    color: #6b655d !important;
    margin: 30px 0 0 !important;
    transition: color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-project:hover .sy-project-title {
    color: #2c2520 !important;
}

.sy-project-sub {
    display: block;
    margin-top: 14px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 2.6px;
    text-transform: uppercase;
    color: #9a938a;
}

/* --- Footer button --------------------------------------------------------- */
.sy-projects-foot {
    margin-top: clamp(44px, 5vw, 72px);
}

.sy-projects-btn {
    display: inline-block;
    background: transparent;
    color: #2c2520;
    border: 1px solid #2c2520;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    text-decoration: none;
    padding: 19px 40px;
    transition: background-color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
                color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-projects-btn:hover {
    background: #2c2520;
    color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
    .sy-project {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 600px) {
    .sy-project-title {
        margin-top: 22px !important;
    }
}


/* ==========================================================================
   ONE PROJECT AT A TIME, AUTO-ADVANCING
   At 1024px and below the 3-up grid becomes a snap carousel showing a single
   project. Native scroll does the work — the JS only auto-advances and syncs
   the dots, so with JS off this degrades to a plain swipeable strip rather
   than breaking.
   ========================================================================== */

@media (max-width: 1024px) {
    .sy-projects-grid {
        /* One card fills the viewport, and the gap is exactly twice the side
           padding — which puts the next card's leading edge just past the right
           of the screen, so only ever one project is visible at rest. */
        --sy-slide-pad: clamp(16px, 5vw, 30px);

        display: flex;
        grid-template-columns: none;
        gap: calc(var(--sy-slide-pad) * 2);

        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;

        /* Bleed past the section padding so the strip spans the full width. */
        margin-inline: calc(-1 * clamp(20px, 4vw, 64px));
        padding-inline: var(--sy-slide-pad);
        padding-bottom: 2px;

        scrollbar-width: none;
    }

    .sy-projects-grid::-webkit-scrollbar {
        display: none;
    }

    .sy-project {
        flex: 0 0 calc(100% - var(--sy-slide-pad) * 2);
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    /* Touch devices have no hover, so the overlay would never appear.
       Show the frame and label at rest instead. */
    .sy-project-hover {
        opacity: 1;
    }

    .sy-project-hover::before {
        opacity: 0.55;
    }

    .sy-project-hover-label {
        transform: none;
        opacity: 1;
    }
}

/* --- Dots ----------------------------------------------------------------
   Built by sections.js, so they only exist when the autoplay is running. */
.sy-projects-dots {
    display: none;
}

@media (max-width: 1024px) {
    .sy-projects-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin-top: 26px;
    }

    .sy-projects-dot {
        width: 7px;
        height: 7px;
        padding: 0;
        border: 0;
        border-radius: 99px;
        background: #d6d0c7;
        cursor: pointer;
        transition: width 0.4s ease, background-color 0.4s ease;
    }

    .sy-projects-dot[aria-current="true"] {
        width: 22px;
        background: #4a423a;
    }
}


/* ==========================================================================
   MOBILE TYPE SCALE
   ========================================================================== */

@media (max-width: 767px) {
    .sy-projects-eyebrow {
        font-size: 12px;
    }

    .sy-projects-eyebrow em {
        font-size: 14px;
    }

    .sy-project-title {
        font-size: 33.6px !important;
        margin-top: 20px !important;
    }

    .sy-project-sub {
        font-size: 13px;
    }

    .sy-projects-btn {
        font-size: 13px;
    }
}
