/* style.css - Solid, Slower Ghost Pops */

:root {
    --bg-color: #111;
    --text-color: #eee;
    --bar-height: auto;
    
    /* Variables */
    --thumb-scale: 1.03; 
    --image-scale: 1.05;
    --hover-scale: 1.2; 
    --link-hover-scale: 1.2;
    --audio-hover-scale: 1.1;
    --fs-hover-scale: 1.05; 
    
    /* Category Column Width */
    --col-width: 25vw;
}

body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace; 
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

a { color: inherit; text-decoration: none; }

/* HIDE SCROLLBARS */
#main-stage-container, .blog-view, #main-stage { -ms-overflow-style: none; scrollbar-width: none; }
#main-stage-container::-webkit-scrollbar, .blog-view::-webkit-scrollbar, #main-stage::-webkit-scrollbar { display: none; }

/* --- TOP BAR --- */
#top-bar {
    background: #000;
    display: flex;
    flex-direction: column; 
    padding: 10px 20px;
    z-index: 20;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    flex-shrink: 0; 
}

.bar-row-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.bar-right { display: flex; align-items: center; gap: 20px; order: 2; }
.bar-left { order: 1; }

#site-title {
    order: 3;
    width: 100%;
    text-align: center;
    font-weight: bold; 
    font-size: 1.2em; 
    margin-top: 5px; 
}

#logo { height: 40px; cursor: pointer; transition: transform 0.2s; }
#logo:hover { transform: scale(1.1); }

/* --- CATEGORY NAV STRIP --- */
#category-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    min-height: 0;
}

.nav-item-rect {
    height: 24px;
    min-width: 120px;
    padding: 0 10px;
    background-size: cover;
    background-position: center;
    background-color: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #444;
    color: #bbb;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 0 1px 2px #000;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    transition: all 0.2s ease;
}

.nav-item-rect:hover {
    transform: scale(1.05);
    color: #fff;
    border-color: #fff;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 0 8px rgba(255,255,255,0.3);
    z-index: 10;
}

.nav-text { position: relative; z-index: 2; pointer-events: none; }

#controls { display: flex; gap: 10px; align-items: center; font-size: 0.8em; }
.control-btn {
    background: #333; border: 1px solid #555; color: #fff;
    cursor: pointer; padding: 5px 10px; font-family: inherit; min-width: 80px; 
}
.control-btn:hover { background: #555; }
.vol-wrapper { display: flex; align-items: center; gap: 5px; }

@media (max-width: 850px) {
    .bar-row-top { flex-direction: column; justify-content: center; gap: 15px; }
    #site-title { order: 2; margin: 0; }
    .bar-right { order: 3; width: 100%; justify-content: center; }
    .nav-item-rect { min-width: 80px; font-size: 0.7em; }
}

/* --- BOTTOM BAR --- */
#bottom-bar {
    height: 60px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Ensures 3 zones: Left, Center, Right */
    padding: 0 20px;
    z-index: 20;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    flex-shrink: 0;
    font-size: 0.85em;
    color: #aaa;
}

/* --- STATS BAR --- */
#stats-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    font-weight: bold;
    text-align: center;
}

#stats-click-text {
    color: #fff;
    transition: color 0.2s ease;
}

/* --- MAIN STAGE --- */
#main-stage-container {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    background: #1a1a1a;
    display: flex; 
}

#main-stage {
    height: 100%; 
    width: 100%;
    box-sizing: border-box;
}

/* --- 1. STANDARD GRID MODE (FLEXBOX) --- */
#main-stage.grid-mode {
    display: flex; 
    flex-wrap: wrap; 
    padding: 20px; 
    gap: 15px;
    justify-content: center; 
    align-content: flex-start;
    overflow-y: auto;
}

#main-stage.grid-mode .grid-cell {
    flex-grow: 1;
    height: 250px;
    min-width: 250px;
    max-width: 500px; 
    position: relative;
    cursor: pointer;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}

#main-stage.grid-mode .grid-cell.type-blog {
    max-width: 800px;
}

/* --- UPDATED: Audio Cells Stack Vertically --- */
#main-stage.grid-mode .grid-cell.type-audio {
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    height: 120px; /* Slightly shorter height for audio bars */
    margin-bottom: 5px;
}

/* --- 2. CATEGORY MODE (FIXED WIDTH) --- */
#main-stage.category-mode {
    display: flex; 
    flex-direction: row; 
    overflow-x: auto;    
    overflow-y: hidden;  
    padding: 0; gap: 0;
    justify-content: center; 
}

#main-stage.category-mode .grid-cell.vertical-col {
    flex: 0 0 var(--col-width); 
    width: var(--col-width);
    height: 100%;
    position: relative;
    cursor: pointer;
    border-right: 1px solid #000;
    transition: width 0.5s ease, flex-basis 0.5s ease;
}

@media (max-width: 600px) {
    #main-stage.category-mode .grid-cell.vertical-col { 
        flex: 0 0 80vw; 
        width: 80vw;
    }
}

/* --- INTERACTIONS --- */
.grid-cell:hover { transform: scale(var(--hover-scale)); z-index: 10; }
.grid-cell.type-link:hover { transform: scale(var(--link-hover-scale)); }
.grid-cell.type-audio:hover { transform: scale(var(--audio-hover-scale)); }

#main-stage:hover .grid-cell:not(:hover) { opacity: 0.5; }

/* --- ORGANIC ITEM --- */
.organic-item {
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #222;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}
.grid-mode .organic-item { border-radius: 4px; box-shadow: 0 4px 6px rgba(0,0,0,0.3); }
.grid-cell:hover .organic-item { box-shadow: 0 0 30px rgba(255,255,255,0.2); }

.item-title {
    background: rgba(0,0,0,0.6); padding: 10px 20px; border-radius: 20px;
    font-size: 1.2em; pointer-events: none; text-align: center;
}

/* --- COUNTERS --- */
.click-counter {
    position: absolute; color: #fff; font-weight: bold; font-size: 3em; 
    text-shadow: 0 0 10px #000; pointer-events: none; z-index: 9999;
    animation: floatUp 1.5s forwards ease-out;
}
.grid-hover-counter {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: #fff; font-weight: bold; font-size: 3em; 
    text-shadow: 0 0 10px #000; pointer-events: none; z-index: 200;
    animation: popFade 1.2s forwards ease-out;
}

/* GHOST CLICKS (Smaller, 0.9 Opacity, Slower) */
.ghost-click {
    position: absolute; color: #fff; 
    font-weight: bold; font-size: 1.5em; 
    text-shadow: 0 0 10px #000; pointer-events: none; z-index: 10000; 
    opacity: 0.9; /* More solid */
    animation: popFadeGhost 2.5s forwards ease-out; /* Slower */
}

@keyframes floatUp { 0% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(-80px) scale(1.2); opacity: 0; } }
@keyframes popFade { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1.5); opacity: 0; } }
@keyframes popFadeGhost { 
    0% { transform: scale(0.5); opacity: 0; } 
    20% { transform: scale(1.0); opacity: 0.9; } 
    100% { transform: translateY(-100px) scale(1.2); opacity: 0; } /* Float higher due to longer time */
}

/* --- POP CAPTION --- */
.pop-caption {
    position: absolute; transform: translate(-50%, -50%); color: #fff; font-weight: bold; font-size: 2em; 
    text-shadow: 0 0 10px #000, 0 0 20px #000; text-align: center; pointer-events: none; z-index: 10000; width: 80%; 
    animation: caption-float 3s forwards ease-in-out;
}
@keyframes caption-float {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    10% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 
    80% { transform: translate(-50%, -60%) scale(1.1); opacity: 1; } 
    100% { transform: translate(-50%, -70%) scale(1.2); opacity: 0; } 
}

/* --- ANIMATIONS --- */
@keyframes breathe-thumb { 0% { transform: scale(1); } 50% { transform: scale(var(--thumb-scale)); } 100% { transform: scale(1); } }
.breathing-thumb { animation: breathe-thumb infinite ease-in-out; }
@keyframes breathe-image { 0% { transform: scale(1); } 50% { transform: scale(var(--image-scale)); } 100% { transform: scale(1); } }
.breathing-image { animation: breathe-image infinite ease-in-out; }

@keyframes pop-grid { 0% { transform: scale(var(--hover-scale)); } 40% { transform: scale(calc(var(--hover-scale) + 0.15)); } 100% { transform: scale(1); } }
.active-pop { animation: pop-grid 0.3s forwards !important; }
.type-link.active-pop { animation: pop-grid 0.3s forwards !important; }

@keyframes pop-fs { 0% { transform: scale(var(--fs-hover-scale)); } 40% { transform: scale(calc(var(--fs-hover-scale) * 1.03)); } 100% { transform: scale(var(--fs-hover-scale)); } }

/* --- FULLSCREEN LAYERS --- */
#fs-wrapper { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
#fs-wrapper.active-pop-fs { animation: pop-fs 0.3s forwards !important; transition: none; }
#fs-inner { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
#fs-image-container { position: relative; width: 95vw; height: 90vh; }
img.fs-placeholder { width: 100%; height: 100%; object-fit: contain; display: block; filter: blur(10px); transform: scale(1.02); }
img.fs-full { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.5s ease; display: block; }
.center-hovered { transform: scale(var(--fs-hover-scale)); }
#center-zone { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80%; height: 80%; z-index: 200; cursor: pointer; }

/* --- AUDIO PLAYER --- */
.audio-controls { position: absolute; inset: 0; background: rgba(0,0,0,0.6); display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; }
.grid-cell:hover .audio-controls { opacity: 1; }
/* Force opacity 1 if playing */
.audio-playing .audio-controls { opacity: 1 !important; background: rgba(0,0,0,0.4); } 

.play-icon { font-size: 40px; margin-bottom: 10px; }
.seek-bar { width: 80%; cursor: pointer; }

/* --- OVERLAY --- */
#overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.98); z-index: 100; display: flex; align-items: center; justify-content: center; opacity: 1; transition: opacity 0.3s; }
#overlay.hidden { opacity: 0; pointer-events: none; }
#overlay-content { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* --- BLOG --- */
.blog-view { max-width: 800px; padding: 40px; color: #fff; line-height: 1.6; font-size: 1.1em; overflow-y: auto; max-height: 90vh; }
.blog-view h1 { color: #aaa; border-bottom: 1px solid #333; padding-bottom: 10px; }
.blog-image-wrapper { width: 60%; margin: 30px auto; position: relative; cursor: pointer; transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); }
.blog-image-wrapper:hover { transform: scale(var(--hover-scale)); z-index: 100; }
.blog-image-wrapper img { width: 100%; height: auto; border: 1px solid #333; display: block; box-shadow: 0 4px 6px rgba(0,0,0,0.3); transition: box-shadow 0.3s ease; }
.blog-image-wrapper:hover img { box-shadow: 0 0 30px rgba(255,255,255,0.2); }

/* --- NAV --- */
.nav-zone { position: absolute; top: 0; bottom: 0; width: 15%; display: flex; align-items: center; justify-content: center; font-size: 60px; color: #fff; cursor: pointer; z-index: 500; opacity: 0; transition: opacity 0.3s ease-in-out; background: transparent; }
.nav-zone:hover { opacity: 1; }
.nav-zone.hidden-nav { display: none !important; }
#nav-prev { left: 0; } #nav-next { right: 0; }
.nav-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(15px); transform: scale(1.2); opacity: 0.6; z-index: -1; }
.nav-arrow { position: relative; text-shadow: 0 0 10px #000; z-index: 10; }
.contact-view { text-align: center; width: 100%; display: flex; flex-direction: column; align-items: center; }
.contact-view img { margin-top: 20px; border: 1px solid #333; width: 60%; height: auto; }