/* ============================================
   miris.tech — Neon Celestial Bento Grid
   ============================================ */

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

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

body {
    background: #0a0a1a;
    color: #b0b0cc;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ---- Star Field ---- */
#star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.star-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#stars-layer-2 { opacity: 0; transition: opacity 1.5s ease; }
#stars-layer-3 { opacity: 0; transition: opacity 1.5s ease; }

/* ---- Particles ---- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: #7b2fff;
    opacity: 0;
    animation: particleDrift linear infinite;
}

@keyframes particleDrift {
    0% { transform: translateY(110vh) translateX(0); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-10vh) translateX(60px); opacity: 0; }
}

/* ---- Observatory ---- */
#observatory {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.observatory-frame {
    position: relative;
    width: min(80vw, 800px);
    height: min(50vh, 400px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.frame-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.frame-rect {
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.4));
    transition: stroke-dashoffset 2s ease-in-out;
}

.frame-rect.drawn {
    stroke-dashoffset: 0;
}

.observatory-content {
    text-align: center;
    z-index: 1;
}

.logotype {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 9rem);
    letter-spacing: 0.06em;
    color: #00f0ff;
    text-shadow:
        0 0 20px rgba(0, 240, 255, 0.6),
        0 0 60px rgba(0, 240, 255, 0.3),
        0 0 100px rgba(0, 240, 255, 0.15);
    opacity: 0;
    transition: opacity 0.8s ease;
}

.logotype.visible {
    opacity: 1;
}

.logotype .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.logotype .letter.show {
    opacity: 1;
    transform: translateY(0);
}

.tagline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #d0d0f0;
    letter-spacing: 0.1em;
    text-transform: lowercase;
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 1s ease 3.2s;
}

.tagline.visible {
    opacity: 1;
}

/* ---- Engine Room (Bento Grid) ---- */
#engine-room {
    position: relative;
    z-index: 2;
    padding: 6rem 4vw 8rem;
    min-height: 100vh;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    gap: 1.2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.bento-cell {
    background: #0f0f2a;
    border: 1px solid #00f0ff;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3), inset 0 0 8px rgba(0, 240, 255, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease,
        border-color 0.4s ease,
        box-shadow 0.6s ease;
    will-change: transform, opacity;
    overflow: hidden;
}

.bento-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

.bento-cell:hover {
    border-image: linear-gradient(135deg, #00f0ff, #ff00aa) 1;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5), inset 0 0 15px rgba(0, 240, 255, 0.2);
}

.bento-cell:hover .game-illustration {
    transform: scale(1.03);
}

.bento-cell:hover::after {
    opacity: 1;
}

.bento-cell::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 240, 255, 0.05), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

/* Bento cell sizes */
.cell-large {
    grid-column: span 2;
    grid-row: span 2;
    position: relative;
}

.cell-tall {
    grid-column: span 1;
    grid-row: span 2;
    position: relative;
}

.cell-wide {
    grid-column: span 3;
    grid-row: span 1;
    position: relative;
}

.cell-medium {
    grid-column: span 2;
    grid-row: span 1;
    position: relative;
}

.cell-small {
    grid-column: span 1;
    grid-row: span 1;
    position: relative;
}

/* Cell content */
.cell-illustration {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.game-illustration {
    width: 100%;
    max-height: 300px;
    transition: transform 0.4s ease-out;
}

.cell-meta {
    padding-top: 0.5rem;
}

.cell-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: #e0e0ff;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.6s ease;
}

.cell-title.revealed {
    clip-path: inset(0 0 0 0);
}

.cell-desc {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #b0b0cc;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.cell-tech {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: rgba(0, 240, 255, 0.7);
}

/* ---- The Forge ---- */
#forge {
    position: relative;
    z-index: 2;
    padding: 6rem 4vw 8rem;
    min-height: 80vh;
}

.section-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: #00f0ff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    text-align: center;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

.section-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: #b0b0cc;
    text-align: center;
    margin-bottom: 4rem;
}

.forge-scroll-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, 0.3) #0f0f2a;
}

.forge-scroll-container::-webkit-scrollbar {
    height: 4px;
}

.forge-scroll-container::-webkit-scrollbar-track {
    background: #0f0f2a;
}

.forge-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 2px;
}

.forge-track {
    width: 1600px;
    max-width: none;
    padding: 2rem 0;
}

#forge-svg {
    width: 100%;
    height: 400px;
}

.forge-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.forge-path.drawn {
    stroke-dashoffset: 0;
}

.forge-node {
    opacity: 0;
    transition: opacity 0.5s ease, filter 0.5s ease;
}

.forge-node.visible {
    opacity: 1;
}

.forge-node.pulse {
    filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.6));
    animation: nodePulse 0.6s ease;
}

@keyframes nodePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ---- Signal (Closing) ---- */
#signal {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 4vw;
}

.signal-content {
    text-align: center;
    max-width: 700px;
}

.signal-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #e0e0ff;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}

.signal-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
    color: #b0b0cc;
    margin-bottom: 2rem;
}

.signal-code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: rgba(0, 240, 255, 0.7);
    letter-spacing: 0.08em;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cell-large { grid-column: span 2; grid-row: span 1; }
    .cell-tall { grid-column: span 1; grid-row: span 1; }
    .cell-wide { grid-column: span 2; grid-row: span 1; }
    .cell-medium { grid-column: span 1; grid-row: span 1; }
}

@media (max-width: 600px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    .cell-large,
    .cell-tall,
    .cell-wide,
    .cell-medium,
    .cell-small {
        grid-column: span 1;
        grid-row: span 1;
    }
    #engine-room { padding: 3rem 3vw 4rem; }
    #forge { padding: 3rem 3vw 4rem; }
}
