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

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

body {
    font-family: 'Rokkitt', serif;
    color: #2E2228;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* === Gradient Backdrop === */
#gradient-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: linear-gradient(170deg, #FFF5ED 0%, #F4A683 25%, #E8735A 50%, #D4944C 75%, #6B3A5E 100%);
    background-size: 400% 400%;
    animation: gradientBreath 30s ease infinite;
}

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

/* === Scroll Container === */
#scroll-container {
    position: relative;
    z-index: 1;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

/* === Snap Sections === */
.snap-section {
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* === Glass Panel Base === */
.glass-panel {
    background: rgba(255, 245, 237, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(46, 34, 40, 0.12);
}

.glass-large {
    border-radius: 24px;
    padding: clamp(2rem, 5vw, 4rem);
    max-width: clamp(320px, 80vw, 900px);
    width: 80vw;
}

.glass-card {
    border-radius: 16px;
    padding: clamp(1rem, 2vw, 2rem);
}

/* === Section 1: Threshold === */
#threshold {
    justify-content: center;
    align-items: center;
}

.threshold-panel {
    text-align: center;
    opacity: 0;
    transform: scale(0.95);
    animation: panelSolidify 1.2s ease-out 0.3s forwards;
}

@keyframes panelSolidify {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hero-kanji {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #2E2228;
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-feature-settings: "palt";
}

.hero-transliteration {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B3A5E;
    margin-top: clamp(0.5rem, 1.5vh, 1.5rem);
}

/* === Section 2: Broadcast === */
#broadcast {
    justify-content: center;
    gap: clamp(1.5rem, 3vh, 3rem);
}

.broadcast-bar {
    width: 70vw;
    max-width: 800px;
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(2rem, 4vw, 3rem);
    border-radius: 16px;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.8s ease-out, opacity 0.8s ease-out;
}

.broadcast-bar.visible {
    transform: translateX(0);
    opacity: 1;
}

.broadcast-text {
    font-family: 'Rokkitt', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: #2E2228;
}

.waveform-container {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 50px;
    padding: 0 2rem;
}

.waveform-bar {
    width: 2px;
    background: #E8C97A;
    border-radius: 1px;
    animation: waveformPulse 2s ease-in-out infinite;
}

.waveform-bar:nth-child(1)  { height: 12px; animation-delay: 0s; }
.waveform-bar:nth-child(2)  { height: 28px; animation-delay: 0.1s; }
.waveform-bar:nth-child(3)  { height: 18px; animation-delay: 0.2s; }
.waveform-bar:nth-child(4)  { height: 40px; animation-delay: 0.3s; }
.waveform-bar:nth-child(5)  { height: 22px; animation-delay: 0.4s; }
.waveform-bar:nth-child(6)  { height: 35px; animation-delay: 0.5s; }
.waveform-bar:nth-child(7)  { height: 15px; animation-delay: 0.6s; }
.waveform-bar:nth-child(8)  { height: 30px; animation-delay: 0.7s; }
.waveform-bar:nth-child(9)  { height: 8px;  animation-delay: 0.8s; }
.waveform-bar:nth-child(10) { height: 25px; animation-delay: 0.9s; }
.waveform-bar:nth-child(11) { height: 38px; animation-delay: 1.0s; }
.waveform-bar:nth-child(12) { height: 14px; animation-delay: 1.1s; }

@keyframes waveformPulse {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.4); }
}

.kanji-cards {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
    flex-wrap: wrap;
    justify-content: center;
    max-width: clamp(320px, 80vw, 900px);
}

.kanji-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 120px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.kanji-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.kanji-card-1 { transition-delay: 0.15s; }
.kanji-card-2 { transition-delay: 0.3s; margin-top: 1.5rem; }
.kanji-card-3 { transition-delay: 0.45s; margin-top: -1rem; }

.kanji-char {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: #2E2228;
    font-feature-settings: "palt";
}

.kanji-gloss {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    letter-spacing: 0.08em;
    color: #6B3A5E;
}

/* === Section 3: Dissolution === */
#dissolution {
    justify-content: center;
    gap: clamp(1rem, 2.5vh, 2rem);
}

.dissolution-bars {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 2.5vh, 2rem);
    max-width: clamp(320px, 80vw, 900px);
    width: 80vw;
}

.dissolve-bar {
    padding: clamp(0.8rem, 1.5vw, 1.5rem) clamp(1.5rem, 3vw, 2.5rem);
    border-radius: 16px;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.dissolve-bar.visible {
    opacity: 1;
    transform: translateY(0);
}

.dissolve-bar p {
    font-family: 'Rokkitt', serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: #2E2228;
}

.dissolve-bar-1 { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition-delay: 0s; }
.dissolve-bar-2 { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); background: rgba(255,245,237,0.12); transition-delay: 0.15s; }
.dissolve-bar-3 { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); background: rgba(255,245,237,0.09); transition-delay: 0.3s; }
.dissolve-bar-4 { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: rgba(255,245,237,0.06); transition-delay: 0.45s; }
.dissolve-bar-5 { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); background: rgba(255,245,237,0.03); transition-delay: 0.6s; text-align: center; }

.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    animation: particleRise 8s linear infinite;
    opacity: 0;
}

@keyframes particleRise {
    0% { transform: translateY(0); opacity: 0.6; }
    100% { transform: translateY(-100vh); opacity: 0; }
}

/* === Section 4: Resonance === */
#resonance {
    justify-content: center;
    align-items: center;
}

.resonance-circle {
    width: clamp(250px, 50vmin, 400px);
    height: clamp(250px, 50vmin, 400px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.ripple-svg {
    width: 100%;
    height: 100%;
}

.ripple {
    fill: none;
    stroke-width: 1.5;
    animation: rippleExpand 6s ease-out infinite;
}

.ripple-1 { stroke: #F4A683; opacity: 0.6; animation-delay: 0s; }
.ripple-2 { stroke: #E8735A; opacity: 0.4; animation-delay: 1.2s; }
.ripple-3 { stroke: #D4944C; opacity: 0.3; animation-delay: 2.4s; }
.ripple-4 { stroke: #E8C97A; opacity: 0.2; animation-delay: 3.6s; }

@keyframes rippleExpand {
    0% { r: 30; opacity: 0.6; stroke-width: 1.5; }
    100% { r: 180; opacity: 0; stroke-width: 0.5; }
}

.orbit-texts {
    position: absolute;
    width: clamp(300px, 60vmin, 500px);
    height: clamp(300px, 60vmin, 500px);
    animation: orbitSpin 60s linear infinite;
}

.orbit-text {
    position: absolute;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    letter-spacing: 0.08em;
    color: rgba(255, 245, 237, 0.7);
    white-space: nowrap;
}

.orbit-text-1 { top: 0; left: 50%; transform: translateX(-50%); }
.orbit-text-2 { top: 25%; right: 0; }
.orbit-text-3 { bottom: 25%; right: 5%; }
.orbit-text-4 { bottom: 0; left: 50%; transform: translateX(-50%); }
.orbit-text-5 { bottom: 25%; left: 0; font-family: 'Noto Serif JP', serif; font-weight: 500; }
.orbit-text-6 { top: 25%; left: 0; }

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

/* === Section 5: Return === */
#return-section {
    justify-content: center;
    align-items: center;
}

.return-panel {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.return-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.return-domain {
    font-family: 'Rokkitt', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #2E2228;
    letter-spacing: -0.02em;
}

/* === Animate-in utility === */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}
