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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0b0a0d;
    color: #d4cfc6;
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* ===== SVG NOISE OVERLAY ===== */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    filter: url(#grain);
    background: transparent;
}

/* ===== SCROLL PROGRESS ===== */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background: #00f0ff;
    z-index: 1000;
    transition: height 0.1s linear;
}

/* ===== SECTION 1: HEADLINE MORGUE ===== */
#headline-morgue {
    width: 100%;
    height: 100vh;
    background: #0b0a0d;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.diagonal-slash {
    position: absolute;
    top: 0;
    left: 0;
    width: 150%;
    height: 2px;
    background: rgba(0, 240, 255, 0.4);
    transform: rotate(35deg);
    transform-origin: 30% 50%;
    top: 50%;
}

.title-container {
    text-align: center;
    position: relative;
    z-index: 2;
}

#main-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 7rem);
    color: #ff2d7b;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-shadow: 0 0 40px rgba(255, 45, 123, 0.5), 0 0 80px rgba(255, 45, 123, 0.2);
}

#main-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(60px) scale(0.92);
    animation: charBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#main-title .char[data-index="0"] { animation-delay: 0.2s; }
#main-title .char[data-index="1"] { animation-delay: 0.4s; }
#main-title .char[data-index="2"] { animation-delay: 0.6s; }
#main-title .char[data-index="3"] { animation-delay: 0.8s; }

@keyframes charBounce {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.subtitle {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 2vw, 1.4rem);
    color: #d4cfc6;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s forwards;
    letter-spacing: 0.04em;
    margin-top: 1rem;
}

@keyframes fadeIn {
    to { opacity: 0.7; }
}

/* ===== SECTION 2: CLIP WALL ===== */
#clip-wall {
    width: 100%;
    min-height: 200vh;
    background: #0b0a0d;
    position: relative;
    padding: 4rem 0;
}

.clip-container {
    position: relative;
    width: 100%;
    min-height: 180vh;
}

.clip {
    position: absolute;
    left: var(--x);
    top: var(--y);
    z-index: var(--z);
    width: clamp(280px, 35vw, 420px);
    transform: rotate(var(--rot));
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clip.visible {
    opacity: 1;
}

.clip-inner {
    background: #2a2119;
    padding: 1.5rem 1.8rem;
    position: relative;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
    clip-path: polygon(2% 0%, 98% 1%, 100% 3%, 99% 97%, 97% 100%, 3% 99%, 0% 96%, 1% 4%);
}

.clip:nth-child(1) .clip-inner { clip-path: polygon(0% 2%, 97% 0%, 100% 4%, 98% 98%, 100% 100%, 4% 97%, 1% 100%, 0% 3%); }
.clip:nth-child(2) .clip-inner { clip-path: polygon(1% 0%, 100% 1%, 99% 5%, 100% 96%, 97% 100%, 2% 99%, 0% 97%, 3% 2%); }
.clip:nth-child(3) .clip-inner { clip-path: polygon(3% 1%, 98% 0%, 100% 2%, 99% 99%, 96% 100%, 0% 98%, 2% 96%, 0% 3%); }
.clip:nth-child(4) .clip-inner { clip-path: polygon(0% 0%, 99% 3%, 97% 1%, 100% 97%, 98% 100%, 1% 98%, 3% 100%, 0% 4%); }
.clip:nth-child(5) .clip-inner { clip-path: polygon(2% 1%, 100% 0%, 98% 3%, 100% 98%, 97% 99%, 3% 100%, 0% 97%, 1% 2%); }
.clip:nth-child(6) .clip-inner { clip-path: polygon(1% 3%, 97% 0%, 100% 2%, 99% 96%, 100% 100%, 2% 98%, 0% 100%, 3% 1%); }
.clip:nth-child(7) .clip-inner { clip-path: polygon(0% 1%, 98% 2%, 100% 0%, 99% 97%, 96% 100%, 1% 99%, 0% 96%, 2% 4%); }
.clip:nth-child(8) .clip-inner { clip-path: polygon(3% 0%, 100% 2%, 98% 4%, 100% 99%, 97% 97%, 0% 100%, 2% 98%, 0% 2%); }

.clip-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: url(#grain);
    opacity: 0.15;
    pointer-events: none;
}

.clip-source {
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    font-weight: 300;
    color: rgba(0, 240, 255, 0.7);
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 0.8rem;
}

.clip-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #d4cfc6;
    line-height: 1.65;
}

.annotation-line {
    position: absolute;
    top: 30%;
    left: -5%;
    width: 110%;
    height: 2px;
    background: #ff2d7b;
    transform: rotate(-8deg);
    opacity: 0.6;
}

/* ===== SECTION SLASH DIVIDERS ===== */
.section-slash {
    border: none;
    height: 2px;
    background: #ff2d7b;
    transform: rotate(-3deg);
    transform-origin: left center;
    margin: 0 -5%;
    width: 110%;
    position: relative;
    z-index: 10;
}

.section-slash-alt {
    background: #00f0ff;
    transform: rotate(2deg);
}

/* ===== SECTION 3: DISSECTION TABLE ===== */
#dissection-table {
    width: 100%;
    min-height: 150vh;
    background: #1a0a12;
    padding: 8rem 0;
    position: relative;
}

.manifesto {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 2rem;
}

.manifesto-text {
    margin-bottom: 2.5rem;
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.75;
    color: #d4cfc6;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.manifesto-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.manifesto-text em {
    color: #00f0ff;
    font-style: italic;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.8s ease;
}

.manifesto-text.visible em {
    text-decoration-color: #00f0ff;
}

.pull-quote {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 3rem 2rem;
    text-align: center;
    transform: rotate(-2deg);
    margin-bottom: 3rem;
    opacity: 0;
    transition: opacity 0.6s ease 0.2s;
}

.pull-quote.visible {
    opacity: 1;
}

.quote-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(1.8rem, 5vw, 4rem);
    color: #ff2d7b;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.bracket {
    font-family: 'Fira Code', monospace;
    font-size: 120%;
    color: #e6ff00;
    display: inline-block;
    vertical-align: middle;
}

.bracket-left {
    transform: rotate(8deg);
    margin-right: 0.5em;
    border-left: 3px solid #e6ff00;
    padding-left: 0.3em;
    transform: skewY(-5deg);
}

.bracket-right {
    transform: rotate(-8deg);
    margin-left: 0.5em;
    border-right: 3px solid #e6ff00;
    padding-right: 0.3em;
    transform: skewY(5deg);
}

/* ===== SECTION 4: ARCHIVE DRAWER ===== */
#archive-drawer {
    width: 100%;
    min-height: 120vh;
    background: #0b0a0d;
    position: relative;
    padding: 6rem 0;
    overflow: hidden;
}

.grid-paper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background:
        repeating-linear-gradient(90deg, rgba(26, 26, 36, 0.25) 0px, transparent 1px, transparent 40px),
        repeating-linear-gradient(0deg, rgba(26, 26, 36, 0.25) 0px, transparent 1px, transparent 40px),
        repeating-linear-gradient(90deg, rgba(26, 26, 36, 0.4) 0px, transparent 1px, transparent 200px),
        repeating-linear-gradient(0deg, rgba(26, 26, 36, 0.4) 0px, transparent 1px, transparent 200px);
    z-index: 0;
}

.archive-track {
    display: flex;
    gap: 2rem;
    padding: 2rem 3rem;
    overflow-x: auto;
    cursor: grab;
    position: relative;
    z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: #1a1a24 #0b0a0d;
}

.archive-track::-webkit-scrollbar {
    height: 4px;
}

.archive-track::-webkit-scrollbar-track {
    background: #0b0a0d;
}

.archive-track::-webkit-scrollbar-thumb {
    background: #1a1a24;
}

.folder {
    flex: 0 0 clamp(260px, 22vw, 320px);
    min-height: 500px;
    background: #0b0a0d;
    border: 1px solid #1a1a24;
    position: relative;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(60px) scale(0.92);
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.folder.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.folder-tab {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    color: #e6ff00;
    letter-spacing: 0.08em;
    padding: 0.8rem 1.2rem;
    background: #1a0a12;
    clip-path: polygon(0 0, 85% 0, 100% 100%, 0 100%);
    width: 70%;
}

.folder-content {
    padding: 1.5rem;
    flex: 1;
}

.folder-content h3 {
    font-family: 'Noto Sans JP', 'Nunito', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    color: #ff2d7b;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

.folder-content p {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.7;
    color: #d4cfc6;
    margin-bottom: 1.5rem;
}

.folder-code {
    font-family: 'Fira Code', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    font-weight: 300;
    color: rgba(0, 240, 255, 0.7);
    letter-spacing: 0.02em;
    display: block;
    margin-top: auto;
}

/* ===== SECTION 5: TRANSMISSION END ===== */
#transmission-end {
    width: 100%;
    height: 100vh;
    background: #0b0a0d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.crt-content {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 4px;
}

.crt-line {
    width: 0%;
    height: 2px;
    background: #ff2d7b;
    box-shadow: 0 0 20px rgba(255, 45, 123, 0.6), 0 0 60px rgba(255, 45, 123, 0.3);
    transition: width 0.8s ease;
}

.crt-line.active {
    width: 100%;
}

.crt-line.collapse {
    animation: crtCollapse 0.6s ease forwards;
}

@keyframes crtCollapse {
    0% { width: 100%; height: 2px; }
    100% { width: 0%; height: 2px; }
}

.crt-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff2d7b;
    opacity: 0;
    box-shadow: 0 0 20px #ff2d7b, 0 0 40px #ff2d7b;
}

.crt-dot.active {
    opacity: 1;
    animation: dotFade 1.2s ease 0.2s forwards;
}

@keyframes dotFade {
    0% { opacity: 1; box-shadow: 0 0 20px #ff2d7b, 0 0 40px #ff2d7b; }
    100% { opacity: 0; box-shadow: 0 0 0px #ff2d7b, 0 0 0px #ff2d7b; }
}

.end-text {
    margin-top: 3rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease 2s;
}

.end-text.visible {
    opacity: 1;
}

.end-label {
    font-family: 'Fira Code', monospace;
    font-weight: 300;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    color: rgba(0, 240, 255, 0.7);
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 0.5rem;
}

#timestamp {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    color: rgba(0, 240, 255, 0.5);
    letter-spacing: 0.02em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .clip {
        width: clamp(220px, 80vw, 340px);
        position: relative;
        left: auto;
        top: auto;
        margin: 2rem auto;
        display: block;
    }

    .clip-container {
        min-height: auto;
        display: flex;
        flex-direction: column;
    }

    .archive-track {
        padding: 2rem 1.5rem;
    }

    .folder {
        flex: 0 0 280px;
        min-height: 400px;
    }

    .pull-quote {
        padding: 2rem 1rem;
    }
}
