/* continu.ax - Cyberpunk Folktale Machine */
/* Colors: #0c0e1a #161832 #1a1040 #34d399 #c4b5fd #e0f2fe #94a3b8 #cbd5e1 #f97316 */
/* Fonts: Space Grotesk 700, Inter 400/500, Noto Sans JP 300 */

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

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #94a3b8;
    background: linear-gradient(
        135deg,
        #0c0e1a 0%,
        #161832 25%,
        #0c0e1a 50%,
        #1a1040 75%,
        #0c0e1a 100%
    );
    background-size: 400% 400%;
    animation: auroraBreath 30s ease-in-out infinite;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.75;
}

@keyframes auroraBreath {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 50% 100%; }
    75% { background-position: 0% 50%; }
    100% { background-position: 0% 0%; }
}

/* ===== Scroll Progress Indicator ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 0%;
    background: linear-gradient(to bottom, #34d399, #c4b5fd, #f97316);
    z-index: 1000;
    transition: height 0.1s linear;
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #e0f2fe;
    letter-spacing: -0.03em;
    line-height: 1.1;
    perspective: 600px;
}

.letter {
    display: inline-block;
    animation: letterTilt 5s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    transform-style: preserve-3d;
}

@keyframes letterTilt {
    0%, 100% { transform: perspective(400px) rotateY(-6deg) rotateX(2deg); }
    50% { transform: perspective(400px) rotateY(6deg) rotateX(-2deg); }
}

.hero-subtitle {
    margin-top: 1.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

/* ===== Paper Lantern ===== */
.paper-lantern {
    position: absolute;
    top: 12%;
    right: 15%;
    z-index: 1;
    animation: lanternBob 5s ease-in-out infinite;
}

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

.lantern-string {
    width: 1px;
    height: 40px;
    background: #94a3b8;
    margin: 0 auto;
}

.lantern-body {
    width: 50px;
    height: 70px;
    border-radius: 50% / 40%;
    background: radial-gradient(circle at 50% 40%, #f97316, #0c0e1a);
    position: relative;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.4), 0 0 60px rgba(249, 115, 22, 0.2);
}

.lantern-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.15), transparent 70%);
    animation: lanternPulse 3s ease-in-out infinite;
}

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

/* ===== Kanji Watermarks ===== */
.kanji-watermark {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: clamp(4rem, 10vw, 12rem);
    color: #34d399;
    opacity: 0.08;
    position: absolute;
    z-index: 0;
    user-select: none;
    pointer-events: none;
    animation: kanjiDrift 20s ease-in-out infinite alternate;
}

@keyframes kanjiDrift {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(3deg); }
}

.kanji-hero {
    top: 20%;
    left: 10%;
    font-size: clamp(6rem, 15vw, 14rem);
}

.kanji-alley {
    top: 15%;
    right: 5%;
    font-size: clamp(5rem, 12vw, 12rem);
}

.kanji-market {
    bottom: 10%;
    left: 8%;
    font-size: clamp(4rem, 10vw, 10rem);
}

/* ===== Scroll Chevron ===== */
.scroll-chevron {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 14px;
    height: 14px;
    border-bottom: 2px solid #34d399;
    border-right: 2px solid #34d399;
    opacity: 0.6;
    animation: chevronPulse 2s ease-in-out infinite;
    z-index: 2;
}

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

/* ===== Panel Dividers ===== */
.panel-divider {
    height: 20vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider-line {
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, #34d399 50%, transparent);
    opacity: 0;
    transition: opacity 0.8s ease;
}

.divider-line.is-visible {
    opacity: 1;
}

/* ===== Panels (General) ===== */
.panel {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 3.5rem 5%;
}

.panel-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: -0.01em;
    margin-bottom: 1.75rem;
    color: #c4b5fd;
}

.panel-text {
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.75;
    color: #94a3b8;
    margin-bottom: 1.75rem;
    max-width: 540px;
}

.panel-text.emphasized {
    color: #cbd5e1;
    font-weight: 500;
}

/* ===== Panel 1: The Alley ===== */
.panel-alley {
    justify-content: flex-start;
}

.panel-alley-content {
    width: 40%;
    padding-left: 5%;
    z-index: 2;
    transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.15s ease-out;
}

/* ===== Kitsune Mask ===== */
.kitsune-mask {
    position: absolute;
    right: 15%;
    top: 50%;
    transform: translateY(-50%) perspective(600px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.15s ease-out;
    width: 180px;
    height: 220px;
    z-index: 1;
}

.kitsune-ear {
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-left: 35px solid transparent;
    border-right: 35px solid transparent;
    border-bottom: 60px solid #161832;
}

.kitsune-ear::after {
    content: '';
    position: absolute;
    top: 3px;
    left: -32px;
    width: 0;
    height: 0;
    border-left: 32px solid transparent;
    border-right: 32px solid transparent;
    border-bottom: 54px solid transparent;
    border-bottom-color: transparent;
    filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.3));
}

.kitsune-ear-left {
    left: 15px;
    transform: rotate(-8deg);
    border-bottom-color: #161832;
    outline: 1px solid rgba(52, 211, 153, 0.3);
    outline-offset: -1px;
}

.kitsune-ear-right {
    right: 15px;
    transform: rotate(8deg);
    border-bottom-color: #161832;
    outline: 1px solid rgba(52, 211, 153, 0.3);
    outline-offset: -1px;
}

.kitsune-face {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 160px;
    background: #161832;
    clip-path: polygon(50% 100%, 0% 20%, 15% 0%, 85% 0%, 100% 20%);
    border: 1px solid rgba(52, 211, 153, 0.3);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.1);
}

.kitsune-face::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 100%, 0% 20%, 15% 0%, 85% 0%, 100% 20%);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.kitsune-eye {
    position: absolute;
    top: 50px;
    width: 20px;
    height: 20px;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: #34d399;
    animation: eyePulse 4s ease-in-out infinite;
}

@keyframes eyePulse {
    0%, 100% { box-shadow: 0 0 10px rgba(52, 211, 153, 0.6); background: #34d399; }
    50% { box-shadow: 0 0 15px rgba(196, 181, 253, 0.6); background: #c4b5fd; }
}

.kitsune-eye-left {
    left: 30px;
}

.kitsune-eye-right {
    right: 30px;
}

.kitsune-nose {
    position: absolute;
    top: 85px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #34d399;
    opacity: 0.5;
}

/* ===== Panel 2: The Market ===== */
.panel-market {
    justify-content: center;
}

.market-stalls {
    display: flex;
    gap: 2rem;
    width: 90%;
    max-width: 1200px;
    perspective: 1200px;
    transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.15s ease-out;
}

.stall {
    padding: 2rem;
    background: rgba(22, 24, 50, 0.5);
    border: 1px solid rgba(52, 211, 153, 0.1);
    border-radius: 2px;
}

.stall-1 {
    flex: 0 0 25%;
}

.stall-2 {
    flex: 0 0 45%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stall-3 {
    flex: 0 0 25%;
}

.stall-title {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.stall-motif {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.circuit-pattern {
    width: 80px;
    height: 80px;
    border: 1px solid rgba(52, 211, 153, 0.2);
    position: relative;
}

.circuit-pattern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(52, 211, 153, 0.3);
}

.circuit-pattern::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: rgba(52, 211, 153, 0.3);
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 2px;
    animation: swatchPulse 4s ease-in-out infinite;
}

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

.swatch-jade {
    background: #34d399;
    animation-delay: 0s;
}

.swatch-wisteria {
    background: #c4b5fd;
    animation-delay: 1.3s;
}

.swatch-ember {
    background: #f97316;
    animation-delay: 2.6s;
}

/* ===== Panel 3: The Shrine ===== */
.panel-shrine {
    justify-content: center;
    align-items: center;
}

.shrine-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.15s ease-out;
}

.shrine-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #e0f2fe;
    line-height: 2;
    letter-spacing: 0.02em;
    margin-bottom: 3.5rem;
}

/* ===== Torii Gate ===== */
.torii-gate {
    position: relative;
    width: 300px;
    height: 400px;
    filter: drop-shadow(0 0 40px rgba(196, 181, 253, 0.3));
}

.torii-top-beam {
    position: absolute;
    top: 0;
    left: -20px;
    width: 340px;
    height: 24px;
    background: linear-gradient(to bottom, #c4b5fd, #34d399);
    border-radius: 8px 8px 0 0;
}

.torii-bottom-beam {
    position: absolute;
    top: 50px;
    left: 0;
    width: 300px;
    height: 14px;
    background: linear-gradient(to bottom, #c4b5fd, #34d399);
    opacity: 0.8;
}

.torii-pillar {
    position: absolute;
    top: 24px;
    width: 22px;
    height: 376px;
    background: linear-gradient(to bottom, #c4b5fd, #34d399);
}

.torii-pillar-left {
    left: 30px;
}

.torii-pillar-right {
    right: 30px;
}

/* ===== Panel 4: The Signal ===== */
.panel-signal {
    justify-content: center;
    align-items: center;
}

.signal-content {
    transform: rotate(-5deg) perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.15s ease-out;
    max-width: 800px;
    padding: 3.5rem;
}

.signal-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    color: #e0f2fe;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

/* ===== Circuit Border Lines ===== */
.circuit-border {
    position: fixed;
    top: 0;
    width: 1px;
    height: 100vh;
    z-index: 999;
    pointer-events: none;
}

.circuit-border-left {
    left: 2%;
    background: repeating-linear-gradient(
        to bottom,
        rgba(52, 211, 153, 0.15) 0px,
        rgba(52, 211, 153, 0.15) 20px,
        transparent 20px,
        transparent 40px,
        rgba(52, 211, 153, 0.15) 40px,
        rgba(52, 211, 153, 0.15) 50px,
        transparent 50px,
        transparent 80px
    );
}

.circuit-border-right {
    right: 2%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 30px,
        rgba(52, 211, 153, 0.15) 30px,
        rgba(52, 211, 153, 0.15) 45px,
        transparent 45px,
        transparent 70px,
        rgba(52, 211, 153, 0.15) 70px,
        rgba(52, 211, 153, 0.15) 90px
    );
}

/* ===== Tilt-3D Elements ===== */
[data-tilt] {
    transform-style: preserve-3d;
    will-change: transform;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .panel-alley {
        flex-direction: column;
        justify-content: center;
    }

    .panel-alley-content {
        width: 90%;
        padding-left: 0;
    }

    .kitsune-mask {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin: 3.5rem auto 0;
    }

    .market-stalls {
        flex-direction: column;
        width: 95%;
    }

    .stall-1,
    .stall-2,
    .stall-3 {
        flex: 1 1 auto;
    }

    .paper-lantern {
        right: 8%;
        top: 8%;
    }

    .circuit-border {
        display: none;
    }

    .signal-content {
        transform: rotate(-3deg);
    }

    .torii-gate {
        width: 200px;
        height: 280px;
    }

    .torii-top-beam {
        width: 240px;
        left: -20px;
        height: 18px;
    }

    .torii-bottom-beam {
        width: 200px;
        height: 10px;
        top: 40px;
    }

    .torii-pillar {
        width: 16px;
        height: 262px;
        top: 18px;
    }

    .torii-pillar-left {
        left: 20px;
    }

    .torii-pillar-right {
        right: 20px;
    }
}
