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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0D0D1A;
    color: #F0EDE8;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === SCROLL CONTAINER === */
.scroll-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100vh;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

/* === PANELS === */
.panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
}

.panel-gallery {
    width: 200vw;
}

/* === OPENING PANEL === */
.panel-opening {
    background-color: #0D0D1A;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.hex-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
}

.hex-pattern-overlay {
    mix-blend-mode: difference;
    animation: drift 25s linear infinite alternate;
}

@keyframes drift {
    from { transform: translate(0, 0); }
    to { transform: translate(16px, -8px); }
}

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

.domain-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(40px, 8vw, 96px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #F0EDE8;
    animation: titlePulse 4s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% {
        text-shadow: none;
        filter: none;
    }
    25% {
        text-shadow:
            2px 0 #9B111E,
            -2px 0 #0B3D91,
            0 2px #046A38;
        filter: none;
    }
    50% {
        text-shadow: none;
        filter: none;
    }
    75% {
        text-shadow:
            -3px 1px #9B111E,
            3px -1px #0B3D91,
            1px 3px #046A38;
        filter: blur(0.5px);
    }
}

/* === DIPTYCH PANELS === */
.panel-diptych {
    display: flex;
    flex-direction: row;
    background-color: #1A1A2E;
}

.diptych-left {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.diptych-left .hex-pattern {
    opacity: 0.3;
}

.diptych-right {
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #0D0D1A;
    overflow: hidden;
}

.diptych-seam {
    width: 4px;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    overflow: hidden;
    background-color: #4A3728;
}

.seam-svg {
    width: 100%;
    height: 100%;
    animation: seamBreathe 6s ease-in-out infinite;
}

@keyframes seamBreathe {
    0%, 100% { transform: scaleX(1); opacity: 0.6; }
    50% { transform: scaleX(2.5); opacity: 1; }
}

.diptych-text {
    position: relative;
    z-index: 2;
    padding: 40px;
    max-width: 560px;
}

.panel-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 80px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #F0EDE8;
    margin-bottom: 24px;
}

.diptych-left .panel-heading {
    padding-left: 10%;
}

.panel-body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    color: #C8C2B8;
    max-width: 480px;
}

.diptych-left .panel-body {
    padding-left: 10%;
}

/* === GLITCH ZONE === */
.glitch-zone {
    position: relative;
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(0, 0, 0, 0.15) 1px,
        rgba(0, 0, 0, 0.15) 2px
    );
    pointer-events: none;
    z-index: 3;
}

.glitch-text {
    text-shadow:
        2px 0 #9B111E,
        -2px 0 #0B3D91,
        0 2px #046A38;
    animation: glitchText 3.5s steps(1) infinite;
}

@keyframes glitchText {
    0%, 5% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    6% {
        clip-path: inset(20% 0 40% 0);
        transform: translate(-4px, 0);
    }
    8% {
        clip-path: inset(60% 0 10% 0);
        transform: translate(6px, 0);
    }
    10% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    40%, 42% {
        clip-path: inset(30% 0 30% 0);
        transform: translate(3px, 0);
    }
    43% {
        clip-path: inset(10% 0 60% 0);
        transform: translate(-5px, 0);
    }
    45% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    70%, 72% {
        clip-path: inset(50% 0 20% 0);
        transform: translate(4px, 0);
    }
    74% {
        clip-path: inset(5% 0 70% 0);
        transform: translate(-3px, 0);
    }
    76% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
        transform: translate(0, 0);
    }
}

/* === CARD GALLERY === */
.panel-gallery {
    display: flex;
    align-items: center;
    background-color: #0D0D1A;
    scroll-snap-align: start;
}

.gallery-inner {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 0 80px;
    height: 100%;
}

.card {
    width: 320px;
    height: 480px;
    perspective: 1200px;
    flex-shrink: 0;
    cursor: pointer;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-front {
    z-index: 2;
}

.card-hex-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.card-label {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 28px;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: #F0EDE8;
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 20px;
}

.card-indicator {
    position: absolute;
    bottom: 20px;
    right: 20px;
    color: #C98A1A;
    font-size: 14px;
    z-index: 2;
    animation: indicatorPulse 2s ease-in-out infinite;
}

@keyframes indicatorPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

.card-back {
    transform: rotateY(180deg);
    background-color: #0D0D1A;
    padding: 32px;
    border: 1px solid #2D2A3E;
}

.card-back .scanlines {
    z-index: 1;
}

.card-back-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.65;
    color: #C8C2B8;
    position: relative;
    z-index: 2;
    text-align: center;
}

.card-back-text.glitch-text {
    animation: glitchTextSlow 5s steps(1) infinite;
}

@keyframes glitchTextSlow {
    0%, 8% {
        text-shadow:
            1px 0 #9B111E,
            -1px 0 #0B3D91,
            0 1px #046A38;
        transform: translate(0, 0);
    }
    9% {
        text-shadow:
            3px 0 #9B111E,
            -2px 0 #0B3D91,
            0 2px #046A38;
        transform: translate(-2px, 1px);
    }
    11% {
        text-shadow:
            1px 0 #9B111E,
            -1px 0 #0B3D91,
            0 1px #046A38;
        transform: translate(0, 0);
    }
    50%, 53% {
        text-shadow:
            1px 0 #9B111E,
            -1px 0 #0B3D91,
            0 1px #046A38;
        transform: translate(0, 0);
    }
    54% {
        text-shadow:
            -2px 1px #9B111E,
            2px -1px #0B3D91,
            1px 2px #046A38;
        transform: translate(2px, -1px);
    }
    56% {
        text-shadow:
            1px 0 #9B111E,
            -1px 0 #0B3D91,
            0 1px #046A38;
        transform: translate(0, 0);
    }
    100% {
        text-shadow:
            1px 0 #9B111E,
            -1px 0 #0B3D91,
            0 1px #046A38;
        transform: translate(0, 0);
    }
}

/* === CLOSING PANEL === */
.panel-closing {
    background-color: #1A1A2E;
    display: flex;
    align-items: center;
    justify-content: center;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
}

.closing-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(40px, 9vw, 96px);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #F0EDE8;
}

/* === PROGRESS BAR === */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: rgba(13, 13, 26, 0.8);
    z-index: 100;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #9B111E, #9966CC);
    transition: width 0.1s linear;
}

.progress-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.progress-tick {
    position: absolute;
    top: -3px;
    width: 6px;
    height: 6px;
    transform: rotate(45deg) translateX(-50%);
    background-color: #C98A1A;
    opacity: 0.5;
}

/* === MONOSPACE ACCENTS === */
.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: #7B6F8E;
}

/* === RESPONSIVE (Mobile < 768px) === */
@media (max-width: 767px) {
    .scroll-container {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: scroll;
        scroll-snap-type: y mandatory;
    }

    .panel {
        width: 100vw;
        height: 100vh;
        scroll-snap-align: start;
    }

    .panel-gallery {
        width: 100vw;
        height: auto;
        min-height: 100vh;
    }

    .panel-diptych {
        flex-direction: column;
    }

    .diptych-left,
    .diptych-right {
        width: 100%;
        height: 50%;
    }

    .diptych-seam {
        width: 100%;
        height: 4px;
    }

    .seam-svg {
        width: 100%;
        height: 4px;
    }

    .diptych-text {
        padding: 24px;
    }

    .diptych-left .panel-heading,
    .diptych-left .panel-body {
        padding-left: 0;
    }

    .panel-heading {
        font-size: clamp(24px, 6vw, 40px);
        margin-bottom: 12px;
    }

    .panel-body {
        font-size: 16px;
    }

    .gallery-inner {
        flex-direction: column;
        gap: 24px;
        padding: 40px 24px;
        align-items: center;
    }

    .card {
        width: 100%;
        max-width: 320px;
        height: 200px;
    }

    /* Progress bar on right edge for mobile */
    .progress-bar {
        bottom: auto;
        top: 0;
        right: 0;
        left: auto;
        width: 3px;
        height: 100%;
    }

    .progress-fill {
        width: 100%;
        height: 0%;
        background: linear-gradient(to bottom, #9B111E, #9966CC);
        transition: height 0.1s linear;
    }

    .progress-tick {
        top: auto;
        left: -3px;
    }
}
