/* ============================================
   Theory7 - Retro Black & White Style
   ============================================ */

/* Custom Font - only for headings to avoid spacing issue */
@font-face {
    font-family: 'Reimbrandt';
    src: url('./assets/Reimbrandt-DEMO-BF6560113f3bf0a.otf') format('opentype');
}

/* Fix for missing space glyph in Reimbrandt font */
.safe-space {
    font-family: "Courier New", monospace;
    display: inline-block;
    white-space: pre;
    font-size: 0.5em;
    /* Make the space narrower */
    vertical-align: middle;
}

/* Reset and Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    image-rendering: pixelated;
    /* Use monospace for body text to avoid font spacing issues */
    font-family: "Courier New", Courier, monospace;
    min-height: 100vh;
    background-color: #000;
    padding-bottom: 80px;
    color: #fff;
    overflow-x: hidden;
}

/* Reimbrandt only for headings */
h1,
h2,
h3 {
    font-family: 'Reimbrandt', "Courier New", monospace;
}

#grad {
    width: 100%;
    min-height: 100vh;
    background: transparent;
    /* Let Game of Life show through */
    display: flex;
    justify-content: center;
    padding: 20px;
    padding-bottom: 100px;
    overflow: visible !important;
}

/* Main Container */
.main-container {
    width: 100%;
    max-width: 900px;
    background: #000;
    border: 2px solid #fff;
    padding: 25px;
    color: #fff;
    overflow: visible;
}

.main-container.scrollable {
    max-height: none;
}

/* ============================================
   Fire Settings Popup
   ============================================ */
.fire-settings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.fire-settings-overlay.open {
    display: flex;
}

.fire-settings-popup {
    background: #000;
    border: 2px solid #fff;
    padding: 30px;
    min-width: 320px;
}

.fire-settings-popup h3 {
    margin: 0 0 25px 0;
    color: #fff;
    font-size: 1.4em;
    text-align: center;
    letter-spacing: 2px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.setting-row:last-of-type {
    border-bottom: none;
    margin-bottom: 25px;
}

.setting-label {
    color: #fff;
    font-size: 0.9em;
}

.setting-toggle {
    background: #000;
    border: 2px solid #fff;
    color: #fff;
    padding: 8px 20px;
    cursor: pointer;
    font-family: "Courier New", monospace;
    font-size: 0.85em;
}

.setting-toggle:hover {
    background: #222;
}

.setting-toggle.active {
    background: #fff;
    color: #000;
}

.setting-slider {
    width: 120px;
    accent-color: #fff;
}

.color-options {
    display: flex;
    gap: 10px;
}

.color-btn {
    width: 28px;
    height: 28px;
    border: 2px solid #fff;
    cursor: pointer;
    padding: 0;
}

.color-btn.selected {
    box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff;
}

.color-btn.fire-grayscale {
    background: linear-gradient(to top, #333, #999);
}

.color-btn.fire-orange {
    background: linear-gradient(to top, #df5707, #cf7f0f);
}

.color-btn.fire-blue {
    background: linear-gradient(to top, #0747df, #0f7fcf);
}

.color-btn.fire-green {
    background: linear-gradient(to top, #07df17, #7fcf0f);
}

.color-btn.fire-purple {
    background: linear-gradient(to top, #9707df, #cf0faf);
}

/* Settings sections */
.settings-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-section h4 {
    margin: 0 0 15px 0;
    color: #888;
    font-size: 0.85em;
    text-transform: lowercase;
    letter-spacing: 1px;
}

/* close-settings button removed - click outside to close */

/* ============================================
   Bottom Navigation - Floating Box
   ============================================ */
.navbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0;
    padding: 0;
    background: #000;
    border: 2px solid #fff;
    z-index: 1000;
}

.nav-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #000;
    border: none;
    border-right: 1px solid #333;
    color: #888;
    text-decoration: none;
    font-family: "Courier New", monospace;
    font-size: 13px;
    letter-spacing: 1px;
    transition: all 0.15s ease;
    text-transform: lowercase;
    cursor: pointer;
}

.nav-btn:last-child {
    border-right: none;
}

.nav-btn:hover {
    background: #111;
    color: #fff;
}

.nav-btn:active,
.nav-btn.active {
    background: #000;
    color: #fff;
}

#fire-settings-btn {
    color: #fff;
}

#fire-settings-btn:hover {
    color: #888;
}

/* ============================================
   Header
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #fff;
}

.header h1 {
    margin: 0 0 15px 0;
    font-size: 2.5em;
    color: #fff;
    letter-spacing: 4px;
}

.header p {
    margin: 0;
    color: #888;
    font-size: 0.9em;
}

/* ============================================
   Big Content Boxes - Homepage (Fire Border)
   ============================================ */
.content-boxes {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: visible;
}

.big-box {
    background: #000;
    /* Border removed - drawn in JS for pixel-perfect fire alignment */
    padding: 30px;
    min-height: 180px;
    position: relative;
    z-index: 1;
}

.big-box h2 {
    margin: 0 0 15px 0;
    font-size: 1.3em;
    color: #fff;
    letter-spacing: 2px;
}

.big-box p {
    margin: 0 0 10px 0;
    line-height: 1.7;
    color: #ccc;
    font-size: 0.9em;
}

.big-box .media-placeholder {
    width: 100%;
    height: 120px;
    background: #000;
    border: 1px dashed #555;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 1em;
    margin-top: 15px;
}

.content-row {
    display: flex;
    gap: 20px;
}

.content-row .big-box {
    flex: 1;
    min-height: 150px;
}

/* ============================================
   Gallery Grid
   ============================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 10px 0;
    overflow: visible;
}

.gallery-item {
    background: #000;
    /* Border removed - drawn in JS for pixel-perfect fire alignment */
    padding: 12px;
    text-align: center;
    position: relative;
}

.photo-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border: 1px dashed #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: #555;
    margin-bottom: 10px;
}

.photo-caption {
    margin: 0;
    font-size: 0.8em;
    color: #888;
}

/* ============================================
   Blog Post Boxes
   ============================================ */
.blog-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.blog-post {
    background: #000;
    /* Border removed - drawn in JS for pixel-perfect fire alignment */
    border-left: 4px solid #fff;
    padding: 20px;
    position: relative;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.post-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.1em;
    letter-spacing: 1px;
}

.post-date {
    font-size: 0.75em;
    color: #666;
}

.post-content p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.7;
    color: #ccc;
}

/* ============================================
   Fire Canvas Container
   ============================================ */
.fire-border {
    position: relative;
    overflow: visible;
    z-index: 1;
}

.fire-canvas-container {
    position: absolute;
    left: -2px;
    right: -2px;
    bottom: -2px;
    height: 60px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s ease;
    overflow: hidden;
}

.fire-border:hover .fire-canvas-container {
    opacity: 1;
}

.fire-canvas-container canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #fff;
}

.footer p {
    margin: 0;
    font-size: 0.8em;
    color: #666;
    letter-spacing: 1px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 700px) {
    .content-row {
        flex-direction: column;
    }

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

    .navbar {
        flex-wrap: wrap;
        left: 10px;
        right: 10px;
        transform: none;
        justify-content: center;
    }

    .nav-btn {
        padding: 10px 16px;
        font-size: 11px;
    }

    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 10px;
        font-size: 1.2em;
    }
}

/* ============================================
   Read More Button
   ============================================ */
.read-more-btn {
    background: transparent;
    border: 1px solid #555;
    color: #888;
    padding: 8px 16px;
    margin-top: 15px;
    cursor: pointer;
    font-family: "Courier New", monospace;
    font-size: 0.8em;
    transition: all 0.15s ease;
}

.read-more-btn:hover {
    border-color: #fff;
    color: #fff;
}

.post-full p {
    margin: 0 0 10px 0;
    line-height: 1.7;
    color: #ccc;
}

/* ============================================
   Gallery Thumbnails
   ============================================ */
.gallery-item {
    padding: 0 !important;
    /* Image fills to white border */
}

.photo-container {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    background: #000;
    position: relative;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.4s ease;
}

.photo-container:hover .gallery-thumb {
    filter: grayscale(0%);
}

/* Hide photo captions */
.photo-caption {
    display: none;
}

/* ============================================
   Lightbox Modal
   ============================================ */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.lightbox-overlay.open {
    display: flex;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image-wrapper {
    max-width: 100%;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    transition: transform 0.1s ease;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
    padding: 10px;
    line-height: 1;
}

.lightbox-close:hover {
    color: #888;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #fff;
    color: #fff;
    font-size: 1.5em;
    padding: 15px 20px;
    cursor: pointer;
    font-family: "Courier New", monospace;
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: #fff;
    color: #000;
}

.lightbox-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.lightbox-zoom-in,
.lightbox-zoom-out {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.2em;
    font-family: "Courier New", monospace;
}

.lightbox-zoom-in:hover,
.lightbox-zoom-out:hover {
    background: #fff;
    color: #000;
}

.lightbox-zoom-level {
    color: #888;
    font-size: 0.9em;
    min-width: 50px;
    text-align: center;
}

.lightbox-caption {
    color: #888;
    font-size: 0.9em;
    margin-top: 15px;
    text-align: center;
    max-width: 600px;
}

/* ============================================
   Music Player
   ============================================ */
.music-player {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #000;
    border: 2px solid #fff;
    padding: 12px 15px;
    z-index: 999;
    width: 220px;
    /* Fixed width */
}

.music-player-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.music-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    overflow: hidden;
    width: 100%;
    /* Ensure container takes full width */
}

.music-title-wrapper {
    display: flex;
    white-space: nowrap;
    overflow: hidden;
    /* Hide overflow */
    max-width: 100%;
}

/* Flex layout with consistent gap for seamless loop */
.music-title-wrapper.scrolling {
    display: flex;
    gap: 30px;
    animation: marquee 10s linear infinite;
    width: max-content;
    max-width: none;
    overflow: visible;
}

/* Base title style */
.music-title {
    color: #fff;
    font-size: 0.85em;
    white-space: nowrap;
    display: inline-block;
}

/* Remove padding since we use gap now */
.music-title-wrapper.scrolling .music-title {
    padding-right: 0;
}

/* Show cloned titles when scrolling */
.music-title-clone {
    display: block;
    /* Flex items are block by default */
}

/* Infinite scrolling animation - slides wrapper left by 1 unit (text + gap) */
/* The distance is calculated in JS and set to --scroll-dist */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(var(--scroll-dist));
    }
}

.music-artist {
    color: #666;
    font-size: 0.75em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-controls {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.music-btn {
    background: #000;
    border: 1px solid #555;
    color: #888;
    padding: 5px 10px;
    cursor: pointer;
    font-family: "Courier New", monospace;
    font-size: 0.7em;
    transition: all 0.15s ease;
}

.music-btn:hover {
    border-color: #fff;
    color: #fff;
}

.music-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.music-play {
    flex: 1;
}

.music-progress {
    height: 4px;
    background: #333;
    cursor: pointer;
    margin-top: 4px;
}

.music-progress-bar {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: width 0.1s linear;
}

/* Volume wrapper for popup positioning */
.music-volume-wrapper {
    position: relative;
}

.music-volume-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    border: 1px solid #555;
    padding: 10px 8px;
    margin-bottom: 5px;
    display: none;
}

.music-volume-popup.open {
    display: block;
}

/* Custom vertical volume bar - fill style */
.music-volume-bar {
    width: 20px;
    height: 80px;
    background: #333;
    cursor: pointer;
    position: relative;
}

.music-volume-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: #fff;
    transition: height 0.1s ease;
}

/* Volume button styling */
.music-volume-btn {
    font-size: 1.1em !important;
}

/* Responsive - stack above navbar on mobile */
@media (max-width: 700px) {
    .music-player {
        bottom: 80px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}