/* ================================================
   mosun.xyz — Styles
   Dark-mode scholarly + cyberpunk neon
   Diagonal-sections layout with 7-degree angles
   ================================================ */

/* === CSS Custom Properties === */
:root {
    --color-bg-primary: #06080f;
    --color-bg-secondary: #0a0e27;
    --color-bg-tertiary: #141829;
    --color-divider: #1e2340;
    --color-text-primary: #ffffff;
    --color-text-body: #c8ccd8;
    --color-text-muted: #5c6178;
    --color-accent-pink: #ff2d78;
    --color-accent-cyan: #3df5c4;
    --color-accent-amber: #ffb833;
    --color-glow-pink: #ff2d7833;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --angle: 7deg;
    --scroll-progress: 0;
}

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

html {
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-primary);
    color: var(--color-text-body);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Neon Particle Dust === */
.particle-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: drift linear infinite;
}

@keyframes drift {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: var(--p-opacity);
    }
    90% {
        opacity: var(--p-opacity);
    }
    100% {
        transform: translateY(-10vh) translateX(var(--p-drift-x));
        opacity: 0;
    }
}

/* === Section Navigation === */
.section-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-dot {
    width: 2px;
    height: 24px;
    background: var(--color-text-muted);
    border-radius: 1px;
    transition: background 0.4s ease, height 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
}

.nav-dot-active {
    height: 40px;
    background: var(--color-accent-cyan);
    box-shadow: 0 0 8px var(--color-accent-cyan);
}

/* === Diagonal Glow Line === */
.diagonal-glow-line {
    position: fixed;
    top: -20%;
    left: 50%;
    width: 2px;
    height: 140%;
    background: linear-gradient(to bottom, transparent, var(--color-accent-pink), var(--color-accent-cyan), transparent);
    transform: rotate(calc(7deg + var(--scroll-progress) * 2deg));
    transform-origin: center center;
    z-index: 100;
    pointer-events: none;
    opacity: 0.3;
    animation: pulse-glow 4s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    0% {
        opacity: 0.15;
        filter: blur(1px);
        box-shadow: 0 0 20px var(--color-accent-pink), 0 0 60px var(--color-glow-pink);
    }
    100% {
        opacity: 0.4;
        filter: blur(0px);
        box-shadow: 0 0 20px var(--color-accent-cyan), 0 0 60px rgba(61, 245, 196, 0.2);
    }
}

/* === Panel Base === */
.panel {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(48px, 8vh, 120px) clamp(24px, 4vw, 80px);
    scroll-snap-align: start;
}

.panel-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    width: 100%;
}

/* === Panel Grid Overlay === */
.panel-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(93, 97, 120, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(93, 97, 120, 0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 1;
    pointer-events: none;
}

/* === Watermark Glyphs === */
.watermark-glyph {
    position: absolute;
    font-family: var(--font-display);
    font-size: 400px;
    font-weight: 700;
    opacity: 0.04;
    color: var(--color-text-primary);
    pointer-events: none;
    z-index: 1;
    line-height: 1;
    user-select: none;
}

.watermark-left {
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
}

.watermark-right {
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
}

.watermark-center {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* === Diagonal Transitions === */
.diagonal-transition {
    position: absolute;
    top: -1px;
    left: -5%;
    width: 110%;
    height: 120px;
    z-index: 3;
    pointer-events: none;
}

.diagonal-transition-1 {
    background: var(--color-bg-primary);
    clip-path: polygon(0 0, 100% 0, 100% 30%, 0 100%);
}

.diagonal-transition-2 {
    background: var(--color-bg-secondary);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 30%);
}

.diagonal-transition-3 {
    background: var(--color-bg-tertiary);
    clip-path: polygon(0 0, 100% 0, 100% 30%, 0 100%);
}

.diagonal-transition-4 {
    background: var(--color-bg-secondary);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 30%);
}

.diagonal-transition-5 {
    background: var(--color-bg-tertiary);
    clip-path: polygon(0 0, 100% 0, 100% 30%, 0 100%);
}

/* === Logic Gate Border === */
.logic-border {
    position: absolute;
    z-index: 4;
    pointer-events: none;
}

.logic-border-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Ctext x='4' y='12' font-family='monospace' font-size='12' fill='%231e2340' opacity='0.6'%3E∧ ∨ ¬ →%3C/text%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 96px 16px;
    background-position: center;
    opacity: 0.5;
}

/* === Hero Panel === */
.panel-hero {
    background: var(--color-bg-primary);
    flex-direction: column;
    text-align: center;
    min-height: 100vh;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}

.panel-hero .panel-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.hero-kanji {
    font-family: var(--font-display);
    font-size: clamp(80px, 15vw, 200px);
    font-weight: 700;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, var(--color-accent-pink), var(--color-accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    opacity: 0;
    transform: translateY(30px);
    animation: hero-fade-in 1.2s ease-out 0.3s forwards;
}

/* Neon glow warm-up on hero title */
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 144px);
    font-weight: 700;
    color: var(--color-accent-pink);
    letter-spacing: 0.15em;
    line-height: 1.15;
    opacity: 0;
    transform: translateY(30px);
    animation: hero-fade-in 1.2s ease-out 0.6s forwards, neon-warmup 2s ease-out 1.8s forwards;
    text-shadow: none;
}

@keyframes neon-warmup {
    0% {
        text-shadow: none;
    }
    100% {
        text-shadow: 0 0 10px currentColor, 0 0 40px rgba(255, 45, 120, 0.3), 0 0 80px rgba(255, 45, 120, 0.1);
    }
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: clamp(12px, 1.5vw, 18px);
    color: var(--color-text-muted);
    letter-spacing: 0.06em;
    opacity: 0;
    transform: translateY(20px);
    animation: hero-fade-in 1s ease-out 1s forwards;
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 60px;
    opacity: 0;
    animation: hero-fade-in 1s ease-out 1.4s forwards;
}

.scroll-indicator-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.scroll-indicator-arrow {
    animation: bounce-arrow 2s ease-in-out infinite;
}

.scroll-indicator-arrow svg {
    display: block;
}

@keyframes hero-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* === Neon Text Glow Classes === */
.neon-text-pink {
    text-shadow: 0 0 10px var(--color-accent-pink), 0 0 40px rgba(255, 45, 120, 0.3), 0 0 80px rgba(255, 45, 120, 0.1);
}

.neon-text-cyan {
    text-shadow: 0 0 10px var(--color-accent-cyan), 0 0 40px rgba(61, 245, 196, 0.3), 0 0 80px rgba(61, 245, 196, 0.1);
}

.neon-text-amber {
    text-shadow: 0 0 10px var(--color-accent-amber), 0 0 40px rgba(255, 184, 51, 0.3), 0 0 80px rgba(255, 184, 51, 0.1);
}

/* === Content Panels === */
.panel-spear {
    background: var(--color-bg-secondary);
    clip-path: polygon(0 12%, 100% 0, 100% 88%, 0 100%);
    margin-top: -12vh;
}

.panel-shield {
    background: var(--color-bg-tertiary);
    clip-path: polygon(0 0, 100% 12%, 100% 100%, 0 88%);
    margin-top: -12vh;
}

.panel-collision {
    background: var(--color-bg-secondary);
    clip-path: polygon(0 12%, 100% 0, 100% 88%, 0 100%);
    margin-top: -12vh;
}

.panel-resolution {
    background: var(--color-bg-tertiary);
    clip-path: polygon(0 0, 100% 12%, 100% 100%, 0 88%);
    margin-top: -12vh;
}

.panel-coda {
    background: var(--color-bg-primary);
    min-height: 60vh;
    margin-top: -12vh;
}

/* === Collision Racing Lines + Flash === */
.collision-flash {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0;
    z-index: 5;
    pointer-events: none;
}

.collision-flash.active {
    animation: flash-burst 0.4s ease-out forwards;
}

@keyframes flash-burst {
    0% { opacity: 0; }
    30% { opacity: 1; }
    100% { opacity: 0; }
}

.collision-racing-lines {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.racing-line {
    position: absolute;
    top: 50%;
    height: 2px;
    width: 0;
    transform: rotate(7deg);
}

.racing-line-pink {
    left: 0;
    background: linear-gradient(90deg, transparent, var(--color-accent-pink));
    transform-origin: left center;
}

.racing-line-cyan {
    right: 0;
    background: linear-gradient(270deg, transparent, var(--color-accent-cyan));
    transform-origin: right center;
}

.racing-line-pink.active {
    animation: race-from-left 0.6s ease-out forwards;
}

.racing-line-cyan.active {
    animation: race-from-right 0.6s ease-out forwards;
}

@keyframes race-from-left {
    0% { width: 0; }
    100% { width: 55%; }
}

@keyframes race-from-right {
    0% { width: 0; }
    100% { width: 55%; }
}

/* === Collision Heading — Chromatic Split === */
.panel-collision .section-heading {
    position: relative;
    display: inline-block;
}

.collision-text {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 144px);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.collision-text-pink {
    color: var(--color-accent-pink);
    text-shadow: 0 0 10px var(--color-accent-pink), 0 0 40px rgba(255, 45, 120, 0.3);
}

.collision-text-cyan {
    position: absolute;
    left: 3px;
    top: 1px;
    color: var(--color-accent-cyan);
    text-shadow: 0 0 10px var(--color-accent-cyan), 0 0 40px rgba(61, 245, 196, 0.3);
    mix-blend-mode: screen;
    opacity: 0.7;
}

/* === Section Markers === */
.section-marker {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.section-number {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-accent-cyan);
    letter-spacing: 0.1em;
    padding: 4px 12px;
    border: 1px solid rgba(61, 245, 196, 0.3);
    border-radius: 2px;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* === Section Headings === */
.section-heading {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 144px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 40px;
}

.panel-spear .section-heading {
    color: var(--color-accent-pink);
}

.panel-shield .section-heading {
    color: var(--color-accent-cyan);
}

.panel-resolution .section-heading {
    color: var(--color-accent-amber);
}

.heading-translation {
    font-family: var(--font-mono);
    font-size: clamp(14px, 2vw, 24px);
    font-weight: 400;
    color: var(--color-text-muted);
    vertical-align: middle;
    margin-left: 12px;
    -webkit-text-fill-color: initial;
}

/* === Content Blocks === */
.content-block {
    max-width: 680px;
}

.content-lead {
    font-family: var(--font-display);
    font-size: clamp(18px, 2.5vw, 28px);
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
    margin-bottom: 28px;
    font-style: italic;
}

.content-body {
    font-family: var(--font-body);
    font-size: clamp(16px, 1.2vw, 20px);
    font-weight: 400;
    color: var(--color-text-body);
    line-height: 1.72;
    margin-top: 24px;
}

/* === Proof Blocks === */
.proof-block {
    font-family: var(--font-mono);
    font-size: clamp(12px, 0.9vw, 14px);
    background: rgba(10, 14, 39, 0.6);
    border-left: 3px solid var(--color-text-muted);
    padding: 20px 24px;
    margin: 20px 0;
    border-radius: 0 4px 4px 0;
}

.panel-spear .proof-block {
    border-left-color: var(--color-accent-pink);
}

.panel-shield .proof-block {
    border-left-color: var(--color-accent-cyan);
}

.collision-proof {
    border-left-color: var(--color-accent-amber);
}

.resolution-proof {
    border-left-color: var(--color-accent-amber);
}

.proof-line {
    color: var(--color-text-body);
    padding: 4px 0;
    line-height: 1.6;
    letter-spacing: 0.06em;
}

.proof-symbol {
    color: var(--color-accent-cyan);
    margin-right: 8px;
    font-weight: 700;
}

.proof-divider {
    color: var(--color-text-muted);
    opacity: 0.5;
    user-select: none;
}

.proof-contradiction {
    color: var(--color-accent-pink);
    font-weight: 700;
    font-size: 1.1em;
}

.proof-contradiction .proof-symbol {
    color: var(--color-accent-pink);
}

.proof-resolution {
    color: var(--color-accent-amber);
    font-weight: 700;
}

.proof-resolution .proof-symbol {
    color: var(--color-accent-amber);
}

/* === Visual Motifs (SVGs) === */
.visual-motif {
    position: absolute;
    right: -5%;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 300px;
    opacity: 0.15;
    pointer-events: none;
}

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

.orbit-circle {
    animation: orbit-rotate 30s linear infinite;
    transform-origin: center;
}

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

/* Collision motif special styles */
.collision-point {
    fill: var(--color-accent-amber);
    animation: collision-pulse 2s ease-in-out infinite;
}

@keyframes collision-pulse {
    0%, 100% { r: 6; opacity: 0.8; }
    50% { r: 12; opacity: 1; }
}

.collision-ring {
    animation: collision-expand 3s ease-out infinite;
    transform-origin: center;
}

.collision-ring-1 { animation-delay: 0s; }
.collision-ring-2 { animation-delay: 1s; }
.collision-ring-3 { animation-delay: 2s; }

@keyframes collision-expand {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.8); }
}

/* === CRT Terminal === */
.crt-terminal {
    margin-top: 48px;
    background: rgba(6, 8, 15, 0.9);
    border: 1px solid rgba(61, 245, 196, 0.2);
    border-radius: 8px;
    overflow: hidden;
    max-width: 520px;
    box-shadow: 0 0 30px rgba(61, 245, 196, 0.05), inset 0 0 60px rgba(6, 8, 15, 0.5);
}

.crt-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(20, 24, 41, 0.8);
    border-bottom: 1px solid rgba(92, 97, 120, 0.2);
}

.crt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.crt-dot-red { background: #ff5f57; }
.crt-dot-yellow { background: #febc2e; }
.crt-dot-green { background: #28c840; }

.crt-title {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: 8px;
}

.crt-body {
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.8;
}

.crt-line {
    color: var(--color-text-body);
}

.crt-prompt {
    color: var(--color-accent-cyan);
    margin-right: 8px;
}

.crt-keyword {
    color: var(--color-accent-pink);
}

.crt-comment {
    color: var(--color-text-muted);
    font-style: italic;
}

.crt-indent {
    display: inline-block;
    width: 32px;
}

.crt-cursor {
    color: var(--color-accent-cyan);
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* === Scholar's Desk Motif === */
.scholar-desk {
    position: relative;
    width: 280px;
    height: 180px;
    margin-top: 60px;
}

.desk-surface {
    position: absolute;
    left: 20px;
    top: 30px;
    width: 240px;
    height: 120px;
    border: 1px solid var(--color-divider);
    background: var(--color-bg-tertiary);
    border-radius: 2px;
}

.desk-brush {
    position: absolute;
    left: 60px;
    top: 70px;
    width: 160px;
    height: 2px;
    background: var(--color-accent-pink);
    box-shadow: 0 0 8px var(--color-accent-pink);
}

.desk-inkstone {
    position: absolute;
    left: 200px;
    top: 60px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--color-accent-cyan);
    box-shadow: 0 0 8px var(--color-accent-cyan);
}

.desk-scroll {
    position: absolute;
    left: 40px;
    top: 45px;
    width: 16px;
    height: 80px;
    border: 1px solid var(--color-text-body);
    border-radius: 2px;
}

/* === Coda Panel === */
.panel-content-coda {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

.coda-symbol {
    font-family: var(--font-mono);
    font-size: clamp(48px, 8vw, 96px);
    color: var(--color-accent-amber);
    line-height: 1;
    opacity: 0.6;
}

.coda-text {
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 48px);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.coda-subtext {
    font-family: var(--font-mono);
    font-size: clamp(11px, 1.2vw, 15px);
    color: var(--color-text-muted);
    letter-spacing: 0.05em;
}

/* === Scroll-Reveal Animations === */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--delay, 0ms);
}

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

/* Hero content is always visible (animated via keyframes) */
.panel-hero .panel-content {
    opacity: 1;
    transform: none;
}

/* === Responsive === */
@media (max-width: 768px) {
    :root {
        --angle: 4deg;
    }

    .panel {
        padding: 60px 24px;
    }

    .panel-spear,
    .panel-shield,
    .panel-collision,
    .panel-resolution {
        margin-top: -6vh;
    }

    .visual-motif {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 200px;
        height: 200px;
        margin: 40px auto 0;
        opacity: 0.2;
    }

    .diagonal-transition {
        height: 80px;
    }

    .crt-terminal {
        max-width: 100%;
    }

    .proof-block {
        padding: 16px 20px;
        font-size: 12px;
    }

    .section-heading {
        font-size: clamp(36px, 12vw, 96px);
    }

    .watermark-glyph {
        font-size: 200px;
    }

    .section-nav {
        right: 12px;
    }

    .racing-line {
        display: none;
    }

    .scholar-desk {
        transform: scale(0.8);
        transform-origin: top left;
    }
}

@media (max-width: 480px) {
    .panel {
        padding: 40px 16px;
    }

    .panel-hero,
    .panel-spear,
    .panel-shield,
    .panel-collision,
    .panel-resolution {
        clip-path: none;
    }

    .hero-kanji {
        font-size: clamp(60px, 20vw, 120px);
    }

    .section-marker {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .watermark-glyph {
        display: none;
    }

    .section-nav {
        display: none;
    }
}
