/* =============================================
   SIM-AI.NET — Pop-Art Comic Timeline
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --aurora-mint: #00E5A0;
    --neural-violet: #7B2FFF;
    --pulse-magenta: #FF2D87;
    --signal-gold: #FFD600;
    --ink-black: #0a0a0a;
    --newsprint: #FAFAF5;
    --halftone-gray: #B8B8C8;
    --void-indigo: #12102E;
    --text-dark: #2A2A3E;

    --aurora-gradient: linear-gradient(135deg, #00E5A0 0%, #7B2FFF 35%, #FF2D87 65%, #FFD600 100%);
    --aurora-angle: 135deg;

    --dot-size: 3px;
    --dot-color: var(--halftone-gray);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 400;
    color: var(--text-dark);
    background-color: var(--newsprint);
    overflow-x: hidden;
    line-height: 1.7;
}

/* --- Grain Overlay --- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    mix-blend-mode: overlay;
    transform: translateZ(0);
}

.grain-overlay svg {
    width: 100%;
    height: 100%;
}

/* --- Ben-Day Dot Overlays --- */
.ben-day-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.ben-day-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--neural-violet) 4px, transparent 4px);
    background-size: 16px 16px;
    opacity: 0.15;
    mix-blend-mode: multiply;
}

.ben-day-small::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--halftone-gray) 1.5px, transparent 1.5px);
    background-size: 8px 8px;
    opacity: 0.3;
    mix-blend-mode: multiply;
}

.ben-day-splash::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--pulse-magenta) 4px, transparent 4px);
    background-size: 16px 16px;
    opacity: 0.12;
    mix-blend-mode: multiply;
}

/* --- Issue Number Badge --- */
.issue-badge {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--newsprint);
    border: 3px solid var(--pulse-magenta);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 3px 3px 0 var(--ink-black);
    transition: transform 0.3s ease;
}

.issue-badge:hover {
    transform: scale(1.1);
}

.issue-number {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.2rem;
    color: var(--ink-black);
}

.radial-menu {
    position: absolute;
    top: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.radial-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.radial-item {
    display: block;
    padding: 8px 16px;
    background: var(--void-indigo);
    color: var(--signal-gold);
    font-family: 'Righteous', cursive;
    font-size: 0.8rem;
    text-decoration: none;
    border: 2px solid var(--ink-black);
    white-space: nowrap;
    letter-spacing: 0.04em;
    transition: background-color 0.2s ease;
}

.radial-item:hover {
    background: var(--neural-violet);
}

/* --- Onomatopoeia Background Text --- */
.onomatopoeia {
    position: fixed;
    font-family: 'Dela Gothic One', cursive;
    text-transform: uppercase;
    color: var(--ink-black);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.6s ease;
}

.onomatopoeia.visible {
    opacity: 0.04;
}

.onomatopoeia-think {
    font-size: clamp(120px, 20vw, 280px);
    top: 15%;
    left: -5%;
    transform: rotate(-12deg);
}

.onomatopoeia-compute {
    font-size: clamp(100px, 18vw, 240px);
    top: 45%;
    right: -8%;
    transform: rotate(8deg);
}

.onomatopoeia-simulate {
    font-size: clamp(100px, 16vw, 220px);
    bottom: 10%;
    left: 5%;
    transform: rotate(-5deg);
}

/* --- HERO PANEL --- */
.hero-panel {
    position: relative;
    width: 100%;
    height: 100vh;
    background: var(--void-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 4px solid var(--ink-black);
}

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

.action-lines {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

.action-lines-group line {
    stroke: var(--pulse-magenta);
    stroke-width: 2;
    opacity: 0.25;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: drawLine 2s ease-out forwards;
}

.action-lines-group line:nth-child(2n) {
    stroke: var(--neural-violet);
    animation-delay: 0.1s;
}

.action-lines-group line:nth-child(3n) {
    stroke: var(--aurora-mint);
    animation-delay: 0.2s;
}

.action-lines-group line:nth-child(4n) {
    stroke: var(--signal-gold);
    animation-delay: 0.15s;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(5rem, 15vw, 14rem);
    text-transform: uppercase;
    background: var(--aurora-gradient);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: auroraShimmer 12s ease infinite;
    position: relative;
    z-index: 2;
    line-height: 1;
}

@keyframes auroraShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-bubble {
    position: relative;
    margin-top: 2rem;
    opacity: 0;
    animation: fadeInBubble 0.8s ease 1.5s forwards;
}

@keyframes fadeInBubble {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Speech Bubbles --- */
.speech-bubble {
    position: relative;
    background: var(--newsprint);
    border: 3px solid var(--ink-black);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    box-shadow: 4px 4px 0px var(--ink-black);
    max-width: 520px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.speech-bubble:hover {
    transform: scale(1.03);
    box-shadow: 6px 6px 0px var(--ink-black);
}

.speech-bubble h2 {
    font-family: 'Righteous', cursive;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    color: var(--ink-black);
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.speech-bubble p {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.7;
    color: var(--text-dark);
}

.hero-bubble {
    display: inline-block;
}

.hero-bubble p {
    font-family: 'Righteous', cursive;
    font-size: clamp(1rem, 2.2vw, 1.6rem);
    letter-spacing: 0.04em;
    color: var(--text-dark);
}

.bubble-tail,
.bubble-tail-left,
.bubble-tail-right {
    position: absolute;
}

.bubble-tail {
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
}

.bubble-tail-left {
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
}

.bubble-tail-right {
    right: -28px;
    top: 50%;
    transform: translateY(-50%);
}

/* --- Timeline Spine --- */
.timeline-spine {
    position: fixed;
    left: 33%;
    top: 0;
    width: 6px;
    height: 100vh;
    background: var(--halftone-gray);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: 3px;
    overflow: hidden;
}

.timeline-spine.visible {
    opacity: 1;
}

.spine-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(
        var(--aurora-angle),
        var(--aurora-mint) 0%,
        var(--neural-violet) 35%,
        var(--pulse-magenta) 65%,
        var(--signal-gold) 100%
    );
    background-size: 300% 300%;
    animation: auroraShimmer 12s ease infinite;
    transition: height 0.1s linear;
    border-radius: 3px;
}

/* --- Timeline Nodes --- */
.timeline-node {
    position: absolute;
    left: 33%;
    transform: translateX(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--signal-gold);
    border: 3px solid var(--ink-black);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    box-shadow: 3px 3px 0 var(--ink-black);
    top: 20px;
}

.timeline-node span {
    font-family: 'Righteous', cursive;
    font-size: 0.7rem;
    color: var(--ink-black);
    letter-spacing: 0.02em;
}

/* --- Panel Base Styles --- */
.panel {
    position: relative;
    width: 100%;
    border-bottom: 4px solid var(--ink-black);
}

/* --- Dialogue Panels --- */
.dialogue-panel {
    display: grid;
    grid-template-columns: 33% 1fr;
    min-height: 80vh;
    padding: 4rem 2rem;
    background: var(--newsprint);
    position: relative;
}

.dialogue-panel .panel-card {
    grid-column: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    perspective: 1200px;
    position: relative;
}

.dialogue-reverse .panel-card {
    grid-template-columns: 1fr 1fr;
}

/* --- Card Flip --- */
.panel-card,
.montage-card {
    position: relative;
}

.card-front,
.card-back {
    backface-visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink-black);
    border: 4px solid var(--ink-black);
    z-index: 5;
    overflow: hidden;
}

.card-teaser {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    color: var(--signal-gold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    z-index: 2;
    position: relative;
    text-align: center;
    padding: 1rem;
}

.card-back {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    min-height: 400px;
    align-items: center;
}

.dialogue-reverse .card-back {
    direction: rtl;
}

.dialogue-reverse .card-back > * {
    direction: ltr;
}

[data-flipped="true"] .card-front {
    transform: perspective(1200px) rotateY(180deg);
    pointer-events: none;
}

[data-flipped="true"] .card-back {
    opacity: 1;
}

[data-flipped="false"] .card-back {
    opacity: 0;
}

/* --- Dialogue Visual --- */
.dialogue-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.dialogue-visual svg {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.dialogue-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* --- Warhol Grid --- */
.warhol-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 280px;
}

.warhol-cell {
    border: 3px solid var(--ink-black);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.warhol-cell svg {
    width: 100%;
    height: 100%;
}

.warhol-cell-1 { background: linear-gradient(135deg, #00E5A0 0%, #7B2FFF 100%); }
.warhol-cell-2 { background: linear-gradient(135deg, #FF2D87 0%, #FFD600 100%); }
.warhol-cell-3 { background: linear-gradient(135deg, #7B2FFF 0%, #FF2D87 100%); }
.warhol-cell-4 { background: linear-gradient(135deg, #FFD600 0%, #00E5A0 100%); }

/* --- Splash Panels --- */
.splash-panel {
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void-indigo);
    transform: rotate(0.5deg);
    overflow: visible;
    position: relative;
}

.splash-panel-2 {
    transform: rotate(-0.5deg);
}

.splash-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.splash-text {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(2rem, 5vw, 4.5rem);
    text-transform: uppercase;
    background: var(--aurora-gradient);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: auroraShimmer 12s ease infinite;
    line-height: 1.2;
    max-width: 900px;
}

.onomatopoeia-inline {
    position: absolute;
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(80px, 14vw, 200px);
    color: var(--signal-gold);
    opacity: 0;
    z-index: 1;
    text-transform: uppercase;
    pointer-events: none;
    bottom: 10%;
    right: 5%;
    transform: rotate(8deg);
}

.onomatopoeia-inline.pop {
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: rotate(8deg) scale(0);
    }
    100% {
        opacity: 0.15;
        transform: rotate(8deg) scale(1);
    }
}

/* --- Montage Panel --- */
.montage-panel {
    display: grid;
    grid-template-columns: 33% 1fr;
    padding: 4rem 2rem 4rem;
    min-height: 70vh;
    background: var(--newsprint);
    position: relative;
    align-items: start;
}

.montage-strip {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.montage-card {
    aspect-ratio: 1;
    border: 4px solid var(--ink-black);
    background: var(--newsprint);
    perspective: 1200px;
    position: relative;
    overflow: hidden;
}

.montage-card .card-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.montage-card .card-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.montage-card[data-flipped="true"] .card-front {
    transform: perspective(1200px) rotateY(180deg);
    pointer-events: none;
}

.montage-card[data-flipped="true"] .card-back {
    opacity: 1;
}

.montage-card[data-flipped="false"] .card-back {
    opacity: 0;
}

.montage-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    width: 100%;
    height: 100%;
}

.montage-item svg {
    width: 80%;
    max-width: 150px;
    height: auto;
}

.montage-label {
    font-family: 'Righteous', cursive;
    font-size: 0.9rem;
    color: var(--ink-black);
    letter-spacing: 0.04em;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

.montage-bubble {
    grid-column: 2;
    margin-top: 2rem;
    justify-self: start;
    max-width: 600px;
}

/* --- Interactive Dot Density --- */
.dialogue-panel:hover .ben-day-small::before,
.montage-card:hover .ben-day-small::before {
    background-image: radial-gradient(circle, var(--pulse-magenta) 2px, transparent 2px);
    background-size: 6px 6px;
    opacity: 0.4;
    transition: all 0.4s ease;
}

/* --- Rotated Panels --- */
.dialogue-panel:nth-of-type(odd) {
    transform: rotate(0deg);
}

.dialogue-panel:nth-of-type(even) {
    transform: rotate(0deg);
}

/* Some panels offset-rotated like zine clippings */
#epoch-room {
    transform: rotate(0.3deg);
}

#epoch-deep {
    transform: rotate(-0.2deg);
}

/* --- Footer Panel --- */
.footer-panel {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void-indigo);
    position: relative;
    overflow: hidden;
}

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

.footer-title {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(2rem, 6vw, 5rem);
    color: var(--signal-gold);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.footer-tagline {
    font-family: 'Righteous', cursive;
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    color: var(--newsprint);
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
}

.footer-domain {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: var(--halftone-gray);
    letter-spacing: 0.1em;
}

.footer-panel .onomatopoeia-inline {
    font-size: clamp(60px, 12vw, 180px);
    bottom: 15%;
    left: 5%;
    right: auto;
    transform: rotate(-10deg);
}

/* --- Halftone Gradient Transitions (between panels) --- */
.dialogue-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-image: radial-gradient(circle, var(--ink-black) 1px, transparent 1px);
    background-size: 6px 6px;
    opacity: 0.08;
    pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .dialogue-panel {
        grid-template-columns: 1fr;
        padding: 3rem 1rem;
    }

    .dialogue-panel .panel-card {
        grid-column: 1;
        grid-template-columns: 1fr;
    }

    .card-back {
        grid-template-columns: 1fr;
    }

    .montage-panel {
        grid-template-columns: 1fr;
    }

    .montage-strip {
        grid-column: 1;
        grid-template-columns: repeat(2, 1fr);
    }

    .montage-bubble {
        grid-column: 1;
    }

    .timeline-spine {
        left: 16px;
    }

    .timeline-node {
        left: 16px;
    }

    .issue-badge {
        width: 44px;
        height: 44px;
        top: 16px;
        right: 16px;
    }

    .issue-number {
        font-size: 0.9rem;
    }

    .warhol-grid {
        max-width: 200px;
    }
}

@media (max-width: 600px) {
    .montage-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-title {
        font-size: clamp(3rem, 18vw, 8rem);
    }

    .speech-bubble {
        padding: 1rem 1.2rem;
    }

    .splash-panel {
        height: 50vh;
    }
}

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