/* ==============================================
   RESET & BASE
   ============================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
}

::selection {
    background-color: rgb(255, 0, 0);
    color: #fff;
}

body {
    font-family: Helvetica, Arial, sans-serif;
    font-size: 11pt;
    min-height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    background-color: #fff;
    color: #000;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
    cursor: none;
}

/* ==============================================
   CUSTOM CURSOR
   ============================================== */
.gradient-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle closest-side, rgb(255, 0, 0), transparent);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(var(--cursor-scale, 1));
    transition: transform 0.3s ease;
    opacity: 0.7;
    z-index: 9999;
    will-change: transform;
}

/* ==============================================
   HEADER & FOOTER
   ============================================== */
header,
footer {
    position: fixed;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    font-size: 11pt;
    z-index: 100;
}

header { top: 0; }
footer { bottom: 0; }

/* Photography pages use a white bar */
.bar-header,
.bar-footer {
    background-color: #fff;
    transition: background-color 0.3s ease;
}

#dark-mode-toggle,
#shuffle-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 11pt;
    color: inherit;
    cursor: none;
    padding: 0;
}

/* ==============================================
   LOADER
   ============================================== */
#loader {
    position: fixed;
    inset: 0;
    background-color: rgb(255, 0, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
}

/* Red "bloom" — stays exactly viewport-sized (no oversized DOM element to
   tile/rasterize, which is what caused the small square artifacts before).
   Its `background` is a radial-gradient recomputed frame-by-frame in JS:
   same formula as .gradient-cursor (circle, red → transparent), animating
   from a huge radius (reads as solid red) down to the cursor's exact 35px
   radius, centered on the live mouse position — so the endpoint is
   pixel-identical to the cursor already sitting there. */
#loader-bloom {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#progress-bar {
    position: relative;
    z-index: 1;
    width: 80%;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    transition: opacity 0.25s ease;
}

#progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: #fff;
    border-radius: 8px;
    transition: width 2s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ==============================================
   PAGE TRANSITIONS — a small cross-fade between pages.
   Starts fully opaque (color-matched via html.dark-mode
   below) so it also backstops the pre-paint flash fix above;
   script.js fades it out on load and fades it back in just
   before following a link to another page.
   ============================================== */
#page-transition {
    position: fixed;
    inset: 0;
    z-index: 999;
    background-color: #fff;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#page-transition.is-hidden {
    opacity: 0;
}

html.dark-mode #page-transition {
    background-color: #000;
}

/* ==============================================
   MAIN CONTAINER (index.html)
   ============================================== */
.container {
    display: none;
    opacity: 0;
}

/* ==============================================
   CAROUSEL — DESKTOP
   ============================================== */
.carousel-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
}

.image-container {
    position: absolute;
    transition:
        transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity   0.5s ease,
        filter    0.5s ease,
        width     0.5s ease,
        height    0.5s ease;
    transform-origin: center center;
    overflow: hidden;
    border-radius: 2px;
}

.image-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Inline project-info — hidden on desktop, shown on mobile */
.project-info { display: none; }
.project-title    { font-size: 20pt; font-weight: bold; }
.project-subtitle { font-size: 8pt; }
.project-role     { font-size: 8pt; }

/* Navigation arrows — clean chevron look */
.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: none;
    border: none;
    color: inherit;
    cursor: none;
    opacity: 1;
    padding: 0;
    user-select: none;
}

.carousel-nav svg {
    display: block;
    overflow: visible;
}

.carousel-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
}
/* Arrows are fixed so overflow:hidden on the container can't clip them.
   max() keeps them on-screen even at narrower viewport widths. */
.prev { left:  max(12px, calc(50% - 720px)); }
.next { right: max(12px, calc(50% - 720px)); }

/* Shared info overlay above carousel */
#carousel-info-overlay {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-align: left;
}

/* Header / footer font size on mobile */
@media (max-width: 768px) {
    header, footer, header button, footer button,
    #dark-mode-toggle, #shuffle-btn { font-size: 11pt; }
}

/* ==============================================
   CAROUSEL — MOBILE
   ============================================== */
@media (max-width: 768px) {
    .carousel-container {
        height: auto;
        overflow: visible;
        align-items: flex-start;
        padding: 80px 20px;
    }

    .carousel {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        gap: 40px;
        position: static;
    }

    .image-container {
        position: static !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        transform: none !important;
        opacity: 1 !important;
        filter: none !important;
        z-index: 1 !important;
    }

    .image-container img {
        aspect-ratio: 16 / 9;
        height: auto !important;
    }

    /* Show project-info above image on mobile */
    .project-info {
        display: block !important;
        margin-bottom: 8px;
    }

    .project-title    { font-size: 20pt; font-weight: bold; margin-bottom: 2px; }
    .project-subtitle { font-size: 9pt; }
    .project-role     { display: none; }

    /* Hide desktop overlay and arrows on mobile */
    #carousel-info-overlay { display: none !important; }
    .carousel-nav          { display: none !important; }
}

/* ==============================================
   PHOTOGRAPHY GALLERY
   ============================================== */
.gallery {
    columns: 3;
    column-gap: 12px;
    padding: 80px 20px;
    width: 100%;
}
 
.gallery-item {
    break-inside: avoid;
    margin-bottom: 0;
    padding-bottom: 12px;
    display: block;
}
 
.gallery-zoom {
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

.gallery-zoom:hover img {
    transform: scale(1.04);
}

.gallery-item img.loaded {
    opacity: 1;
}

 
@media (max-width: 900px) { .gallery { columns: 2; } }
@media (max-width: 500px) { .gallery { columns: 2; } }
 

/* ==============================================
   ABOUT PAGE
   ============================================== */
.about-content {
    position: fixed;
    bottom: 80px;
    left: 80px;
    max-width: 800px;
}

#bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.2;
    z-index: -1;
}

.about-content h1 { font-size: 36px; margin-bottom: 20px; }
.about-content p  { font-size: 18px; font-weight: 300; }
.about-content a  { text-decoration: none; }
.about-content a:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .about-content {
        left: 24px;
        right: 24px;
        bottom: 80px;
        max-width: 100%;
    }
    .about-content h1 { font-size: 26px; }
    .about-content p  { font-size: 15px; }
}

/* ==============================================
   PROJECT DETAIL PAGES
   ============================================== */

/* Page wrapper */
.projects-section {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 100px 60px 80px;
}

/* Staggered fade-in for project detail pages */
@keyframes fadeUpIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0);    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

body.project-detail .project-page-genre,
body.project-detail .project-page-title,
body.project-detail .project-page-video {
    opacity: 0;
    animation: fadeUpIn 0.55s ease forwards;
}
body.project-detail .project-page-genre { animation-delay: 0.05s; }
body.project-detail .project-page-title { animation-delay: 0.15s; }
body.project-detail .project-page-video { animation-delay: 0.25s; }

/* Credits-row: opacity only — no transform in animation so JS scroll-pull works */
body.project-detail .project-page-credits-row {
    opacity: 0;
    animation: fadeIn 0.6s ease forwards 0.38s;
}

/* 1/3 text + 2/3 landscape image layout for projects with short credits */
.project-page-credits-row.bts-wide .project-page-credits {
    flex: 1 1 0;
    max-width: none;
}
.project-page-credits-row.bts-wide .project-page-bts {
    flex: 2 1 0;
    max-width: none;
    aspect-ratio: 3 / 2;
}

/* Genre label above project title */
.project-page-genre {
    font-size: 8pt;
    letter-spacing: 0.12em;
    opacity: 0.45;
    text-transform: uppercase;
    margin-bottom: 6px;
    text-align: center;
}

/* Content block: title, video centered; credits/BTS row below */
.project-page {
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
}

.project-page-title {
    font-size: 44pt;
    font-weight: bold;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 72px;
    text-align: center;
}

.project-page-video {
    width: 100%;
    margin: 0 auto 56px;
    aspect-ratio: 16 / 9;
    border-radius: 3px;
    overflow: hidden;
}

.project-page-video iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.project-page-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
    margin-bottom: 8px;
}

.project-page-description {
    font-size: 10pt;
    line-height: 1.7;
}

/* Credits (left) + BTS photo (right) */
.project-page-credits-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    will-change: transform;
    transition: transform 0.25s ease-out;
    gap: 48px;
    width: 100%;
    margin-top: 8px;
}

.project-page-credits {
    flex: 1 1 420px;
    max-width: 480px;
    font-size: 10pt;
    line-height: 2;
}

.project-page-credits strong {
    font-weight: bold;
}

.project-page-bts {
    flex: 0 0 432px;
    max-width: 432px;
    border-radius: 3px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
}

.project-page-bts img {
    width: 100%;
    height: 115%;
    object-fit: cover;
    display: block;
    margin-top: -7.5%;
    will-change: transform;
}

/* Social / external links below project credits */
.project-page-links {
    display: flex;
    gap: 20px;
    margin-top: 14px;
    font-size: 10pt;
}

.project-page-links a {
    text-decoration: underline;
}

/* Impressum sections */
.impressum-section {
    font-size: 10pt;
    line-height: 1.7;
}

.impressum-section + .impressum-section {
    margin-top: 24px;
}

.impressum-section strong {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

.impressum-section p {
    margin: 0;
}

@media (max-width: 768px) {
    .projects-section {
        padding: 80px 24px;
    }
    .project-page-title {
        font-size: 32pt;
        text-align: center;
        margin-bottom: 36px;
    }
    .project-page-genre {
        text-align: center;
    }
    .project-page-body {
        max-width: 100%;
    }
    .project-page-credits-row {
        flex-direction: column;
        gap: 24px;
        align-items: stretch;
    }
    .project-page-credits {
        max-width: 100%;
        flex: none;
    }
    .project-page-credits-row.bts-wide .project-page-credits,
    .project-page-credits-row.bts-wide .project-page-bts {
        flex: none;
        max-width: 100%;
        width: 100%;
    }
    .project-page-credits:only-child {
        text-align: center;
    }
    .project-page-credits:only-child .project-page-links {
        justify-content: center;
    }
    .project-page-bts {
        max-width: 100%;
        width: 100%;
        flex: none;
    }
}

@media (max-width: 480px) {
    .project-page-title { font-size: 29pt; }
}

/* Project detail pages: transparent header/footer on desktop, solid on mobile */
@media (min-width: 769px) {
    body.project-detail .bar-header,
    body.project-detail .bar-footer,
    body.project-detail.dark-mode .bar-header,
    body.project-detail.dark-mode .bar-footer {
        background-color: transparent;
    }

    /* Hero section fills viewport — credits always start below the fold */
    body.project-detail .projects-section {
        padding-top: 0;
        padding-bottom: 0;
    }
    body.project-detail .project-page {
        max-width: 960px;
    }
    body.project-detail .project-page-hero {
        min-height: 100vh;
        padding-top: 110px;
        padding-bottom: 90px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    body.project-detail .project-page-credits-row {
        padding-top: 60px;
        padding-bottom: 60px;
    }
}

/* At narrower desktops the fixed bars overlap content — restore solid bg */
@media (max-width: 1250px) {
    body.project-detail .bar-header,
    body.project-detail .bar-footer,
    body.project-detail.dark-mode .bar-header,
    body.project-detail.dark-mode .bar-footer {
        background-color: #fff;
    }
    html.dark-mode body.project-detail .bar-header,
    html.dark-mode body.project-detail .bar-footer {
        background-color: #000;
    }
}

/* ==============================================
   ABOUT PAGE — ALWAYS DARK
   ============================================== */
body.about-page {
    background-color: #000;
    color: #fff;
}

body.about-page header a,
body.about-page footer a,
body.about-page #dark-mode-toggle {
    color: #fff;
}
/* Pre-paint dark mode: a tiny inline script in <head> adds this class to
   <html> synchronously, before the stylesheet even loads, by reading
   localStorage. These rules mirror the body.dark-mode ones below but key
   off <html> so the correct colors are already in place on first paint —
   no flash of the light theme when navigating between pages in dark mode. */
html.dark-mode body {
    background-color: #000;
    color: #fff;
}

html.dark-mode .bar-header,
html.dark-mode .bar-footer {
    background-color: #000;
}

@media (min-width: 769px) {
    html.dark-mode body.project-detail .bar-header,
    html.dark-mode body.project-detail .bar-footer {
        background-color: transparent;
    }
}

body.dark-mode {
    background-color: #000;
    color: #fff;
}

body.dark-mode .bar-header,
body.dark-mode .bar-footer {
    background-color: #000;
}
/* ==============================================
   LIGHTBOX
   ============================================== */
#lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#lightbox.active {
    opacity: 1;
    pointer-events: all;
}

#lightbox-img {
    max-width: 88vw;
    max-height: 84vh;
    object-fit: contain;
    border-radius: 2px;
    display: block;
    cursor: none;
    user-select: none;
}

#lightbox-close {
    position: fixed;
    top: 20px;
    right: 40px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 42pt;
    font-weight: 300;
    cursor: none;
    line-height: 1;
    z-index: 501;
    /* Red gradient text */
    background: radial-gradient(circle at center, rgb(255, 0, 0), rgba(180, 0, 0, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity 0.2s ease;
}

#lightbox-close:hover { opacity: 1; }