/* ============================================================
   mosoon.org — Contradiction (矛盾)
   Street-style editorial / Wheat-paste philosophical zine
   ============================================================ */

/* Custom Properties */
:root {
    --layer-1-angle: 0deg;
    --layer-2-angle: 3deg;
    --layer-3-angle: -2deg;
    --layer-4-angle: 0deg;
    --layer-5-angle: 1deg;
    --paper-base: #f4efe6;
    --paper-dark: #e8e0d2;
    --ink-primary: #1c2a3d;
    --sky-reveal: #d6e8f7;
    --accent-blue: #3a6b9f;
    --stamp-red: #c4613a;
    --shield-blue: #7a98b3;
    --alley-shadow: #2d2825;
    --zine-yellow: #e8c84a;
}

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

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--ink-primary);
    background-color: var(--paper-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Progress Bar
   ============================================================ */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background-color: var(--accent-blue);
    z-index: 1000;
    transition: height 0.1s linear;
}

/* ============================================================
   Ripple Container
   ============================================================ */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(58, 107, 159, 0.12) 0%, transparent 70%);
    transform: scale(0);
    animation: rippleExpand 600ms ease-out forwards;
    pointer-events: none;
}

.ripple-dark {
    background: radial-gradient(circle, rgba(214, 232, 247, 0.15) 0%, transparent 70%);
}

@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* ============================================================
   Paper Texture (CSS-only)
   ============================================================ */
.paper-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-color: var(--paper-base);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 20% 50%, rgba(180, 160, 130, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(180, 160, 130, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(180, 160, 130, 0.07) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 90%, rgba(180, 160, 130, 0.05) 0%, transparent 35%),
        radial-gradient(circle at 70% 60%, rgba(180, 160, 130, 0.04) 0%, transparent 30%);
    background-size: 300px 300px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    box-shadow: inset 0 0 100px rgba(45, 40, 37, 0.07);
}

.paper-texture-dark {
    background-color: var(--alley-shadow);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at 30% 40%, rgba(100, 90, 80, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(100, 90, 80, 0.08) 0%, transparent 40%);
    background-size: 300px 300px, 100% 100%, 100% 100%;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   Layer System
   ============================================================ */
.layer {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.layer-content {
    position: relative;
    z-index: 1;
    padding: 12vh 6vw;
    max-width: 100%;
}

/* Layer 1: The Wall */
.layer-1 {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.layer-1-content {
    text-align: left;
    max-width: 780px;
    padding-left: 8vw;
    transform: rotate(var(--layer-1-angle));
}

.layer-1 .headline {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--ink-primary);
    margin-bottom: 1.5rem;
    position: relative;
}

.headline-word-first {
    display: inline-block;
}

.headline-word-rest {
    display: inline-block;
    transform: rotate(-1.5deg);
    transform-origin: left bottom;
}

.paradox-question {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    line-height: 1.6;
    max-width: 38ch;
    color: var(--accent-blue);
    margin-top: 1rem;
}

/* Layer 2: The Spear */
.layer-2 {
    min-height: 140vh;
    margin-top: -40vh;
    z-index: 6;
    clip-path: polygon(
        0% 3%, 4% 0%, 12% 2.5%, 20% 0.5%, 28% 2%, 36% 0%, 44% 1.8%, 52% 0.3%, 60% 2.2%, 68% 0.8%, 76% 2.5%, 84% 0.2%, 92% 1.5%, 100% 0%,
        100% 100%, 0% 100%
    );
}

.layer-2-content {
    max-width: 680px;
    margin-left: auto;
    margin-right: 8vw;
    transform: rotate(var(--layer-2-angle));
    padding-top: 15vh;
}

/* Layer 3: The Shield */
.layer-3 {
    min-height: 140vh;
    margin-top: -40vh;
    z-index: 7;
    clip-path: polygon(
        0% 0%, 100% 0%,
        100% 2%, 96% 0.5%, 88% 2.8%, 80% 0.3%, 72% 1.8%, 64% 0.2%, 56% 2.5%, 48% 0.8%, 40% 2.2%, 32% 0.5%, 24% 2.8%, 16% 0.3%, 8% 1.5%, 0% 2.5%,
        0% 100%, 100% 100%
    );
}

.layer-3-content {
    max-width: 680px;
    margin-left: 8vw;
    margin-right: auto;
    transform: rotate(var(--layer-3-angle));
    padding-top: 15vh;
}

/* Layer 4: The Contradiction */
.layer-4 {
    min-height: 120vh;
    margin-top: -40vh;
    z-index: 8;
    background-color: var(--sky-reveal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-4-content {
    max-width: 680px;
    text-align: center;
    transform: rotate(var(--layer-4-angle));
    position: relative;
}

.cjk-watermark-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    max-width: 900px;
    height: auto;
    pointer-events: none;
    z-index: 0;
}

.layer-4 .stamp-label,
.layer-4 .headline,
.layer-4 .body-block {
    position: relative;
    z-index: 1;
}

/* Layer 5: The Street */
.layer-5 {
    min-height: 100vh;
    margin-top: -20vh;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(
        0% 2%, 5% 0%, 15% 1.5%, 25% 0.5%, 35% 2.2%, 45% 0.3%, 55% 1.8%, 65% 0.2%, 75% 2.5%, 85% 0.8%, 95% 1.2%, 100% 0%,
        100% 100%, 0% 100%
    );
}

.layer-5-content {
    text-align: center;
    transform: rotate(var(--layer-5-angle));
}

.coda-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 3vw, 2rem);
    color: var(--paper-base);
    letter-spacing: -0.01em;
    line-height: 1.5;
    max-width: 30ch;
    margin: 0 auto;
}

/* ============================================================
   Typography
   ============================================================ */

/* Headlines */
.headline {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--ink-primary);
    margin-bottom: 2rem;
    position: relative;
}

/* Ink bleed effect */
.headline::after {
    content: attr(data-text);
    position: absolute;
    top: 2px;
    left: 1px;
    color: var(--accent-blue);
    opacity: 0.08;
    z-index: -1;
    font-family: inherit;
    font-weight: inherit;
    font-size: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    filter: blur(1.5px);
    pointer-events: none;
}

/* Stamp animation for headlines */
.headline-stamp {
    opacity: 0;
    transform: scale(1.2);
    transition: opacity 300ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.headline-stamp.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Body blocks */
.body-block {
    max-width: 38ch;
    opacity: 0;
    transition: opacity 400ms ease;
}

.body-block.revealed {
    opacity: 1;
}

.body-block p {
    margin-bottom: 1.2em;
}

.body-block em {
    font-weight: 600;
    font-style: italic;
    color: var(--ink-primary);
}

.body-block-spear {
    margin-left: auto;
}

.body-block-shield {
    margin-right: auto;
}

.body-block-contradiction {
    margin: 0 auto;
    text-align: left;
}

/* CJK Characters */
.cjk-inline {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: 180%;
    vertical-align: middle;
    line-height: 1;
}

.cjk-large {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 8rem);
    display: block;
    margin-bottom: 1rem;
    color: var(--ink-primary);
}

.cjk-watermark {
    position: absolute;
    bottom: 10%;
    right: 5%;
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    color: var(--accent-blue);
    opacity: 0.06;
    pointer-events: none;
    user-select: none;
}

.cjk-mark {
    margin-top: 3rem;
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: 48px;
    color: var(--paper-base);
    opacity: 0.6;
}

/* Stamp labels (layer indicators) */
.stamp-label {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--shield-blue);
    display: block;
    margin-bottom: 1.5rem;
}

.stamp-label-4 {
    color: var(--accent-blue);
}

.stamp-label-5 {
    color: var(--shield-blue);
}

/* ============================================================
   Vintage Stamps
   ============================================================ */
.stamp {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--stamp-red);
    border: 3px solid var(--stamp-red);
    border-radius: 4px;
    padding: 6px 14px;
    display: inline-block;
    position: absolute;
    white-space: nowrap;
    opacity: 0.7;
}

.stamp-1 {
    bottom: 20%;
    right: 8%;
    transform: rotate(7deg);
}

.stamp-2 {
    top: 25%;
    left: 5%;
    transform: rotate(-5deg);
}

.stamp-3 {
    bottom: 15%;
    left: 10%;
    transform: rotate(11deg);
}

.stamp-4 {
    top: 20%;
    right: 5%;
    transform: rotate(8deg);
}

.stamp-5 {
    bottom: 20%;
    right: 6%;
    transform: rotate(-6deg);
}

.stamp-6 {
    bottom: 15%;
    right: 10%;
    transform: rotate(5deg);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ============================================================
   Headline Contradiction (Layer 4)
   ============================================================ */
.headline-contradiction {
    text-align: center;
    color: var(--ink-primary);
}

.layer-4 .body-block {
    color: var(--ink-primary);
}

.layer-4 .stamp-label {
    text-align: center;
}

/* ============================================================
   Layer transitions (scroll-driven)
   ============================================================ */
.layer {
    transition: opacity 0.6s ease, filter 0.6s ease;
}

.layer.faded {
    opacity: 0.4;
    filter: blur(1.5px);
}

/* Layer entry animation */
.layer-entering {
    opacity: 0.3;
    transform: translateY(20px);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .layer-content {
        padding: 8vh 5vw;
    }

    .layer-1-content {
        padding-left: 5vw;
    }

    .layer-2-content {
        margin-right: 5vw;
        transform: rotate(2deg);
    }

    .layer-3-content {
        margin-left: 5vw;
        transform: rotate(-1.5deg);
    }

    .stamp {
        font-size: 0.6rem;
        padding: 4px 10px;
        border-width: 2px;
    }

    .cjk-watermark {
        font-size: 5rem;
    }

    .headline {
        font-size: clamp(2rem, 7vw, 3.5rem);
    }

    .layer-1 .headline {
        font-size: clamp(2.5rem, 10vw, 5rem);
    }
}

@media (max-width: 480px) {
    .stamp-scattered {
        display: none;
    }

    .layer-2 {
        margin-top: -20vh;
    }

    .layer-3 {
        margin-top: -20vh;
    }

    .layer-4 {
        margin-top: -20vh;
    }

    .layer-5 {
        margin-top: -10vh;
    }
}

/* ============================================================
   Text shadow (ink bleed) for headlines
   ============================================================ */
.layer-1 .headline,
.layer-2 .headline,
.layer-3 .headline,
.layer-5 .coda-text {
    text-shadow: 2px 2px 0 rgba(58, 107, 159, 0.15);
}

.headline-contradiction {
    text-shadow: 2px 2px 0 rgba(58, 107, 159, 0.12);
}

/* ============================================================
   Selection
   ============================================================ */
::selection {
    background-color: var(--accent-blue);
    color: var(--paper-base);
}
