/* ============================================
   miris.works — Surrealist Urban Cartography
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-indigo: #1a1a3e;
    --bone-white: #f0ece4;
    --muted-indigo: #2a2a52;
    --warm-ivory: #e8e0d0;
    --tarnished-gold: #b8a472;
    --phantom-gray: #3a3a5e;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'EB Garamond', 'Georgia', serif;
    --font-mono: 'Space Mono', monospace;

    --content-width: 680px;
    --grid-width: 1200px;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--deep-indigo);
    color: var(--bone-white);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Fixed Navigation --- */
#nav-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 24px 0;
    pointer-events: none;
}

#nav-title {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bone-white);
    opacity: 0;
    transition: opacity 0.6s ease;
}

#nav-title.visible {
    opacity: 1;
}

/* --- Scroll Progress Indicator --- */
#scroll-progress {
    position: fixed;
    top: 0;
    right: 16px;
    width: 2px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

#scroll-progress::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--tarnished-gold);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.15s linear;
}

/* --- Central Axis --- */
#central-axis {
    position: fixed;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100vh;
    background-color: var(--bone-white);
    opacity: 0;
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
    transition: opacity 1s ease;
}

#central-axis.visible {
    opacity: 0.08;
}

/* --- Ghost Architecture (Flanking) --- */
.ghost-architecture {
    position: fixed;
    top: 0;
    width: calc((100vw - var(--content-width)) / 2 - 20px);
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.ghost-architecture.visible {
    opacity: 1;
}

#ghost-left {
    left: 20px;
}

#ghost-right {
    right: 20px;
}

.ghost-architecture svg {
    width: 100%;
    height: 200%;
    animation: ghostDrift 120s linear infinite;
}

#ghost-right .ghost-architecture svg,
#ghost-right svg {
    animation: ghostDriftReverse 140s linear infinite;
}

@keyframes ghostDrift {
    0% { transform: translateY(0); }
    50% { transform: translateY(-25%); }
    100% { transform: translateY(0); }
}

@keyframes ghostDriftReverse {
    0% { transform: translateY(-15%); }
    50% { transform: translateY(10%); }
    100% { transform: translateY(-15%); }
}

.ghost-building {
    stroke: var(--phantom-gray);
    fill: none;
    stroke-width: 1;
    stroke-linecap: round;
    opacity: 0.3;
}

.ghost-building rect {
    fill: none;
    stroke: var(--phantom-gray);
}

/* --- Monument Sections --- */
.monument {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
}

.monument-horizon {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--phantom-gray);
    opacity: 0.15;
    transform: translateY(-50%);
}

.monument-content {
    max-width: var(--content-width);
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 2;
}

.monument-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--bone-white);
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.monument-title.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.monument-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    color: var(--warm-ivory);
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out 0.15s, transform 0.6s ease-out 0.15s;
}

.monument-text.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* --- Monument Variations --- */

/* Monument 2: Clip-path reveal */
.monument-reveal .monument-content {
    clip-path: inset(0 50% 0 50%);
    transition: clip-path 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.monument-reveal.active .monument-content {
    clip-path: inset(0 0% 0 0%);
}

/* Monument 3: Reflection */
.monument-reflect .monument-reflection {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleY(-1);
    max-width: var(--content-width);
    width: 100%;
    height: 30%;
    overflow: hidden;
    opacity: 0.06;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
}

/* Monument 4: Subtle rotation */
.monument-rotate .monument-content {
    transition: transform 0.8s ease-out;
}

.monument-rotate.active .monument-content {
    transform: rotate(-0.5deg);
}

/* --- Illustrations --- */
.monument-illustration {
    max-width: 400px;
    margin: 0 auto 40px;
    width: 100%;
}

.monument-illustration svg,
.illustration {
    width: 100%;
    height: auto;
    stroke: currentColor;
    color: var(--bone-white);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
    fill: none;
}

.draw-on-scroll.active .draw-path {
    stroke-dashoffset: 0;
}

/* Window flicker effect */
.window-flicker {
    fill: none;
    stroke: var(--bone-white);
    stroke-width: 1.5;
    opacity: 0.15;
}

/* --- Intro / Hero Section --- */
#intro {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#entry-point {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: var(--bone-white);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

#entry-line {
    width: 1px;
    height: 60vh;
    background-color: var(--bone-white);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scaleY(0);
    transform-origin: center;
    opacity: 0.6;
}

#entry-line.expanded {
    transform: translate(-50%, -50%) scaleY(1);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#entry-line.full {
    height: 100vh;
    opacity: 0.15;
    transition: height 0.8s ease, opacity 0.8s ease;
}

#site-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 7vw, 6rem);
    font-weight: 600;
    letter-spacing: 0.3em;
    line-height: 1.15;
    color: var(--bone-white);
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease, letter-spacing 1s ease;
}

#site-title.visible {
    opacity: 1;
    letter-spacing: 0.02em;
}

#site-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    font-style: italic;
    color: var(--warm-ivory);
    margin-top: 16px;
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

#site-subtitle.visible {
    opacity: 1;
}

/* --- Street Crossings --- */
.street-crossing {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.crossing-line {
    width: 100%;
    max-width: var(--content-width);
    height: 20px;
    overflow: visible;
}

.crossing-path {
    stroke: var(--tarnished-gold);
    stroke-width: 1;
    fill: none;
    stroke-linecap: round;
    opacity: 0.4;
    transition: d 1.2s ease-in-out;
}

/* --- Work Links --- */
.work-items {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}

.work-link {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--bone-white);
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding-bottom: 2px;
    background-image: linear-gradient(var(--tarnished-gold), var(--tarnished-gold));
    background-size: 0% 1px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: color 0.3s ease, background-size 0.3s ease;
}

.work-link:hover {
    color: var(--tarnished-gold);
    background-size: 100% 1px;
}

.contact-link {
    font-family: var(--font-mono);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    letter-spacing: 0.08em;
    display: inline-block;
    margin-top: 24px;
}

/* --- Monument Meta --- */
.monument-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 64px;
    opacity: 0.4;
}

.meta-text {
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 1vw, 0.75rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-ivory);
}

.meta-divider {
    width: 32px;
    height: 1px;
    background-color: var(--warm-ivory);
    opacity: 0.4;
}

/* --- Final Spacer --- */
.final-spacer {
    height: 20vh;
}

/* --- Below-horizon blur effect --- */
.monument-content > *:last-child {
    position: relative;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .ghost-architecture {
        display: none;
    }

    .monument {
        padding: 48px 20px;
    }

    .monument-illustration {
        max-width: 300px;
    }

    .street-crossing {
        height: 20vh;
    }

    #scroll-progress {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .monument {
        padding: 32px 16px;
        min-height: 80vh;
    }

    .monument-illustration {
        max-width: 260px;
    }

    .work-items {
        gap: 12px;
    }

    .monument-meta {
        flex-direction: column;
        gap: 8px;
    }

    .meta-divider {
        width: 1px;
        height: 16px;
    }
}

/* --- Morph animation for archway --- */
@keyframes archMorph {
    0% {
        d: path("M100,200 L100,80 Q200,0 300,80 L300,200");
    }
    50% {
        d: path("M100,200 L100,60 Q200,-20 300,60 L300,200");
    }
    100% {
        d: path("M100,200 L100,80 Q200,0 300,80 L300,200");
    }
}

.archway-morph {
    animation: archMorph 8s ease-in-out infinite;
}

/* --- Crossing path morph states --- */
@keyframes crossingMorph1 {
    0% { d: path("M0,10 L680,10"); }
    33% { d: path("M0,10 Q340,0 680,10"); }
    66% { d: path("M0,10 L170,5 L340,15 L510,5 L680,10"); }
    100% { d: path("M0,10 L680,10"); }
}

.street-crossing.active .crossing-path {
    animation: crossingMorph1 8s ease-in-out infinite;
}

/* --- Global SVG styling --- */
svg {
    overflow: visible;
}

/* --- Selection color --- */
::selection {
    background-color: var(--muted-indigo);
    color: var(--bone-white);
}
