/* ==============================
   masugomi.com — styles.css
   Frozen spectacle of corrupted opulence
   ============================== */

/* Palette: #0B0C14 #E8EDF5 #00D4FF #F0A830 #C8B8E8 #2A3050 #FF2244 #D0E8F0 */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0b0c14;
    color: #e8edf5;
    font-family: 'Caveat', cursive;
    overflow-x: hidden;
    min-height: 100vh;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Frost Margins --- */
.frost-margin {
    position: fixed;
    top: 0;
    bottom: 0;
    width: clamp(60px, 12vw, 180px);
    background: rgba(232,237,245,0.06);
    backdrop-filter: blur(24px) saturate(0.7);
    -webkit-backdrop-filter: blur(24px) saturate(0.7);
    z-index: 10;
    overflow: hidden;
}

.frost-margin--left {
    left: 0;
    border-right: 1px solid rgba(208,232,240,0.1);
}

.frost-margin--right {
    right: 0;
    border-left: 1px solid rgba(208,232,240,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Margin annotations */
.margin-annotation {
    position: absolute;
    width: 80%;
    left: 10%;
    top: 20%;
    opacity: 0.4;
}

/* --- Floating Kanji --- */
.kanji-float {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.kanji-float span {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    opacity: 0.12;
    color: #e8edf5;
    animation: float-up 45s linear infinite;
}

.kanji-float span:nth-child(1) { left: 20%; animation-delay: 0s; bottom: -20px; }
.kanji-float span:nth-child(2) { left: 50%; animation-delay: -6s; bottom: -20px; }
.kanji-float span:nth-child(3) { left: 30%; animation-delay: -12s; bottom: -20px; }
.kanji-float span:nth-child(4) { left: 70%; animation-delay: -18s; bottom: -20px; }
.kanji-float span:nth-child(5) { left: 15%; animation-delay: -24s; bottom: -20px; }
.kanji-float span:nth-child(6) { left: 60%; animation-delay: -30s; bottom: -20px; }
.kanji-float span:nth-child(7) { left: 40%; animation-delay: -36s; bottom: -20px; }
.kanji-float span:nth-child(8) { left: 80%; animation-delay: -42s; bottom: -20px; }

@keyframes float-up {
    0% { transform: translateY(0); opacity: 0; }
    5% { opacity: 0.12; }
    95% { opacity: 0.12; }
    100% { transform: translateY(-100vh); opacity: 0; }
}

/* --- Nav Dots --- */
.nav-dots {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,212,255,0.5);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.4s ease;
    padding: 0;
}

.nav-dot.active {
    background: #00d4ff;
    border-color: #00d4ff;
    box-shadow: 0 0 12px rgba(0,212,255,0.5);
}

.nav-dot-label {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    color: #e8edf5;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.nav-dot:hover .nav-dot-label {
    opacity: 0.6;
}

/* --- Broadcast Column --- */
.broadcast-column {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
    scroll-snap-type: y mandatory;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.broadcast-column::-webkit-scrollbar {
    display: none;
}

/* --- Broadcast Frame --- */
.broadcast-frame {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    padding: 60px 0;
}

.frame-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 100%;
}

/* --- Flow Curves (background) --- */
.flow-curve {
    position: absolute;
    top: 0;
    left: -20%;
    width: 140%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    animation: flow-drift 30s ease-in-out infinite alternate;
}

@keyframes flow-drift {
    0% { transform: translateX(-30px); }
    100% { transform: translateX(30px); }
}

.flow-curve--slow {
    animation-duration: 60s;
}

/* --- Neon Headlines --- */
.neon-headline {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #e8edf5;
    text-shadow:
        0 0 4px #00d4ff,
        0 0 20px rgba(0,212,255,0.4),
        0 0 60px rgba(0,212,255,0.15);
    animation: neon-pulse 4s ease-in-out infinite;
    transition: font-weight 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    margin-bottom: 1.2rem;
}

.neon-headline:hover {
    font-weight: 900;
}

@keyframes neon-pulse {
    0%, 100% { text-shadow: 0 0 4px #00d4ff, 0 0 20px rgba(0,212,255,0.4), 0 0 60px rgba(0,212,255,0.1); }
    50% { text-shadow: 0 0 4px #00d4ff, 0 0 20px rgba(0,212,255,0.4), 0 0 60px rgba(0,212,255,0.25); }
}

.neon-headline--dim {
    text-shadow:
        0 0 4px rgba(0,212,255,0.5),
        0 0 20px rgba(0,212,255,0.2),
        0 0 60px rgba(0,212,255,0.08);
}

.neon-headline--fading {
    text-shadow:
        0 0 4px rgba(0,212,255,0.3),
        0 0 20px rgba(0,212,255,0.1),
        0 0 60px rgba(0,212,255,0.05);
    animation: neon-fade 4s ease-in-out infinite;
}

@keyframes neon-fade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.3; }
}

.neon-headline--struck {
    position: relative;
}

.struck-text {
    text-decoration: line-through;
    text-decoration-color: #ff2244;
    text-decoration-thickness: 3px;
    opacity: 0.4;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
}

/* --- Handwritten Headline --- */
.handwritten-headline {
    font-family: 'Caveat', cursive;
    font-size: clamp(2.4rem, 5vw, 4.5rem);
    font-weight: 700;
    color: #f0a830;
    text-shadow: 0 0 20px rgba(240,168,48,0.3);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

/* --- Annotation Body --- */
.annotation-body {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    font-weight: 400;
    line-height: 1.8;
    color: #e8edf5;
    opacity: 0.85;
}

.annotation-body--sparse {
    opacity: 0.5;
    font-style: italic;
}

.annotation-body--dominant {
    font-size: clamp(1.3rem, 2.2vw, 1.7rem);
    color: #f0a830;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto;
}

.annotation-body--final {
    opacity: 0.4;
}

.annotation-rewrite {
    color: #f0a830;
}

/* --- Broadcast Meta --- */
.broadcast-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(232,237,245,0.35);
    margin-bottom: 2rem;
}

/* --- Broadcast Voice (official text) --- */
.broadcast-voice {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    line-height: 1.3;
    color: #e8edf5;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

/* --- Dual Text Layout --- */
.dual-text {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.official-text {
    padding: 1.2rem 1.5rem;
    background: rgba(42,48,80,0.3);
    border-left: 2px solid rgba(0,212,255,0.3);
}

.annotation-text {
    padding: 1.2rem 1.5rem;
    border-left: 2px solid rgba(240,168,48,0.5);
}

/* --- Annotation Overlays --- */
.annotation-overlay {
    position: absolute;
    bottom: 10%;
    left: 10%;
    width: 80%;
    z-index: 3;
    pointer-events: none;
}

.annotation-overlay path {
    transition: opacity 0.8s ease;
}

.broadcast-frame.in-view .annotation-overlay path {
    opacity: 0.7;
}

/* --- Frost Dividers --- */
.frost-divider {
    display: flex;
    justify-content: center;
    padding: 0;
    position: relative;
}

.ice-crystal {
    width: min(600px, 80vw);
    height: 40px;
    overflow: visible;
}

.ice-crystal line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease;
}

.frost-divider.in-view .ice-crystal line {
    stroke-dashoffset: 0;
}

/* --- Glitch Effects --- */
.glitch-band {
    position: fixed;
    top: 45%;
    left: 0;
    width: 100%;
    height: 3px;
    background: repeating-linear-gradient(90deg,
        #ff2244 0px, #ff2244 4px,
        #00d4ff 4px, #00d4ff 8px,
        #0b0c14 8px, #0b0c14 14px,
        #e8edf5 14px, #e8edf5 16px,
        #ff2244 16px, #ff2244 22px
    );
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

body.glitch-active {
    transform: translateX(4px);
}

body.glitch-active .glitch-band {
    opacity: 1;
}

body.glitch-active .neon-headline {
    text-shadow:
        2px 0 #ff2244,
        -2px 0 #00d4ff,
        0 0 4px #00d4ff,
        0 0 20px rgba(0,212,255,0.4);
}

/* --- Frame Content Inverted --- */
.frame-content--inverted .neon-headline--struck {
    margin-bottom: 0.5rem;
}

/* --- Final Frame --- */
.broadcast-frame--final .flow-curve {
    animation-duration: 60s;
}

.broadcast-frame--final.in-view .neon-headline {
    animation: neon-fade 4s ease-in-out infinite;
}

/* --- Frame Visibility Animation --- */
.broadcast-frame .frame-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
    .frost-margin {
        width: clamp(30px, 8vw, 60px);
    }

    .frost-margin--left .margin-annotation,
    .frost-margin--left .kanji-float {
        display: none;
    }

    .nav-dot-label {
        display: none;
    }

    .broadcast-column {
        padding: 0 16px;
    }
}
