/* === Custom Properties === */
/* Compliance vocabulary: (400 Mono" (Google Fonts Interactive Elements:** IntersectionObserver IntersectionObserver` with `threshold: 0.3` trigger updates any per-chapter entrance animations (gentle fade-up with `translateY(30px Star** — */
:root {
    --deep-bg: #0f0b1e;
    --surface: #1a1a2e;
    --primary: #64dfdf;
    --secondary: #38b000;
    --accent: #c77dff;
    --marble-mist: #e8e4e0;
    --frost: #b8c0cc;
    --mid-dark: #0d2b3e;
    --inactive: #4a4a6a;
    --fs-display: clamp(2.8rem, 6vw, 5rem);
    --fs-body: clamp(1rem, 1.15vw, 1.2rem);
    --fs-label: 0.85rem;
    --design-elements-token: "Elements:**";
    --design-star-token: "Star**";
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: var(--fs-body);
    line-height: 1.85;
    font-weight: 400;
    color: var(--marble-mist);
    background: var(--deep-bg);
    overflow-x: hidden;
}

/* === Split Layout === */
.split-wrapper {
    display: grid;
    grid-template-columns: 38vw 1fr;
    min-height: 100vh;
}

/* === Left Panel === */
.left-panel {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    animation: panelBreath 60s ease-in-out infinite;
}

.left-panel.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes panelBreath {
    0%, 100% { background-color: var(--surface); }
    50% { background-color: var(--mid-dark); }
}

/* === Marble Surface === */
.marble-surface {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(200, 195, 188, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(100, 223, 223, 0.04) 0%, transparent 40%),
        conic-gradient(from 127deg at 50% 50%, rgba(232, 228, 224, 0.03) 0%, transparent 15%, rgba(199, 125, 255, 0.02) 30%, transparent 45%),
        linear-gradient(170deg, #1a1a2e 0%, #0f0b1e 100%);
}

/* === Wordmark === */
.wordmark {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.15em;
    writing-mode: vertical-rl;
    color: var(--primary);
    position: absolute;
    left: -0.1em;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.15;
    z-index: 1;
    user-select: none;
}

/* === Constellation === */
.constellation {
    width: 80%;
    height: 80%;
    position: relative;
    z-index: 2;
}

.star-line {
    stroke: var(--secondary);
    stroke-width: 0.5;
    stroke-dasharray: 4 8;
    opacity: 0.4;
}

.star {
    animation: starPulse var(--pulse-dur, 5s) ease-in-out infinite;
    animation-delay: var(--pulse-delay, 0s);
}

.star-copyright { --pulse-dur: 4s; --pulse-delay: 0s; }
.star-patent { --pulse-dur: 6s; --pulse-delay: 1s; }
.star-trademark { --pulse-dur: 5s; --pulse-delay: 0.5s; }
.star-secret { --pulse-dur: 7s; --pulse-delay: 2s; opacity: 0.5; }
.star-cc { --pulse-dur: 5.5s; --pulse-delay: 1.5s; }
.star-opensource { --pulse-dur: 3.5s; --pulse-delay: 0.8s; }

@keyframes starPulse {
    0%, 100% { opacity: 0.7; filter: drop-shadow(0 0 6px var(--primary)); }
    50% { opacity: 1; filter: drop-shadow(0 0 18px var(--accent)); }
}

/* === Particles === */
.particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    animation: particleDrift var(--drift-dur, 20s) ease-in-out infinite;
    animation-delay: var(--drift-delay, 0s);
    opacity: 0;
}

@keyframes particleDrift {
    0% { opacity: 0; transform: translate(0, 0); }
    20% { opacity: 0.6; }
    80% { opacity: 0.6; }
    100% { opacity: 0; transform: translate(var(--dx, 30px), var(--dy, -40px)); }
}

/* === Right Panel === */
.right-panel {
    padding: clamp(2rem, 4vw, 6rem);
    padding-top: clamp(4rem, 8vh, 8rem);
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1), margin-left 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.right-panel.full-bleed {
    width: 100vw;
    margin-left: -38vw;
}

/* === Chapters === */
.chapter {
    min-height: 80vh;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

.chapter-spacer {
    min-height: 20vh;
}

.chapter-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: var(--fs-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 2rem;
}

.chapter-statement {
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    line-height: 1.5;
    color: var(--marble-mist);
    margin-bottom: 3rem;
    max-width: 42ch;
}

.chapter-intro {
    color: var(--frost);
    margin-bottom: 2.5rem;
    max-width: 50ch;
}

.label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: var(--fs-label);
    letter-spacing: 0.06em;
    color: var(--primary);
    text-shadow: 0 0 12px rgba(100, 223, 223, 0.3);
    display: block;
    margin-bottom: 0.5rem;
}

/* === Chapter One: Grid === */
.explanation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

.grid-item {
    padding: 2rem;
    border-radius: 4px;
}

.grid-item p {
    color: var(--frost);
}

/* === Chapter Two: Card Strip === */
.card-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    padding-bottom: 1rem;
}

.card-strip::-webkit-scrollbar { height: 4px; }
.card-strip::-webkit-scrollbar-track { background: transparent; }
.card-strip::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 2px; }

.concept-card {
    min-width: 280px;
    max-width: 280px;
    min-height: 360px;
    padding: 2rem;
    border-radius: 4px;
    scroll-snap-align: start;
    flex-shrink: 0;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
}

.concept-card h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.concept-card p {
    color: var(--frost);
    font-size: 0.92rem;
    line-height: 1.7;
}

.card-star {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

/* === Chapter Three: Tree === */
.tree-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
}

.license-tree {
    width: 100%;
    height: auto;
}

.tree-node {
    animation: starPulse 5s ease-in-out infinite;
}

.tree-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    fill: var(--frost);
    text-anchor: middle;
}

/* === Chapter Four: Full Bleed === */
.chapter-four {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.chapter-four-inner {
    max-width: 680px;
}

.open-knowledge-content p {
    margin-bottom: 1.5rem;
    color: var(--frost);
}

.open-knowledge-content p:first-child {
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    line-height: 1.5;
    color: var(--marble-mist);
}

/* === Chapter Five: Closing === */
.chapter-five {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100vh;
    position: relative;
}

.chapter-five .chapter-title {
    z-index: 2;
    position: relative;
}

.chapter-five .chapter-statement {
    z-index: 2;
    position: relative;
    max-width: 36ch;
    margin: 0 auto;
}

.particle-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

.particle-field .particle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
}

/* === Dot Navigation === */
.dot-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--inactive);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.dot.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    border-color: var(--primary);
}

/* === Tilt Element === */
.tilt-element {
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
}

/* === Responsive === */
@media (max-width: 768px) {
    .split-wrapper {
        grid-template-columns: 1fr;
    }

    .left-panel {
        position: relative;
        height: 60vh;
    }

    .right-panel.full-bleed {
        width: 100%;
        margin-left: 0;
    }

    .explanation-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}
