/* ============================================
   nonri.xyz — styles.css
   Creamy Pastel Logic Timeline
   ============================================ */

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

:root {
    --warm-ivory: #FFF8F0;
    --deep-graphite: #1A1A2E;
    --charcoal: #3D3D3D;
    --warm-gray: #5A5A5A;
    --dusty-rose: #D4A0A0;
    --soft-lavender: #B8A9D4;
    --faded-sage: #A8C4A0;
    --muted-ochre: #D4C090;
    --parchment: #F0E0D0;
    --sand-whisper: #E8D5C4;
    --cream: #F5E6D3;
    --brown-mid: #6B5B4B;
    --label-color: #9A8A7A;
    --dust-light: #D4C5B8;
}

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    font-family: 'Commissioner', sans-serif;
    background-color: var(--warm-ivory);
    color: var(--charcoal);
    overflow-x: hidden;
    position: relative;
}

/* === Star-Celestial Background === */
#stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    border-radius: 50%;
    background: var(--muted-ochre);
}

@keyframes star-drift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(10px, -15px); }
    50% { transform: translate(-8px, -25px); }
    75% { transform: translate(5px, -10px); }
    100% { transform: translate(0, 0); }
}

/* === Central Spine === */
#spine {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#spine-path {
    stroke-dasharray: 8000;
    stroke-dashoffset: 8000;
    transition: stroke 0.8s ease;
}

/* === Waypoint Navigation === */
#waypoints {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.waypoint {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--label-color);
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.3s, color 0.3s;
}

.waypoint.active {
    opacity: 1;
    color: var(--charcoal);
}

.waypoint:hover {
    opacity: 0.8;
}

/* === Chapter Base === */
.chapter {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    overflow: hidden;
    background-color: var(--warm-ivory);
    transition: background-color 1.5s ease-in-out, color 1.5s ease-in-out;
}

.chapter-content {
    position: relative;
    z-index: 10;
    max-width: 600px;
    padding: 2rem;
}

.chapter-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* === Blobs === */
.blob {
    position: absolute;
    mix-blend-mode: multiply;
    filter: blur(1px);
}

@keyframes blob-breathe {
    0%, 100% { transform: scale(1) rotate(0deg); }
    33% { transform: scale(1.05) rotate(1deg); }
    66% { transform: scale(0.97) rotate(-1deg); }
}

@keyframes blob-breathe-alt {
    0%, 100% { transform: scale(1) rotate(0deg); }
    33% { transform: scale(0.96) rotate(-1.5deg); }
    66% { transform: scale(1.04) rotate(1.5deg); }
}

.blob-breathe {
    animation: blob-breathe 10s ease-in-out infinite;
}

.blob-breathe-alt {
    animation: blob-breathe-alt 12s ease-in-out infinite;
}

/* === Premise Section === */
.premise-content {
    text-align: center;
}

.premise-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(5rem, 12vw, 8rem);
    color: var(--charcoal);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.char-3d {
    display: inline-block;
    opacity: 0;
    animation: char-fade-in 0.8s ease forwards;
}

.char-left {
    transform: perspective(800px) rotateY(-2deg);
    animation-delay: 0.2s;
}

.char-right {
    transform: perspective(800px) rotateY(2deg);
    animation-delay: 0.6s;
}

@keyframes char-fade-in {
    0% { opacity: 0; transform: perspective(800px) rotateY(0deg) translateY(20px); }
    100% { opacity: 1; }
}

.char-left {
    animation: char-fade-left 0.8s ease 0.2s forwards;
}

.char-right {
    animation: char-fade-right 0.8s ease 0.6s forwards;
}

@keyframes char-fade-left {
    0% { opacity: 0; transform: perspective(800px) rotateY(-8deg) translateY(20px); }
    100% { opacity: 1; transform: perspective(800px) rotateY(-2deg) translateY(0); }
}

@keyframes char-fade-right {
    0% { opacity: 0; transform: perspective(800px) rotateY(8deg) translateY(20px); }
    100% { opacity: 1; transform: perspective(800px) rotateY(2deg) translateY(0); }
}

.premise-subtitle {
    font-weight: 300;
    font-size: 18px;
    color: var(--label-color);
    opacity: 0;
    animation: fade-in 1s ease 1s forwards;
}

@keyframes fade-in {
    to { opacity: 1; }
}

/* === Chapter Headers === */
.chapter-header {
    margin-bottom: 2rem;
}

.symbol {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--charcoal);
    letter-spacing: -0.02em;
    display: block;
    line-height: 1;
}

.chapter-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--charcoal);
    letter-spacing: -0.02em;
    margin-top: 0.5rem;
}

/* === Body Text === */
.body-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: var(--warm-gray);
    max-width: 520px;
    margin-bottom: 1.25rem;
}

code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--brown-mid);
    background: var(--parchment);
    padding: 0 4px;
    border-radius: 2px;
}

/* === Tilt Cards === */
.tilt-card {
    background: var(--warm-ivory);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
    padding: 2rem;
    border-radius: 8px;
    will-change: transform;
    transition: transform 0.15s ease-out;
}

/* === Truth Display (Conjunction) === */
.truth-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem;
}

.truth-blob {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

.truth-p {
    background-color: var(--dusty-rose);
}

.truth-q {
    background-color: var(--faded-sage);
}

.truth-blob:hover {
    transform: scale(1.1);
}

.truth-blob[data-value="F"] {
    background-color: var(--label-color);
}

.truth-operator, .truth-result {
    color: var(--warm-gray);
    font-size: 1.2rem;
}

.truth-value {
    font-weight: 700;
    color: var(--faded-sage);
    transition: color 0.3s;
}

.truth-value.false {
    color: var(--dusty-rose);
}

/* === Negation Section === */
.chapter-negation {
    background-color: var(--warm-ivory);
}

.chapter-negation.inverted {
    background-color: var(--deep-graphite);
}

.chapter-negation.inverted .symbol,
.chapter-negation.inverted .chapter-title {
    color: var(--cream);
}

.chapter-negation.inverted .body-text {
    color: #C8B8A8;
}

.chapter-negation.inverted .tilt-card {
    background: rgba(255, 248, 240, 0.05);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.chapter-negation.inverted code {
    background: rgba(240, 224, 208, 0.15);
    color: #C8B8A8;
}

.negation-blob {
    filter: none;
    mix-blend-mode: normal;
}

@keyframes negation-oscillate {
    0%, 100% { background-color: var(--deep-graphite); }
    50% { background-color: var(--warm-ivory); }
}

.chapter-negation.oscillating {
    animation: negation-oscillate 8s ease-in-out infinite;
}

.chapter-negation.oscillating .symbol,
.chapter-negation.oscillating .chapter-title {
    transition: color 4s ease-in-out;
}

/* === Implication Cascade === */
.implication-cascade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.cascade-star {
    position: absolute;
    border-radius: 50%;
    background: var(--muted-ochre);
    opacity: 0;
    animation: cascade-fall 4s ease-in infinite;
}

@keyframes cascade-fall {
    0% { opacity: 0; transform: translateY(0) scale(1); }
    10% { opacity: 0.4; }
    90% { opacity: 0.2; }
    100% { opacity: 0; transform: translateY(300px) scale(0.3); }
}

/* === Paradox Orbit === */
.paradox-orbit {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.orbit-star {
    position: absolute;
    border-radius: 50%;
    background: var(--soft-lavender);
}

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(120px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(120px) rotate(-360deg); }
}

/* === Glitch Effect === */
@keyframes glitch-text {
    0%, 100% { transform: translateX(0); text-shadow: none; }
    25% { transform: translateX(3px); text-shadow: -3px 0 var(--dusty-rose); }
    50% { transform: translateX(-2px); text-shadow: 2px 0 var(--faded-sage); }
    75% { transform: translateX(4px); text-shadow: -4px 0 var(--soft-lavender); }
}

.glitch-active .chapter-title,
.glitch-active .symbol {
    animation: glitch-text 0.4s steps(1) forwards;
}

.glitch-active .blob {
    animation: glitch-blob 0.4s steps(1) forwards;
}

@keyframes glitch-blob {
    0%, 100% { clip-path: none; }
    33% { clip-path: inset(0 0 66% 0); transform: translateX(5px); }
    66% { clip-path: inset(33% 0 33% 0); transform: translateX(-3px); }
}

.glitch-flash {
    filter: hue-rotate(180deg);
    transition: filter 0.1s;
}

/* === Responsive === */
@media (max-width: 768px) {
    #waypoints {
        right: 0.75rem;
        gap: 1rem;
    }

    .waypoint {
        font-size: 0.65rem;
    }

    .chapter-content {
        padding: 1.5rem;
    }

    .tilt-card {
        padding: 1.5rem;
    }

    .premise-title {
        font-size: clamp(3.5rem, 15vw, 6rem);
    }
}

/* === Section reveal animation === */
.chapter-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.chapter-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.premise-content {
    opacity: 1;
    transform: none;
}
