@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=Outfit:wght@100..900&display=swap');

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

:root {
    --bg: #161616;
    --bg-dark: #111111;
    --text: #f0ece4;
    --text-muted: #8a8a8a;
    --border: #3a3a3a;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    background-color: var(--bg-dark);
    z-index: 100;
    max-width: 400px;
    margin: 0 auto;
}

.nav-link {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link.active {
    color: var(--text);
    font-weight: 700;
}

/* ============================================
   UPLOAD INTERFACE
   ============================================ */

.upload-interface {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.upload-area-wrapper {
    position: relative;
}

.upload-bg-frame {
    position: absolute;
    left: -65%;
    top: 70%;
    transform: translateY(-50%);
    width: 90%;
    height: auto;
    opacity: 0.5;
    pointer-events: none;
    filter: invert(1);
    z-index: 0;
}

.upload-bg-frame--right {
    left: auto;
    right: -65%;
    transform: translateY(-50%) scaleX(-1);
}

/* Section visibility */
.section {
    display: none;
}

.section.active {
    display: block;
}

header {
    padding: 4rem 2rem 0;
    text-align: center;
}

header h1 {
    margin: 0 auto;
    clip-path: inset(0 100% 0 0);
    animation: writeReveal 8s cubic-bezier(0.25, 1, 0.5, 1) 0.4s forwards;
}

header h1 img {
    width: clamp(320px, 80vw, 900px);
    height: auto;
    display: block;
    margin: 0 auto;
    filter: invert(1);
}

header h1.animation-done {
    clip-path: inset(0 0% 0 0);
    animation: none;
}

@keyframes writeReveal {
    to {
        clip-path: inset(0 0% 0 0);
    }
}

main {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Upload Section */
.upload-section {
    padding: 1rem 0 0;
}

.upload-area {
    border: 1px solid var(--border);
    padding: 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--bg-dark);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--text-muted);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    display: none;
}

.upload-text {
    display: none;
}

.upload-or {
    display: none;
}

.upload-button {
    background-color: #d4d0c8;
    color: #1a1a1a;
    border: none;
    padding: 0.85rem 2.2rem;
    font-size: 0.72rem;
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-button:hover {
    background-color: #e8e4dc;
}

.upload-hint {
    text-align: center;
    color: var(--text-muted);
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 2rem;
}

/* Gallery Section */
.gallery-section {
    position: relative;
    min-height: 200px;
    padding: 2rem 0;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;

}

.gallery-item {
    position: relative;
    overflow: hidden;
    background-color: var(--bg-dark);
    aspect-ratio: 1;
    animation: fadeIn 0.4s ease;
}


.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.05);
    transition: all 0.3s ease;
}

.gallery-item:hover img {
    filter: grayscale(100%) contrast(1);
    transform: scale(1.02);
}

/* Delete button — only visible in admin mode */
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background-color: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

body.admin-mode .gallery-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background-color: #cc4444;
    border-color: #cc4444;
    color: white;
}

/* ============================================
   ADMIN MODAL
   ============================================ */

.admin-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: background-color 0.2s ease;
}

.admin-overlay.visible {
    background-color: rgba(0, 0, 0, 0.6);
}

.admin-modal {
    background-color: var(--bg);
    border: 1px solid var(--border);
    padding: 2.5rem 2rem 2rem;
    width: 300px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-overlay.visible .admin-modal {
    opacity: 1;
    transform: translateY(0);
}

.admin-title {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.admin-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    outline: none;
    transition: border-color 0.2s ease;
}

.admin-input:focus {
    border-color: var(--text-muted);
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.2rem;
}

.admin-actions button {
    flex: 1;
    padding: 0.65rem 1rem;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-cancel {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.admin-cancel:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.admin-submit {
    background-color: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
}

.admin-submit:hover {
    background-color: #d4d0c8;
    border-color: #d4d0c8;
}

.admin-error {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #cc4444;
    margin-top: 1rem;
    min-height: 1em;
}

/* Loading State */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-muted);
}

.loading.visible {
    display: flex;
}

.loading p {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Empty State */
.empty-message {
    display: none;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 4rem 2rem;
}

.empty-message.visible {
    display: block;
}


/* ============================================
   SLIDESHOW / PROJECTION MODE
   ============================================ */

.slideshow {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0a0a0a;
    z-index: 1000;
}

.slideshow-image {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 2s cubic-bezier(0.5, 0, 0.5, 1);
    filter: grayscale(100%) contrast(1.05);
}

/* Portrait group layout — side-by-side */
.slideshow-image.portrait-layout {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    background: none !important;
}

.slideshow-image.portrait-layout img {
    height: 100%;
    flex: 1;
    min-width: 0;
    object-fit: cover;
}

.slideshow-image.fade-out {
    opacity: 0;
}

/* Film texture video overlay */
.film-texture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 3;
    mix-blend-mode: overlay;
    opacity: 0.5;
}

/* Video/GIF slides */
.slideshow-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Texture Overlay */
.texture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.4;
    mix-blend-mode: overlay;
    z-index: 3;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Film grain animation */
.texture-overlay::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: transparent url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E") repeat;
    opacity: 0.3;
    animation: grain 0.5s steps(10) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -2%); }
    20% { transform: translate(2%, 2%); }
    30% { transform: translate(-1%, 1%); }
    40% { transform: translate(1%, -1%); }
    50% { transform: translate(-2%, 2%); }
    60% { transform: translate(2%, -2%); }
    70% { transform: translate(0, 2%); }
    80% { transform: translate(-2%, 0); }
    90% { transform: translate(2%, 1%); }
}

/* Vignette effect */
.slideshow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 2;
}

/* New Upload Indicator */
.new-upload-indicator {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.8);
    z-index: 10;
    transition: transform 0.5s ease;
    border: 1px solid rgba(255,255,255,0.2);
}

.new-upload-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   PROJECTION MODE STATE
   ============================================ */

body.projection-mode .nav {
    display: none;
}

body.projection-mode .upload-interface {
    display: none;
}

body.projection-mode .slideshow {
    display: block;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@media (max-width: 900px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    header {
        padding: 3rem 1.5rem 0;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 1.5rem;
    }

    .upload-area {
        aspect-ratio: 4 / 3;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-item.wide,
    .gallery-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .slideshow-exit-btn {
        display: block;
        position: fixed;
        top: 1.2rem;
        right: 1.2rem;
        z-index: 1100;
        background: rgba(0, 0, 0, 0.6);
        color: #f0ece4;
        border: 1px solid rgba(240, 236, 228, 0.3);
        padding: 0.5rem 1rem;
        font-family: 'Instrument Sans', sans-serif;
        font-size: 0.72rem;
        font-weight: 600;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        cursor: pointer;
        border-radius: 2px;
    }
}

.slideshow-exit-btn {
    display: none;
}
