/* =========================================
   VARIABLES & THEME
   ========================================= */
:root {
    --primary-color: #8e44ad;
    --background-color: #1c1c1c;
    --text-color: #f5f5f5;
    --accent-color: #e67e22;
    --border-color: #7d009c;
    --cursor-img: url('assets/cursor/fishe_cur.gif'), auto;
    --point-img: url('assets/cursor/fishe_point.gif'), auto;
}

/* =========================================
   GLOBAL RESET & STICKY FOOTER ENGINE
   ========================================= */
* {
    box-sizing: border-box; 
    cursor: var(--cursor-img) !important;
}

html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'VT323', monospace;
}

a, button, .interactive-list li, .gallery-item {
    cursor: var(--point-img) !important;
}

/* =========================================
   HEADER & FOOTER 
   ========================================= */
#header-placeholder { width: 100%; flex-shrink: 0; }

header {
    width: 100%;
    background: var(--primary-color);
    padding: 10px 0;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

#footer-placeholder {
    width: 100%;
    margin-top: auto; 
    background-color: var(--primary-color); 
    flex-shrink: 0;
}

#footer-placeholder footer {
    padding: 25px 0 20px 0 !important;
    background: transparent !important; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================
   DYNAMIC DASHBOARD (AUTO 2 OR 3 COLUMNS)
   ========================================= */
.dashboard-grid {
    display: flex;
    flex-direction: column; 
    gap: 25px;
    width: 95%;
    max-width: 1200px;
    margin: 40px auto;
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* FIX 1: Bumped to 1050px so halved windows trigger mobile view */
@media (min-width: 1050px) {
    .dashboard-grid {
        flex-direction: row; 
        align-items: flex-start;
        justify-content: center;
    }
    .side-column { width: 250px; flex-shrink: 0; }
    .main-column { flex: 1; min-width: 0; }
}

/* =========================================
   RETRO WINDOWS
   ========================================= */
.window-container {
    position: relative;
    background-color: var(--background-color);
    border: 5px solid var(--border-color);
    border-top: 36px solid var(--border-color);
    border-radius: 10px;
    outline: 5px solid #1f1f1f;
    padding: 30px 15px 15px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
    text-align: center; 
}

.windowTitle {
    font-size: 18px;
    color: whitesmoke;
    position: absolute;
    top: -36px;
    left: 10px;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.windowIcon { font-size: 18px; color: transparent; text-shadow: 0 0 0 whitesmoke; }

.xBtn, .sizeBtn, .minBtn {
    padding: 2px 8px;
    color: whitesmoke;
    position: absolute;
    top: -34px;
    border: 2px outset #666;
    border-radius: 4px;
    background: transparent;
}
.xBtn { right: 0; background-color: #ff4c4c; border-color: #cc0000; }
.sizeBtn { right: 32px; }
.minBtn { right: 66px; }

.tilt-left { transition: transform 0.3s; }
.tilt-right { transition: transform 0.3s; }
@media (min-width: 1050px) {
    .tilt-left:hover { transform: rotate(-2deg); z-index: 10; }
    .tilt-right:hover { transform: rotate(2deg); z-index: 10; }
}

/* =========================================
   BBB EXPORT CONTAINER 
   ========================================= */
.container {
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 2px dashed var(--primary-color);
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* =========================================
   UI ELEMENTS 
   ========================================= */
h1 { margin: 0; font-size: 2.5rem; color: #ffffff; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5); }
.logo { margin: 0 17px; width: 170px; height: auto; }
.window-container h2, .container h2 { color: var(--accent-color); margin-top: 0; }

.button, .buttosn {
    font-family: 'VT323', monospace;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1.2rem;
    transition: transform 0.2s, background-color 0.3s;
    margin: 10px auto; 
    display: inline-block;
}
.button:hover, .buttosn:hover { background-color: var(--accent-color); transform: scale(1.1); }

input {
    width: 80%;
    padding: 10px;
    border: 2px solid var(--accent-color);
    border-radius: 5px;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    font-family: 'VT323', monospace;
    margin-bottom: 10px;
}

.status { margin-top: 20px; font-size: 1.2rem; color: var(--accent-color); }
.loading { display: none; width: 30px; margin-top: 10px; }
.counter { font-size: 1.5rem; margin-top: 20px; margin-bottom: 0; color: var(--accent-color); }

/* =========================================
   THE SILLY FACE EXPLOSION RIG 
   ========================================= */
.face-wrapper {
    position: relative;
    display: block; 
    width: max-content; 
    margin: 20px auto; 
}

.silly-face { 
    font-size: 5rem; 
    display: block; 
    transform-origin: center center; 
    animation: spin 4s infinite linear; 
    line-height: 1;
    margin: 0;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.explosion { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    display: none; 
    width: 160px; 
    height: auto;
    z-index: 50;
    pointer-events: none; 
}

/* =========================================
   IMAGE SCALING & ABOUT SECTION FIXES
   ========================================= */
.about-split { 
    display: flex; 
    gap: 30px; 
    align-items: center; /* Centers elements gracefully */
    justify-content: center;
    flex-wrap: wrap; /* FIX 2: Allows text to drop below image if squished */
}

/* Home Page Image Setup */
.about-img { 
    flex: 1 1 250px; 
    max-width: 300px;
    display: flex;
    justify-content: center; 
    align-items: center; 
}

.about-img img { 
    width: 100%; 
    max-width: 300px; 
    height: auto; 
    border: none !important; 
    border-radius: 8px; 
}

/* Projects Page Image Setup */
#win-viewer .about-img {
    flex: 0 0 250px; 
    min-height: 250px; 
}

#win-viewer .about-img img {
    max-width: 250px;
    max-height: 250px; 
    object-fit: contain;
}

.about-text { 
    text-align: left; 
    font-size: 1.5rem; 
    flex: 2 1 250px; /* Allows text to grow, but shrink if needed */
    min-width: 250px; /* Forces wrap if container gets smaller than this */
}

@media (max-width: 600px) {
    .about-split { flex-direction: column; align-items: center; text-align: center; }
    .about-img, #win-viewer .about-img { flex: 0 0 auto; min-height: auto; }
    .about-text { text-align: center; }
}

/* =========================================
   COMPACT WINDOW (FOR ADS)
   ========================================= */
.compact-window { padding: 28px 0 0 0 !important; width: 190px !important; height: 212px; margin: 0 auto !important; overflow: hidden; display: flex; flex-direction: column; align-items: center; }
.compact-window .widget-content { line-height: 0; width: 180px; height: 180px; }

/* =========================================
   PROJECTS PAGE & MOBILE REORDERING
   ========================================= */
.interactive-list { text-align: left; font-size: 1.5rem; padding-left: 20px; list-style-type: square; }
.interactive-list li { margin-bottom: 10px; transition: color 0.2s, padding-left 0.2s; }
.interactive-list li:hover { color: var(--accent-color); padding-left: 10px; font-weight: bold; }

@media (max-width: 1049px) { /* Matched to new desktop breakpoint */
    .side-column, .main-column { display: contents; }
    
    #win-directory { 
        order: 1; 
        position: relative; 
        padding: 25px 5px 10px 5px !important; 
        margin: 10px 0 25px 0 !important; 
        border-radius: 10px !important; 
        transform: none !important;
    }
    
    #win-viewer    { order: 2; }
    #win-status    { order: 3; }
    #win-details   { order: 4; }
    #win-captures  { order: 5; }

    .interactive-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px 5px; list-style-type: none; }
    .interactive-list li { background-color: rgba(255, 255, 255, 0.1); padding: 6px 10px; border: 2px solid var(--accent-color); border-radius: 6px; font-size: 1.1rem; margin: 0; }
}

/* =========================================
   GALLERY & LIGHTBOX
   ========================================= */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
.gallery-item { border: 2px dashed var(--primary-color); padding: 5px; background: rgba(255,255,255,0.05); text-align: center; transition: transform 0.2s; }

/* FIX: Image cropping applied here */
.gallery-item img { 
    width: 100%; 
    height: 120px; 
    object-fit: cover; 
    display: block; 
    border-radius: 4px; 
}

/* =========================================
   LIGHTBOX NAVIGATION BUTTONS
   ========================================= */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    font-size: 2rem;
    padding: 10px 15px;
    z-index: 10;
    transition: background 0.2s, transform 0.2s;
}

.nav-btn:hover {
    background: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn { left: 10px; }
.next-btn { right: 10px; }

/* Hide arrows on really thin screens if they overlap too much */
@media (max-width: 500px) {
    .nav-btn { font-size: 1.5rem; padding: 8px 10px; }
    .prev-btn { left: 5px; }
    .next-btn { right: 5px; }
}

.glitch-hover:hover { transform: scale(1.05); }

.lightbox { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); align-items: center; justify-content: center; }
.lightbox-content { background: var(--background-color); border: 5px solid var(--border-color); padding: 20px; max-width: 90%; text-align: center; position: relative; border-radius: 8px; }
.lightbox-content img { max-width: 100%; max-height: 70vh; border: none !important; border-radius: 8px; }
.close-lightbox { position: absolute; top: -15px; right: -15px; background: #ff4c4c; border-radius: 50%; width: 30px; height: 30px; border: 2px solid #cc0000; color: white; font-weight: bold; }

/* Global Oneko Override */
#oneko, .oneko, img[src*="oneko"] { z-index: 9999 !important; position: fixed; }

/* =========================================
   NAVBAR & FOOTER BADGES (Moved from JS)
   ========================================= */
.kuna-navbar { margin-top: 15px; font-size: 1.5rem; color: #cccccc; }
.kuna-navbar a { color: #ffffff; text-decoration: underline; padding: 0 8px; transition: color 0.2s; }
.kuna-navbar a:hover { color: #ff66cc; }

.badges { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; max-width: 900px; margin: 0 auto 15px auto; padding: 0 15px; }
.badges a { display: inline-block; }
.badges img { image-rendering: pixelated; image-rendering: crisp-edges; height: 31px; display: block; }
.indestructible-text { color: white; font-size: 1.2rem; margin: 0; text-align: center; }