/* ==========================================================================
   Portfolio / Showreel styles — Netflix-inspired, not a copy.
   Reuses the brand tokens from netflix-style.css where sensible, but this
   file is self-contained: it owns everything on the new index.html.
   ========================================================================== */

:root {
    --bg: #0b0b0d;
    --bg-soft: #131316;
    --bg-card: #1a1a1e;
    --bg-elevated: #232327;
    --text: #f5f5f7;
    --text-soft: #a8a8b0;
    --text-faint: #6e6e76;
    --brand: #e5091a;
    --brand-soft: #ff2f3f;
    --line: rgba(255, 255, 255, 0.10);
    --overlay: rgba(0, 0, 0, 0.72);
    --radius: 8px;
    --radius-sm: 5px;
    --shadow-card: 0 18px 40px rgba(0, 0, 0, 0.55);
    --ease: 200ms cubic-bezier(.4,0,.2,1);
    --nav-h: 68px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    width: 100%;
    min-height: 100%;
}

body.portfolio {
    margin: 0;
    font-family: 'Poppins', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; }
img { max-width: 100%; display: block; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible {
    outline: 2px solid var(--brand-soft);
    outline-offset: 2px;
}

/* ---------- Nav ---------- */
.pf-nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1200;
    height: calc(var(--nav-h) + var(--safe-t));
    padding-top: var(--safe-t);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-inline: clamp(1rem, 4vw, 3rem);
    background: linear-gradient(to bottom, rgba(11,11,13,0.92) 0%, rgba(11,11,13,0.75) 60%, transparent 100%);
    transition: background var(--ease);
}

.pf-nav.scrolled {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
}

.pf-nav-left {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
}

.pf-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    white-space: nowrap;
}

.pf-brand .dot { color: var(--brand); }
.pf-brand-logo { display: block; width: auto; max-width: 220px; object-fit: contain; }

.pf-links {
    display: flex;
    gap: 1.6rem;
}

.pf-links a {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-soft);
    transition: color var(--ease);
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.pf-links a:hover,
.pf-links a.active {
    color: var(--text);
    border-bottom-color: var(--brand);
}

.pf-nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pf-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
}

.pf-search input {
    background: transparent;
    border: 0;
    width: clamp(90px, 14vw, 180px);
    font-size: 0.86rem;
}

.pf-search input::placeholder { color: var(--text-faint); }
.pf-search i { color: var(--text-faint); font-size: 0.85rem; }

.pf-menu-btn {
    display: none;
    font-size: 1.2rem;
    padding: 0.4rem;
}

/* ---------- Mobile sidebar ---------- */
.pf-sidebar-overlay {
    position: fixed; inset: 0; z-index: 1300;
    background: rgba(0,0,0,0.6);
    opacity: 0; pointer-events: none;
    transition: opacity var(--ease);
}
.pf-sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

.pf-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(78vw, 320px);
    z-index: 1400;
    background: var(--bg-soft);
    border-left: 1px solid var(--line);
    padding: calc(1.25rem + var(--safe-t)) 1.25rem calc(1.25rem + var(--safe-b));
    transform: translateX(100%);
    transition: transform var(--ease);
    display: flex; flex-direction: column; gap: 1.5rem;
}
.pf-sidebar.open { transform: translateX(0); }

.pf-sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
}

.pf-sidebar nav {
    display: flex; flex-direction: column; gap: 0.25rem;
}

.pf-sidebar nav a {
    padding: 0.75rem 0.25rem;
    font-size: 1rem;
    color: var(--text-soft);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 0.6rem;
}
.pf-sidebar nav a:hover,
.pf-sidebar nav a.active { color: var(--text); }

/* ---------- About banner (compact, auto-changing photo) ---------- */
.pf-about {
    position: relative;
    height: clamp(300px, 46vh, 440px);
    min-height: 300px;
    display: flex;
    align-items: flex-end;
    padding: calc(var(--nav-h) + var(--safe-t) + 1rem) clamp(1rem, 4vw, 3rem) clamp(1.75rem, 4vw, 2.75rem);
    overflow: hidden;
    background: #000;
}

.pf-about-bg {
    position: absolute; inset: 0;
    z-index: 0;
}

.pf-about-layer {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0;
    transition: opacity 1200ms ease;
}

.pf-about-layer.active { opacity: 0.85; }

.pf-about-bg::after {
    content: '';
    position: absolute; inset: 0;
    z-index: 1;
    background:
        linear-gradient(to top, var(--bg) 4%, rgba(11,11,13,0.2) 46%, rgba(11,11,13,0.55) 100%),
        linear-gradient(to right, rgba(11,11,13,0.85) 0%, rgba(11,11,13,0.15) 55%),
        rgba(11,11,13,0.28);
}

/* Scrolling blurred thumbnails behind the About text */
.pf-about-marquee {
    position: absolute;
    inset: -40px;               /* oversize so the blur never fades at the edges */
    display: flex;
    flex-direction: column;
    filter: blur(var(--about-blur, 10px));
}
.pf-marquee-row {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.pf-marquee-track {
    display: flex;
    height: 100%;
    width: max-content;
    animation: pf-marquee var(--marquee-dur, 100s) linear infinite;
    will-change: transform;
}
.pf-marquee-track.reverse { animation-direction: reverse; }
.pf-marquee-track img {
    flex: none;
    height: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-right: 6px;          /* margin (not gap) so the half-way loop is exact */
}
@keyframes pf-marquee {
    to { transform: translateX(-50%); }
}

.pf-about-content {
    position: relative; z-index: 1;
    max-width: 560px;
}

.pf-about-name {
    font-size: clamp(1.5rem, 3.4vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.pf-about-tagline {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    color: var(--brand-soft);
    font-weight: 500;
    margin-bottom: 0.6rem;
}

.pf-about-bio {
    white-space: pre-line;      /* a "\n" in the bio text becomes a line break */
    font-size: clamp(0.88rem, 1.4vw, 0.98rem);
    color: var(--text-soft);
    max-width: 46ch;
    margin-bottom: 1.15rem;
}

.pf-about-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform var(--ease), background var(--ease), opacity var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--text);
    color: #111;
}
.btn-primary:hover { background: rgba(255,255,255,0.85); }

.btn-secondary {
    background: rgba(120,120,128,0.38);
    color: var(--text);
    backdrop-filter: blur(6px);
}
.btn-secondary:hover { background: rgba(120,120,128,0.55); }

/* ---------- Category pills ---------- */
.pf-filters {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 1.25rem clamp(1rem, 4vw, 3rem) 0.25rem;
    scrollbar-width: none;
}
.pf-filters::-webkit-scrollbar { display: none; }

.pf-filter-pill {
    flex: none;
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.pf-filter-pill:hover { color: var(--text); border-color: rgba(255,255,255,0.28); }

.pf-filter-pill.active {
    background: var(--text);
    color: #111;
    border-color: var(--text);
}

/* ---------- Rows ---------- */
.pf-rows {
    padding: 1rem clamp(1rem, 4vw, 3rem) 4rem;
    display: flex;
    flex-direction: column;
    gap: 2.4rem;
}

.pf-row-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.pf-row-title {
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 600;
}

/* Optional section logos (set `logo:` on a section in portfolio-data.js) */
.pf-row-title .pf-row-logo {
    display: block;
    height: calc(clamp(26px, 3.4vw, 38px) * var(--logo-scale, 1));
    width: auto;
    max-width: min(calc(260px * var(--logo-scale, 1)), 80vw);
    object-fit: contain;
}
.pf-filter-pill .pf-pill-logo {
    display: block;
    height: calc(18px * var(--logo-scale, 1));
    width: auto;
    max-width: calc(96px * var(--logo-scale, 1));
    object-fit: contain;
}

.pf-row-count {
    font-size: 0.8rem;
    color: var(--text-faint);
}

.pf-row-wrap {
    position: relative;
}

.pf-row-arrow {
    position: absolute;
    top: 0; bottom: 0.5rem;
    width: 48px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, var(--bg) 15%, transparent);
    color: var(--text);
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity var(--ease);
}
.pf-row-arrow.next {
    left: auto; right: 0;
    background: linear-gradient(to left, var(--bg) 15%, transparent);
}
.pf-row-wrap:hover .pf-row-arrow { opacity: 1; }
.pf-row-arrow.is-hidden { display: none; }

@media (hover: none) {
    .pf-row-arrow { display: none; }
}

.pf-row {
    display: flex;
    align-items: flex-start; /* mixed 16:9 + vertical cards keep their own height */
    gap: 0.9rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding: 0.25rem 0.15rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
    cursor: grab;
    user-select: none;
}

.pf-row.dragging {
    scroll-behavior: auto;
    scroll-snap-type: none;
    cursor: grabbing;
}

.pf-row::-webkit-scrollbar { height: 6px; }
.pf-row::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 999px; }

/* --- Standard 16:9 card --- */
.pf-card {
    flex: none;
    scroll-snap-align: start;
    width: clamp(260px, 30vw, 400px);
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    text-align: left;
    transition: transform var(--ease), box-shadow var(--ease);
}

.pf-card:hover,
.pf-card:focus-visible {
    transform: translateY(-6px) scale(1.035);
    box-shadow: var(--shadow-card);
    z-index: 2;
}

.pf-card-media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-elevated);
    overflow: hidden;
}

.pf-card-media img,
.pf-card-media video {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 500ms ease;
    pointer-events: none; /* clicks always go to the card, not the video frame */
}
.pf-card:hover .pf-card-media img,
.pf-card:hover .pf-card-media video { transform: scale(1.06); }

.pf-card-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.28);
    opacity: 0;
    transition: opacity var(--ease);
    font-size: 1.6rem;
}
.pf-card:hover .pf-card-play { opacity: 1; }

.pf-card-play i {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: #111;
}

.pf-card-duration {
    position: absolute; right: 0.5rem; bottom: 0.5rem;
    background: rgba(0,0,0,0.75);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.pf-card-body {
    padding: 0.65rem 0.75rem 0.85rem;
}

.pf-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.pf-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    color: var(--text-faint);
}

.pf-views {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.pf-views i { font-size: 0.7rem; }

.pf-tag {
    background: var(--bg-elevated);
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* #BTT ("Behind the Thumbnail") link — on cards and in the modal */
.pf-btt {
    color: var(--brand-soft);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.15rem 0.1rem;
}
.pf-btt:hover { text-decoration: underline; }
.pf-tag.pf-btt {
    background: rgba(229, 9, 26, 0.16);
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}
.pf-tag.pf-btt:hover { background: rgba(229, 9, 26, 0.3); text-decoration: none; }

/* --- Vertical / TikTok-shaped cards (sized per-card, not per-row,
       so a row can mix orientations if you ever want it to) --- */
.pf-card[data-orientation="9:16"] {
    width: clamp(140px, 15vw, 190px);
}
.pf-card[data-orientation="9:16"] .pf-card-media {
    aspect-ratio: 9 / 16;
}

/* ---------- Empty state ---------- */
.pf-empty {
    color: var(--text-faint);
    padding: 2rem 0;
    font-size: 0.92rem;
}

/* ---------- Modal player ---------- */
.pf-modal {
    position: fixed; inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    padding: clamp(0.5rem, 3vw, 3rem);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ease);
}
.pf-modal.open { opacity: 1; pointer-events: auto; }

.pf-modal-inner {
    position: relative;
    width: min(920px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

/* Vertical videos: as wide as fits, but never so tall the player scrolls */
.pf-modal.pf-modal-vertical .pf-modal-inner {
    width: min(420px, 100%, calc((92vh - 240px) * 9 / 16));
    min-width: min(240px, 100%);
}

/* Thumbnail-only items: show the image as large as the screen allows
   (the calc keeps the whole 16:9 picture + text visible without scrolling). */
.pf-modal.pf-modal-image:not(.pf-modal-vertical) .pf-modal-inner {
    width: min(1180px, 100%, calc((92vh - 170px) * 16 / 9));
}

.pf-modal-close {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    z-index: 2;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(20,20,20,0.85);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}

/* Next / previous arrows (sit at the screen edges) and the "3 / 7" counter */
.pf-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.82);
    border: 1px solid var(--line);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    transition: background var(--ease), transform var(--ease);
}
.pf-modal-nav[hidden], .pf-modal-count[hidden] { display: none; }
.pf-modal-nav:hover { background: rgba(60, 60, 64, 0.95); }
.pf-modal-nav:active { transform: translateY(-50%) scale(0.94); }
.pf-modal-nav.prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.pf-modal-nav.next { right: clamp(0.5rem, 2vw, 1.5rem); }
.pf-modal-count {
    position: absolute;
    top: clamp(0.9rem, 2.5vw, 1.4rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.82);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-soft);
}
@media (max-width: 640px) {
    .pf-modal-nav { width: 40px; height: 40px; font-size: 1rem; background: rgba(20, 20, 20, 0.7); }
}

.pf-modal-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}
.pf-modal-vertical .pf-modal-media { aspect-ratio: 9 / 16; }

.pf-modal-media video,
.pf-modal-media iframe {
    width: 100%; height: 100%;
    border: 0;
    display: block;
}

.pf-modal-media img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}

.pf-modal-body {
    padding: 1.25rem 1.5rem 1.75rem;
}

.pf-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pf-modal-desc {
    color: var(--text-soft);
    font-size: 0.92rem;
    margin-bottom: 0.9rem;
}

.pf-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ---------- Footer ---------- */
.pf-footer {
    padding: 2.5rem clamp(1rem, 4vw, 3rem) calc(2.5rem + var(--safe-b));
    border-top: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    justify-content: space-between;
}

.pf-footer a { color: var(--text-soft); }
.pf-footer a:hover { color: var(--text); }

.pf-footer-social {
    display: flex;
    gap: 1rem;
    font-size: 1.05rem;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
    .pf-marquee-track { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .pf-links { display: none; }
    .pf-menu-btn { display: block; }
    .pf-search input { width: 110px; }
}

@media (max-width: 640px) {
    .pf-search { display: none; }
    .pf-about { height: auto; min-height: 340px; padding-bottom: 1.5rem; }
    .pf-about-bio { font-size: 0.86rem; margin-bottom: 0.9rem; }
    .btn { padding: 0.7rem 1.15rem; font-size: 0.88rem; }
    .pf-card[data-orientation="9:16"] { width: clamp(120px, 34vw, 150px); }
    .pf-card:not([data-orientation="9:16"]) { width: clamp(210px, 74vw, 300px); }
}

/* the name now stays visible on small phones; very long names get an ellipsis */
.pf-brand { min-width: 0; }
.pf-brand .brand-word { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
    .pf-brand { max-width: 60vw; }
}
