/* =========================================================
   JESSE BRONSTEIN — Portfolio
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #000;
    --fg:       #e8e4dc;
    --muted:    #666;
    --border:   #1e1c1a;
    --card-bg:  #0c0b0a;
    --gutter:   clamp(16px, 2vw, 28px);
    --header-h: 44px;
    --mono:     'Roboto Mono', monospace;
    --sans:     'Public Sans', sans-serif;
    --sidebar-w: 220px;
}

html {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar               { width: 3px; height: 3px; }
::-webkit-scrollbar-track         { background: transparent; }
::-webkit-scrollbar-thumb         { background: var(--border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover   { background: var(--muted); }
::-webkit-scrollbar-corner        { background: transparent; }

body { background: var(--bg); overflow-x: hidden; }
a    { color: inherit; text-decoration: none; }

/* ── Hero ────────────────────────────────────────────── */
.hero {
    position: relative;
    height: 100svh;
    min-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

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

.hero-bar {
    position: relative;
    z-index: 120;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: var(--header-h);
    width: 100%;
    padding: 0 var(--gutter);
    transition: background 0.3s ease;
}

.hero-bar.is-stuck {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.hero-center {
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    display: flex;
    justify-content: center;
    gap: 16vw;
    cursor: pointer;
}

.hero-side {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 300;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fff;
}

.hero-right {
    text-align: right;
}

.hero-center:hover,
.hero-side:hover {
    font-style: italic;
}


.header-center:hover,
.header-side:hover,
.work-dropdown-toggle:hover {
    font-style: italic;
}


/* ── Work section ────────────────────────────────────── */
.work-section {
    padding: clamp(40px, 6vh, 80px) var(--gutter) clamp(60px, 9vh, 100px);
    background: var(--bg);
}

/* ── Filter bar (not sticky, below header) ───────────── */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
}

.filter-links {
    display: flex;
    gap: 24px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: var(--fg);
}

.icon-sun { display: block; }
.icon-moon { display: none; }

html.light-mode .icon-sun { display: none; }
html.light-mode .icon-moon { display: block; }

.filter-link {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
    line-height: 1.4;
}

.filter-link:hover { color: var(--fg); }
.filter-link.active { color: var(--fg); font-weight: 400; }

/* ── Project feed ────────────────────────────────────── */
.project-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project.is-hidden { display: none; }

.project-stills {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    cursor: pointer;
}

.project-stills img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    background: var(--card-bg);
    transition: filter 0.3s ease;
}

.project-stills:hover img {
    filter: brightness(0.5);
}

.project-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}

.project-stills:hover .project-title {
    opacity: 1;
}

/* ── About section ───────────────────────────────────── */
.about-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(24px, 4vw, 60px);
    padding: clamp(40px, 6vh, 72px) var(--gutter);
    align-items: start;
    background: var(--bg);
}

.about-section-heading {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg);
    margin-bottom: 16px;
}


.about-bio {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--muted);
    line-height: 1.5;
    max-width: 480px;
    margin-bottom: 24px;
}

.about-contact-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.about-email {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}
.about-email:hover { color: var(--fg); }

.about-gear-accordion {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gear-group {
}

.gear-group:last-child {
}

.about-col-heading {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted);
    padding: 8px 0;
    cursor: pointer;
    list-style: none;
    transition: color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.about-col-heading::after {
    content: '+';
    font-size: 0.7rem;
    font-weight: 300;
}

.gear-group[open] > .about-col-heading::after {
    content: '\2212';
}

.about-col-heading:hover {
    color: var(--fg);
}

.about-col-heading::-webkit-details-marker {
    display: none;
}

@keyframes gear-open {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.about-section-heading + .gear-group .about-col-heading {
    padding-top: 0;
}

.gear-group[open] .gear-list {
    padding-bottom: 14px;
    animation: gear-open 0.22s ease;
}

.gear-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gear-list li {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--muted);
    line-height: 1.4;
}

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: clamp(32px, 5vh, 60px) var(--gutter);
    background: var(--bg);
}

.footer-left,
.footer-center {
    font-family: var(--mono);
    font-size: 0.58rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.footer-right {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.footer-icon {
    color: var(--muted);
    transition: color 0.2s;
}

.footer-icon:hover {
    color: var(--fg);
}

/* ── Overlay ─────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

.overlay-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: var(--header-h);
    padding: 0 var(--gutter);
    flex-shrink: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: transparent;
}

.overlay-header-side {
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 300;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s;
    text-align: left;
    justify-self: start;
}

.overlay-header-side:hover {
    font-style: italic;
}

.overlay-header-center {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg);
    display: flex;
    justify-content: center;
    gap: 16vw;
    cursor: pointer;
}

.overlay-header-center:hover {
    font-style: italic;
}

.overlay-header-right {
    text-align: right;
    justify-self: end;
}

.overlay-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.overlay-sidebar {
    width: calc(var(--gutter) + var(--sidebar-w));
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    padding: calc(var(--header-h) + 20px) var(--gutter) 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.overlay-sidebar::-webkit-scrollbar { display: none; }

/* ── Overlay filter dropdown ─────────────────────────── */
.overlay-filter-nav {
    position: relative;
}

.overlay-filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.58rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg);
    padding: 0;
}
.overlay-filter-plus {
    font-size: 0.8rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.2s ease;
    display: inline-block;
}
.overlay-filter-nav.is-open .overlay-filter-plus {
    transform: rotate(45deg);
}

.overlay-filter-dropdown {
    display: none;
    flex-direction: column;
    gap: 0;
    padding-top: 8px;
}
.overlay-filter-nav.is-open .overlay-filter-dropdown {
    display: flex;
}

.overlay-filter-item {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.58rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    padding: 5px 0;
    transition: color 0.2s;
}
.overlay-filter-item:hover { color: var(--fg); }
.overlay-filter-item.active { display: none; }

/* ── Overlay thumbnail nav ───────────────────────────── */
.overlay-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overlay-nav-item {
    position: relative;
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
}
.overlay-nav-item img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    transition: filter 0.25s ease;
    filter: brightness(0.65);
}
.overlay-nav-item:hover img,
.overlay-nav-item.is-active img {
    filter: brightness(1);
}
.overlay-nav-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 0.55rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 4px;
    text-align: center;
    background: rgba(0,0,0,0.35);
}
.overlay-nav-item:hover .overlay-nav-label,
.overlay-nav-item.is-active .overlay-nav-label {
    opacity: 1;
}

.overlay-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(var(--header-h) + 20px);
}

.overlay-video-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 var(--gutter);
}

.overlay-video {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: var(--card-bg);
}

.overlay-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.overlay-bar {
    padding: 16px var(--gutter);
    border-bottom: 1px solid var(--border);
}

.overlay-title {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg);
}

.overlay-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: var(--gutter);
}

.overlay-gallery img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    background: var(--card-bg);
    cursor: pointer;
    transition: filter 0.3s ease;
}

.overlay-gallery img:hover {
    filter: brightness(1.15);
}

.overlay-bottom-pad { height: clamp(40px, 6vh, 80px); }

/* ── Light mode ──────────────────────────────────────── */
html.light-mode {
    --bg:       #f0eeeb;
    --fg:       #000;
    --muted:    #555;
    --border:   #d4d2cf;
    --card-bg:  #e5e3e0;
}

html.light-mode body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

html.light-mode .hero-bar {
    mix-blend-mode: difference;
}

html.light-mode .hero-side,
html.light-mode .hero-center {
    color: #fff;
}

html.light-mode .overlay {
    background: var(--bg);
}

/* ── Scroll animations ───────────────────────────────── */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.reveal { opacity: 0; }

.reveal.is-visible {
    animation: fade-up 0.6s ease forwards;
}

.project-feed .project:nth-child(1).is-visible  { animation-delay: 0ms; }
.project-feed .project:nth-child(2).is-visible  { animation-delay: 60ms; }
.project-feed .project:nth-child(3).is-visible  { animation-delay: 120ms; }
.project-feed .project:nth-child(4).is-visible  { animation-delay: 180ms; }
.project-feed .project:nth-child(5).is-visible  { animation-delay: 240ms; }
.project-feed .project:nth-child(6).is-visible  { animation-delay: 300ms; }
.project-feed .project:nth-child(7).is-visible  { animation-delay: 360ms; }
.project-feed .project:nth-child(8).is-visible  { animation-delay: 420ms; }
.project-feed .project:nth-child(9).is-visible  { animation-delay: 480ms; }
.project-feed .project:nth-child(10).is-visible { animation-delay: 540ms; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
    .about-section { grid-template-columns: 1fr; }
    .overlay-sidebar { display: none; }
    .overlay-gallery { grid-template-columns: 1fr; }
    .header-center { font-size: 0.7rem; }
}
@media (max-width: 768px) and (min-width: 581px) {
    .project-stills { grid-template-columns: repeat(2, 1fr); }
    .project-stills img:nth-child(3) { display: none; }
}

@media (max-width: 580px) {
    .project-stills { grid-template-columns: 1fr; gap: 2px; }
    .project-stills img:nth-child(1),
    .project-stills img:nth-child(3) { display: none; }
    .filter-bar { flex-direction: row; flex-wrap: wrap; gap: 12px; }
}

/* ── Lightbox ────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.lightbox.is-open {
    opacity: 1;
    pointer-events: all;
}
.lightbox-img-wrap {
    max-width: calc(100vw - 120px);
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    display: block;
}
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 28px;
    background: none;
    border: none;
    color: var(--fg);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
    z-index: 1001;
    font-family: inherit;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--fg);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
    padding: 20px;
    z-index: 1001;
    font-family: inherit;
}
.lightbox-arrow:hover { opacity: 1; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--fg);
    opacity: 0.4;
    font-family: var(--mono);
}
.overlay-gallery img { cursor: pointer; }
