/* ===================================
   archaic.studio -- styles.css
   Cinematic Archival Dashboard
   =================================== */

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

:root {
    --matte-black: #0a0a0a;
    --gunmetal: #1a1a1e;
    --gunmetal-light: #2a2a2e;
    --brushed-chrome: #8a8a8a;
    --silver-highlight: #b4c3d2;
    --chrome-white: #dce3ea;
    --aged-vellum: #e8dcc8;
    --foxed-cream: #d4c4a8;
    --dried-sage: #7a8a6e;
    --faded-moss: #5a6a4e;
    --patina-bronze: #8a7a5e;
    --ink-graphite: #3a3a40;
    --patina-silver: #9aa8b4;
    --chrome-highlight: #c8d0d8;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Work Sans', sans-serif;
    font-weight: 350;
    background: var(--matte-black);
    color: var(--patina-silver);
    overflow-x: hidden;
    line-height: 1.72;
    letter-spacing: 0.01em;
    font-size: clamp(0.9rem, 1.4vw, 1.05rem);
}

/* --- Film Grain Overlay --- */
#grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#grain-overlay.active {
    opacity: 1;
    animation: grainFlicker 0.4s steps(4) infinite;
}

@keyframes grainFlicker {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-2px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, -2px); }
    100% { transform: translate(2px, 0); }
}

/* --- Vignette Overlay --- */
#vignette-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    box-shadow: inset 0 0 150px rgba(0,0,0,0.5), inset 0 0 80px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 1s ease;
}

#vignette-overlay.active {
    opacity: 1;
}

/* --- Entry Screen --- */
#entry-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--matte-black);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 1.2s ease;
}

#entry-screen.bg-shift {
    background-color: var(--gunmetal);
}

#entry-screen.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#entry-line {
    width: 100%;
    height: 1px;
    background: var(--chrome-white);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: absolute;
    top: 50%;
}

#entry-line.draw {
    transform: scaleX(1);
}

#entry-title {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    color: var(--silver-highlight);
    letter-spacing: 0.08em;
    opacity: 0;
    transform: translateY(20px);
    filter: blur(8px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 1s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 2;
}

#entry-title.reveal {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

#entry-subtitle {
    font-family: 'Work Sans', sans-serif;
    font-weight: 350;
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
    color: var(--patina-silver);
    letter-spacing: 0.12em;
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 16px;
    position: relative;
    z-index: 2;
}

#entry-subtitle.reveal {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* Entry floating leaves */
.entry-leaf {
    position: absolute;
    width: 20px;
    height: 60px;
    background: var(--dried-sage);
    opacity: 0;
    clip-path: ellipse(12% 50% at 50% 50%);
    z-index: 1;
}

.entry-leaf.drift {
    animation: entryLeafDrift 4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.entry-leaf-1 {
    left: 30%;
    top: -10%;
    transform: rotate(20deg);
}
.entry-leaf-2 {
    left: 55%;
    top: -10%;
    transform: rotate(-15deg);
}
.entry-leaf-3 {
    left: 70%;
    top: -10%;
    transform: rotate(35deg);
}

@keyframes entryLeafDrift {
    0% {
        opacity: 0;
        transform: translateY(-10vh) translateX(0) rotate(0deg);
    }
    20% {
        opacity: 0.2;
    }
    100% {
        opacity: 0;
        transform: translateY(110vh) translateX(30px) rotate(45deg);
    }
}

/* --- Dashboard --- */
#dashboard {
    display: grid;
    grid-template-rows: 60vh 80px 1fr;
    min-height: 100vh;
    opacity: 0;
    visibility: hidden;
}

#dashboard.visible {
    opacity: 1;
    visibility: visible;
}

/* --- Monitor Wall --- */
#monitor-wall {
    background: var(--matte-black);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transform: translateY(-100%);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#monitor-wall.slide-in {
    transform: translateY(0);
}

#monitor-letterbox {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--matte-black);
}

#cinematic-frame {
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 2.35 / 1;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--brushed-chrome);
    box-shadow: 0 0 20px rgba(138,138,138,0.15), inset 0 0 8px rgba(0,0,0,0.6);
    background: var(--matte-black);
}

/* Ambient atmospheric loop */
#ambient-loop {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

#ambient-pulse {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(122,138,110,0.03) 0%, transparent 70%);
    animation: ambientPulse 12s ease-in-out infinite;
}

@keyframes ambientPulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; }
}

/* Drifting leaves in the monitor */
.drift-leaf {
    position: absolute;
    background: var(--dried-sage);
    clip-path: ellipse(12% 50% at 50% 50%);
    opacity: 0;
}

.drift-leaf-bg {
    width: 10px;
    height: 30px;
    opacity: 0.06;
}

.drift-leaf-fg {
    width: 16px;
    height: 48px;
    opacity: 0.1;
}

.drift-leaf-1 {
    left: 15%;
    animation: leafDrift 18s linear infinite;
    animation-delay: 0s;
    transform: rotate(15deg);
}

.drift-leaf-2 {
    left: 45%;
    animation: leafDrift 15s linear infinite;
    animation-delay: -6s;
    transform: rotate(-25deg);
}

.drift-leaf-3 {
    left: 78%;
    animation: leafDrift 20s linear infinite;
    animation-delay: -12s;
    transform: rotate(30deg);
}

.drift-leaf-4 {
    left: 30%;
    animation: leafDrift 14s linear infinite;
    animation-delay: -3s;
    transform: rotate(-10deg);
}

.drift-leaf-5 {
    left: 65%;
    animation: leafDrift 16s linear infinite;
    animation-delay: -9s;
    transform: rotate(22deg);
}

@keyframes leafDrift {
    0% {
        top: -10%;
        transform: translateX(0) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: 0.08;
    }
    50% {
        transform: translateX(30px) rotate(22deg);
    }
    95% {
        opacity: 0.08;
    }
    100% {
        top: 110%;
        transform: translateX(0px) rotate(45deg);
        opacity: 0;
    }
}

/* Monitor content */
#monitor-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    z-index: 2;
}

#monitor-heading {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(1.3rem, 2.8vw, 2rem);
    color: var(--silver-highlight);
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

#monitor-description {
    font-family: 'Work Sans', sans-serif;
    font-weight: 350;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--patina-silver);
    max-width: 600px;
    line-height: 1.8;
}

/* Frame scanline effect */
#frame-scanline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(180,195,210,0.08) 50%, transparent 100%);
    animation: scanline 8s linear infinite;
    z-index: 3;
    pointer-events: none;
}

@keyframes scanline {
    0% { top: -2px; }
    100% { top: 100%; }
}

/* --- Control Strip --- */
#control-strip {
    background: linear-gradient(180deg, #2a2a2e 0%, #1a1a1e 100%);
    border-top: 1px solid #3a3a3e;
    border-bottom: 1px solid #0a0a0e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#control-strip-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.strip-ornament {
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.chrome-leaf-svg {
    width: 40px;
    height: 20px;
}

.control-btn {
    position: relative;
    background: linear-gradient(135deg, #3a3a3e 0%, #2a2a2e 25%, #3a3a3e 50%, #2a2a2e 75%, #3a3a3e 100%);
    background-size: 200% 200%;
    background-position: 0% 0%;
    border: none;
    padding: 10px 24px;
    cursor: pointer;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.08), inset -1px -1px 0 rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.4);
    transition: background-position 0.4s ease, box-shadow 0.12s ease, transform 0.12s ease;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.control-btn:hover {
    background-position: 100% 100%;
    background-image: radial-gradient(ellipse at center, rgba(180,195,210,0.12) 0%, transparent 70%), linear-gradient(135deg, #3a3a3e 0%, #2a2a2e 25%, #3a3a3e 50%, #2a2a2e 75%, #3a3a3e 100%);
}

.control-btn:active,
.control-btn.pressed {
    transform: translateY(1px);
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.5), 0 0 0 rgba(0,0,0,0);
}

.btn-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1vw, 0.82rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--chrome-highlight);
    opacity: 0.7;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.control-btn:hover .btn-label {
    color: var(--chrome-white);
    opacity: 1;
}

.control-btn.active .btn-label {
    color: var(--chrome-white);
    opacity: 1;
}

.btn-indicator {
    width: 0;
    height: 3px;
    background: var(--chrome-white);
    box-shadow: 0 2px 8px rgba(220,227,234,0.4);
    transition: width 0.3s ease;
    border-radius: 1px;
}

.control-btn.active .btn-indicator {
    width: 100%;
}

/* Control Strip button assembly animation */
.control-btn {
    opacity: 0;
    transform: scale(0.9);
}

.control-btn.assembled {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease, background-position 0.4s ease, box-shadow 0.12s ease;
}

/* --- Specimen Shelf --- */
#specimen-shelf {
    background: var(--gunmetal);
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#specimen-shelf.slide-in {
    transform: translateY(0);
}

#shelf-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding: 24px 40px;
    height: 100%;
    align-items: stretch;
}

#shelf-scroll::-webkit-scrollbar {
    display: none;
}

#shelf-scroll {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Specimen Cards --- */
.specimen-card {
    flex-shrink: 0;
    width: 320px;
    min-height: 280px;
    position: relative;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    /* Paper-aged background */
    background:
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(140,120,90,0.04) 3px, rgba(140,120,90,0.04) 4px),
        radial-gradient(ellipse at center, transparent 50%, rgba(180,160,130,0.15) 100%),
        linear-gradient(135deg, var(--aged-vellum) 0%, var(--foxed-cream) 100%);
    filter: url(#paper-noise);
    border-radius: 2px;
    overflow: hidden;
}

.specimen-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.specimen-card:hover .card-leaf-watermark {
    opacity: 0.12;
}

/* Chrome label plate */
.card-chrome-plate {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(180deg, #4a4a4e 0%, #3a3a3e 100%);
    border-bottom: 1px solid var(--brushed-chrome);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.card-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    letter-spacing: 0.06em;
    color: var(--chrome-white);
    text-transform: uppercase;
}

.card-date {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.6rem, 0.8vw, 0.7rem);
    letter-spacing: 0.06em;
    color: var(--chrome-highlight);
    opacity: 0.7;
}

/* Card body */
.card-body {
    padding: 20px 16px;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.card-title {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--ink-graphite);
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 350;
    font-size: clamp(0.8rem, 1.1vw, 0.92rem);
    color: var(--ink-graphite);
    line-height: 1.72;
    letter-spacing: 0.01em;
    margin-bottom: 14px;
}

.card-meta {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.9vw, 0.75rem);
    color: var(--patina-bronze);
    letter-spacing: 0.06em;
}

/* Leaf watermarks on cards */
.card-leaf-watermark {
    position: absolute;
    opacity: 0.05;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.leaf-lanceolate {
    width: 40px;
    height: 120px;
    background: var(--faded-moss);
    clip-path: ellipse(12% 50% at 50% 50%);
    right: 20px;
    bottom: 20px;
    transform: rotate(25deg);
}

.leaf-palmate {
    width: 80px;
    height: 80px;
    right: 15px;
    bottom: 15px;
    transform: rotate(-10deg);
    background: radial-gradient(ellipse at 50% 40%, var(--faded-moss) 0%, transparent 70%);
}

.leaf-compound {
    width: 60px;
    height: 100px;
    right: 18px;
    bottom: 18px;
    transform: rotate(15deg);
    background: var(--faded-moss);
    clip-path: polygon(48% 0%, 52% 0%, 55% 15%, 65% 12%, 60% 20%, 70% 22%, 62% 28%, 72% 32%, 60% 36%, 68% 42%, 58% 44%, 65% 52%, 55% 50%, 60% 60%, 52% 56%, 55% 68%, 50% 62%, 45% 68%, 48% 56%, 40% 60%, 45% 50%, 35% 52%, 42% 44%, 32% 42%, 40% 36%, 28% 32%, 38% 28%, 30% 22%, 40% 20%, 35% 12%, 45% 15%);
}

/* Corner fold */
.card-corner-fold {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, transparent 50%, rgba(180,160,130,0.3) 50%);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    z-index: 2;
}

/* --- Blur-Focus Animation Classes --- */
.blur-focus {
    opacity: 0.3;
    filter: blur(6px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.blur-focus.in-view {
    opacity: 1;
    filter: blur(0);
}

/* --- Expanded card state in monitor --- */
.specimen-card.expanded {
    position: fixed;
    z-index: 100;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.specimen-card.dimmed {
    opacity: 0.2;
    transition: opacity 0.4s ease;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    #dashboard {
        grid-template-rows: auto 1fr auto;
        min-height: auto;
    }

    #monitor-wall {
        min-height: 50vh;
    }

    #cinematic-frame {
        width: 96%;
        aspect-ratio: 16 / 9;
    }

    #monitor-content {
        padding: 20px;
    }

    #monitor-heading {
        font-size: clamp(1.1rem, 4vw, 1.6rem);
    }

    #monitor-description {
        font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    }

    #control-strip {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        height: 60px;
    }

    #control-strip-inner {
        gap: 2px;
    }

    .control-btn {
        padding: 8px 14px;
    }

    .strip-ornament {
        display: none;
    }

    #specimen-shelf {
        overflow: visible;
    }

    #shelf-scroll {
        flex-direction: column;
        overflow-x: visible;
        overflow-y: auto;
        scroll-snap-type: none;
        padding: 20px 16px 80px 16px;
        gap: 16px;
    }

    .specimen-card {
        width: 100%;
        flex-shrink: 1;
    }
}

/* --- Utility: hidden SVG filters --- */
#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}
