/* ============================================
   mujun.wiki - Maximalist Technical Elegance
   Palette: Sapphire #0D47A1, Emerald #1B5E20,
   Amethyst #4A148C, Ruby #880E4F, Gold #D4AF37,
   Silver #C0C0C0, Off-white #F5F3F0,
   Dark text #2C2C3C, Light accent #E8E4E0
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2vw, 1.125rem);
    line-height: 1.65;
    color: #2C2C3C;
    background-color: #F5F3F0;
    overflow-x: hidden;
    position: relative;
}

/* ---- Particle Canvas ---- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ---- Circuit SVG Overlay ---- */
#circuit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ---- Section Base ---- */
.section {
    position: relative;
    z-index: 2;
    padding: clamp(3rem, 8vw, 7rem) clamp(1.5rem, 5vw, 4rem);
    overflow: hidden;
}

.section__inner {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.section__inner--wide {
    max-width: 1100px;
}

/* ---- Section Backgrounds via box-shadow/transform for depth ---- */
.section--hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2C2C3C;
    box-shadow: 0 8px 40px rgba(13, 71, 161, 0.15);
    transform: translateZ(0);
}

.section--architecture {
    background: #F5F3F0;
    box-shadow: 0 6px 30px rgba(27, 94, 32, 0.1), inset 0 2px 0 #E8E4E0;
    transform: translateZ(0);
}

.section--taxonomy {
    background: #2C2C3C;
    box-shadow: 0 10px 50px rgba(74, 20, 140, 0.15);
    transform: translateZ(0);
}

.section--featured {
    background: #F5F3F0;
    box-shadow: 0 6px 30px rgba(136, 14, 79, 0.1), inset 0 2px 0 #E8E4E0;
    transform: translateZ(0);
}

.section--systems {
    background: #2C2C3C;
    box-shadow: 0 10px 50px rgba(13, 71, 161, 0.15);
    transform: translateZ(0);
}

.section--footer {
    background: #1a1a28;
    padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 5vw, 4rem);
}

/* ---- Geometric Background Shapes ---- */
.geo-shape {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    opacity: 0.06;
    transition: transform 0.8s ease;
}

.geo-hexagon {
    width: 120px;
    height: 120px;
    background: transparent;
    border: 1.5px solid #0D47A1;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.geo-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1.5px solid #4A148C;
}

.geo-polygon {
    width: 100px;
    height: 100px;
    border: 1.5px solid #1B5E20;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

/* Dark sections get brighter shapes */
.section--hero .geo-shape,
.section--taxonomy .geo-shape,
.section--systems .geo-shape {
    opacity: 0.08;
}

.section--hero .geo-hexagon { border-color: #D4AF37; }
.section--hero .geo-circle { border-color: #C0C0C0; }
.section--taxonomy .geo-hexagon { border-color: #4A148C; }
.section--taxonomy .geo-circle { border-color: #D4AF37; }
.section--systems .geo-hexagon { border-color: #0D47A1; }
.section--systems .geo-circle { border-color: #1B5E20; }

/* ---- Typography ---- */
h1, h2, h3, h4 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.15;
}

.section__title {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.section__title--sapphire {
    color: #0D47A1;
    text-shadow: 2px 2px 8px rgba(13, 71, 161, 0.15);
}

.section__title--emerald {
    color: #1B5E20;
    text-shadow: 2px 2px 8px rgba(27, 94, 32, 0.15);
}

.section__title--amethyst {
    color: #4A148C;
    text-shadow: 2px 2px 8px rgba(74, 20, 140, 0.15);
}

.section__title--ruby {
    color: #880E4F;
    text-shadow: 2px 2px 8px rgba(136, 14, 79, 0.15);
}

/* Titles on dark backgrounds */
.section--taxonomy .section__title--amethyst {
    color: #b388ff;
    text-shadow: 2px 2px 12px rgba(74, 20, 140, 0.3);
}

.section--systems .section__title--sapphire {
    color: #82b1ff;
    text-shadow: 2px 2px 12px rgba(13, 71, 161, 0.3);
}

.section__lead {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    letter-spacing: 0.04em;
    color: #2C2C3C;
    margin-bottom: 2.5rem;
    max-width: 700px;
}

.section--taxonomy .section__lead,
.section--systems .section__lead {
    color: #E8E4E0;
}

/* Mono accent text */
.mono-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mono-label--gold { color: #D4AF37; }
.mono-label--silver { color: #C0C0C0; }
.mono-label--sapphire { color: #0D47A1; }
.mono-label--emerald { color: #1B5E20; }
.mono-label--amethyst { color: #4A148C; }
.mono-label--ruby { color: #880E4F; }

/* ---- Hero Section ---- */
.hero__glitch-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.hero__title {
    font-size: clamp(3rem, 10vw, 7rem);
    color: #F5F3F0;
    letter-spacing: 0.12em;
    position: relative;
    z-index: 3;
    background: linear-gradient(135deg, #D4AF37, #F5F3F0, #D4AF37);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero__glitch {
    position: absolute;
    top: 0;
    left: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 0;
    z-index: 2;
}

.hero__glitch--sapphire {
    color: #0D47A1;
    transform: translate(3px, -2px);
    animation: glitch-sapphire 8s infinite;
}

.hero__glitch--ruby {
    color: #880E4F;
    transform: translate(-3px, 2px);
    animation: glitch-ruby 8s infinite;
}

@keyframes glitch-sapphire {
    0%, 92%, 100% { opacity: 0; }
    93% { opacity: 0.4; transform: translate(4px, -3px); }
    94% { opacity: 0; }
    96% { opacity: 0.3; transform: translate(-2px, 1px); }
    97% { opacity: 0; }
}

@keyframes glitch-ruby {
    0%, 90%, 100% { opacity: 0; }
    91% { opacity: 0.35; transform: translate(-4px, 3px); }
    92% { opacity: 0; }
    95% { opacity: 0.25; transform: translate(2px, -1px); }
    96% { opacity: 0; }
}

.hero__subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    color: #E8E4E0;
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 0.8s 0.5s forwards;
}

.hero__meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    opacity: 0;
    animation: fadeInUp 0.8s 0.8s forwards;
}

.meta-tag {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.meta-tag__label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: #C0C0C0;
}

.meta-tag__value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.9rem;
    color: #D4AF37;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Connector Lines ---- */
.connector-line {
    position: relative;
    margin: 2rem auto 0;
}

.connector-line--vertical {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, #D4AF37, transparent);
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.section--hero .connector-line--vertical,
.section--taxonomy .connector-line--vertical,
.section--systems .connector-line--vertical {
    background: linear-gradient(to bottom, #D4AF37, transparent);
}

.section--architecture .connector-line--vertical {
    background: linear-gradient(to bottom, #1B5E20, transparent);
}

.section--featured .connector-line--vertical {
    background: linear-gradient(to bottom, #880E4F, transparent);
}

/* ---- Gradient Mesh Transitions ---- */
.gradient-mesh {
    height: clamp(60px, 8vw, 120px);
    position: relative;
    z-index: 2;
}

.gradient-mesh--sapphire-emerald {
    background: linear-gradient(135deg, #0D47A1 0%, #145a2a 40%, #1B5E20 100%);
}

.gradient-mesh--emerald-amethyst {
    background: linear-gradient(135deg, #1B5E20 0%, #2d3a6e 40%, #4A148C 100%);
}

.gradient-mesh--amethyst-ruby {
    background: linear-gradient(135deg, #4A148C 0%, #6a1165 40%, #880E4F 100%);
}

.gradient-mesh--ruby-sapphire {
    background: linear-gradient(135deg, #880E4F 0%, #4a2b78 40%, #0D47A1 100%);
}

/* ---- Cards (Architecture Section) ---- */
.card-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.card--elevated {
    box-shadow: 0 4px 20px rgba(44, 44, 60, 0.08), 0 1px 4px rgba(44, 44, 60, 0.04);
}

.card--elevated:hover {
    box-shadow: 0 8px 40px rgba(44, 44, 60, 0.14), 0 2px 8px rgba(44, 44, 60, 0.08);
    transform: translateY(-2px);
}

.card__accent-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.card__accent-bar--sapphire { background: #0D47A1; }
.card__accent-bar--emerald { background: #1B5E20; }
.card__accent-bar--amethyst { background: #4A148C; }
.card__accent-bar--ruby { background: #880E4F; }

.card__title {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: #2C2C3C;
    margin-bottom: 0.75rem;
}

.card__text {
    color: #2C2C3C;
    margin-bottom: 1rem;
    line-height: 1.65;
}

.card__meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.card__meta .mono-label {
    color: #C0C0C0;
}

/* ---- Taxonomy Grid ---- */
.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.taxonomy-node {
    background: rgba(245, 243, 240, 0.05);
    border: 1px solid rgba(232, 228, 224, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.taxonomy-node:hover {
    background: rgba(245, 243, 240, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.08);
}

.taxonomy-node__icon {
    margin-bottom: 1rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.taxonomy-node:hover .taxonomy-node__icon {
    opacity: 1;
}

.taxonomy-node__title {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: #F5F3F0;
    margin-bottom: 0.5rem;
}

.taxonomy-node__desc {
    color: #E8E4E0;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

/* ---- Featured Entries ---- */
.entries-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.entry {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(44, 44, 60, 0.08);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
    align-items: start;
}

.entry:hover {
    box-shadow: 0 8px 40px rgba(44, 44, 60, 0.14);
    transform: translateY(-2px);
}

.entry__number {
    font-size: 1.5rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.entry__title {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: #2C2C3C;
    margin-bottom: 0.5rem;
}

.entry__excerpt {
    color: #2C2C3C;
    line-height: 1.65;
    margin-bottom: 1rem;
}

.entry__tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.entry__tag {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    text-transform: uppercase;
}

.entry__tag--sapphire {
    background: rgba(13, 71, 161, 0.1);
    color: #0D47A1;
}

.entry__tag--emerald {
    background: rgba(27, 94, 32, 0.1);
    color: #1B5E20;
}

.entry__tag--amethyst {
    background: rgba(74, 20, 140, 0.1);
    color: #4A148C;
}

.entry__tag--ruby {
    background: rgba(136, 14, 79, 0.1);
    color: #880E4F;
}

.entry__depth {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.depth-meter {
    width: 6px;
    height: 80px;
    background: #E8E4E0;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.depth-meter__fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, #D4AF37, #0D47A1);
    border-radius: 3px;
    transition: height 1s ease;
}

.entry__depth .mono-label {
    color: #C0C0C0;
    font-size: 0.65rem;
}

/* ---- System Panels ---- */
.systems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.system-panel {
    background: rgba(245, 243, 240, 0.04);
    border: 1px solid rgba(232, 228, 224, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.system-panel:hover {
    border-color: rgba(212, 175, 55, 0.3);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.08);
}

.system-panel__header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(232, 228, 224, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.system-panel__title {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: #F5F3F0;
}

.system-panel__body {
    padding: 1.5rem;
}

.system-panel__metric {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.system-panel__metric-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    color: #D4AF37;
    letter-spacing: 0.04em;
}

.system-panel__metric .mono-label {
    color: #C0C0C0;
}

.system-panel__bar {
    width: 100%;
    height: 4px;
    background: rgba(232, 228, 224, 0.1);
    border-radius: 2px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.system-panel__bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to right, #0D47A1, #D4AF37);
    transition: width 1.5s ease;
}

.system-panel__desc {
    color: #E8E4E0;
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0.8;
}

/* ---- Footer ---- */
.section--footer .section__inner {
    text-align: center;
}

.footer__brand {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.footer__logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, #D4AF37, #F5F3F0, #D4AF37);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer__dot {
    color: #C0C0C0;
    font-size: 2rem;
}

.footer__domain {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #C0C0C0;
}

.footer__tagline {
    color: #C0C0C0;
    margin-bottom: 2rem;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
}

.footer__stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.footer__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.footer__stat-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    color: #D4AF37;
    letter-spacing: 0.04em;
}

.footer__stat .mono-label {
    color: #C0C0C0;
    font-size: 0.65rem;
}

.footer__circuit-line {
    width: 120px;
    height: 1px;
    background: linear-gradient(to right, transparent, #D4AF37, transparent);
    margin: 0 auto;
}

/* ---- Reveal Animation ---- */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered delays for reveal children */
.card-stack [data-reveal]:nth-child(1) { transition-delay: 0ms; }
.card-stack [data-reveal]:nth-child(2) { transition-delay: 100ms; }
.card-stack [data-reveal]:nth-child(3) { transition-delay: 200ms; }

.taxonomy-grid [data-reveal]:nth-child(1) { transition-delay: 0ms; }
.taxonomy-grid [data-reveal]:nth-child(2) { transition-delay: 50ms; }
.taxonomy-grid [data-reveal]:nth-child(3) { transition-delay: 100ms; }
.taxonomy-grid [data-reveal]:nth-child(4) { transition-delay: 150ms; }
.taxonomy-grid [data-reveal]:nth-child(5) { transition-delay: 200ms; }
.taxonomy-grid [data-reveal]:nth-child(6) { transition-delay: 250ms; }

.entries-stack [data-reveal]:nth-child(1) { transition-delay: 0ms; }
.entries-stack [data-reveal]:nth-child(2) { transition-delay: 100ms; }
.entries-stack [data-reveal]:nth-child(3) { transition-delay: 200ms; }

.systems-grid [data-reveal]:nth-child(1) { transition-delay: 0ms; }
.systems-grid [data-reveal]:nth-child(2) { transition-delay: 100ms; }
.systems-grid [data-reveal]:nth-child(3) { transition-delay: 200ms; }

/* ---- Typewriter cursor ---- */
.hero__title.typewriter-active::after {
    content: '';
    display: inline-block;
    width: 3px;
    height: 0.85em;
    background: #D4AF37;
    margin-left: 4px;
    vertical-align: baseline;
    animation: cursor-blink 0.7s steps(1) infinite;
}

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

/* ---- Gradient mesh color shift on scroll ---- */
.gradient-mesh {
    transition: filter 0.3s ease;
}

/* ---- Scale shifts for accent elements ---- */
.geo-shape {
    transition: transform 1s ease;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .entry {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .entry__number {
        writing-mode: horizontal-tb;
        font-size: 1.2rem;
    }

    .entry__depth {
        flex-direction: row;
    }

    .depth-meter {
        width: 60px;
        height: 6px;
    }

    .depth-meter__fill {
        left: 0;
        bottom: 0;
        height: 100%;
        width: var(--fill-width, 80%);
    }

    .hero__meta {
        gap: 1rem;
    }

    .taxonomy-grid {
        grid-template-columns: 1fr;
    }

    .systems-grid {
        grid-template-columns: 1fr;
    }

    .footer__stats {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 2.5rem 1rem;
    }

    .hero__title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
}
