/* ==========================================================================
   PORTFOLIO PAGE
   [sy_latest_project] banner + [sy_portfolio] grid
   Markup: inc/portfolio.php
   ========================================================================== */

.sy-lp,
.sy-portfolio {
    --sy-pf-ink: #2c2520;
    --sy-pf-muted: #9a938a;
    --sy-pf-serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
    --sy-pf-sans: 'Raleway', Helvetica, Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Hide the theme's "Archives: Portfolios" banner where the plugin has taken
   over the URL. inc/portfolio.php adds .sy-pf-takeover to the body; the theme
   prints this header from header.php, so it cannot be unhooked in PHP.
   -------------------------------------------------------------------------- */
.sy-pf-takeover .page-header {
    display: none;
}

/* ==========================================================================
   1. LATEST PROJECT BANNER  —  [sy_latest_project]
   ========================================================================== */

.sy-lp {
    position: relative;
    height: var(--sy-lp-height, 620px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    /* Full-bleed out of any boxed container it is dropped into. The theme
       already sets body { overflow: hidden }, so 100vw cannot add a scrollbar. */
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: #1a1714;
}

.sy-lp-media {
    position: absolute;
    inset: 0;
}

.sy-lp-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sy-lp-scrim {
    position: absolute;
    inset: 0;
    background: rgba(28, 22, 17, var(--sy-lp-scrim, 0.3));
}

/*
 * Centred by absolute positioning, not by the parent's flex alignment.
 *
 * The banner is 560px tall and the content was still sitting near the top of
 * it. Rather than keep chasing which rule is winning over align-items, this
 * pins the block to the middle of the section outright: the parent is
 * position:relative, so top/left 50% with a -50%/-50% translate lands it dead
 * centre regardless of what the flex context is doing.
 */
.sy-lp-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 clamp(20px, 5vw, 90px);
    text-align: center;
    text-decoration: none;
}

.sy-lp-eyebrow {
    font-family: var(--sy-pf-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 4.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

.sy-lp-title {
    margin: 0;
    font-family: var(--sy-pf-serif);
    font-size: clamp(38.4px, 6vw, 89.6px);
    font-weight: 300;
    line-height: 1.08;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffffff;
}

.sy-lp-sub {
    font-family: var(--sy-pf-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
}

.sy-lp-content:hover .sy-lp-title,
.sy-lp-content:focus-visible .sy-lp-title {
    opacity: 0.85;
}

/* Scroll cue — a chevron drawn from two borders rather than shipped as an icon. */
.sy-lp-arrow {
    position: absolute;
    bottom: clamp(22px, 3vw, 40px);
    left: 50%;
    width: 17px;
    height: 17px;
    margin-left: -9px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.9);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.9);
    transform: rotate(45deg);
    animation: sy-lp-nudge 2.4s ease-in-out infinite;
}

@keyframes sy-lp-nudge {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50%      { transform: rotate(45deg) translate(4px, 4px); }
}

/* ==========================================================================
   2. PORTFOLIO GRID  —  [sy_portfolio]
   ========================================================================== */

.sy-portfolio {
    background: #ffffff;
    padding: clamp(46px, 6vw, 86px) clamp(20px, 4vw, 64px);
    text-align: center;
}

.sy-portfolio-eyebrow {
    display: block;
    font-family: var(--sy-pf-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 4.5px;
    text-transform: uppercase;
    color: var(--sy-pf-muted);
    margin-bottom: clamp(30px, 4vw, 52px);
}

.sy-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(var(--sy-pf-cols, 3), 1fr);
    gap: clamp(16px, 2.2vw, 34px) clamp(14px, 1.8vw, 26px);
    max-width: 1360px;
    margin: 0 auto;
}

/* --- Tile ------------------------------------------------------------------ */
.sy-pf-item {
    display: block;
    text-decoration: none;

    /*
     * Fades up as it scrolls into view. sections.js adds .sy-pf-item--visible.
     * The delay is keyed to the tile's column, not its position in the list —
     * a running index would leave the thirtieth tile waiting several seconds
     * after it had already appeared.
     */
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 0.95s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.95s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition-delay: calc((var(--sy-i, 1) - 1) * 0.13s);
}

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

.sy-pf-media {
    display: block;
    position: relative;
    overflow: hidden;
    background: #efece7;
    /* The ratio is repeated here, not just on the <img>, so a project with no
       featured image keeps its shape instead of collapsing the tile. */
    aspect-ratio: 4 / 5;
}

.sy-pf-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-pf-item:hover .sy-pf-media img,
.sy-pf-item:focus-visible .sy-pf-media img {
    transform: scale(1.05);
}

/* --- Hover overlay ---------------------------------------------------------
   The same scrim and inset hairline as the homepage grid, scaled up: these
   tiles are the page's subject rather than a teaser, so the label carries more
   weight and the frame sits further in. */
.sy-pf-hover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(38, 33, 28, 0.32);
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-pf-hover::before {
    content: "";
    position: absolute;
    inset: clamp(14px, 1.8vw, 26px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

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

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

.sy-pf-item:hover .sy-pf-hover-label,
.sy-pf-item:focus-visible .sy-pf-hover-label {
    transform: translateY(0);
}

/* --- Caption ---------------------------------------------------------------- */
.sy-pf-title {
    font-family: var(--sy-pf-serif) !important;
    font-size: clamp(22.4px, 1.7vw, 28px) !important;
    font-weight: 400 !important;
    line-height: 1.18 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase;
    color: #6b655d !important;
    margin: 22px 0 0 !important;
    transition: color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sy-pf-item:hover .sy-pf-title {
    color: var(--sy-pf-ink) !important;
}

.sy-pf-sub {
    display: block;
    margin-top: 9px;
    font-family: var(--sy-pf-sans);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 3.4px;
    text-transform: uppercase;
    color: var(--sy-pf-muted);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .sy-portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sy-lp {
        height: clamp(380px, 62vw, 520px);
    }
}

@media (hover: none) {
    /* No pointer to hover with — show the frame at rest so the tiles read as
       tappable, with the scrim dropped so it does not dull the photograph. */
    .sy-pf-hover {
        opacity: 1;
        background: transparent;
    }

    .sy-pf-hover::before {
        opacity: 0.6;
    }

    .sy-pf-hover-label {
        display: none;
    }
}

@media (max-width: 600px) {
    .sy-portfolio-grid {
        grid-template-columns: 1fr;
        gap: 38px;
    }

    .sy-portfolio {
        padding: 44px 20px 54px;
    }

    .sy-pf-title {
        font-size: 24.8px !important;
        margin-top: 18px !important;
    }

    .sy-pf-sub {
        font-size: 11px;
    }

    .sy-lp {
        height: clamp(320px, 82vw, 440px);
    }
}

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

    .sy-pf-media img {
        transition: none;
    }

    .sy-lp-arrow {
        animation: none;
    }
}
