/* ==========================================================================
   misty.day - Fog-wrapped game studio archive on a lightbox table
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --lightbox-amber: #f5e6cc;
    --aged-blueprint: #2c3e42;
    --burnt-umber: #3b2f24;
    --fog-gray: #8a7e72;
    --oxidized-copper: #b87333;
    --solder-silver: #a8a199;
    --amber-glow: #e5a84b;
    --parchment-cream: #e8d5b7;
    --darkroom-brown: #1e1912;
    --pcb-green: #4a6741;
    --surface-warm: #d4a574;
    --surface-mid: #c4956a;
    --ease-cinematic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    background: var(--lightbox-amber);
    color: var(--burnt-umber);
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Fog Layer --- */
#fog-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
}

.fog-particle {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(245, 230, 204, 0.4), transparent);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.fog-1  { width: 280px; height: 50px; top: 5%;  left: -280px; animation: fogDrift1 55s 0s linear infinite; }
.fog-2  { width: 200px; height: 35px; top: 15%; left: -200px; animation: fogDrift2 70s 5s linear infinite; }
.fog-3  { width: 300px; height: 60px; top: 25%; left: -300px; animation: fogDrift1 45s 12s linear infinite; }
.fog-4  { width: 150px; height: 25px; top: 35%; left: -150px; animation: fogDrift3 80s 3s linear infinite; }
.fog-5  { width: 250px; height: 45px; top: 45%; left: -250px; animation: fogDrift2 60s 20s linear infinite; }
.fog-6  { width: 180px; height: 30px; top: 55%; left: -180px; animation: fogDrift1 75s 8s linear infinite; }
.fog-7  { width: 320px; height: 55px; top: 65%; left: -320px; animation: fogDrift3 50s 15s linear infinite; }
.fog-8  { width: 220px; height: 40px; top: 75%; left: -220px; animation: fogDrift2 65s 25s linear infinite; }
.fog-9  { width: 160px; height: 28px; top: 85%; left: -160px; animation: fogDrift1 85s 10s linear infinite; }
.fog-10 { width: 260px; height: 48px; top: 10%; left: -260px; animation: fogDrift3 58s 30s linear infinite; }
.fog-11 { width: 190px; height: 32px; top: 20%; left: -190px; animation: fogDrift2 72s 18s linear infinite; }
.fog-12 { width: 240px; height: 42px; top: 40%; left: -240px; animation: fogDrift1 63s 35s linear infinite; }
.fog-13 { width: 170px; height: 30px; top: 50%; left: -170px; animation: fogDrift3 90s 7s linear infinite; }
.fog-14 { width: 290px; height: 52px; top: 60%; left: -290px; animation: fogDrift2 48s 22s linear infinite; }
.fog-15 { width: 210px; height: 38px; top: 70%; left: -210px; animation: fogDrift1 68s 40s linear infinite; }
.fog-16 { width: 140px; height: 22px; top: 80%; left: -140px; animation: fogDrift3 78s 14s linear infinite; }
.fog-17 { width: 270px; height: 46px; top: 90%; left: -270px; animation: fogDrift2 52s 28s linear infinite; }
.fog-18 { width: 230px; height: 40px; top: 30%; left: -230px; animation: fogDrift1 82s 45s linear infinite; }

@keyframes fogDrift1 {
    0%   { transform: translateX(0) translateY(0); }
    50%  { transform: translateX(calc(100vw + 350px)) translateY(15px); }
    100% { transform: translateX(0) translateY(0); }
}

@keyframes fogDrift2 {
    0%   { transform: translateX(0) translateY(0); }
    50%  { transform: translateX(calc(100vw + 350px)) translateY(-10px); }
    100% { transform: translateX(0) translateY(0); }
}

@keyframes fogDrift3 {
    0%   { transform: translateX(0) translateY(0); }
    50%  { transform: translateX(calc(100vw + 350px)) translateY(20px); }
    100% { transform: translateX(0) translateY(0); }
}

/* --- Navigation Tabs --- */
#index-tabs {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tab-link {
    display: block;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 12px 8px;
    background: var(--oxidized-copper);
    color: var(--parchment-cream);
    text-decoration: none;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    border-radius: 4px 0 0 4px;
    transition: background-color 0.6s var(--ease-cinematic), transform 0.3s var(--ease-cinematic);
}

.tab-link:hover,
.tab-link.active {
    background: var(--amber-glow);
    color: var(--burnt-umber);
    transform: translateX(-4px);
}

/* --- Main Layout --- */
#lightbox-table {
    position: relative;
    width: 100%;
}

.section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 5%;
    scroll-snap-align: start;
    position: relative;
}

/* --- Paper Aging Effect (applied to panels) --- */
.paper-aged {
    background-image:
        radial-gradient(ellipse at 30% 70%, rgba(139, 119, 89, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 119, 89, 0.06) 0%, transparent 40%);
    box-shadow: inset 0 0 40px rgba(30, 25, 18, 0.15);
    filter: sepia(8%) contrast(98%);
}

/* --- Circuit Traces --- */
.circuit-trace {
    position: absolute;
    background: var(--oxidized-copper);
    z-index: 2;
}

.hero-trace-1 {
    width: 1.5px;
    height: 120px;
    bottom: 20%;
    left: 30%;
    transform: rotate(45deg);
    transform-origin: top center;
}

.hero-trace-2 {
    width: 200px;
    height: 1.5px;
    bottom: 18%;
    left: 32%;
}

.hero-trace-3 {
    width: 1.5px;
    height: 80px;
    bottom: 25%;
    left: 55%;
    transform: rotate(-45deg);
    transform-origin: top center;
}

.solder-point {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--solder-silver);
    z-index: 3;
}

.hero-solder-1 {
    bottom: calc(18% - 4px);
    left: calc(32% - 4px);
}

.hero-solder-2 {
    bottom: calc(18% - 4px);
    left: calc(32% + 196px);
}

/* --- Hero Section --- */
#hero {
    justify-content: flex-start;
    padding-left: 10%;
}

.hero-content {
    position: relative;
}

.hero-title {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 12vw, 10rem);
    color: var(--burnt-umber);
    letter-spacing: 0.02em;
    line-height: 1.15;
}

.hero-subtitle {
    font-family: 'Courier Prime', monospace;
    font-style: italic;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--fog-gray);
    margin-top: 1rem;
    letter-spacing: 0.01em;
}

/* --- Panel Base Styles --- */
.panel {
    position: relative;
    background-image:
        radial-gradient(ellipse at 30% 70%, rgba(139, 119, 89, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 119, 89, 0.06) 0%, transparent 40%);
    box-shadow: inset 0 0 40px rgba(30, 25, 18, 0.15), 0 8px 32px rgba(30, 25, 18, 0.2);
    transition: transform 0.4s var(--ease-cinematic);
}

.panel .panel-content {
    position: relative;
    z-index: 2;
    filter: sepia(8%) contrast(98%);
}

/* --- Document Cluster --- */
.document-cluster {
    position: relative;
    width: 90%;
    max-width: 1200px;
    min-height: 600px;
}

/* --- Blueprint Panel --- */
.blueprint-panel {
    background-color: var(--aged-blueprint);
    color: var(--parchment-cream);
    padding: 48px 40px;
    transform: rotate(-1.5deg);
    width: 70%;
    position: relative;
    margin-left: 5%;
    perspective: 800px;
}

.blueprint-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(232, 213, 183, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232, 213, 183, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 1;
    pointer-events: none;
}

.section-label {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: clamp(2.2rem, 5.5vw, 4.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 2rem;
}

.spec-doc {
    max-width: 600px;
}

.spec-section {
    font-family: 'Courier Prime', monospace;
    font-weight: 700;
    font-size: 1.1em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--amber-glow);
}

.spec-body {
    font-family: 'Courier Prime', monospace;
    font-weight: 400;
    color: var(--parchment-cream);
    margin-bottom: 1rem;
}

/* --- Annotations (inside blueprint) --- */
.annotation {
    position: relative;
    background: var(--surface-warm);
    color: var(--burnt-umber);
    padding: 12px 16px;
    margin: 16px 0;
    font-family: 'Caveat', cursive;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    line-height: 1.5;
    transform: rotate(1.5deg);
    box-shadow: 0 2px 8px rgba(30, 25, 18, 0.15);
}

.annotation .pin {
    position: absolute;
    top: -4px;
    left: 20px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--oxidized-copper);
    box-shadow: 0 2px 3px rgba(30, 25, 18, 0.3);
}

.annotation-2 {
    transform: rotate(-0.8deg);
    background: var(--surface-mid);
}

.annotation-author {
    font-weight: 700;
    color: var(--oxidized-copper);
}

/* --- Polaroid Cards --- */
.polaroid {
    position: absolute;
    width: 200px;
    perspective: 800px;
}

.polaroid-1 {
    top: -40px;
    right: 10%;
    transform: rotate(3.2deg);
}

.polaroid-2 {
    top: 80px;
    right: 3%;
    transform: rotate(-2.1deg);
}

.polaroid-3 {
    top: 220px;
    right: 8%;
    transform: rotate(4.5deg);
}

.polaroid-inner {
    background: var(--parchment-cream);
    padding: 16px;
    position: relative;
    background-image:
        radial-gradient(ellipse at 30% 70%, rgba(139, 119, 89, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 119, 89, 0.06) 0%, transparent 40%);
    box-shadow: inset 0 0 20px rgba(30, 25, 18, 0.1), 0 4px 16px rgba(30, 25, 18, 0.2);
}

.tape {
    position: absolute;
    top: -6px;
    right: 10px;
    width: 40px;
    height: 14px;
    background: rgba(232, 213, 183, 0.6);
    transform: rotate(45deg);
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 2px,
        rgba(139, 119, 89, 0.15) 2px,
        rgba(139, 119, 89, 0.15) 4px
    );
}

.polaroid-text {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--burnt-umber);
    margin-bottom: 8px;
    line-height: 1.3;
}

.polaroid-caption {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--fog-gray);
}

/* --- Blueprint Circuit Traces --- */
.bp-trace-1 {
    width: 80px;
    height: 1.5px;
    top: 60px;
    right: 22%;
    transform: rotate(45deg);
}

.bp-trace-2 {
    width: 1.5px;
    height: 100px;
    top: 120px;
    right: 18%;
}

.bp-trace-3 {
    width: 60px;
    height: 1.5px;
    top: 260px;
    right: 20%;
    transform: rotate(-45deg);
}

.bp-solder-1 { top: 56px; right: calc(22% - 4px); }
.bp-solder-2 { top: 116px; right: calc(18% - 4px); }
.bp-solder-3 { top: 256px; right: calc(20% - 4px); }

/* --- PCB Panel (Projects) --- */
.pcb-panel {
    background-color: var(--aged-blueprint);
    color: var(--parchment-cream);
    padding: 48px 40px;
    transform: rotate(0.8deg);
    width: 100%;
    position: relative;
    perspective: 800px;
}

.pcb-background {
    position: absolute;
    inset: 0;
    background-color: rgba(74, 103, 65, 0.15);
    background-image:
        linear-gradient(rgba(184, 115, 51, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(184, 115, 51, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 1;
    pointer-events: none;
}

.pcb-label {
    color: var(--amber-glow);
}

.pcb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 2rem;
}

.project-card {
    background: rgba(30, 25, 18, 0.4);
    border: 1.5px solid var(--oxidized-copper);
    padding: 20px;
    position: relative;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    transition: box-shadow 0.8s ease, transform 0.4s var(--ease-cinematic);
    perspective: 800px;
}

.project-card:hover {
    box-shadow: 0 0 8px rgba(184, 115, 51, 0.5), 0 0 20px rgba(184, 115, 51, 0.2);
}

.component-pins {
    margin-bottom: 8px;
}

.pin-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--solder-silver);
}

.project-name {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--amber-glow);
    margin-bottom: 8px;
    line-height: 1.3;
}

.project-desc {
    font-family: 'Courier Prime', monospace;
    font-size: 0.9rem;
    color: var(--parchment-cream);
    line-height: 1.6;
}

.trace-connector {
    position: absolute;
    width: 20px;
    height: 1.5px;
    background: var(--oxidized-copper);
    top: 50%;
    transition: box-shadow 0.8s ease;
}

.trace-right { right: -20px; }
.trace-left { left: -20px; }

.project-card:hover .trace-connector {
    box-shadow: 0 0 6px rgba(184, 115, 51, 0.6);
}

/* Circuit SVG overlay */
.circuit-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.trace-path {
    fill: none;
    stroke: var(--oxidized-copper);
    stroke-width: 0.3;
    opacity: 0.4;
}

/* --- Sticky Notes (Philosophy) --- */
.sticky-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
}

.sticky-note {
    width: 260px;
    padding: 24px 20px;
    position: relative;
    box-shadow: 0 4px 16px rgba(30, 25, 18, 0.2);
    transition: transform 0.4s var(--ease-cinematic);
    perspective: 800px;
    background-image:
        radial-gradient(ellipse at 30% 70%, rgba(139, 119, 89, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 119, 89, 0.06) 0%, transparent 40%);
    box-shadow: inset 0 0 25px rgba(30, 25, 18, 0.08), 0 4px 16px rgba(30, 25, 18, 0.2);
}

.sticky-1 { background-color: var(--surface-warm); transform: rotate(-3.5deg); }
.sticky-2 { background-color: var(--surface-mid); transform: rotate(2.8deg); margin-top: 40px; }
.sticky-3 { background-color: var(--parchment-cream); transform: rotate(-1.2deg); }
.sticky-4 { background-color: var(--surface-warm); transform: rotate(4.2deg); margin-top: 30px; }
.sticky-5 { background-color: var(--surface-mid); transform: rotate(-2.5deg); }
.sticky-6 { background-color: var(--parchment-cream); transform: rotate(1.5deg); margin-top: 20px; }

.sticky-note .pin {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--oxidized-copper);
    box-shadow: 0 2px 4px rgba(30, 25, 18, 0.3);
}

.sticky-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    line-height: 1.5;
    color: var(--burnt-umber);
}

.sticky-text.copper-ink {
    color: var(--oxidized-copper);
}

.sticky-correction {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    line-height: 1.5;
    color: var(--oxidized-copper);
    margin-top: 4px;
}

.strikethrough {
    text-decoration: line-through;
    text-decoration-color: var(--burnt-umber);
    text-decoration-thickness: 2px;
    opacity: 0.6;
}

/* --- Doodles --- */
.sticky-doodle {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.doodle-circle {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--fog-gray);
    border-radius: 50%;
}

.doodle-triangle {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid var(--fog-gray);
    opacity: 0.5;
}

.doodle-arrow {
    width: 20px;
    height: 1.5px;
    background: var(--fog-gray);
    position: relative;
    opacity: 0.5;
}

.doodle-arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -4px;
    width: 0;
    height: 0;
    border-left: 6px solid var(--fog-gray);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

/* --- Closing Section --- */
#closing {
    flex-direction: column;
    text-align: center;
}

.closing-content {
    position: relative;
    z-index: 1;
}

.closing-text {
    font-family: 'Courier Prime', monospace;
    font-size: clamp(1rem, 1.8vw, 1.5rem);
    color: var(--burnt-umber);
    letter-spacing: 0.01em;
}

.closing-logo {
    margin-top: 3rem;
    opacity: 0.4;
}

.logo-svg {
    width: 80px;
    height: 80px;
}

/* --- Tilt 3D perspective on parent containers --- */
.tilt-target {
    transition: transform 0.4s var(--ease-cinematic);
}

/* --- Scroll-triggered visibility --- */
.section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--ease-cinematic), transform 0.8s var(--ease-cinematic);
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero always visible on load */
#hero {
    opacity: 1;
    transform: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section {
        padding: 60px 4%;
    }

    .blueprint-panel {
        width: 95%;
        margin-left: 0;
        padding: 32px 24px;
    }

    .polaroid {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin-top: 16px;
    }

    .polaroid-1,
    .polaroid-2,
    .polaroid-3 {
        top: auto;
        right: auto;
    }

    .document-cluster {
        width: 95%;
    }

    .pcb-grid {
        grid-template-columns: 1fr;
    }

    .sticky-cluster {
        flex-direction: column;
        align-items: center;
        padding: 20px;
    }

    .sticky-note {
        width: 90%;
    }

    #index-tabs {
        display: none;
    }

    .circuit-trace,
    .solder-point {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.5rem, 15vw, 4rem);
    }

    .section-label {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
    }
}
