/* simidiots.net — Scandinavian clarity corrupted by digital dementia */
/* Palette: Frost White #f4f2ef, Deep Fjord #1c2a38, Glacier Blue #a8c5d6,
   Bubble Rose #d4a0b0, Glitch Violet #7b5ea7, Birch Warm #e2d5c3, Signal Red #c44f4f */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    background-color: #f4f2ef;
    color: #1c2a38;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==================== SCAN LINES ==================== */
.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        to bottom,
        rgba(28, 42, 56, 0.03) 0px,
        rgba(28, 42, 56, 0.03) 1px,
        transparent 1px,
        transparent 4px
    );
}

.scan-lines.enhanced {
    background: repeating-linear-gradient(
        to bottom,
        rgba(28, 42, 56, 0.06) 0px,
        rgba(28, 42, 56, 0.06) 1px,
        transparent 1px,
        transparent 4px
    );
}

/* ==================== BUBBLES ==================== */
#bubble-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.bubble {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    left: var(--start-x);
    bottom: calc(-1 * var(--size));
    background:
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.6), transparent 50%),
        radial-gradient(circle at 30% 30%, rgba(212, 160, 176, 0.3), rgba(168, 197, 214, 0.2) 40%, rgba(123, 94, 167, 0.15) 70%, transparent 100%);
    border: 1px solid rgba(168, 197, 214, 0.15);
    animation: bubble-rise var(--duration) ease-in-out var(--delay) infinite;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes bubble-rise {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    5% {
        opacity: 0.7;
    }
    50% {
        transform: translateY(-50vh) translateX(var(--drift));
        opacity: 0.6;
    }
    90% {
        opacity: 0.5;
    }
    95% {
        transform: translateY(-105vh) translateX(calc(var(--drift) * -0.5));
        opacity: 0.3;
    }
    97% {
        transform: translateY(-108vh) translateX(calc(var(--drift) * -0.5)) scale(1.2);
        opacity: 0;
    }
    100% {
        transform: translateY(-110vh) translateX(0);
        opacity: 0;
    }
}

/* ==================== BREATHING CIRCLE ==================== */
.breathing-circle {
    position: fixed;
    bottom: 48px;
    right: 48px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(168, 197, 214, 0.4);
    z-index: 100;
    animation: breathe 4s ease-in-out infinite;
    cursor: default;
}

.breathing-circle:hover .breathing-tooltip {
    opacity: 1;
    transform: translateX(-100%) translateY(-50%) translateX(-12px);
}

.breathing-tooltip {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateX(-100%) translateY(-50%) translateX(-12px);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(28, 42, 56, 0.5);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.6);
        opacity: 0.7;
    }
}

/* ==================== ZONES ==================== */
.zone {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    padding: 96px 48px;
}

/* ==================== ZONE 1 — ARRIVAL ==================== */
.zone-1 {
    justify-content: flex-start;
    align-items: flex-start;
    padding-top: 20vh;
    padding-left: 10vw;
}

.zone-1-content {
    position: relative;
    transform: translateY(4px);
}

.domain-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #1c2a38;
    margin-bottom: 24px;
    opacity: 0;
    animation: fade-in 2s ease-out 0.5s forwards;
}

.domain-subtitle {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 1.1rem;
    color: rgba(28, 42, 56, 0.7);
    opacity: 0;
    animation: fade-in 2s ease-out 1.5s forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glitch effect for domain title letters */
.glitch-letter {
    display: inline-block;
    position: relative;
    transition: text-shadow 0.15s ease;
}

.glitch-letter.glitching {
    text-shadow:
        2px 0 0 rgba(196, 79, 79, 0.4),
        -2px 0 0 rgba(168, 197, 214, 0.4);
}

/* ==================== ZONE 2 — SIMULATION ==================== */
.zone-2 {
    justify-content: flex-end;
    align-items: flex-start;
    padding-right: 8vw;
    padding-top: 15vh;
}

.simulation-cards {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 320px;
}

/* Frosted Glass Cards */
.frost-card {
    background: rgba(244, 242, 239, 0.55);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(168, 197, 214, 0.2);
    border-radius: 12px;
    padding: 32px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 8px 32px rgba(28, 42, 56, 0.06);
    position: relative;
    transform: translateY(4px);
}

.card-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.75;
    color: #1c2a38;
}

/* Zoom Focus Animation */
.zoom-focus {
    opacity: 0.3;
    transform: scale(0.85);
    filter: blur(4px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, filter 0.6s ease-out;
}

.zoom-focus.in-view {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* ==================== ZONE 3 — BREATH ==================== */
.zone-3 {
    justify-content: center;
    align-items: center;
    background-color: #f4f2ef;
    transition: background-color 0.8s ease;
}

.zone-3.active-bg {
    background-color: #e2d5c3;
}

.breath-content {
    text-align: center;
}

.pause-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 3vw, 2rem);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #1c2a38;
}

.pause-letter {
    display: inline-block;
    transition: transform 0.2s ease;
    position: relative;
}

.pause-letter.displaced {
    animation: letter-displace 0.2s ease forwards;
}

@keyframes letter-displace {
    0% { transform: translate(0, 0); }
    30% { transform: translate(var(--dx), var(--dy)); }
    100% { transform: translate(0, 0); }
}

/* ==================== ZONE 4 — THE IDIOT ==================== */
.zone-4 {
    justify-content: flex-start;
    align-items: flex-end;
    padding-left: 8vw;
    padding-bottom: 15vh;
    flex-direction: column;
    align-items: flex-start;
}

.idiot-content {
    position: relative;
}

.idiot-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.02em;
    line-height: 1;
    color: #1c2a38;
    margin-bottom: 24px;
}

.glitch-char {
    display: inline-block;
    position: relative;
    animation: char-glitch 10s ease-in-out var(--glitch-delay) infinite;
}

@keyframes char-glitch {
    0%, 95%, 100% {
        transform: translate(0, 0);
        text-shadow: none;
        clip-path: none;
    }
    96% {
        transform: translate(4px, -2px);
        text-shadow:
            3px 0 0 rgba(196, 79, 79, 0.3),
            -3px 0 0 rgba(168, 197, 214, 0.3);
    }
    97% {
        transform: translate(-6px, 3px);
        text-shadow:
            -2px 0 0 rgba(123, 94, 167, 0.4),
            2px 0 0 rgba(196, 79, 79, 0.3);
    }
    98% {
        transform: translate(2px, -1px);
        text-shadow:
            4px 0 0 rgba(168, 197, 214, 0.3),
            -4px 0 0 rgba(196, 79, 79, 0.3);
    }
}

.idiot-subtitle {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    color: rgba(28, 42, 56, 0.65);
    max-width: 480px;
    line-height: 1.75;
}

/* ==================== ZONE 5 — RESOLUTION ==================== */
.zone-5 {
    justify-content: center;
    align-items: center;
    background-color: #f4f2ef;
}

.resolution-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.resolution-card {
    max-width: 520px;
    text-align: center;
    z-index: 10;
}

.resolution-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.75;
    color: #1c2a38;
}

/* Orbiting Bubbles */
.orbit-bubble {
    position: absolute;
    border-radius: 50%;
    background:
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.5), transparent 50%),
        radial-gradient(circle at 30% 30%, rgba(212, 160, 176, 0.35), rgba(168, 197, 214, 0.2) 50%, transparent 100%);
    border: 1px solid rgba(168, 197, 214, 0.12);
    pointer-events: none;
}

.orbit-1 {
    width: 32px;
    height: 32px;
    animation: orbit-1 20s linear infinite;
}

.orbit-2 {
    width: 24px;
    height: 24px;
    animation: orbit-2 25s linear infinite;
}

.orbit-3 {
    width: 40px;
    height: 40px;
    animation: orbit-3 30s linear infinite;
}

@keyframes orbit-1 {
    0% { transform: rotate(0deg) translateX(280px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(280px) rotate(-360deg); }
}

@keyframes orbit-2 {
    0% { transform: rotate(120deg) translateX(300px) translateY(40px) rotate(-120deg); }
    100% { transform: rotate(480deg) translateX(300px) translateY(40px) rotate(-480deg); }
}

@keyframes orbit-3 {
    0% { transform: rotate(240deg) translateX(260px) translateY(-30px) rotate(-240deg); }
    100% { transform: rotate(600deg) translateX(260px) translateY(-30px) rotate(-600deg); }
}

/* ==================== VIEWPORT GLITCH ==================== */
.viewport-glitch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    background-color: rgba(123, 94, 167, 0.03);
    transition: none;
}

.viewport-glitch.active {
    opacity: 1;
    transform: translateX(2px);
}

/* ==================== PIXEL DISPLACEMENT BLOCKS ==================== */
@keyframes pixel-shift {
    0%, 90%, 100% {
        transform: translateX(0);
        opacity: 0;
    }
    92% {
        transform: translateX(6px);
        opacity: 1;
    }
    96% {
        transform: translateX(6px);
        opacity: 1;
    }
    98% {
        transform: translateX(0);
        opacity: 0;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .zone {
        padding: 48px 24px;
    }

    .zone-1 {
        padding-left: 6vw;
        padding-top: 15vh;
    }

    .zone-2 {
        padding-right: 6vw;
        justify-content: center;
    }

    .simulation-cards {
        max-width: 90vw;
    }

    .zone-4 {
        padding-left: 6vw;
    }

    .breathing-circle {
        bottom: 24px;
        right: 24px;
    }

    .orbit-1 { animation-name: orbit-1-sm; }
    .orbit-2 { animation-name: orbit-2-sm; }
    .orbit-3 { animation-name: orbit-3-sm; }

    @keyframes orbit-1-sm {
        0% { transform: rotate(0deg) translateX(150px) rotate(0deg); }
        100% { transform: rotate(360deg) translateX(150px) rotate(-360deg); }
    }

    @keyframes orbit-2-sm {
        0% { transform: rotate(120deg) translateX(160px) translateY(20px) rotate(-120deg); }
        100% { transform: rotate(480deg) translateX(160px) translateY(20px) rotate(-480deg); }
    }

    @keyframes orbit-3-sm {
        0% { transform: rotate(240deg) translateX(140px) translateY(-15px) rotate(-240deg); }
        100% { transform: rotate(600deg) translateX(140px) translateY(-15px) rotate(-600deg); }
    }
}
