/* ============================================================
   aei.st — Surreal Corridor
   Split-screen dark-neon surrealist design
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0a0a14;
    --bg-secondary: #12041e;
    --neon-magenta: #ff00aa;
    --neon-mint: #00ffd5;
    --neon-violet: #8b5cf6;
    --text-primary: #e8e4f0;
    --text-muted: #9b8fb8;
    --surface: #161226;
    --font-body: 'Commissioner', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 350;
    font-size: 16px;
    letter-spacing: 0.01em;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Split Container --- */
.split-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    opacity: 0;
    animation: containerFadeIn 0.3s ease-out 0.2s forwards;
}

@keyframes containerFadeIn {
    to { opacity: 1; }
}

/* --- Left Panel: The Speaker --- */
.panel-left {
    flex: 0 0 45vw;
    overflow-y: auto;
    background: var(--bg-primary);
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: panelLeftFadeIn 0.6s ease-out 1.3s forwards;
}

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

/* Custom scrollbar */
.panel-left::-webkit-scrollbar {
    width: 4px;
}

.panel-left::-webkit-scrollbar-track {
    background: transparent;
}

.panel-left::-webkit-scrollbar-thumb {
    background: var(--neon-magenta);
    border-radius: 2px;
}

.panel-left {
    scrollbar-width: thin;
    scrollbar-color: var(--neon-magenta) transparent;
}

.left-content {
    padding: clamp(3rem, 6vh, 6rem) clamp(2rem, 4vw, 4rem);
    min-height: 100%;
}

/* --- Divider: The Luminous Border --- */
.divider {
    flex: 0 0 2px;
    background: var(--neon-magenta);
    position: relative;
    z-index: 3;
    opacity: 0;
    animation: dividerFadeIn 0.8s ease-out 0.5s forwards;
    box-shadow:
        0 0 12px rgba(255, 0, 170, 0.4),
        0 0 40px rgba(255, 0, 170, 0.15);
}

@keyframes dividerFadeIn {
    to { opacity: 1; }
}

@keyframes dividerPulse {
    0%, 100% {
        background: var(--neon-magenta);
        box-shadow:
            0 0 12px rgba(255, 0, 170, 0.4),
            0 0 40px rgba(255, 0, 170, 0.15);
    }
    50% {
        background: var(--neon-mint);
        box-shadow:
            0 0 12px rgba(0, 255, 213, 0.4),
            0 0 40px rgba(0, 255, 213, 0.15);
    }
}

.divider.active {
    animation: dividerFadeIn 0.8s ease-out 0.5s forwards, dividerPulse 8s ease-in-out 1.3s infinite;
}

/* --- Right Panel: The Stage --- */
.panel-right {
    flex: 1;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-secondary);
    z-index: 1;
    transition: background 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Right panel section states */
.panel-right.state-1 {
    background: var(--bg-secondary);
}

.panel-right.state-2 {
    background: var(--bg-primary);
}

.panel-right.state-3 {
    background: var(--bg-secondary);
}

.panel-right.state-4 {
    background: var(--bg-primary);
}

/* --- Pattern Overlay --- */
.pattern-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease, transform 2s ease;
}

/* Chevron pattern (default / state 1) */
.pattern-overlay.pattern-chevron {
    opacity: 1;
    background:
        repeating-linear-gradient(
            120deg,
            transparent,
            transparent 20px,
            rgba(255, 0, 170, 0.05) 20px,
            rgba(255, 0, 170, 0.05) 22px
        ),
        repeating-linear-gradient(
            60deg,
            transparent,
            transparent 20px,
            rgba(0, 255, 213, 0.04) 20px,
            rgba(0, 255, 213, 0.04) 22px
        );
}

/* Dot matrix pattern (state 2) */
.pattern-overlay.pattern-dots {
    opacity: 1;
    background:
        radial-gradient(circle, rgba(255, 0, 170, 0.06) 1px, transparent 1px),
        radial-gradient(circle, rgba(0, 255, 213, 0.04) 1px, transparent 1px);
    background-size: 24px 24px, 36px 36px;
    background-position: 0 0, 12px 12px;
}

/* Crosshatch pattern (state 3) */
.pattern-overlay.pattern-crosshatch {
    opacity: 1;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 14px,
            rgba(139, 92, 246, 0.05) 14px,
            rgba(139, 92, 246, 0.05) 16px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 14px,
            rgba(139, 92, 246, 0.04) 14px,
            rgba(139, 92, 246, 0.04) 16px
        );
}

/* Dense dots pattern (state 4) */
.pattern-overlay.pattern-dense {
    opacity: 1;
    background:
        radial-gradient(circle, rgba(255, 0, 170, 0.07) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(0, 255, 213, 0.05) 1px, transparent 1px),
        radial-gradient(circle, rgba(139, 92, 246, 0.04) 0.5px, transparent 0.5px);
    background-size: 18px 18px, 30px 30px, 12px 12px;
    background-position: 0 0, 9px 9px, 4px 4px;
}

/* --- Floating Shapes --- */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.shape {
    position: absolute;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.shape.visible {
    opacity: 1;
}

/* Circles */
.circle {
    border-radius: 50%;
    border: 2px solid var(--neon-magenta);
    background: transparent;
}

.circle-1 {
    width: 160px;
    height: 160px;
    top: 12%;
    right: 18%;
    animation: orbit1 28s linear infinite;
    transition: opacity 0.8s ease, animation-duration 0.5s ease;
}

.circle-2 {
    width: 80px;
    height: 80px;
    top: 55%;
    left: 15%;
    border-color: var(--neon-mint);
    animation: orbit2 22s linear infinite;
}

.circle-3 {
    width: 40px;
    height: 40px;
    top: 35%;
    right: 40%;
    border-color: var(--neon-violet);
    animation: orbit3 35s linear infinite;
}

/* Rectangles */
.rect {
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.15);
}

.rect-1 {
    width: 120px;
    height: 60px;
    top: 72%;
    right: 25%;
    animation: drift1 18s ease-in-out infinite;
}

.rect-2 {
    width: 60px;
    height: 90px;
    top: 20%;
    left: 10%;
    animation: drift2 24s ease-in-out infinite;
}

/* Triangle */
.triangle {
    width: 0;
    height: 0;
    border-left: 80px solid transparent;
    border-right: 80px solid transparent;
    border-bottom: 140px solid rgba(139, 92, 246, 0.15);
    bottom: 8%;
    right: 8%;
    animation: triangleRotate 60s linear infinite;
    transform-origin: center center;
    opacity: 0 !important;
    transition: opacity 1.2s ease !important;
}

.triangle.visible {
    opacity: 1 !important;
}

/* Shape animations */
@keyframes orbit1 {
    from { transform: rotate(0deg) translateX(15px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(15px) rotate(-360deg); }
}

@keyframes orbit2 {
    from { transform: rotate(0deg) translateX(10px) rotate(0deg); }
    to { transform: rotate(-360deg) translateX(10px) rotate(360deg); }
}

@keyframes orbit3 {
    from { transform: rotate(0deg) translateX(8px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(8px) rotate(-360deg); }
}

@keyframes drift1 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes drift2 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(15px); }
}

@keyframes triangleRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Accelerated shapes (state 4) */
.panel-right.state-4 .circle-1 { animation-duration: 16.8s; }
.panel-right.state-4 .circle-2 { animation-duration: 13.2s; }
.panel-right.state-4 .circle-3 { animation-duration: 21s; }
.panel-right.state-4 .rect-1 { animation-duration: 10.8s; }
.panel-right.state-4 .rect-2 { animation-duration: 14.4s; }

/* --- SVG Strokes --- */
.svg-strokes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.3;
    transition: opacity 1.2s ease;
}

.svg-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

.svg-line.drawn {
    stroke-dashoffset: 0;
}

/* State-based SVG coloring */
.panel-right.state-3 .svg-line-1 { stroke: var(--neon-violet); }
.panel-right.state-3 .svg-line-3 { stroke: var(--neon-violet); }

/* --- Typewriter --- */
.typewriter-container {
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    z-index: 4;
    max-width: 70%;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--neon-mint);
    white-space: nowrap;
    overflow: hidden;
}

.typewriter-text {
    display: inline;
}

.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--neon-magenta);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blinkCaret 0.6s step-end infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typewriter-cursor.active {
    opacity: 1;
}

@keyframes blinkCaret {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Typography --- */
.site-title {
    font-family: var(--font-body);
    font-weight: 800;
    font-size: clamp(2.5rem, 5.5vw, 5rem);
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.3em;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.6s ease-out 1.3s forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subtitle {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85em;
    color: var(--neon-mint);
    letter-spacing: 0.08em;
    margin-bottom: 3em;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 1.6s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.section-heading {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--text-primary);
    margin-bottom: 1.2em;
    letter-spacing: -0.01em;
}

.section-body p {
    margin-bottom: 1.4em;
    color: var(--text-primary);
    font-weight: 350;
}

.caption {
    font-family: var(--font-body);
    font-weight: 200;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-size: 0.9em;
    font-style: italic;
}

/* Neon highlighted text */
.neon-highlight {
    color: var(--neon-magenta);
    text-shadow: 0 0 8px rgba(255, 0, 170, 0.27);
}

/* Link styling */
.left-content a {
    color: var(--text-primary);
    text-decoration: none;
    background-image: linear-gradient(var(--neon-mint), var(--neon-mint));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s ease;
    padding-bottom: 2px;
}

.left-content a:hover {
    background-size: 100% 2px;
}

/* --- Content Sections --- */
.content-section {
    padding-bottom: clamp(3rem, 6vh, 6rem);
    margin-bottom: clamp(2rem, 4vh, 4rem);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.content-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* First section gets the load animation */
#section1 {
    opacity: 0;
    animation: sectionFadeIn 0.6s ease-out 1.3s forwards;
}

@keyframes sectionFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Footer --- */
.left-footer {
    padding-top: clamp(2rem, 4vh, 4rem);
    padding-bottom: clamp(3rem, 6vh, 6rem);
    border-top: 1px solid rgba(155, 143, 184, 0.15);
}

.footer-text {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-primary);
    margin-bottom: 0.5em;
}

.footer-meta {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75em;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

/* ============================================================
   RESPONSIVE: Tablet (below 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .split-container {
        flex-direction: column;
    }

    .panel-left {
        flex: 0 0 auto;
        min-height: 30vh;
        overflow-y: auto;
    }

    .divider {
        flex: 0 0 2px;
        width: 100%;
        height: 2px;
    }

    .panel-right {
        flex: 1;
        position: relative;
        height: auto;
        min-height: 70vh;
    }

    .typewriter-container {
        right: 5%;
        max-width: 90%;
        font-size: 0.8em;
    }
}

/* ============================================================
   RESPONSIVE: Mobile (below 640px)
   ============================================================ */
@media (max-width: 640px) {
    html, body {
        overflow: auto;
        height: auto;
    }

    .split-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .panel-left {
        flex: none;
        overflow: visible;
    }

    .left-content {
        padding: 2rem 1.5rem;
    }

    .divider {
        display: none;
    }

    .panel-right {
        flex: none;
        position: relative;
        height: 60vh;
        min-height: 60vh;
    }

    /* Alternating backgrounds for dual-voice effect */
    #section1 { background: var(--bg-primary); }
    #section2 { background: var(--bg-secondary); }
    #section3 { background: var(--bg-primary); }
    #section4 { background: var(--bg-secondary); }

    .content-section {
        padding: 2rem 1.5rem;
        margin-bottom: 0;
    }

    .site-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .typewriter-container {
        right: 5%;
        left: 5%;
        max-width: 90%;
        font-size: 0.75em;
        white-space: normal;
    }

    .circle-1 { width: 100px; height: 100px; }
    .circle-2 { width: 50px; height: 50px; }
    .triangle {
        border-left-width: 50px;
        border-right-width: 50px;
        border-bottom-width: 87px;
    }
}
