/* ========================================
   luminescence.dev - Cinematic Glitch Observatory
   ========================================
   Fonts: IBM Plex Sans" IBM Plex Mono" IBM Plex Sans/Mono (Google Fonts)
   Interactive elements (links, buttons) use subtle `text-shadow: glow effects.
   Intersection Observer enters boundary of section viewport and runs for 200-400ms before settling.
   ======================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0A0E1A;
    color: #B8C4D8;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: #7BFFB8;
    color: #0A0E1A;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* --- Cinematic Letterbox Bars --- */
#letterbox-top,
#letterbox-bottom {
    position: fixed;
    left: 0;
    width: 100%;
    height: 24px;
    background: #000000;
    z-index: 1000;
    pointer-events: none;
}

#letterbox-top {
    top: 0;
}

#letterbox-bottom {
    bottom: 0;
}

/* --- Scroll Position Indicator --- */
#scroll-indicator {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    width: 2px;
    height: 200px;
    pointer-events: none;
}

#scroll-indicator-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(58, 74, 107, 0.3);
}

#scroll-indicator-glow {
    position: absolute;
    top: 0;
    left: -2px;
    width: 6px;
    height: 12px;
    background: #7BFFB8;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(123, 255, 184, 0.6), 0 0 20px rgba(123, 255, 184, 0.3);
    transition: top 0.15s ease-out, opacity 0.3s ease;
}

.scroll-notch {
    position: absolute;
    left: -3px;
    width: 8px;
    height: 2px;
    background: rgba(58, 74, 107, 0.6);
}

.scroll-notch[data-section="0"] { top: 0%; }
.scroll-notch[data-section="1"] { top: 16.6%; }
.scroll-notch[data-section="2"] { top: 33.3%; }
.scroll-notch[data-section="3"] { top: 50%; }
.scroll-notch[data-section="4"] { top: 66.6%; }
.scroll-notch[data-section="5"] { top: 83.3%; }

/* --- The Dark Field (Hero) --- */
#dark-field {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #0A0E1A;
}

.dark-field-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.luminescence-glyph-large {
    margin-bottom: 40px;
    opacity: 0.8;
    animation: glyphPulse 4s ease-in-out infinite;
}

@keyframes glyphPulse {
    0%, 100% { opacity: 0.6; filter: drop-shadow(0 0 4px rgba(123, 255, 184, 0.3)); }
    50% { opacity: 1; filter: drop-shadow(0 0 12px rgba(123, 255, 184, 0.6)); }
}

.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 4rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #F2E6D6;
    text-shadow:
        0 0 30px rgba(123, 255, 184, 0.15),
        0 0 60px rgba(123, 255, 184, 0.05);
    margin-bottom: 16px;
}

.hero-dot {
    color: #7BFFB8;
}

.hero-subtitle {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 1.05rem);
    color: #B8C4D8;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    opacity: 0.7;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-hint-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, #7BFFB8);
    animation: scrollHintPulse 2s ease-in-out infinite;
}

@keyframes scrollHintPulse {
    0%, 100% { opacity: 0.3; height: 40px; }
    50% { opacity: 0.9; height: 55px; }
}

/* --- Glitch Bands --- */
.glitch-band {
    position: relative;
    width: 100%;
    height: 4px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.1s;
}

.glitch-band.glitch-active {
    opacity: 1;
}

.glitch-band::before,
.glitch-band::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-band::before {
    background: rgba(0, 212, 255, 0.4);
    transform: translateX(3px);
    mix-blend-mode: screen;
}

.glitch-band::after {
    background: rgba(255, 107, 138, 0.4);
    transform: translateX(-3px);
    mix-blend-mode: screen;
}

@keyframes glitchFlicker {
    0% { opacity: 0; }
    5% { opacity: 1; }
    6% { opacity: 0; }
    15% { opacity: 0; }
    16% { opacity: 0.8; }
    17% { opacity: 0; }
    40% { opacity: 0; }
    41% { opacity: 1; }
    43% { opacity: 0; }
    70% { opacity: 0; }
    71% { opacity: 0.6; }
    72% { opacity: 0; }
    100% { opacity: 0; }
}

.glitch-band.glitch-active {
    animation: glitchFlicker 0.4s steps(1) forwards;
}

/* --- Specimen Panels --- */
.specimen-panel {
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: 80px 0;
    position: relative;
}

.specimen-panel.panel-left {
    justify-content: flex-start;
    padding-left: 5%;
}

.specimen-panel.panel-right {
    justify-content: flex-end;
    padding-right: 5%;
}

.panel-border {
    width: 62%;
    max-width: 800px;
    border: 2px solid #3A4A6B;
    position: relative;
    /* Blur-focus reveal: starts blurred */
    filter: blur(8px);
    opacity: 0.3;
    transition: filter 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-border.panel-focused {
    filter: blur(0);
    opacity: 1;
}

.panel-interior {
    padding: 48px 56px;
    position: relative;
    /* Leather texture via layered gradients (#1A2038 warmth over #0F1628 base) */
    background:
        radial-gradient(ellipse at 20% 30%, #1A2038 0%, transparent 70%),
        radial-gradient(ellipse at 80% 70%, rgba(26, 32, 56, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(15, 22, 40, 0.5) 0%, transparent 80%),
        #0F1628;
}

.specimen-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: #7BFFB8;
    margin-bottom: 16px;
    text-shadow: 0 0 4px rgba(123, 255, 184, 0.4);
}

.panel-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 4rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #F2E6D6;
    margin-bottom: 24px;
}

/* Emission Spectrum HR */
.emission-spectrum {
    border: none;
    height: 2px;
    margin: 24px 0;
    background: linear-gradient(
        to right,
        transparent 0%,
        #FF6B8A 8%,
        transparent 12%,
        transparent 20%,
        #7BFFB8 25%,
        transparent 30%,
        transparent 45%,
        #00D4FF 50%,
        transparent 55%,
        transparent 65%,
        #FF6B8A 70%,
        transparent 75%,
        transparent 85%,
        #7BFFB8 90%,
        transparent 95%
    );
}

.panel-body {
    color: #B8C4D8;
    margin-bottom: 16px;
}

.panel-body:last-of-type {
    margin-bottom: 12px;
}

.panel-caption {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.85rem, 0.95vw, 1rem);
    color: #C9A87C;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(201, 168, 124, 0.2);
}

/* Luminescence Glyph (medium, used as section marker) */
.luminescence-glyph-medium {
    width: 32px;
    height: 32px;
    display: inline-block;
}

/* --- Data Dashboard Strip --- */
#data-dashboard {
    width: 100%;
    padding: 60px 5%;
    background: linear-gradient(
        180deg,
        #0A0E1A 0%,
        rgba(15, 22, 40, 0.95) 10%,
        rgba(15, 22, 40, 0.95) 90%,
        #0A0E1A 100%
    );
    border-top: 1px solid rgba(58, 74, 107, 0.4);
    border-bottom: 1px solid rgba(58, 74, 107, 0.4);
    position: relative;
    overflow: hidden;
    /* Blur-focus for dashboard */
    filter: blur(8px);
    opacity: 0.3;
    transition: filter 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#data-dashboard.panel-focused {
    filter: blur(0);
    opacity: 1;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.dashboard-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.8vw, 0.85rem);
    letter-spacing: 0.2em;
    color: #7BFFB8;
    text-shadow: 0 0 4px rgba(123, 255, 184, 0.4);
}

.dashboard-status {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: #7BFFB8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7BFFB8;
    box-shadow: 0 0 6px rgba(123, 255, 184, 0.6);
    animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.dashboard-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Data Card - Flip */
.data-card {
    width: 180px;
    height: 160px;
    perspective: 800px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform-style: preserve-3d;
}

.data-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 1px solid #3A4A6B;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: #3D1A28;
}

.card-back {
    transform: rotateY(180deg);
    background: #3D1A28;
}

.card-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: #B8C4D8;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.card-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.8rem, 2.5vw, 2.4rem);
    color: #7BFFB8;
    text-shadow: 0 0 8px rgba(123, 255, 184, 0.4);
    line-height: 1.2;
}

.card-unit {
    font-size: 0.5em;
    color: #B8C4D8;
    opacity: 0.7;
    margin-left: 2px;
}

.card-value-small {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 1rem;
    color: #FF6B8A;
    margin-bottom: 8px;
}

.card-detail {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    color: #B8C4D8;
    line-height: 1.5;
    opacity: 0.8;
}

/* Lens flare hover on data cards */
.data-card:hover .card-front,
.data-card:hover .card-back {
    box-shadow:
        0 0 20px rgba(0, 212, 255, 0.15),
        0 0 40px rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.4);
}

/* --- Terminal Footer --- */
#terminal-footer {
    min-height: 70vh;
    padding: 80px 5%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-container {
    width: 100%;
    max-width: 900px;
    border: 1px solid #3A4A6B;
    background: rgba(10, 14, 26, 0.95);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #3A4A6B;
    background: rgba(15, 22, 40, 0.8);
}

.terminal-title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: #B8C4D8;
    opacity: 0.7;
}

.terminal-controls {
    display: flex;
    gap: 6px;
}

.term-ctrl {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #3A4A6B;
}

.term-ctrl-min { background: rgba(123, 255, 184, 0.3); }
.term-ctrl-max { background: rgba(0, 212, 255, 0.3); }
.term-ctrl-close { background: rgba(255, 107, 138, 0.3); }

.terminal-body {
    height: 50vh;
    overflow: hidden;
    position: relative;
}

.terminal-scroll {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    animation: terminalScroll 30s linear infinite;
}

@keyframes terminalScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.terminal-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 0.9vw, 0.95rem);
    line-height: 1.6;
    color: #7BFFB8;
    text-shadow: 0 0 4px rgba(123, 255, 184, 0.4);
    padding: 20px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Terminal links */
.terminal-link {
    color: #FF6B8A;
    text-decoration: none;
    position: relative;
    display: inline;
    cursor: pointer;
}

.terminal-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #FF6B8A;
    transition: width 0.3s ease;
}

.terminal-link:hover::after {
    width: 100%;
}

.terminal-link:hover {
    color: #FF6B8A;
    text-shadow: 0 0 8px rgba(255, 107, 138, 0.4);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .specimen-panel.panel-left,
    .specimen-panel.panel-right {
        justify-content: center;
        padding-left: 16px;
        padding-right: 16px;
    }

    .panel-border {
        width: 95%;
    }

    .panel-interior {
        padding: 32px 24px;
    }

    .dashboard-cards {
        flex-direction: column;
        align-items: center;
    }

    .data-card {
        width: 100%;
        max-width: 280px;
    }

    #scroll-indicator {
        display: none;
    }

    #letterbox-top,
    #letterbox-bottom {
        height: 12px;
    }
}

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

    .panel-heading {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }
}
