/* ========================================
   riron.org — Brutalist Luxury Design System
   ======================================== */

/* Custom Properties */
:root {
    --substrate: #0d0d0d;
    --charcoal: #1a1a1a;
    --block-bg: #2a2a28;
    --aged-gold: #f0e6c8;
    --true-gold: #c9a356;
    --body-text: #e8e0d0;
    --copper: #8b4513;
    --black: #000000;
    --gold-ghost: rgba(201, 163, 86, 0.5);

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Space Grotesk', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --ease-heavy: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-exit: cubic-bezier(0.7, 0, 0.84, 0);

    --perspective: 1200px;
    --baseline: 8px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background: var(--substrate);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--body-text);
    background: var(--substrate);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* SVG Filters — Hidden */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========================================
   Layer 0 — The Substrate
   ======================================== */
#substrate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--substrate);
    z-index: 0;
    filter: url(#noise-substrate);
}

/* ========================================
   Navigation — Fixed Vertical Strip
   ======================================== */
#nav-strip {
    position: fixed;
    left: 0;
    top: 0;
    width: 48px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 32px;
    z-index: 100;
    background: transparent;
}

.nav-glyph {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--true-gold);
    opacity: 0.7;
    text-decoration: none;
    transition: transform 0.4s var(--ease-heavy), opacity 0.3s ease;
    display: block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
}

.nav-glyph:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.nav-glyph.active {
    opacity: 1;
    color: var(--aged-gold);
}

/* ========================================
   Main Container — Perspective
   ======================================== */
#perspective-container {
    position: relative;
    z-index: 1;
    perspective: var(--perspective);
    transform-style: preserve-3d;
}

/* ========================================
   Act I — The Void
   ======================================== */
.act-void {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.void-content {
    text-align: center;
    opacity: 0;
    animation: voidReveal 1.2s var(--ease-heavy) 0.8s forwards;
}

.void-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--aged-gold);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 0.92;
    clip-path: inset(50% 50% 50% 50%);
    animation: clipReveal 1.5s var(--ease-heavy) 1s forwards;
}

.void-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    color: var(--true-gold);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 24px;
    opacity: 0;
    animation: fadeIn 1s ease 2s forwards;
}

.gold-fracture {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 24px;
}

.fracture-opening {
    bottom: 48px;
}

.fracture-main {
    stroke: var(--true-gold);
    stroke-width: 2;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawLine 2s var(--ease-heavy) 2.5s forwards;
}

.fracture-branch {
    stroke: var(--true-gold);
    stroke-width: 1;
    opacity: 0;
    animation: fadeIn 0.4s ease 3.5s forwards;
}

/* ========================================
   Act II — The Monoliths
   ======================================== */
.act-monoliths {
    position: relative;
    padding: 64px 48px 64px 80px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    min-height: 300vh;
}

.monolith {
    position: relative;
    background: var(--block-bg);
    border: 4px solid var(--aged-gold);
    border-radius: 0;
    padding: 0;
    transform: translateY(60px) translateZ(-20px);
    opacity: 0;
    transition: transform 0.8s var(--ease-heavy), opacity 0.8s var(--ease-heavy);
    z-index: 2;
}

.monolith.visible {
    transform: translateY(0) translateZ(-20px);
    opacity: 1;
}

.monolith::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
    transition: top 0.3s var(--ease-heavy), left 0.3s var(--ease-heavy);
}

.monolith:hover::after {
    top: 12px;
    left: 12px;
}

.monolith-inner {
    padding: 48px;
    position: relative;
    filter: url(#noise-block);
}

.monolith h2 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--aged-gold);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 0.92;
    margin-bottom: 32px;
}

.monolith p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    color: var(--body-text);
    line-height: 1.65;
    letter-spacing: 0.01em;
    margin-bottom: 16px;
}

.monolith p:last-child {
    margin-bottom: 0;
}

/* Monolith Grid Positioning — Overlapping */
.monolith-1 {
    grid-column: 1 / 8;
    grid-row: 1;
    margin-bottom: -48px;
    z-index: 3;
    transition-delay: 0s;
}

.monolith-2 {
    grid-column: 5 / 13;
    grid-row: 2;
    margin-top: -24px;
    margin-bottom: -48px;
    z-index: 4;
    transition-delay: 0.12s;
}

.monolith-3 {
    grid-column: 2 / 9;
    grid-row: 3;
    margin-top: -24px;
    margin-bottom: -48px;
    z-index: 5;
    transition-delay: 0.24s;
}

.monolith-4 {
    grid-column: 6 / 13;
    grid-row: 4;
    margin-top: -24px;
    margin-bottom: -48px;
    z-index: 6;
    transition-delay: 0.36s;
}

.monolith-5 {
    grid-column: 1 / 8;
    grid-row: 5;
    margin-top: -24px;
    z-index: 7;
    transition-delay: 0.48s;
}

/* Annotations — Layer 2 */
.annotation {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--true-gold);
    opacity: 0.3;
    filter: blur(4px);
    margin-bottom: 24px;
    transition: opacity 0.6s ease, filter 0.6s ease;
    position: relative;
    z-index: 10;
}

.monolith.visible .annotation {
    opacity: 0.7;
    filter: blur(0);
}

/* Circuit Paths */
.circuit-paths {
    position: absolute;
    width: 100%;
    height: 400px;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.circuit-svg-1 { top: 0; left: 0; }
.circuit-svg-2 { top: 25%; left: 0; }
.circuit-svg-3 { top: 45%; left: 0; }
.circuit-svg-4 { top: 60%; left: 0; }
.circuit-svg-5 { top: 75%; left: 0; }

.circuit-line {
    fill: none;
    stroke: var(--true-gold);
    stroke-width: 1;
    opacity: 0.3;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s var(--ease-heavy);
}

.circuit-line.drawn {
    stroke-dashoffset: 0;
}

.circuit-node {
    fill: var(--true-gold);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.circuit-node.visible {
    opacity: 0.5;
    animation: nodePulse 2s ease-in-out infinite;
}

/* ========================================
   Act III — The Network
   ======================================== */
.act-network {
    position: relative;
    height: 150vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 80px;
}

.network-diagram {
    width: 100%;
    max-width: 800px;
    height: auto;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s var(--ease-heavy), transform 1s var(--ease-heavy);
}

.network-diagram.visible {
    opacity: 1;
    transform: translateY(0);
}

.network-node {
    fill: var(--true-gold);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.network-diagram.visible .network-node {
    animation: nodePulse 2s ease-in-out infinite;
}

.network-diagram.visible .node-center {
    animation-delay: 0s;
}
.network-diagram.visible .node-1 {
    animation-delay: 0.2s;
}
.network-diagram.visible .node-2 {
    animation-delay: 0.4s;
}
.network-diagram.visible .node-3 {
    animation-delay: 0.6s;
}
.network-diagram.visible .node-4 {
    animation-delay: 0.8s;
}
.network-diagram.visible .node-5 {
    animation-delay: 1.0s;
}

.network-path {
    fill: none;
    stroke: var(--true-gold);
    stroke-width: 1;
    opacity: 0.3;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.5s var(--ease-heavy);
}

.network-diagram.visible .network-path {
    stroke-dashoffset: 0;
}

.network-cross {
    opacity: 0.15;
}

.network-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    fill: var(--true-gold);
    opacity: 0.6;
    text-anchor: start;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.network-label-center {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 900;
    fill: var(--aged-gold);
    text-anchor: middle;
    opacity: 0;
    transition: opacity 1s ease 1.5s;
}

.network-diagram.visible .network-label-center {
    opacity: 1;
}

/* ========================================
   Gold Leaf Fracture Divider
   ======================================== */
.fracture-divider {
    position: relative;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 80px;
}

.fracture-closing {
    position: relative;
    width: 100%;
    height: 24px;
}

.fracture-left,
.fracture-right {
    stroke: var(--true-gold);
    stroke-width: 2;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.fracture-closing.visible .fracture-left,
.fracture-closing.visible .fracture-right {
    animation: drawLine600 2s var(--ease-heavy) forwards;
}

.fracture-closing .fracture-branch {
    stroke: var(--true-gold);
    stroke-width: 1;
    opacity: 0;
}

.fracture-closing.visible .fracture-branch {
    animation: fadeIn 0.4s ease 1.5s forwards;
}

/* ========================================
   Act IV — The Colophon
   ======================================== */
.act-colophon {
    position: relative;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 128px 80px;
}

.colophon-block {
    max-width: 480px;
    background: var(--block-bg);
    border: 4px solid var(--aged-gold);
    border-radius: 0;
    position: relative;
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.8s var(--ease-heavy), opacity 0.8s var(--ease-heavy);
}

.colophon-block.visible {
    transform: translateY(0);
    opacity: 1;
}

.colophon-block::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

.colophon-inner {
    padding: 48px;
}

.colophon-inner h2 {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--aged-gold);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 0.92;
    margin-bottom: 32px;
}

.colophon-inner p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    color: var(--body-text);
    line-height: 1.65;
    letter-spacing: 0.01em;
    margin-bottom: 16px;
}

.colophon-inner p:last-child {
    margin-bottom: 0;
}

.colophon-nav {
    display: flex;
    gap: 48px;
    margin-top: 64px;
}

.colophon-glyph {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--true-gold);
    opacity: 0.7;
    text-decoration: none;
    transition: transform 0.4s var(--ease-heavy), opacity 0.3s ease;
    display: block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border: 1px solid rgba(201, 163, 86, 0.3);
}

.colophon-glyph:hover {
    opacity: 1;
    transform: rotate(90deg);
    border-color: var(--true-gold);
}

/* ========================================
   Keyframe Animations
   ======================================== */
@keyframes voidReveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes clipReveal {
    from {
        clip-path: inset(50% 50% 50% 50%);
    }
    to {
        clip-path: inset(0% 0% 0% 0%);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes drawLine {
    from {
        stroke-dashoffset: 1200;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes drawLine600 {
    from {
        stroke-dashoffset: 600;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes nodePulse {
    0% { opacity: 0.3; }
    50% { opacity: 0.6; }
    100% { opacity: 0.3; }
}

/* ========================================
   Tilt 3D Micro-Interaction
   ======================================== */
.monolith.tilt-active {
    transition: transform 0.1s ease-out;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 768px) {
    #nav-strip {
        display: none;
    }

    .act-monoliths {
        display: flex;
        flex-direction: column;
        padding: 32px 16px;
        gap: 0;
    }

    .monolith {
        margin-left: 0 !important;
        margin-right: 0 !important;
        grid-column: auto !important;
    }

    .monolith-1,
    .monolith-2,
    .monolith-3,
    .monolith-4,
    .monolith-5 {
        margin-top: -24px;
        margin-bottom: -24px;
    }

    .monolith-1 {
        margin-top: 0;
    }

    .monolith-inner {
        padding: 32px 24px;
    }

    .act-network {
        padding: 0 16px;
        height: 100vh;
    }

    .act-colophon {
        padding: 64px 16px;
    }

    .circuit-paths {
        display: none;
    }

    .colophon-nav {
        gap: 24px;
    }

    .fracture-divider {
        padding: 0 16px;
    }
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .void-title {
        clip-path: inset(0% 0% 0% 0%);
    }

    .void-content {
        opacity: 1;
    }

    .void-subtitle {
        opacity: 1;
    }

    .fracture-main {
        stroke-dashoffset: 0;
    }

    .fracture-branch {
        opacity: 1;
    }

    .monolith {
        transform: translateZ(-20px);
        opacity: 1;
    }

    .annotation {
        opacity: 0.7;
        filter: blur(0);
    }

    .circuit-line {
        stroke-dashoffset: 0;
    }

    .circuit-node {
        opacity: 0.5;
    }

    .network-diagram {
        opacity: 1;
        transform: none;
    }

    .network-node {
        opacity: 0.5;
    }

    .network-path {
        stroke-dashoffset: 0;
    }

    .network-label-center {
        opacity: 1;
    }

    .colophon-block {
        transform: none;
        opacity: 1;
    }
}
