:root {
    --vermillion: #E63946;
    --prussian: #1D3557;
    --saffron: #F4D35E;
    --chalk: #F1FAEE;
    --carbon: #0D1117;
    --concrete: #A8DADC;
    --rose: #C1666B;
    --blueprint: #457B9D;
    --pace: 1;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "DM Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.65;
    color: var(--prussian);
    background: var(--chalk);
    overflow-x: hidden;
    cursor: crosshair;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* NAV INDICATOR */
#nav-indicator {
    position: fixed;
    top: 32px;
    right: 32px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nav-triangle {
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 24px solid var(--prussian);
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: spinTriangle 8s linear infinite;
}

@keyframes spinTriangle {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#nav-indicator:hover .nav-triangle {
    animation-play-state: paused;
    transform: rotate(180deg) scale(1.2);
}

.nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    margin-top: 12px;
}

#nav-indicator:hover .nav-links {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.nav-link {
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--prussian);
    text-decoration: none;
    background: var(--chalk);
    padding: 4px 10px;
    border: 1px solid var(--prussian);
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.nav-link:hover {
    background: var(--vermillion);
    color: var(--chalk);
    transform: rotate(3deg);
}

.nav-link::after {
    content: " " attr(data-label);
    font-size: 0.6rem;
    opacity: 0.7;
}

/* PLANES - SECTIONS */
.plane {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    overflow: hidden;
}

/* PLANE 1 - POINT */
.plane-1 {
    background: var(--chalk);
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    width: min(70vw, 420px);
    height: min(70vw, 420px);
    position: relative;
    z-index: 2;
}

.matrix-block {
    border-radius: 4px;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: breathe 4s ease-in-out infinite;
}

.matrix-block[data-index="0"] { background: var(--vermillion); }
.matrix-block[data-index="1"] { background: var(--saffron); }
.matrix-block[data-index="2"] { background: var(--prussian); }
.matrix-block[data-index="3"] { background: var(--saffron); }
.matrix-block[data-index="4"] { background: var(--chalk); border: 2px solid var(--prussian); }
.matrix-block[data-index="5"] { background: var(--vermillion); }
.matrix-block[data-index="6"] { background: var(--prussian); }
.matrix-block[data-index="7"] { background: var(--vermillion); }
.matrix-block[data-index="8"] { background: var(--saffron); }

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.98); }
}

.matrix-block:nth-child(2) { animation-delay: 0.5s; }
.matrix-block:nth-child(3) { animation-delay: 1s; }
.matrix-block:nth-child(4) { animation-delay: 1.5s; }
.matrix-block:nth-child(5) { animation-delay: 2s; }
.matrix-block:nth-child(6) { animation-delay: 2.5s; }
.matrix-block:nth-child(7) { animation-delay: 3s; }
.matrix-block:nth-child(8) { animation-delay: 0.3s; }
.matrix-block:nth-child(9) { animation-delay: 0.7s; }

.domain-name-reveal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 7rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 0.92;
    color: var(--prussian);
    z-index: 1;
    pointer-events: none;
    opacity: 0.15;
    mix-blend-mode: multiply;
}

.red-circle {
    position: fixed;
    width: 24px;
    height: 24px;
    background: var(--vermillion);
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: pulseOpacity 2s ease-in-out infinite;
}

.scroll-triangle {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 18px solid var(--prussian);
}

@keyframes pulseOpacity {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* BAUHAUS BARS */
.bauhaus-bar {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
}

.bar-vermillion {
    background: var(--vermillion);
}

.bar-prussian {
    background: var(--prussian);
}

.bar-saffron {
    background: var(--saffron);
}

.bar-label {
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.bar-vermillion .bar-label { color: var(--chalk); }
.bar-prussian .bar-label { color: var(--saffron); }
.bar-saffron .bar-label { color: var(--prussian); }

/* PLANE 2 - LINE */
.plane-2 {
    background: var(--chalk);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

.grid-lines-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.grid-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--blueprint);
    opacity: 0.1;
}

.grid-line:nth-child(1) { top: 20%; }
.grid-line:nth-child(2) { top: 40%; }
.grid-line:nth-child(3) { top: 50%; }
.grid-line:nth-child(4) { top: 65%; }
.grid-line:nth-child(5) { top: 85%; }

.content-modules {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    max-width: 1100px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.module {
    padding: 40px;
    transform: rotate(var(--rotation, 0deg));
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    opacity: 0;
    animation: moduleEnter 0.6s ease forwards;
}

.module.in-view {
    opacity: 1;
}

@keyframes moduleEnter {
    from {
        opacity: 0;
        transform: translateX(-60px) rotate(15deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) rotate(var(--rotation, 0deg));
    }
}

.module:nth-child(1) { animation-delay: 0s; }
.module:nth-child(2) { animation-delay: 0.15s; }
.module:nth-child(3) { animation-delay: 0.3s; }
.module:nth-child(4) { animation-delay: 0.45s; }

.module-a {
    background: var(--vermillion);
    color: var(--chalk);
    box-shadow: 8px 8px 0px var(--saffron);
}

.module-b {
    background: var(--prussian);
    color: var(--chalk);
    box-shadow: 8px 8px 0px var(--vermillion);
}

.module-c {
    background: var(--saffron);
    color: var(--prussian);
    box-shadow: 8px 8px 0px var(--prussian);
}

.module:hover {
    transform: rotate(calc(var(--rotation, 0deg) + 3deg)) translate(12px, -8px);
}

.module-a:hover {
    box-shadow: 12px 12px 0px var(--saffron);
}

.module-b:hover {
    box-shadow: 12px 12px 0px var(--vermillion);
}

.module-c:hover {
    box-shadow: 12px 12px 0px var(--prussian);
}

.module-annotation {
    font-family: "Space Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.6;
    display: block;
    margin-bottom: 12px;
}

.module-title {
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: clamp(1.8rem, 4vw, 3rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 0.92;
    margin-bottom: 16px;
}

.module-text {
    font-family: "DM Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    line-height: 1.65;
}

/* PLANE 3 - PLANE (COMPOSITION) */
.plane-3 {
    background: var(--chalk);
    position: relative;
    padding: 60px 40px;
    min-height: 120vh;
}

.kandinsky-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.3;
}

.svg-draw {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 4s ease;
}

.svg-draw.drawn {
    stroke-dashoffset: 0;
}

.composition-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(6, minmax(100px, 1fr));
    gap: 16px;
    max-width: 1300px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    min-height: 80vh;
}

.comp-module {
    padding: 32px;
    transform: rotate(var(--rotation, 0deg));
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.comp-module:hover {
    transform: rotate(calc(var(--rotation, 0deg) + 3deg)) translate(12px, -8px);
}

.comp-module.module-a {
    background: var(--vermillion);
    color: var(--chalk);
    box-shadow: 8px 8px 0px var(--saffron);
}

.comp-module.module-b {
    background: var(--prussian);
    color: var(--chalk);
    box-shadow: 8px 8px 0px var(--vermillion);
}

.comp-module.module-c {
    background: var(--saffron);
    color: var(--prussian);
    box-shadow: 8px 8px 0px var(--prussian);
}

.comp-module.module-a:hover {
    box-shadow: 12px 12px 0px var(--saffron);
}
.comp-module.module-b:hover {
    box-shadow: 12px 12px 0px var(--vermillion);
}
.comp-module.module-c:hover {
    box-shadow: 12px 12px 0px var(--prussian);
}

.comp-image {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-mask {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.mask-circle {
    clip-path: circle(45% at 50% 50%);
}

.mask-triangle {
    clip-path: polygon(50% 5%, 95% 95%, 5% 95%);
}

.mask-hexagon {
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
}

.duotone-image {
    width: 100%;
    height: 100%;
    min-height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.duotone-vermillion {
    background: linear-gradient(135deg, var(--vermillion) 0%, var(--saffron) 100%);
}

.duotone-prussian {
    background: linear-gradient(135deg, var(--prussian) 0%, var(--concrete) 100%);
}

.duotone-saffron {
    background: linear-gradient(135deg, var(--saffron) 0%, var(--vermillion) 100%);
}

/* PLANE 4 - BEYOND (SUBVERSION) */
.plane-4 {
    background: var(--chalk);
    position: relative;
    padding: 80px 40px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.warp-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.2;
    background-image:
        repeating-linear-gradient(
            0deg,
            var(--blueprint) 0px,
            var(--blueprint) 1px,
            transparent 1px,
            transparent 60px
        ),
        repeating-linear-gradient(
            90deg,
            var(--blueprint) 0px,
            var(--blueprint) 1px,
            transparent 1px,
            transparent 60px
        );
    filter: url(#warp);
    animation: warpPulse 6s ease-in-out infinite;
}

@keyframes warpPulse {
    0%, 100% { transform: skewX(0deg) skewY(0deg); }
    25% { transform: skewX(2deg) skewY(-1deg); }
    50% { transform: skewX(-1deg) skewY(2deg); }
    75% { transform: skewX(1deg) skewY(-2deg); }
}

.subversion-modules {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 1000px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.sub-module {
    padding: 36px;
    transform: rotate(var(--rotation, 0deg)) translate(var(--shift-x, 0), var(--shift-y, 0));
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.sub-module.module-a {
    background: var(--vermillion);
    color: var(--chalk);
    box-shadow: 8px 8px 0px var(--saffron);
}

.sub-module.module-b {
    background: var(--prussian);
    color: var(--chalk);
    box-shadow: 8px 8px 0px var(--vermillion);
}

.sub-module.module-c {
    background: var(--saffron);
    color: var(--prussian);
    box-shadow: 8px 8px 0px var(--prussian);
}

.sub-module:hover {
    transform: rotate(calc(var(--rotation, 0deg) + 5deg)) translate(calc(var(--shift-x, 0) + 15px), calc(var(--shift-y, 0) - 10px));
}

.sub-module.module-a:hover {
    box-shadow: 14px 14px 0px var(--saffron);
}
.sub-module.module-b:hover {
    box-shadow: 14px 14px 0px var(--vermillion);
}
.sub-module.module-c:hover {
    box-shadow: 14px 14px 0px var(--prussian);
}

.floating-annotations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.float-note {
    position: absolute;
    font-family: "Space Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rose);
    opacity: 0;
    animation: floatFade 5s ease-in-out infinite;
}

.note-1 {
    top: 15%;
    left: 8%;
    animation-delay: 0s;
}

.note-2 {
    top: 70%;
    right: 10%;
    animation-delay: 1.2s;
}

.note-3 {
    bottom: 20%;
    left: 15%;
    animation-delay: 2.5s;
}

.note-4 {
    top: 40%;
    right: 20%;
    animation-delay: 3.8s;
}

@keyframes floatFade {
    0%, 100% { opacity: 0; transform: translateY(0); }
    20% { opacity: 0.8; }
    80% { opacity: 0.8; }
    50% { transform: translateY(-10px); }
}

/* PLANE 5 - SYNTHESIS */
.plane-5 {
    background: var(--carbon);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.synthesis-circle {
    width: min(80vw, 500px);
    height: min(80vw, 500px);
    border-radius: 50%;
    background: var(--saffron);
    border: 4px solid var(--vermillion);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slowSpin 90s linear infinite;
}

@keyframes slowSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.synthesis-domain {
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: clamp(2rem, 6vw, 4.5rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 0.92;
    color: var(--prussian);
    animation: slowSpin 90s linear infinite reverse;
}

.synthesis-tagline {
    font-family: "Space Mono", monospace;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    color: var(--chalk);
    margin-top: 40px;
    opacity: 0.8;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .content-modules,
    .subversion-modules {
        grid-template-columns: 1fr;
    }

    .composition-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .comp-module {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    #nav-indicator {
        top: 16px;
        right: 16px;
    }

    .module,
    .sub-module,
    .comp-module {
        --rotation: 0deg !important;
    }

    .sub-module {
        --shift-x: 0px !important;
        --shift-y: 0px !important;
    }

    .block-matrix {
        width: 85vw;
        height: 85vw;
    }

    .plane-2,
    .plane-3,
    .plane-4 {
        padding: 40px 20px;
    }
}

@media (max-width: 480px) {
    .composition-grid {
        grid-template-columns: 1fr;
    }

    .domain-name-reveal {
        font-size: clamp(2rem, 12vw, 4rem);
    }
}
