/* reiwa.day — Sci-Fi Temporal Observatory */

:root {
    --crimson-deep: #6b1d2a;
    --magenta-signal: #d4006a;
    --void-black: #0e0a0c;
    --parchment-gold: #d4c5a9;
    --warm-white: #f2ece0;
    --teal-accent: #00d4aa;
    --muted-rose: #8a3a4a;
    --sand: #c8b8a0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--void-black);
    color: var(--warm-white);
}

/* Boot Screen */
#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--void-black);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
}

#boot-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.boot-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--teal-accent);
}

.boot-line {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.boot-line.visible {
    opacity: 1;
    transform: translateX(0);
}

.boot-line.glitch-target {
    color: var(--magenta-signal);
}

/* Main Container */
#main-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

#main-container.visible {
    opacity: 1;
}

/* Panel System (Left 45%) */
#panel-system {
    width: 45%;
    height: 100%;
    background: var(--void-black);
    border-right: 1px solid rgba(0, 212, 170, 0.2);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    overflow: hidden;
}

/* Panel Signal (Right 55%) */
#panel-signal {
    width: 55%;
    height: 100%;
    background: var(--warm-white);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Panel Headers */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 212, 170, 0.3);
}

#panel-signal .panel-header {
    border-bottom-color: rgba(107, 29, 42, 0.2);
}

.hud-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

#panel-system .hud-label {
    color: var(--teal-accent);
}

#panel-signal .hud-label {
    color: var(--muted-rose);
}

.hud-status {
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Epoch Display */
.epoch-display {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.epoch-marker {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    border-left: 2px solid rgba(0, 212, 170, 0.15);
    padding-left: 1rem;
    transition: border-color 0.3s ease;
}

.epoch-marker.active {
    border-left-color: var(--teal-accent);
}

.epoch-marker:hover {
    border-left-color: var(--magenta-signal);
}

.epoch-year {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--warm-white);
}

.epoch-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--sand);
    opacity: 0.7;
}

/* System Grid */
.system-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: auto;
}

.grid-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    border: 1px solid rgba(0, 212, 170, 0.1);
}

.grid-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--teal-accent);
    opacity: 0.6;
}

.grid-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--warm-white);
}

.status-active {
    color: var(--magenta-signal);
}

/* Signal Panel Content */
.signal-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    gap: 2rem;
}

.signal-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--crimson-deep);
    line-height: 1;
    position: relative;
}

/* Glitch Text Effect */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: var(--teal-accent);
    animation: glitch-1 3s infinite linear;
    clip-path: inset(0 0 65% 0);
}

.glitch-text::after {
    color: var(--magenta-signal);
    animation: glitch-2 3s infinite linear;
    clip-path: inset(60% 0 0 0);
}

@keyframes glitch-1 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    92% { opacity: 0.8; transform: translate(-3px, 2px); }
    94% { opacity: 0; transform: translate(0); }
    96% { opacity: 0.6; transform: translate(2px, -1px); }
    98% { opacity: 0; }
}

@keyframes glitch-2 {
    0%, 88%, 100% { opacity: 0; transform: translate(0); }
    90% { opacity: 0.7; transform: translate(4px, -2px); }
    93% { opacity: 0; }
    95% { opacity: 0.5; transform: translate(-2px, 1px); }
    97% { opacity: 0; }
}

.signal-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-style: italic;
    color: var(--muted-rose);
    opacity: 0.8;
}

.signal-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.signal-passage {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    line-height: 1.8;
    color: var(--void-black);
    opacity: 0.85;
}

/* Signal Fragments */
.signal-fragments {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(107, 29, 42, 0.15);
}

.fragment {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 14px;
    color: var(--crimson-deep);
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.fragment:hover {
    opacity: 1;
    color: var(--magenta-signal);
}

/* Scanline Overlay */
.scanline-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 212, 170, 0.02) 2px,
        rgba(0, 212, 170, 0.02) 4px
    );
}

/* Noise Overlay */
.noise-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* HUD Overlay */
#hud-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 1s ease 1.5s;
}

#hud-overlay.visible {
    opacity: 1;
}

.hud-corner {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--teal-accent);
    opacity: 0.5;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.top-left { top: 1rem; left: 1rem; }
.top-right { top: 1rem; right: 1rem; text-align: right; }
.bottom-left { bottom: 1rem; left: 1rem; }
.bottom-right { bottom: 1rem; right: 1rem; text-align: right; }

/* Mobile Responsive */
@media (max-width: 768px) {
    #main-container {
        flex-direction: column;
    }

    #panel-system {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 212, 170, 0.2);
        padding: 1.5rem;
    }

    #panel-signal {
        width: 100%;
        height: 60%;
        padding: 2rem;
    }

    .signal-title {
        font-size: 3.5rem;
    }

    .epoch-display {
        gap: 0.4rem;
    }

    .epoch-marker {
        padding: 0.25rem 0;
        padding-left: 0.75rem;
    }
}
