/* ===========================================
   mujun.wiki - The Paradox Engine
   Scandinavian minimalism meets philosophical contradiction
   =========================================== */

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

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

body {
    font-family: 'Karla', sans-serif;
    background: #F4F1EC;
    color: #3C3F41;
    overflow-x: hidden;
    position: relative;
}

/* Grain Overlay */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.03;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3Oeli0teleNjY2Li4ubm5ueli0teleampqeli0teleZmZmRkZGPj4+Xl5eeli0tetra2tpaWlnZ2cheli0tAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpsNBuDJjoDBAAABJklEQVRIx7WW2w6AIAxDxwUV8f9/1LkxSGd04YH4MJrQLkP/gPQhDvoCvXEhZECe4LlB8gBfuEPyAv+4Q/IC/7hD8gK/uEPyAv+4Q/IC/7hD8gJFcSAeQBPx5Blp5AOeG9Tn1OcPyBt08QI9e0beE1TxAj3bi23yBr24kQ94bpB+wb9ukL5Bn+6QvkDPvpE3uENe+gR/ukLe4Lkh+ga/uJC+wS9upE/Qhxvp4gF5gy5e4DkZ9CF1LoJQDfkePKQ/oIvw7wBOhv3r/wIOQPqfJPAAAAAElFTkSuQmCC");
}

/* Cursor Trail */
#cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.trail-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #C4CAD0;
    opacity: 0.4;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.trail-dot.fading {
    opacity: 0;
}

/* ===========================================
   HUD Chrome Overlay
   =========================================== */
#hud-chrome {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9990;
    opacity: 0;
    transition: opacity 2s ease;
}

#hud-chrome.visible {
    opacity: 1;
}

#hud-border {
    position: absolute;
    top: 32px;
    left: 32px;
    width: calc(100% - 64px);
    height: calc(100% - 64px);
}

#hud-rect {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#hud-chrome.visible #hud-rect {
    stroke-dashoffset: 0;
}

/* Crosshairs */
.crosshair {
    position: absolute;
    width: 24px;
    height: 24px;
    animation: crosshairRotate 30s linear infinite;
}

.crosshair.recalibrating {
    animation-duration: 3s;
}

@keyframes crosshairRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(90deg); }
}

.crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #3C3F41;
    transform: translateY(-0.5px);
}

.crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: #3C3F41;
    transform: translateX(-0.5px);
}

.crosshair-tl {
    top: 20px;
    left: 20px;
    transform-origin: center center;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.8s ease 0.5s, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s;
}

.crosshair-tr {
    top: 20px;
    right: 20px;
    transform-origin: center center;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.8s ease 0.7s, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.7s;
}

.crosshair-bl {
    bottom: 20px;
    left: 20px;
    transform-origin: center center;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.8s ease 0.9s, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.9s;
}

.crosshair-br {
    bottom: 20px;
    right: 20px;
    transform-origin: center center;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.8s ease 1.1s, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.1s;
}

#hud-chrome.visible .crosshair-tl,
#hud-chrome.visible .crosshair-tr,
#hud-chrome.visible .crosshair-bl,
#hud-chrome.visible .crosshair-br {
    opacity: 1;
    transform: scale(1);
}

/* HUD Status Line */
#hud-status {
    position: absolute;
    top: 36px;
    left: 56px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8B9DAF;
}

#hud-status-text {
    opacity: 0;
    transition: opacity 0.6s ease;
}

#hud-chrome.visible #hud-status-text {
    opacity: 1;
}

/* Navigation Glyph */
#nav-glyph {
    position: absolute;
    bottom: 40px;
    left: 40px;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

#nav-glyph:hover {
    opacity: 1;
}

/* Section Nav */
#section-nav {
    position: absolute;
    bottom: 80px;
    left: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    visibility: hidden;
}

#section-nav.open {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

.nav-item {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #8B9DAF;
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-item:hover {
    color: #D4A843;
}

.nav-ordinal {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 14px;
    margin-right: 8px;
    color: #6B7280;
}

/* ===========================================
   Sections
   =========================================== */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.section-light {
    background: #F4F1EC;
    color: #3C3F41;
}

.section-dark {
    background: #1A1D21;
    color: #E8EBF0;
}

/* Section Gradients (transitions) */
.section-gradient {
    height: 20vh;
    position: relative;
    z-index: 1;
}

.gradient-light-to-dark {
    background: linear-gradient(to bottom, #F4F1EC, #1A1D21);
}

.gradient-dark-to-light {
    background: linear-gradient(to bottom, #1A1D21, #F4F1EC);
}

/* Watermarks */
.watermark {
    position: absolute;
    opacity: 0.04;
    z-index: 0;
}

.watermark-spear {
    top: 50%;
    left: 10%;
    transform: translateY(-50%) rotate(15deg);
}

.watermark-shield {
    top: 50%;
    left: 10%;
    transform: translateY(-50%) rotate(-15deg);
}

/* ===========================================
   Hero Section
   =========================================== */
.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#hero-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 120px;
    line-height: 1.05;
    letter-spacing: 0.3em;
    color: #1A1D21;
    opacity: 0;
    transition: opacity 1.2s ease, letter-spacing 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#hero-title.revealed {
    opacity: 1;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8B9DAF;
    margin-top: 24px;
    opacity: 0;
    transition: opacity 1s ease 0.6s;
}

#hero-title.revealed ~ .hero-subtitle {
    opacity: 1;
}

.hero-subtitle.revealed {
    opacity: 1;
}

/* ===========================================
   Diptych Layout
   =========================================== */
.diptych {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 100vh;
    padding: 64px 32px 64px calc(15% + 32px);
    position: relative;
    z-index: 2;
    gap: 0;
}

.diptych-reversed {
    padding: 64px calc(15% + 32px) 64px 32px;
    flex-direction: row-reverse;
}

.diptych-thesis {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 40px;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.diptych-reversed .diptych-thesis {
    transform: translateX(30px);
}

.diptych-thesis.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.section-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 48px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 32px;
}

.section-light .section-title {
    color: #1A1D21;
}

.section-dark .section-title {
    color: #E8EBF0;
}

.section-body {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    letter-spacing: 0.01em;
    margin-bottom: 24px;
    max-width: 540px;
}

.section-light .section-body {
    color: #3C3F41;
}

.section-dark .section-body {
    color: #B8BEC6;
}

/* Diptych Divider */
.diptych-divider {
    width: 1px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 60px;
    margin: 0 16px;
}

.divider-line {
    position: absolute;
    top: 10%;
    bottom: 10%;
    width: 0.5px;
    background: #C4CAD0;
    animation: dividerPulse 8s ease-in-out infinite;
}

@keyframes dividerPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Diamond Markers */
.diamond-marker {
    width: 8px;
    height: 8px;
    transform: rotate(45deg);
    position: relative;
    z-index: 1;
    animation: diamondFloat 6s ease-in-out infinite;
}

.diamond-marker:nth-child(odd) {
    animation-delay: -3s;
}

.diamond-warm {
    background: #C4623A;
}

.diamond-cool {
    background: #2B7A78;
}

@keyframes diamondFloat {
    0%, 100% { transform: rotate(45deg) translateY(-4px); }
    50% { transform: rotate(45deg) translateY(4px); }
}

/* Diptych Antithesis (Marble Panel) */
.diptych-antithesis {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s,
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
}

.diptych-reversed .diptych-antithesis {
    transform: translateX(-30px);
}

.diptych-antithesis.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.marble-panel {
    background: #E8E5DF;
    box-shadow: inset 0 0 0 0 #A8A29E;
    width: 100%;
    height: 60vh;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.marble-svg,
.marble-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 768px) {
    #hero-title {
        font-size: 64px;
    }

    .diptych,
    .diptych-reversed {
        flex-direction: column;
        padding: 48px 24px;
    }

    .diptych-reversed {
        flex-direction: column;
    }

    .diptych-thesis {
        padding: 32px 16px;
        transform: translateY(20px) !important;
    }

    .diptych-thesis.animate-in {
        transform: translateY(0) !important;
    }

    .diptych-antithesis {
        flex: 0 0 auto;
        transform: translateY(20px) !important;
    }

    .diptych-antithesis.animate-in {
        transform: translateY(0) !important;
    }

    .diptych-divider {
        width: 80%;
        height: 1px;
        flex-direction: row;
        margin: 24px auto;
        gap: 24px;
    }

    .divider-line {
        top: 50%;
        bottom: auto;
        left: 10%;
        right: 10%;
        width: auto;
        height: 0.5px;
    }

    .section-title {
        font-size: 36px;
    }

    .section-body {
        font-size: 15px;
    }

    .marble-panel {
        height: 40vh;
    }

    .crosshair {
        display: none;
    }

    #hud-border {
        top: 16px;
        left: 16px;
        width: calc(100% - 32px);
        height: calc(100% - 32px);
    }

    #hud-status {
        top: 20px;
        left: 28px;
    }

    #nav-glyph {
        bottom: 24px;
        left: 24px;
    }

    #section-nav {
        bottom: 60px;
        left: 24px;
    }
}

@media (max-width: 480px) {
    #hero-title {
        font-size: 48px;
    }

    .section-title {
        font-size: 28px;
    }
}
