/* District Frame - Portfolio template (v3 editorial)
   Scoped to .page-template-template-portfolio */

.page-template-template-portfolio .df-pf-work {
    padding: 0 0 clamp(64px, 9vw, 128px);
}

/* ============================================================
   HERO MEDIA - the header photo (Blen night portrait) is a tall
   4:5 image; override the default wide 4/3 hero crop (style.css)
   so it shows uncropped. Mirrors the photography page (id 294).
   ============================================================ */
.page-template-template-portfolio .df-page-hero-media img {
    aspect-ratio: 4 / 5;
    object-position: center;
}
@media (max-width: 860px) {
    .page-template-template-portfolio .df-page-hero-media img {
        aspect-ratio: 4 / 3;
    }
}

/* ============================================================
   FEATURED CATEGORIES - links to the matching service pages
   (distinct from the interactive filter bar below)
   ============================================================ */
.page-template-template-portfolio .df-pf-categories {
    margin-top: clamp(28px, 4vw, 48px);
    max-width: 760px;
}
.page-template-template-portfolio .df-pf-categories-kicker {
    display: block;
    margin-bottom: 16px;
    color: var(--df-ink-muted);
}
.page-template-template-portfolio .df-pf-categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}
.page-template-template-portfolio .df-pf-categories-list li {
    display: flex;
}
.page-template-template-portfolio .df-pf-categories-list a {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--df-hairline);
    border-radius: 999px;
    color: var(--df-ink-muted);
    transition: color 0.25s ease, border-color 0.25s ease;
}
.page-template-template-portfolio .df-pf-categories-list a:hover,
.page-template-template-portfolio .df-pf-categories-list a:focus-visible {
    color: var(--df-ink);
    border-color: var(--df-ink);
    outline: none;
}

/* Closing line under the grid */
.page-template-template-portfolio .df-pf-outro {
    margin: clamp(40px, 6vw, 72px) 0 0;
    max-width: 32ch;
    font-family: var(--df-serif);
    font-size: clamp(20px, 2.6vw, 30px);
    line-height: 1.3;
    color: var(--df-ink);
}

/* ============================================================
   FILTER ROW - small uppercase labels between hairlines
   ============================================================ */
.page-template-template-portfolio .df-pf-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 32px;
    padding: 18px 0;
    margin-bottom: clamp(32px, 5vw, 56px);
}
.page-template-template-portfolio .df-pf-filter-btn {
    background: none;
    border: none;
    padding: 4px 0;
    cursor: pointer;
    color: var(--df-ink-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    position: relative;
    transition: color 0.25s ease;
}
.page-template-template-portfolio .df-pf-filter-btn::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 0; height: 1px;
    background: var(--df-ink);
    transition: width 0.3s var(--df-ease);
}
.page-template-template-portfolio .df-pf-filter-btn:hover,
.page-template-template-portfolio .df-pf-filter-btn.is-active {
    color: var(--df-ink);
}
.page-template-template-portfolio .df-pf-filter-btn.is-active::after {
    width: 100%;
}

/* ============================================================
   GRID - uniform 2-col (two videos per row)
   ============================================================ */
.page-template-template-portfolio .df-pf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(16px, 2.4vw, 32px);
}
/* Hidden when the "Photos" tab is active (the class display:grid would
   otherwise beat the [hidden] attribute, so this rule is required). */
.page-template-template-portfolio .df-pf-grid[hidden] { display: none; }
.page-template-template-portfolio .df-work-card {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--df-bg-card);
    text-align: left;
    padding: 0;
    border: none;
    cursor: pointer;
}
.page-template-template-portfolio .df-work-img-wrap {
    display: block;
    line-height: 0;
}
.page-template-template-portfolio .df-work-card img {
    aspect-ratio: 1 / 1;
    width: 100%;
    object-fit: cover;
    object-position: 50% 22%;
    transition: transform 0.6s var(--df-ease);
}
.page-template-template-portfolio .df-work-card {
    font: inherit;
    color: inherit;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}
.page-template-template-portfolio .df-work-card:hover img,
.page-template-template-portfolio .df-work-card:focus-visible img {
    transform: scale(1.03);
}
.page-template-template-portfolio .df-work-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 64px 22px 20px;
    background: linear-gradient(to top, rgba(10, 10, 10, 0.8), transparent);
    color: var(--df-paper);
}
.page-template-template-portfolio .df-work-title {
    font-family: var(--df-serif);
    font-size: clamp(22px, 2.8vw, 32px);
    font-weight: 450;
    line-height: 1.15;
}
.page-template-template-portfolio .df-work-cat {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--df-paper-muted);
}

/* Filter transitions */
.page-template-template-portfolio .df-work-card.df-filter-hide {
    opacity: 0;
    transform: scale(0.985);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.page-template-template-portfolio .df-work-card.df-filter-show {
    animation: dfPfFadeIn 0.3s ease;
}
@keyframes dfPfFadeIn {
    from { opacity: 0; transform: scale(0.985); }
    to   { opacity: 1; transform: none; }
}

/* Keyboard focus */
.page-template-template-portfolio .df-work-card:focus-visible {
    outline: 2px solid var(--df-ink);
    outline-offset: 3px;
}

/* Play affordance on video cards */
.page-template-template-portfolio .df-work-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(14, 14, 14, 0.55);
    border: 1px solid rgba(241, 238, 231, 0.7);
    color: var(--df-paper);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s var(--df-ease), transform 0.3s var(--df-ease);
    pointer-events: none;
}
.page-template-template-portfolio .df-work-play .df-icon {
    width: 24px;
    height: 24px;
    transform: translateX(1px);
}
.page-template-template-portfolio .df-work-card:hover .df-work-play,
.page-template-template-portfolio .df-work-card:focus-visible .df-work-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
    .page-template-template-portfolio .df-pf-grid {
        grid-template-columns: 1fr;
    }
    .page-template-template-portfolio .df-work-card img {
        aspect-ratio: 4 / 3;
    }
}

/* ============================================================
   PROJECT LIGHTBOX
   Moved to <body> at runtime, so these rules are NOT page-scoped.
   (This stylesheet only loads on the portfolio page anyway.)
   ============================================================ */
body.df-modal-open { overflow: hidden; }

.df-pf-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 56px);
}
.df-pf-modal[hidden] { display: none; }

.df-pf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 8, 0.88);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.df-pf-modal-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    animation: dfModalIn 0.32s var(--df-ease);
}
@keyframes dfModalIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.df-pf-modal-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.df-pf-modal-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Shared circular control look (the base .df-project-play styles are global;
   size / colour / position live here). */
.df-pf-modal .df-project-play,
.df-pf-modal-close {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(14, 14, 14, 0.6);
    border: 1px solid rgba(241, 238, 231, 0.5);
    color: var(--df-paper);
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}
.df-pf-modal .df-project-play:hover,
.df-pf-modal-close:hover {
    background: rgba(14, 14, 14, 0.9);
    border-color: var(--df-paper);
}
.df-pf-modal .df-project-play .df-icon,
.df-pf-modal-close .df-icon { width: 20px; height: 20px; }

/* Center play/pause toggle */
.df-pf-modal-media > [data-df-media-toggle] {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    z-index: 2;
}
.df-pf-modal-media > [data-df-media-toggle] .df-icon { width: 26px; height: 26px; }
/* On hover-capable devices, fade the big center button out during playback
   (it returns on hover). Touch devices keep it visible so it stays tappable. */
@media (hover: hover) and (pointer: fine) {
    .df-pf-modal-media.is-playing > [data-df-media-toggle] { opacity: 0; }
    .df-pf-modal-media.is-playing:hover > [data-df-media-toggle] { opacity: 1; }
}

/* Bottom-right tool cluster (info toggle + fullscreen) */
.df-pf-modal-tools {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: flex;
    gap: 10px;
    z-index: 2;
}
.df-pf-modal-info[aria-pressed="true"] {
    background: var(--df-paper);
    color: var(--df-bg-dark);
    border-color: var(--df-paper);
}

/* Close */
.df-pf-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    -webkit-appearance: none;
    appearance: none;
    display: grid;
    place-items: center;
}

/* Description text overlay (toggled by the Info button) */
.df-pf-modal-desc {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    padding: clamp(20px, 4vw, 48px);
    background: linear-gradient(to top, rgba(8, 8, 8, 0.94) 0%, rgba(8, 8, 8, 0.72) 45%, rgba(8, 8, 8, 0.18) 100%);
    color: var(--df-paper);
    animation: dfDescIn 0.28s var(--df-ease);
}
.df-pf-modal-desc[hidden] { display: none; }
.df-pf-modal-desc p {
    max-width: 60ch;
    font-size: clamp(15px, 1.4vw, 18px);
    line-height: 1.6;
}
@keyframes dfDescIn { from { opacity: 0; } to { opacity: 1; } }

/* Title + meta under the video */
.df-pf-modal-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 2px 0;
    color: var(--df-paper);
}
.df-pf-modal-title {
    font-family: var(--df-serif);
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 450;
    line-height: 1.15;
}
.df-pf-modal-sub { color: var(--df-paper-muted); }

@media (max-width: 600px) {
    .df-pf-modal-media > [data-df-media-toggle] { width: 54px; height: 54px; }
    .df-pf-modal-media > [data-df-media-toggle] .df-icon { width: 22px; height: 22px; }
}

/* ============================================================
   PHOTOS GALLERY ("Photos" tab in the main filter bar)
   A uniform square photo grid that swaps in for the video grid
   when "Photos" is selected; opens a slide-through image lightbox.
   The "Photos" filter button reuses the main .df-pf-filter-btn
   underline style, so it needs no extra rules here.
   ============================================================ */

/* --- Uniform square grid (Photos tab) --- */
.page-template-template-portfolio .df-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 1.4vw, 16px);
    margin-top: clamp(4px, 1vw, 12px);
}
.page-template-template-portfolio .df-photo-grid[hidden] { display: none; }

/* The whole card is the clickable button (no nested interactives). */
.page-template-template-portfolio .df-photo-card {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: var(--df-bg-card);
    overflow: hidden;
    cursor: pointer;
    color: inherit;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.page-template-template-portfolio .df-photo-img-wrap {
    display: block;
    line-height: 0;
}
.page-template-template-portfolio .df-photo-card img {
    width: 100%;
    aspect-ratio: 1 / 1;           /* equal squares, perfectly aligned */
    object-fit: cover;
    object-position: 50% 50%;
    transition: transform 0.6s var(--df-ease);
}
.page-template-template-portfolio .df-photo-card:hover img,
.page-template-template-portfolio .df-photo-card:focus-visible img {
    transform: scale(1.05);
}
.page-template-template-portfolio .df-photo-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 48px 16px 14px;
    background: linear-gradient(to top, rgba(8, 8, 8, 0.82), transparent);
    color: var(--df-paper);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s var(--df-ease);
}
.page-template-template-portfolio .df-photo-card:hover .df-photo-overlay,
.page-template-template-portfolio .df-photo-card:focus-visible .df-photo-overlay {
    opacity: 1;
}
.page-template-template-portfolio .df-photo-title {
    font-family: var(--df-serif);
    font-size: clamp(15px, 1.6vw, 20px);
    font-weight: 450;
    line-height: 1.2;
}
.page-template-template-portfolio .df-photo-card:focus-visible {
    outline: 2px solid var(--df-ink);
    outline-offset: 3px;
}

/* ============================================================
   PHOTOGRAPHY LIGHTBOX
   Moved to <body> at runtime (rules are not page-scoped). This
   stylesheet only loads on the portfolio page.
   ============================================================ */
.df-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 56px);
}
.df-photo-modal[hidden] { display: none; }

.df-photo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 8, 0.88);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.df-photo-modal-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1180px;
    max-height: 88vh;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
    background: var(--df-bg-light);
    overflow: hidden;
    animation: dfPhotoModalIn 0.32s var(--df-ease);
}
@keyframes dfPhotoModalIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* Image column on black - the photo is the focus */
.df-photo-modal-figure {
    position: relative;
    background: #0b0b0b;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}
.df-photo-modal-figure img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 88vh;
    object-fit: contain;
}

/* Prev / Next over the image */
.df-photo-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(14, 14, 14, 0.55);
    border: 1px solid rgba(241, 238, 231, 0.5);
    color: var(--df-paper);
    cursor: pointer;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: background 0.25s ease, border-color 0.25s ease;
}
.df-photo-modal-nav:hover {
    background: rgba(14, 14, 14, 0.9);
    border-color: var(--df-paper);
}
.df-photo-modal-nav .df-icon { width: 22px; height: 22px; }
.df-photo-modal-prev { left: 14px; }
.df-photo-modal-next { right: 14px; }
.df-photo-modal-nav:focus-visible {
    outline: 2px solid var(--df-paper);
    outline-offset: 2px;
}

/* Cream detail panel */
.df-photo-modal-panel {
    position: relative;
    background: var(--df-bg-light);
    color: var(--df-ink);
    padding: clamp(28px, 3.4vw, 52px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}
.df-photo-modal-title {
    font-family: var(--df-serif);
    font-size: clamp(26px, 3vw, 40px);
    font-weight: 450;
    line-height: 1.1;
    padding-right: 52px; /* clear the close button on desktop */
}
.df-photo-modal-title:empty { display: none; }
.df-photo-modal-desc {
    margin-top: 4px;
    padding-top: 18px;
    border-top: 1px solid var(--df-hairline);
    font-size: 16px;
    line-height: 1.7;
    color: var(--df-ink-muted);
    max-width: 46ch;
}
.df-photo-modal-desc:empty { display: none; }
.df-photo-modal-count {
    margin-top: auto;
    padding-top: 18px;
    color: var(--df-ink-muted);
}

/* Close button (top-right of the dialog) */
.df-photo-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--df-paper);
    border: 1px solid var(--df-hairline);
    color: var(--df-ink);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.df-photo-modal-close .df-icon { width: 20px; height: 20px; }
.df-photo-modal-close:hover {
    background: var(--df-ink);
    border-color: var(--df-ink);
    color: var(--df-paper);
}
.df-photo-modal-close:focus-visible {
    outline: 2px solid var(--df-ink);
    outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE - photography
   ============================================================ */
@media (max-width: 860px) {
    /* Modal: image stacks above the detail panel */
    .df-photo-modal-dialog {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        max-height: 92vh;
        overflow-y: auto;
    }
    .df-photo-modal-figure { max-height: 56vh; }
    .df-photo-modal-figure img { max-height: 56vh; }
    .df-photo-modal-close {
        background: rgba(14, 14, 14, 0.6);
        border-color: rgba(241, 238, 231, 0.5);
        color: var(--df-paper);
    }
}
@media (max-width: 760px) {
    .page-template-template-portfolio .df-photo-grid {
        grid-template-columns: 1fr 1fr; /* keep 2-up squares on tablet/mobile */
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-template-template-portfolio .df-photo-card img,
    .page-template-template-portfolio .df-photo-overlay {
        transition: none;
    }
    .page-template-template-portfolio .df-photo-card:hover img,
    .page-template-template-portfolio .df-photo-card:focus-visible img {
        transform: none;
    }
    .df-photo-modal-dialog { animation: none; }
}
