/* layer2.id — Retrofuturist Cyberpunk Identity Terminal */
/* Color Palette:
   Void:        #0a0a0c
   Deep Gray:   #16161a
   Mid Gray:    #2e2e38
   Light Gray:  #8b8b9a
   Near White:  #e8e8f0
   Pure Bright: #f5f5ff
   Accent Aqua: #7fdbca
   Accent Amber:#d4a843
   Accent Magenta:#c45c8a
*/

/* ========== RESET & BASE ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0a0a0c;
    color: #e8e8f0;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    line-height: 1.6;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== BOOT SEQUENCE — SCANLINE ========== */
#scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(127, 219, 202, 0.4);
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    animation: scanline-sweep 0.8s ease-out 0.3s forwards;
}

@keyframes scanline-sweep {
    0% { opacity: 1; top: 0; }
    100% { opacity: 0; top: 100vh; }
}

/* ========== FILM GRAIN OVERLAY ========== */
#grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: grain-fadein 1.2s ease-out 0.3s forwards;
}

#tray-three #grain-overlay,
.grain-intensify {
    opacity: 0.05;
}

@keyframes grain-fadein {
    0% { opacity: 0; }
    100% { opacity: 0.035; }
}

/* ========== GHOST GRID LINES ========== */
#ghost-grid {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: ghost-grid-fadein 1s ease-out 1.5s forwards;
}

@keyframes ghost-grid-fadein {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.grid-line-v,
.grid-line-h {
    position: absolute;
    background: #2e2e38;
    animation: grid-pulse 6s ease-in-out infinite;
}

.grid-line-v {
    top: 0;
    width: 1px;
    height: 100%;
    opacity: 0.2;
}

.grid-line-h {
    left: 0;
    width: 100%;
    height: 1px;
    opacity: 0.2;
}

@keyframes grid-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.35; }
}

/* ========== DOMAIN WATERMARK ========== */
#watermark {
    position: fixed;
    bottom: 20px;
    left: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    color: #7fdbca;
    letter-spacing: 0.05em;
    z-index: 100;
    opacity: 0;
    animation: watermark-fadein 0.6s ease-out 2.8s forwards;
}

@keyframes watermark-fadein {
    0% { opacity: 0; }
    100% { opacity: 0.8; }
}

/* ========== TRAY SECTIONS ========== */
.tray {
    position: relative;
    min-height: 100vh;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#tray-one {
    min-height: 100vh;
}

#tray-two {
    min-height: 100vh;
}

#tray-three {
    min-height: 80vh;
    padding-bottom: 80px;
}

.tray-label {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #2e2e38;
    margin-bottom: 24px;
    padding-left: 4px;
}

/* ========== BENTO GRID ========== */
.bento-grid {
    display: grid;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Tray One: Feature cell takes up large area */
.tray-one-grid {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: auto auto;
}

.tray-one-grid .feature-cell {
    grid-column: 1 / 6;
    grid-row: 1 / 3;
}

.tray-one-grid .data-cell:nth-child(2) {
    grid-column: 6 / 8;
    grid-row: 1;
}

.tray-one-grid .data-cell:nth-child(3) {
    grid-column: 8 / 9;
    grid-row: 1;
}

.tray-one-grid .data-cell-live {
    grid-column: 6 / 8;
    grid-row: 2;
}

.tray-one-grid .void-cell {
    grid-column: 8 / 9;
    grid-row: 2;
}

.tray-one-grid .skeleton-cell {
    grid-column: 1 / 4;
    grid-row: 3;
}

.tray-one-grid .data-cell:nth-child(7) {
    grid-column: 4 / 6;
    grid-row: 3;
}

.tray-one-grid .data-cell:nth-child(8) {
    grid-column: 6 / 9;
    grid-row: 3;
}

/* Tray Two: Inverted proportions */
.tray-two-grid {
    grid-template-columns: repeat(8, 1fr);
    grid-auto-rows: minmax(120px, auto);
}

.tray-two-grid .narrative-cell {
    grid-column: 1 / 5;
    grid-row: 1 / 3;
}

.tray-two-grid .data-cell-wide {
    grid-column: 5 / 9;
    grid-row: 1;
}

.tray-two-grid .data-cell:nth-child(3) {
    grid-column: 5 / 7;
    grid-row: 2;
}

.tray-two-grid .skeleton-cell {
    grid-column: 7 / 9;
    grid-row: 2;
}

.tray-two-grid .data-cell:nth-child(5) {
    grid-column: 1 / 3;
    grid-row: 3;
}

.tray-two-grid .void-cell {
    grid-column: 3 / 4;
    grid-row: 3;
}

.tray-two-grid .orb-display-cell {
    grid-column: 4 / 9;
    grid-row: 3;
}

/* Tray Three: Drifting grid */
.tray-three-grid {
    grid-template-columns: repeat(8, 1fr);
    grid-auto-rows: minmax(100px, auto);
}

.tray-three-grid .data-cell:first-child {
    grid-column: 1 / 3;
    grid-row: 1;
}

.tray-three-grid .skeleton-cell:nth-child(2) {
    grid-column: 3 / 6;
    grid-row: 1;
}

.tray-three-grid .skeleton-cell:nth-child(3) {
    grid-column: 6 / 9;
    grid-row: 1;
}

.tray-three-grid .orb-ghost-cell {
    grid-column: 1 / 4;
    grid-row: 2 / 4;
}

.tray-three-grid .narrative-final {
    grid-column: 4 / 9;
    grid-row: 2;
}

.tray-three-grid .void-cell {
    grid-column: 4 / 5;
    grid-row: 3;
}

.tray-three-grid .skeleton-cell:nth-child(7) {
    grid-column: 5 / 7;
    grid-row: 3;
}

.tray-three-grid .data-cell:last-child {
    grid-column: 7 / 9;
    grid-row: 3;
}

/* ========== BENTO CELLS ========== */
.bento-cell {
    background: #16161a;
    border: 1px solid #2e2e38;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s ease, transform 0.3s ease;
    /* Boot: start invisible */
    opacity: 0;
    transform: scale(0.96);
}

.bento-cell.revealed {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.6s ease, border-color 0.4s ease;
}

.bento-cell:hover {
    border-color: #7fdbca;
}

.bento-cell:hover .skeleton-bar {
    animation-duration: 1.2s;
}

.cell-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

/* Feature cell pulsing border */
.feature-cell {
    min-height: 320px;
    animation: feature-border-pulse 4s ease-in-out infinite;
}

.feature-cell.revealed {
    animation: feature-border-pulse 4s ease-in-out infinite;
}

@keyframes feature-border-pulse {
    0%, 100% { border-color: #2e2e38; }
    50% { border-color: rgba(127, 219, 202, 0.1); }
}

.feature-cell .cell-content {
    align-items: flex-start;
    justify-content: center;
    padding: 40px;
}

/* Void cells */
.void-cell {
    background: transparent;
    border-color: rgba(46, 46, 56, 0.3);
    min-height: 60px;
}

.void-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 11px, rgba(46, 46, 56, 0.15) 11px, rgba(46, 46, 56, 0.15) 12px),
        repeating-linear-gradient(90deg, transparent, transparent 11px, rgba(46, 46, 56, 0.15) 11px, rgba(46, 46, 56, 0.15) 12px);
}

/* Drift cells (Tray 3) */
.drift-cell {
    transform: translate(var(--drift-x, 0), var(--drift-y, 0)) rotate(var(--drift-r, 0));
}

.drift-cell.revealed {
    transform: translate(var(--drift-x, 0), var(--drift-y, 0)) rotate(var(--drift-r, 0));
}

/* ========== DISPLAY HEADLINE ========== */
.display-headline {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(2rem, 6vw, 4.5rem);
    color: #f5f5ff;
    letter-spacing: 0.3em;
    line-height: 1.05;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: #8b8b9a;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
}

/* ========== IDENTITY ORBS ========== */
.orb-container {
    position: relative;
    width: 100%;
    height: 120px;
}

.identity-orb {
    position: absolute;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(127, 219, 202, 0.3), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(196, 92, 138, 0.15), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(22, 22, 26, 0.8), rgba(10, 10, 12, 0.95));
    box-shadow: 0 0 20px rgba(127, 219, 202, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.orb-1 {
    width: clamp(60px, 8vw, 100px);
    height: clamp(60px, 8vw, 100px);
    left: 10%;
    top: 10%;
    animation: float-1 8s ease-in-out infinite;
}

.orb-2 {
    width: clamp(40px, 5vw, 70px);
    height: clamp(40px, 5vw, 70px);
    left: 45%;
    top: 20%;
    animation: float-2 10s ease-in-out infinite 1.5s;
    opacity: 0.7;
}

.orb-3 {
    width: clamp(30px, 4vw, 55px);
    height: clamp(30px, 4vw, 55px);
    left: 75%;
    top: 5%;
    animation: float-3 12s ease-in-out infinite 3s;
    opacity: 0.5;
}

.orb-4 {
    width: clamp(50px, 7vw, 90px);
    height: clamp(50px, 7vw, 90px);
    left: 20%;
    top: 15%;
    animation: float-2 9s ease-in-out infinite 0.5s;
}

.orb-5 {
    width: clamp(35px, 5vw, 65px);
    height: clamp(35px, 5vw, 65px);
    left: 60%;
    top: 25%;
    animation: float-1 11s ease-in-out infinite 2s;
    opacity: 0.6;
}

/* Ghost orbs in Tray 3 — larger but more transparent */
.orb-ghost {
    opacity: 0.25;
}

.orb-6 {
    width: clamp(80px, 12vw, 160px);
    height: clamp(80px, 12vw, 160px);
    left: 5%;
    top: 0%;
    animation: float-1 14s ease-in-out infinite;
}

.orb-7 {
    width: clamp(60px, 9vw, 120px);
    height: clamp(60px, 9vw, 120px);
    left: 40%;
    top: 20%;
    animation: float-3 16s ease-in-out infinite 2s;
}

.orb-8 {
    width: clamp(50px, 7vw, 100px);
    height: clamp(50px, 7vw, 100px);
    left: 65%;
    top: 5%;
    animation: float-2 12s ease-in-out infinite 4s;
}

.orb-display-cell,
.orb-ghost-cell {
    position: relative;
    min-height: 140px;
}

.orb-display-cell .cell-content,
.orb-ghost-cell .cell-content {
    position: relative;
}

@keyframes float-1 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes float-2 {
    0%, 100% { transform: translateY(0) translateX(0); }
    33% { transform: translateY(-8px) translateX(3px); }
    66% { transform: translateY(5px) translateX(-3px); }
}

@keyframes float-3 {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-6px) translateX(-4px); }
    50% { transform: translateY(4px) translateX(2px); }
    75% { transform: translateY(-3px) translateX(5px); }
}

/* ========== DATA CELLS ========== */
.data-cell {
    min-height: 80px;
}

.data-cell .cell-content {
    padding: 16px 20px;
    gap: 6px;
}

.data-label {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: clamp(0.55rem, 0.9vw, 0.7rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #8b8b9a;
    display: block;
}

.data-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    letter-spacing: 0.05em;
    color: #e8e8f0;
    display: block;
    margin-top: 4px;
}

.mono-small {
    font-size: clamp(0.65rem, 1vw, 0.85rem);
}

/* ========== ACCENT COLORS ========== */
.accent-aqua { color: #7fdbca; }
.accent-amber { color: #d4a843; }
.accent-magenta { color: #c45c8a; }

/* ========== SKELETON LOADING ========== */
.skeleton-cell {
    min-height: 80px;
}

.skeleton-cell .cell-content {
    gap: 10px;
    justify-content: center;
}

.skeleton-bar {
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 67, 0.15), transparent);
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
    background-color: rgba(46, 46, 56, 0.4);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Skeleton shimmer background for live data cells */
.skeleton-shimmer-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 67, 0.05), transparent);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

.data-cell-live .cell-content {
    position: relative;
}

.data-cell-live .data-label,
.data-cell-live .data-value {
    position: relative;
    z-index: 2;
}

/* ========== NARRATIVE CELLS ========== */
.narrative-cell {
    min-height: 200px;
}

.narrative-cell .cell-content {
    padding: 32px;
    gap: 16px;
}

.narrative-cell p {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    line-height: 1.7;
    color: #e8e8f0;
}

.narrative-cell .cell-content {
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

/* Philosophical text in Tray 3 */
.philosophical-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    line-height: 1.7;
    color: #8b8b9a;
}

.philosophical-text em {
    color: #7fdbca;
    font-style: italic;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .tray-one-grid .feature-cell {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-one-grid .data-cell:nth-child(2),
    .tray-one-grid .data-cell:nth-child(3) {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray-one-grid .data-cell-live {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray-one-grid .void-cell {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray-one-grid .skeleton-cell {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-one-grid .data-cell:nth-child(7),
    .tray-one-grid .data-cell:nth-child(8) {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray-two-grid .narrative-cell {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-two-grid .data-cell-wide {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-two-grid .data-cell:nth-child(3),
    .tray-two-grid .skeleton-cell,
    .tray-two-grid .data-cell:nth-child(5),
    .tray-two-grid .void-cell {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray-two-grid .orb-display-cell {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-three-grid .data-cell:first-child {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-three-grid .skeleton-cell:nth-child(2),
    .tray-three-grid .skeleton-cell:nth-child(3) {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray-three-grid .orb-ghost-cell {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-three-grid .narrative-final {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .tray-three-grid .void-cell,
    .tray-three-grid .skeleton-cell:nth-child(7),
    .tray-three-grid .data-cell:last-child {
        grid-column: span 2;
        grid-row: auto;
    }

    .tray {
        padding: 24px 16px;
    }

    .feature-cell .cell-content {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
    }

    .display-headline {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
        letter-spacing: 0.15em;
    }
}