/* CSS Custom Properties - Colors */
:root {
    --cube-1: #CC4A36;
    --cube-2: #278862;
    --cube-3: #CBB12F;
    --cube-4: #3374A3;
    --bg-cream: #E8E0D4;
    --panel-bg: #FAF8F5;
    --text-dark: #1A1A1A;
    --text-muted: #6B6B6B;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/*
 * BACKGROUND IMAGE SPECIFICATIONS:
 * - Recommended size: 3840x2160px (4K) or minimum 2560x1440px (2K)
 * - Aspect ratio: 16:9 (landscape)
 * - File format: JPG (optimized) or WebP
 * - File size: Under 500KB (optimize for web performance)
 * - Purpose: Fixed background covering full viewport, needs high resolution for retina displays
 *
 * To enable background image: Replace the background-image line below with:
 * background-image: url('images/background.jpg'), url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.03"/></svg>');
 * And update background-size to: background-size: cover, 200px 200px;
 */
body {
    font-family: 'Literata', serif;
    background-color: #FAFAFA;
    color: var(--text-dark);
    line-height: 1.6;
    /* Background image - replace with combined version when image file is added to images/ directory */
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.03"/></svg>');
    background-attachment: fixed;
    background-size: 200px 200px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Responsive Container System */
.main-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    position: relative;
}

@media (min-width: 1200px) {
    .main-content {
        width: 55%;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .main-content {
        width: 75%;
    }
}

@media (max-width: 767px) {
    .main-content {
        width: 92%;
    }
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #FFFFFF;
    border-bottom: 1px solid #eee;
    z-index: 1000;
    padding: 12px 24px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #333;
    text-decoration: none;
}

.header-buttons {
    display: flex;
    gap: 16px;
}

.header-btn {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.header-btn:hover {
    color: #1a1a1a;
}

/* Hero section - the "quiet room" */
.hero {
    max-width: 600px;
    margin: 0 auto;
    padding: 120px 24px 80px;
    min-height: 100vh;
    position: relative;
    background-color: #FAFAFA;
}

/* Avatar-sized photo */
.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 32px;
    display: block;
}

/* Normal case headline - "letter" energy */
.hero h1 {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 24px;
    letter-spacing: 0;
    color: #1a1a1a;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    text-transform: none;
}

/* Body paragraphs with generous spacing */
.hero p {
    margin-bottom: 1.5em;
    color: #333;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 17px;
    line-height: 1.7;
}

/* Slightly lighter for the CTA lines */
.hero p.cta-line {
    color: #555;
    font-size: 16px;
}

.hero-link {
    color: var(--cube-2);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
}

.hero-link:hover {
    color: #1f6b4f;
    text-decoration-thickness: 2px;
}

/* Visual cue that there's more below */
.scroll-hint {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
    color: #888;
    font-size: 14px;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

.scroll-hint span {
    display: inline-block;
    animation: bounce-hint 2s infinite;
}

@keyframes bounce-hint {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(4px); }
    60% { transform: translateY(2px); }
}

/* Cubes Section - Normal section after hero */
.cubes-section {
    position: relative;
    margin: 0;
    min-height: 300vh; /* Scroll room for camera movement through cubes */
    height: auto;
    padding-top: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#cubes-container {
    width: 100%;
    height: calc(100vh - var(--header-h, 0px)); /* Full height minus header */
    min-height: 500px;
    position: sticky;
    top: var(--header-h, 0px); /* Offset by header height so cubes don't hide under header */
    display: block;
    overflow: visible;
}

#cubes-container canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

#cubes-container canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    position: relative;
    z-index: 1;
}

/* Backdrop Overlay */
.panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.panel-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* Blur main content when panel is active - very subtle blur */
body.panel-open .main-content,
body.panel-open .header {
    filter: blur(1px);
    pointer-events: none;
    transition: filter 0.4s ease;
}

/* Ensure panel and its children are never blurred */
.content-panel,
.content-panel *,
.content-panel *::before,
.content-panel *::after {
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Content Panels - Outside main-content, not affected by blur */
.content-panels {
    position: static;
    margin: 0;
    /* Ensure panels are never blurred */
    filter: none !important;
    -webkit-filter: none !important;
}

.content-panel {
    display: none;
    background-color: #FFFFFF;
    border-left: none;
    border-top: 3px solid;
    border-radius: 12px;
    padding: clamp(2rem, 6vw, 2.5rem);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0,0,0,0.04);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px);
    max-width: min(90%, 650px);
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    /* Explicitly prevent any blur on the panel */
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.content-panel.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0);
    pointer-events: all;
    /* Ensure panel content is never blurred */
    filter: none !important;
    -webkit-filter: none !important;
}

.content-panel[data-cube="1"] {
    border-top-color: var(--cube-1);
}

.content-panel[data-cube="2"] {
    border-top-color: var(--cube-2);
}

.content-panel[data-cube="3"] {
    border-top-color: var(--cube-3);
}

.content-panel[data-cube="4"] {
    border-top-color: var(--cube-4);
}

.close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: #f5f5f5;
    border: none;
    font-size: 1.25rem;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    z-index: 1001;
    font-weight: 400;
}

.close-btn:hover {
    background: #eee;
    color: #333;
}

.panel-heading {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 1.8vw, 1.1rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.content-panel[data-cube="1"] .panel-heading {
    color: var(--cube-1);
}

.content-panel[data-cube="2"] .panel-heading {
    color: var(--cube-2);
}

.content-panel[data-cube="3"] .panel-heading {
    color: var(--cube-3);
}

.content-panel[data-cube="4"] .panel-heading {
    color: var(--cube-4);
}

.panel-tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.panel-body {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.95rem, 1.3vw, 1rem);
    line-height: 1.75;
    color: #444;
}

.panel-body p {
    margin-bottom: 1.2rem;
}

.panel-body p:last-child {
    margin-bottom: 0;
}

.panel-body p.highlight {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.01) 100%);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border-left: 3px solid currentColor;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.content-panel[data-cube="1"] .panel-body p.highlight {
    border-left-color: var(--cube-1);
    background: linear-gradient(135deg, rgba(204, 74, 54, 0.06) 0%, rgba(204, 74, 54, 0.02) 100%);
}

.content-panel[data-cube="2"] .panel-body p.highlight {
    border-left-color: var(--cube-2);
    background: linear-gradient(135deg, rgba(39, 136, 98, 0.06) 0%, rgba(39, 136, 98, 0.02) 100%);
}

.content-panel[data-cube="3"] .panel-body p.highlight {
    border-left-color: var(--cube-3);
    background: linear-gradient(135deg, rgba(203, 177, 47, 0.06) 0%, rgba(203, 177, 47, 0.02) 100%);
}

.content-panel[data-cube="4"] .panel-body p.highlight {
    border-left-color: var(--cube-4);
    background: linear-gradient(135deg, rgba(51, 116, 163, 0.06) 0%, rgba(51, 116, 163, 0.02) 100%);
}

.panel-subheading {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--text-dark);
}

.panel-subheading:first-of-type {
    margin-top: 0;
}

.panel-body ul {
    list-style: none;
    padding-left: 0;
}

.panel-body li {
    margin-bottom: 0.8rem;
}

.panel-link {
    color: var(--cube-4);
    text-decoration: none;
    transition: all 0.2s ease;
}

.panel-link:hover {
    text-decoration: underline;
    color: #2a5f8a;
}

/* Panel Buttons */
.panel-button {
    display: inline-block;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    margin: 1rem 0;
    background-color: #1a1a1a;
    color: #FFFFFF;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.panel-button:hover {
    background-color: #333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.panel-button-secondary {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    margin-top: 2rem;
}

.panel-button-secondary:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
    color: #333;
    transform: none;
    box-shadow: none;
}

/* Table of Contents for Panel 2 */
.panel-toc {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(44, 44, 44, 0.1);
}

.toc-heading {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    margin-bottom: 1rem;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toc-list {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toc-list li {
    display: flex;
    flex-direction: column;
}

.toc-link {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(0.95rem, 1.3vw, 1.05rem);
    color: var(--cube-2);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: all 0.2s ease;
    display: inline-block;
    cursor: pointer;
}

.toc-link:hover {
    color: #1f6b4f;
    text-decoration-thickness: 2px;
}

/* Panel Images */
.panel-image {
    width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 4px;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Image Placeholders (kept for reference, but images are now used) */
.image-placeholder {
    width: 100%;
    min-height: 200px;
    background-color: rgba(44, 44, 44, 0.05);
    border: 2px dashed rgba(44, 44, 44, 0.2);
    border-radius: 4px;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-placeholder::before {
    content: 'Image placeholder';
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Mobile Adjustments */
@media (max-width: 767px) {
    .header-container {
        flex-direction: column;
        gap: 0.8rem;
    }

    .header-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Background attachment override - fixed doesn't work well on mobile */
    body {
        background-attachment: scroll;
    }


    /* Hero layout - mobile adjustments */
    .hero {
        padding: 100px 24px 60px;
    }

    .avatar {
        width: 100px;
        height: 100px;
        margin-bottom: 24px;
    }

    .hero h1 {
        font-size: 24px;
    }

    .hero p {
        font-size: 16px;
    }

    .content-panel {
        padding: clamp(1.2rem, 5vw, 2rem);
    }
}

/* Back to Top Button */
.back-to-top-section {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: clamp(2rem, 4vw, 3rem) 0;
    background-color: var(--bg-cream);
}

.back-to-top-btn {
    font-family: 'Anybody', sans-serif;
    font-weight: 700;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;

    padding: clamp(0.8rem, 1.5vw, 1rem) clamp(1.5rem, 2.5vw, 2rem);
    border-radius: 8px;
    border: 2px solid var(--text-dark);
    background-color: transparent;
    color: var(--text-dark);
    cursor: pointer;

    transition: all 0.2s ease;
}

.back-to-top-btn:hover {
    background-color: var(--text-dark);
    color: var(--bg-cream);
    transform: translateY(-2px);
}

.back-to-top-btn:active {
    transform: translateY(0);
}

/* Footer */
.site-footer {
    position: static; /* Changed from fixed - footer appears only at bottom of page */
    width: 100%;
    background-color: rgba(250, 250, 250, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(44, 44, 44, 0.1);
    padding: clamp(0.3rem, 0.6vw, 0.5rem) 0; /* Minimal padding - just enough for text readability */
    z-index: 100; /* Below header (1000) and panels (1000), above main content */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-copyright {
    font-family: 'Literata', serif;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: var(--text-muted);
    margin: 0;
}

.footer-version {
    font-family: 'Anybody', sans-serif;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-version #version-number {
    color: var(--text-dark);
    font-weight: 700;
}

/* Hide footer when panel is open to avoid interference */
body.panel-open .site-footer {
    display: none;
}

/* Mobile footer adjustments */
@media (max-width: 767px) {
    .site-footer {
        padding: clamp(0.25rem, 0.5vw, 0.4rem) 0; /* Even smaller padding on mobile */
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.3rem;
    }

    .footer-copyright,
    .footer-version {
        font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    }
}

/* Image Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 2rem;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 300;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    transition: background 0.2s ease, transform 0.2s ease;
    line-height: 1;
    padding: 0;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.lightbox-close:active {
    transform: scale(0.95);
}

/* Mobile optimizations for lightbox */
@media (max-width: 768px) {
    .lightbox-content {
        padding: 1rem;
        max-width: 100%;
        max-height: 100%;
    }

    .lightbox-image {
        max-height: 85vh;
        border-radius: 4px;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 36px;
        height: 36px;
        font-size: 20px;
        background: rgba(255, 255, 255, 0.95);
    }
}

