/* ===========================================
   lunchbox.dev - Retro-Futuristic Space Canteen
   =========================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #1E1814;
    color: #F0E6D6;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* Crosshatch background texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cline x1='0' y1='8' x2='8' y2='0' stroke='%234A3B30' stroke-width='1' opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: #1E1814;
    border-right: 1px solid #4A3B30;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(-280px);
    transition: transform 400ms ease-out;
    overflow-y: auto;
}

.sidebar.visible {
    transform: translateX(0);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #4A3B30;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #C9A87C;
    letter-spacing: 0.02em;
}

.sidebar-slots {
    padding: 16px 0;
    flex: 1;
}

.sidebar-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    cursor: pointer;
    transition: background-color 200ms ease;
    box-shadow: inset 0 0 2px #3D2B1F;
}

.sidebar-slot:hover {
    background-color: #2A2420;
}

.sidebar-slot .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6B5B4F;
    flex-shrink: 0;
    transition: background-color 200ms linear, box-shadow 300ms ease;
}

.sidebar-slot.active .indicator {
    background-color: #F4A623;
    box-shadow: 0 0 6px rgba(244, 166, 35, 0.4);
}

.sidebar-slot .slot-label {
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6B5B4F;
    transition: color 200ms ease;
}

.sidebar-slot.active .slot-label {
    color: #C9A87C;
}

/* Sidebar collapsed at 1024px */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 56px;
        transform: translateX(-56px);
    }
    .sidebar.visible {
        transform: translateX(0);
    }
    .sidebar-header {
        padding: 16px 8px;
    }
    .sidebar-logo {
        font-size: 1rem;
    }
    .sidebar-slot {
        padding: 14px 8px;
        justify-content: center;
    }
    .sidebar-slot .slot-label {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar.visible ~ .main-content {
        margin-left: 56px;
    }
}

/* --- Mobile Bottom Nav --- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #1E1814;
    border-top: 1px solid #4A3B30;
    z-index: 100;
    justify-content: space-around;
    align-items: center;
}

.mobile-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.mobile-slot .indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #6B5B4F;
    transition: background-color 200ms linear, box-shadow 300ms ease;
}

.mobile-slot.active .indicator {
    background-color: #F4A623;
    box-shadow: 0 0 6px rgba(244, 166, 35, 0.4);
}

.mobile-slot .slot-label {
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6B5B4F;
    transition: color 200ms ease;
}

.mobile-slot.active .slot-label {
    color: #C9A87C;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .mobile-nav {
        display: flex;
    }
    .main-content {
        margin-left: 0 !important;
        padding-bottom: 80px;
    }
}

/* --- Main Content --- */
.main-content {
    position: relative;
    z-index: 1;
    transition: margin-left 400ms ease-out;
}

.main-content.shifted {
    margin-left: 280px;
}

@media (max-width: 1024px) and (min-width: 769px) {
    .main-content.shifted {
        margin-left: 56px;
    }
}

.section {
    min-height: 100vh;
    padding: 48px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Hero Section --- */
.section-hero {
    background-color: #2A2420;
    position: relative;
}

.hero-compartment {
    max-width: 640px;
    width: 100%;
    text-align: center;
}

.hero-lid {
    background-color: #3A2E25;
    border: 1px solid #4A3B30;
    border-radius: 8px;
    padding: 64px 48px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
}

.hero-lid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cline x1='0' y1='8' x2='8' y2='0' stroke='%234A3B30' stroke-width='1' opacity='0.08'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
}

.hero-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4rem);
    color: #C9A87C;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

.hero-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #F4A623;
    box-shadow: 0 0 6px rgba(244, 166, 35, 0.4);
    margin-top: 16px;
    opacity: 0;
    transform: scale(1);
    transition: opacity 200ms ease;
}

.hero-indicator.pulse {
    opacity: 1;
    animation: indicatorPulse 400ms ease-in-out;
}

@keyframes indicatorPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.latch-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.latch-line-left,
.latch-line-right {
    flex: 1;
    height: 1px;
    background-color: #4A3B30;
}

.latch-icon {
    flex-shrink: 0;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.latch-icon.open {
    transform: rotate(90deg);
}

.hero-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 600ms ease, opacity 500ms ease 100ms;
}

.hero-content.revealed {
    max-height: 200px;
    opacity: 1;
}

.hero-tagline {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: #F0E6D6;
    margin-top: 24px;
    line-height: 1.6;
}

/* --- Compartment Cards --- */
.compartment-grid {
    max-width: 900px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 768px) {
    .compartment-grid {
        grid-template-columns: 1fr;
    }
    .section {
        padding: 48px 16px;
    }
}

.compartment-card {
    background-color: #3A2E25;
    border: 1px solid #4A3B30;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 8px 32px rgba(0,0,0,0.3);
    position: relative;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
    opacity: 0;
    transform: translateY(20px);
}

.compartment-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 500ms ease, transform 500ms ease, box-shadow 200ms ease-out;
}

.compartment-card.reveal-left.visible {
    animation: none;
}

.compartment-card.reveal-right.visible {
    animation: none;
}

.compartment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2), 0 16px 48px rgba(0,0,0,0.35);
}

.compartment-card.visible:hover {
    transform: translateY(-4px);
}

.compartment-full {
    grid-column: 1 / -1;
}

.compartment-label {
    display: block;
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #C9A87C;
    margin-bottom: 12px;
}

.card-latch {
    position: absolute;
    top: 24px;
    right: 24px;
}

.compartment-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    color: #F0E6D6;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.compartment-body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: #F0E6D6;
    line-height: 1.65;
    margin-bottom: 16px;
}

.compartment-code {
    background-color: rgba(58, 46, 37, 0.6);
    border-radius: 4px;
    padding: 4px 12px;
    display: inline-block;
}

.compartment-code code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.875em;
    color: #F4A623;
}

/* Status indicators in monitor section */
.status-indicators {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-green {
    background-color: #5A9E6F;
    box-shadow: 0 0 6px rgba(90, 158, 111, 0.4);
}

.status-dot.status-amber {
    background-color: #F4A623;
    box-shadow: 0 0 6px rgba(244, 166, 35, 0.4);
}

.status-dot.status-red {
    background-color: #D4654A;
    box-shadow: 0 0 6px rgba(212, 101, 74, 0.4);
}

.status-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: #C9A87C;
    margin-right: 12px;
}

/* --- Philosophy / Deep Compartment Section --- */
.section-philosophy {
    position: relative;
    background-color: #1E1814;
    overflow: hidden;
}

.philosophy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(135deg, #2A2420 0%, #1E1814 50%, #3A2E25 100%);
    opacity: 0.8;
    z-index: 0;
}

.philosophy-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(74, 59, 48, 0.06) 2px, rgba(74, 59, 48, 0.06) 3px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(74, 59, 48, 0.06) 2px, rgba(74, 59, 48, 0.06) 3px);
    background-size: 12px 12px;
}

.philosophy-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(30, 24, 20, 0.7);
}

.philosophy-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
    text-align: center;
    padding: 48px;
}

.philosophy-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 3rem);
    color: #F0E6D6;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
}

.philosophy-text {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: #C9A87C;
    line-height: 1.75;
    margin-bottom: 20px;
}

/* --- Closing Section --- */
.section-closing {
    background-color: #2A2420;
    position: relative;
}

.closing-compartment {
    max-width: 640px;
    width: 100%;
    text-align: center;
    position: relative;
}

.sealed-stamp {
    display: inline-block;
    border: 2px solid #C9A87C;
    padding: 8px 24px;
    transform: rotate(-12deg);
    margin-bottom: 32px;
    opacity: 0;
    transition: opacity 600ms ease;
}

.sealed-stamp.visible {
    opacity: 1;
}

.stamp-text {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #C9A87C;
}

.closing-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 5vw, 3rem);
    color: #C9A87C;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.closing-tagline {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 1.1rem;
    color: #F0E6D6;
    margin-bottom: 32px;
}

.closing-latch-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 200ms ease;
}

.closing-latch-container:hover {
    transform: scale(1.1);
}

.closing-latch-container:hover .closing-latch {
    transform: rotate(90deg);
}

.closing-latch-label {
    font-family: 'Roboto Slab', serif;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6B5B4F;
    transition: color 200ms ease;
}

.closing-latch-container:hover .closing-latch-label {
    color: #C9A87C;
}

/* --- Scroll reveal base states --- */
.reveal-left {
    transform: translateX(-40px) translateY(20px);
}

.reveal-right {
    transform: translateX(40px) translateY(20px);
}

.reveal-left.visible {
    transform: translateX(0) translateY(0);
}

.reveal-right.visible {
    transform: translateX(0) translateY(0);
}

.reveal-left.visible:hover,
.reveal-right.visible:hover {
    transform: translateY(-4px);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1E1814;
}

::-webkit-scrollbar-thumb {
    background-color: #4A3B30;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #C9A87C;
}
