/* ============================================
   GGOGGL.com — Cyberpunk Oracle Stylesheet
   Bento-Grid / Dopamine-Neon / Blur-Focus
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --void: #0a0a0f;
    --surface: #12121e;
    --border: #1a1a2e;
    --magenta: #ff2d95;
    --cyan: #00f0ff;
    --violet: #b400ff;
    --green: #00ff88;
    --text: #c8c8e0;
    --muted: #a0a0b0;
    --white: #ffffff;
    --neon-magenta: #ff00ff;
    --ticker-muted: #555577;

    --gap: 4px;
    --cell-pad: 24px;
    --cell-border: 1px solid var(--border);

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--magenta) var(--void);
}

body {
    background: var(--void);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    font-weight: 400;
    cursor: none;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Custom Cursor --- */
#crosshair-cursor {
    position: fixed;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#crosshair-cursor::before,
#crosshair-cursor::after {
    content: '';
    position: absolute;
    background: var(--cyan);
}

#crosshair-cursor::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    transform: translateY(-50%);
}

#crosshair-cursor::after {
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    transform: translateX(-50%);
}

body:hover #crosshair-cursor {
    opacity: 1;
}

/* --- Aurora Background --- */
#aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    animation: auroraFadeIn 1.4s ease-out 0.6s forwards;
}

#aurora-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, var(--magenta) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, var(--cyan) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 80%, var(--violet) 0%, transparent 60%);
    opacity: 0.12;
    animation: auroraShift 20s ease-in-out infinite;
}

#aurora-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 80% 20%, var(--green) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, var(--neon-magenta) 0%, transparent 50%);
    opacity: 0.06;
    animation: auroraShift2 25s ease-in-out infinite;
}

@keyframes auroraFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes auroraShift {
    0%, 100% {
        background-position: 20% 30%, 70% 60%, 50% 80%;
        transform: scale(1);
    }
    33% {
        background-position: 30% 20%, 60% 70%, 40% 90%;
        transform: scale(1.05);
    }
    66% {
        background-position: 15% 40%, 80% 50%, 60% 75%;
        transform: scale(0.98);
    }
}

@keyframes auroraShift2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(5%, -3%) scale(1.08);
    }
}

/* --- Scan Lines Overlay --- */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(255, 255, 255, 0.03) 2px,
        rgba(255, 255, 255, 0.03) 3px
    );
}

/* --- Bento Section --- */
.bento-section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    z-index: 1;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

.bento-section.blurred {
    filter: blur(4px);
    opacity: 0.6;
}

.bento-section.focusing {
    animation: sectionFocusIn 0.4s ease-out forwards;
}

@keyframes sectionFocusIn {
    from {
        filter: blur(8px);
        opacity: 0.7;
    }
    to {
        filter: blur(0px);
        opacity: 1;
    }
}

/* --- Initial Load Blur --- */
body.loading .bento-section:first-of-type {
    filter: blur(20px);
}

body.loaded .bento-section:first-of-type {
    animation: heroBootSequence 0.8s ease-out 0.6s forwards;
    filter: blur(20px);
}

body.boot-complete .bento-section:first-of-type {
    filter: blur(0px);
}

@keyframes heroBootSequence {
    from { filter: blur(20px); }
    to { filter: blur(0px); }
}

/* --- Bento Grid: Shared --- */
.bento-grid {
    display: grid;
    gap: var(--gap);
    width: 100%;
    height: 100vh;
    padding: var(--gap);
    position: relative;
}

/* --- Hero Grid: 6 col x 4 row --- */
.hero-grid {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.cell-a {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
}

.cell-b {
    grid-column: 4 / 7;
    grid-row: 1 / 4;
}

.cell-c {
    grid-column: 1 / 3;
    grid-row: 3 / 5;
}

.cell-d {
    grid-column: 3 / 4;
    grid-row: 3 / 4;
}

.cell-e {
    grid-column: 4 / 7;
    grid-row: 4 / 5;
}

/* --- Archive Grid: 2x2 --- */
.archive-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* --- Signal Grid: 1-wide rail + 5-wide main --- */
.signal-grid {
    grid-template-columns: 1fr 5fr;
    grid-template-rows: 1fr;
}

/* --- Noise Grid: 3x2 --- */
.noise-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
}

/* --- Resolution Grid: single cell --- */
.resolution-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

/* --- Bento Cell --- */
.bento-cell {
    background: var(--void);
    border: var(--cell-border);
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bento-cell:hover {
    border-color: var(--magenta);
    box-shadow: 0 0 20px rgba(255, 45, 149, 0.15);
}

.cell-content {
    padding: var(--cell-pad);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Grid Gap Glow --- */
.bento-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: var(--neon-magenta);
    opacity: 0.08;
}

/* --- Grid Dots --- */
.grid-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Grid dots are rendered via JS for precision */

/* --- Logotype --- */
.logotype {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(56px, 8vw, 96px);
    letter-spacing: 0.04em;
    line-height: 1;
    animation: logotypeColorCycle 8s ease-in-out infinite;
}

@keyframes logotypeColorCycle {
    0%, 100% { color: var(--magenta); }
    50% { color: var(--cyan); }
}

/* Logotype snaps in after hero boot */
body.loaded #logotype-hero {
    opacity: 0;
    animation: logotypeSnapIn 0.2s ease-out 1.6s forwards, logotypeColorCycle 8s ease-in-out 1.8s infinite;
}

@keyframes logotypeSnapIn {
    from { opacity: 0; filter: blur(10px); }
    to { opacity: 1; filter: blur(0px); }
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--muted);
    margin-top: 16px;
    letter-spacing: 0.05em;
}

.mono {
    font-family: var(--font-mono);
}

/* --- Collage Panels --- */
.collage-panel {
    background: var(--void);
}

.collage-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.collage-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    mix-blend-mode: screen;
}

.collage-layer-1 { z-index: 1; }
.collage-layer-2 { z-index: 2; mix-blend-mode: color-dodge; }
.collage-layer-3 { z-index: 3; mix-blend-mode: multiply; }

.collage-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Ken Burns drift on hero collage */
.cell-b .collage-container {
    animation: kenBurnsDrift 30s ease-in-out infinite;
}

@keyframes kenBurnsDrift {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.08); }
}

/* Collage hover effects */
.collage-panel:hover .collage-container {
    transform: scale(1.02);
    transition: transform 0.6s ease;
}

.collage-panel:hover .scanline-overlay {
    opacity: 0.12;
}

.scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(255, 255, 255, 0.05) 2px,
        rgba(255, 255, 255, 0.05) 3px
    );
    pointer-events: none;
    opacity: 0.05;
    transition: opacity 0.3s ease;
    z-index: 10;
}

/* --- Terminal Panels --- */
.terminal-panel {
    background: var(--void);
}

.terminal-lines {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
    color: var(--green);
}

.terminal-line {
    opacity: 0;
    white-space: nowrap;
    overflow: hidden;
    color: var(--green);
}

.terminal-line.typed {
    opacity: 1;
    animation: typewriterReveal 0.4s steps(40) forwards;
}

@keyframes typewriterReveal {
    from { max-width: 0; }
    to { max-width: 100%; }
}

.terminal-line.alert {
    color: var(--magenta);
}

/* --- Glowing Orb (Cell D) --- */
.orb-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb {
    width: 80%;
    aspect-ratio: 1;
    max-width: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--magenta) 0%, rgba(255, 45, 149, 0.4) 30%, transparent 70%);
    animation: orbPulse 2s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(255, 45, 149, 0.3), 0 0 80px rgba(255, 45, 149, 0.1);
}

@keyframes orbPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 40px rgba(255, 45, 149, 0.3), 0 0 80px rgba(255, 45, 149, 0.1);
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
        box-shadow: 0 0 60px rgba(255, 45, 149, 0.5), 0 0 120px rgba(255, 45, 149, 0.2);
    }
}

/* --- Marquee Ticker (Cell E) --- */
.marquee-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.marquee-track {
    display: flex;
    white-space: nowrap;
    animation: marqueeScroll 30s linear infinite;
}

.marquee-content {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ticker-muted);
    letter-spacing: 0.05em;
    padding: 0 4px;
    flex-shrink: 0;
}

@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* --- Section Titles --- */
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    color: var(--magenta);
    margin-bottom: 24px;
    line-height: 1.15;
}

.cell-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 36px);
    color: var(--white);
    margin-bottom: 16px;
}

/* --- Body Text --- */
.body-text {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 16px;
    font-weight: 400;
}

.muted-text {
    color: var(--muted);
    font-size: 14px;
}

/* --- Signal Section --- */
.signal-rail {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vertical-label {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(24px, 3vw, 48px);
    color: var(--violet);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.15em;
    opacity: 0.6;
}

.signal-rail .cell-content {
    align-items: center;
    position: relative;
}

.signal-rail .data-rain-cell {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.proclamation {
    margin-bottom: 32px;
    padding-left: 16px;
    border-left: 2px solid var(--violet);
}

.proclamation-prefix {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--cyan);
    display: block;
    margin-bottom: 8px;
    letter-spacing: 0.08em;
}

.proclamation-text {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
}

.signal-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* --- Noise Section --- */
.noise-cell {
    background: var(--void);
    position: relative;
}

.noise-orb {
    position: absolute;
    bottom: 20%;
    right: 20%;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--cyan) 0%, rgba(0, 240, 255, 0.3) 30%, transparent 70%);
    animation: orbPulse 3s ease-in-out infinite;
    opacity: 0.5;
}

/* Data Rain cells */
.data-rain-cell {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--green);
    opacity: 0.15;
}

/* --- Resolution Section --- */
.resolution-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
}

.resolution-content {
    text-align: center;
    position: relative;
}

.logotype-final {
    color: var(--white);
    font-size: clamp(60px, 10vw, 120px);
    z-index: 2;
    position: relative;
    animation: none;
}

.resolution-aurora-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 45, 149, 0.15) 0%,
        rgba(180, 0, 255, 0.1) 30%,
        rgba(0, 240, 255, 0.05) 60%,
        transparent 80%
    );
    animation: resolutionGlow 6s ease-in-out infinite;
    z-index: 1;
}

@keyframes resolutionGlow {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
}

/* Resolution section reverse blur: starts sharp, blurs on scroll */
#section-resolution.reverse-blur {
    transition: filter 1.5s ease-out;
}

/* --- Glitch Effect --- */
@keyframes glitchFlicker {
    0% {
        transform: translate(0, 0);
        text-shadow: none;
        opacity: 1;
    }
    25% {
        transform: translate(2px, 0);
        text-shadow: -2px 0 var(--cyan), 2px 0 var(--magenta);
        opacity: 0.9;
    }
    50% {
        transform: translate(-2px, 0);
        text-shadow: 2px 0 var(--cyan), -2px 0 var(--magenta);
        opacity: 1;
    }
    75% {
        transform: translate(1px, 0);
        text-shadow: -1px 0 var(--magenta), 1px 0 var(--cyan);
        opacity: 0.95;
    }
    100% {
        transform: translate(0, 0);
        text-shadow: none;
        opacity: 1;
    }
}

.bento-cell.glitching {
    animation: glitchFlicker 0.15s linear;
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
        min-height: 100vh;
    }

    .cell-a {
        grid-column: 1;
        grid-row: auto;
        min-height: 30vh;
    }

    .cell-b {
        grid-column: 1;
        grid-row: auto;
        min-height: 35vh;
    }

    .cell-c {
        grid-column: 1;
        grid-row: auto;
        min-height: 25vh;
    }

    .cell-d {
        grid-column: 1;
        grid-row: auto;
        min-height: 15vh;
    }

    .cell-e {
        grid-column: 1;
        grid-row: auto;
        min-height: 8vh;
    }

    .archive-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
        min-height: 100vh;
    }

    .archive-grid .bento-cell {
        min-height: 40vh;
    }

    .signal-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: 100vh;
    }

    .signal-rail {
        min-height: 10vh;
    }

    .signal-rail .vertical-label {
        writing-mode: horizontal-tb;
    }

    .noise-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(3, 1fr);
        height: auto;
        min-height: 100vh;
    }

    .logotype {
        font-size: clamp(40px, 12vw, 72px);
    }

    .logotype-final {
        font-size: clamp(48px, 14vw, 96px);
    }

    .resolution-aurora-glow {
        width: 250px;
        height: 250px;
    }
}

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

    .noise-cell {
        min-height: 30vh;
    }

    .bento-grid {
        padding: 2px;
        gap: 2px;
    }

    .cell-content {
        padding: 16px;
    }

    .proclamation {
        margin-bottom: 24px;
    }
}

/* --- Selection Color --- */
::selection {
    background: var(--magenta);
    color: var(--void);
}

::-moz-selection {
    background: var(--magenta);
    color: var(--void);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--void);
}

::-webkit-scrollbar-thumb {
    background: var(--magenta);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cyan);
}
