/* ============================================================
   MMIDDL.com - Contemplative Observatory
   Colors: #0B0E1A, #111628, #4A7B9D, #C8CCD8, #8B92A8, #D4A853, #2E5C7A, #1C2440
   Fonts: Cormorant Garamond, Source Sans 3, DM Mono
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --canvas: #0B0E1A;
    --secondary-bg: #111628;
    --accent-teal: #4A7B9D;
    --headline: #C8CCD8;
    --body-text: #8B92A8;
    --amber: #D4A853;
    --nebula-teal: #2E5C7A;
    --trace: #1C2440;
    --zen-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    background-color: var(--canvas);
    color: var(--body-text);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 350;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Star Field Background --- */
.star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s var(--zen-ease);
}

.star-field.visible {
    opacity: 1;
}

.stars-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.stars-bright-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

/* --- Shooting Stars --- */
.shooting-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.shooting-star {
    position: absolute;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, var(--headline), transparent);
    opacity: 0;
    transform: rotate(-30deg);
    animation: shootingStar 0.8s var(--zen-ease) forwards;
}

@keyframes shootingStar {
    0% {
        opacity: 0.9;
        transform: rotate(-30deg) translateX(0);
    }
    100% {
        opacity: 0;
        transform: rotate(-30deg) translateX(300px);
    }
}

/* --- Constellation Navigation --- */
.constellation-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 120px;
    height: 160px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.8s var(--zen-ease);
}

.constellation-nav.visible {
    opacity: 1;
}

.nav-svg {
    width: 100%;
    height: 100%;
}

.nav-line {
    stroke: var(--trace);
    stroke-width: 1;
    stroke-dasharray: 2 6;
    opacity: 0.6;
    transition: stroke 0.3s var(--zen-ease), opacity 0.3s var(--zen-ease);
}

.nav-star {
    fill: var(--accent-teal);
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.3s var(--zen-ease), r 0.4s var(--zen-ease), fill 0.3s var(--zen-ease);
}

.nav-star:hover {
    fill: var(--amber);
    opacity: 1;
}

.nav-star.active {
    fill: var(--amber);
    opacity: 1;
}

.constellation-nav:hover .nav-star:not(:hover) {
    opacity: 0.25;
}

.nav-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.nav-label {
    position: absolute;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--accent-teal);
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s var(--zen-ease);
    transform: translateX(-110%);
}

.nav-label[data-for="hero"] { top: 4px; right: 85px; }
.nav-label[data-for="cluster-observe"] { top: 44px; right: 105px; }
.nav-label[data-for="cluster-map"] { top: 36px; right: 20px; transform: translateX(110%); }
.nav-label[data-for="cluster-decode"] { top: 76px; right: 100px; }
.nav-label[data-for="cluster-reflect"] { top: 70px; right: 25px; transform: translateX(110%); }
.nav-label[data-for="cluster-converge"] { top: 110px; right: 60px; }

.constellation-nav:hover .nav-label {
    opacity: 0.8;
}

/* --- Main Content --- */
.main-content {
    position: relative;
    z-index: 10;
}

/* --- Content Clusters --- */
.content-cluster {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 120px;
    scroll-snap-align: center;
}

.cluster-left .cluster-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 80px;
    max-width: 1100px;
    width: 100%;
    padding-right: 10%;
}

.cluster-right .cluster-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 80px;
    max-width: 1100px;
    width: 100%;
    padding-left: 10%;
}

.cluster-center .cluster-inner-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    max-width: 900px;
    width: 100%;
}

.cluster-text {
    max-width: 540px;
    flex-shrink: 0;
}

.cluster-text-center {
    text-align: center;
}

/* --- Cluster entrance animations --- */
.content-cluster .cluster-inner,
.content-cluster .constellation-diagram {
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.8s var(--zen-ease), transform 0.8s var(--zen-ease);
}

.content-cluster.in-view .cluster-inner,
.content-cluster.in-view .constellation-diagram {
    opacity: 1;
    transform: scale(1);
}

.content-cluster .cluster-text {
    opacity: 0;
    transition: opacity 0.6s var(--zen-ease) 0.2s;
}

.content-cluster.in-view .cluster-text {
    opacity: 1;
}

/* --- Hero Section --- */
.hero-cluster {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.nebula-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(74, 123, 157, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: nebulaBreath 6s ease-in-out infinite alternate;
}

.nebula-glow-warm {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(212, 168, 83, 0.04) 0%, transparent 60%);
    top: 50%;
    left: calc(50% + 60px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: nebulaBreath 8s ease-in-out infinite alternate-reverse;
}

@keyframes nebulaBreath {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 72px;
    letter-spacing: 0.12em;
    color: var(--headline);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 1.5s var(--zen-ease) 1.5s, transform 1.5s var(--zen-ease) 1.5s;
    position: relative;
    z-index: 2;
    text-shadow: 0 0 60px rgba(74, 123, 157, 0.2);
}

.hero-title.visible {
    opacity: 1;
    transform: scale(1);
}

.hero-subtitle {
    font-family: 'DM Mono', monospace;
    font-size: 14px;
    letter-spacing: 0.15em;
    color: var(--accent-teal);
    opacity: 0;
    transition: opacity 1s var(--zen-ease) 2.2s;
    margin-top: 20px;
    position: relative;
    z-index: 2;
}

.hero-subtitle.visible {
    opacity: 0.7;
}

.hero-sparkline {
    margin-top: 60px;
    width: 400px;
    max-width: 80vw;
    opacity: 0;
    transition: opacity 1s var(--zen-ease) 2.8s;
    position: relative;
    z-index: 2;
}

.hero-sparkline.visible {
    opacity: 0.5;
}

.sparkline-svg {
    width: 100%;
    height: 60px;
}

.sparkline-path {
    fill: none;
    stroke: var(--accent-teal);
    stroke-width: 1;
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 3s var(--zen-ease) 3s;
}

.hero-sparkline.visible .sparkline-path {
    stroke-dashoffset: 0;
}

/* --- Section Typography --- */
.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 52px;
    letter-spacing: 0.06em;
    color: var(--headline);
    margin-bottom: 28px;
    line-height: 1.15;
}

.section-body {
    color: var(--body-text);
    font-size: 17px;
    line-height: 1.75;
    margin-bottom: 24px;
}

.section-caption {
    margin-top: 16px;
}

.data-label {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--accent-teal);
    text-transform: uppercase;
}

.data-value {
    font-family: 'DM Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--amber);
}

.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 28px;
    color: var(--headline);
    text-shadow: 0 0 30px rgba(74, 123, 157, 0.3);
    margin: 32px 0;
    padding-left: 24px;
    border-left: 1px solid var(--trace);
    line-height: 1.5;
}

/* --- Radial Charts --- */
.radial-chart {
    flex-shrink: 0;
    width: 320px;
    height: 320px;
}

.radial-chart-5 {
    width: 380px;
    height: 380px;
}

.radial-svg {
    width: 100%;
    height: 100%;
}

.radial-svg-large {
    width: 100%;
    height: 100%;
}

.radial-ring {
    fill: none;
    stroke: var(--trace);
    stroke-width: 1;
    opacity: 0.5;
}

.radial-fill {
    fill: rgba(74, 123, 157, 0.12);
    stroke: var(--accent-teal);
    stroke-width: 1;
    transition: fill 0.4s var(--zen-ease);
}

.radial-fill:hover {
    fill: rgba(74, 123, 157, 0.22);
}

.radial-fill-inner {
    fill: rgba(74, 123, 157, 0.08);
    stroke: var(--nebula-teal);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    opacity: 0.6;
}

.radial-node {
    fill: var(--accent-teal);
    opacity: 0.8;
    transition: fill 0.3s var(--zen-ease), opacity 0.3s var(--zen-ease);
}

.radial-node:hover {
    fill: var(--amber);
    opacity: 1;
}

/* --- Constellation Diagrams --- */
.constellation-diagram {
    margin-top: 40px;
    width: 300px;
    height: 200px;
}

.constellation-svg {
    width: 100%;
    height: 100%;
}

.constellation-svg-wide {
    width: 400px;
    height: 250px;
}

.const-line {
    stroke: var(--trace);
    stroke-width: 1;
    transition: stroke 0.3s var(--zen-ease);
}

.const-line:hover {
    stroke: var(--accent-teal);
}

.const-node {
    fill: var(--accent-teal);
    opacity: 0.7;
    cursor: pointer;
    transition: fill 0.4s ease-out, opacity 0.4s ease-out, filter 0.4s ease-out;
    filter: drop-shadow(0 0 2px var(--accent-teal));
}

.const-node:hover {
    fill: var(--amber);
    opacity: 1;
    filter: drop-shadow(0 0 8px var(--amber));
}

.const-node-focal {
    fill: var(--amber);
    opacity: 0.9;
    filter: drop-shadow(0 0 6px var(--amber));
}

/* Pulse animation for constellation nodes */
.pulse-node {
    animation: nodePulse 4s ease-in-out infinite;
}

.pulse-node:nth-child(odd) {
    animation-delay: -1s;
}

.pulse-node:nth-child(3n) {
    animation-delay: -2.5s;
}

@keyframes nodePulse {
    0%, 100% { transform-origin: center; r: inherit; }
    50% { filter: drop-shadow(0 0 5px var(--accent-teal)); }
}

/* --- Connecting Lines / Spark Lines --- */
.connecting-line {
    position: absolute;
    top: -60px;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
    z-index: 5;
}

.spark-path {
    fill: none;
    stroke: var(--accent-teal);
    stroke-width: 1;
    opacity: 0.4;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.content-cluster.in-view .spark-path {
    stroke-dashoffset: 0;
}

/* --- Dot Matrix Backgrounds --- */
.cluster-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* --- Footer --- */
.footer-cluster {
    position: relative;
    padding: 120px;
    text-align: center;
    z-index: 10;
}

.footer-sparkline {
    width: 300px;
    height: 40px;
    margin: 0 auto 40px auto;
    display: block;
    opacity: 0.3;
}

.footer-text {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--body-text);
    opacity: 0.5;
}

.footer-divider {
    color: var(--trace);
    margin: 0 8px;
}

.footer-data {
    margin-top: 12px;
    font-size: 11px;
}

/* --- Text Link Glow --- */
a {
    color: var(--accent-teal);
    text-decoration: none;
    transition: text-shadow 0.25s var(--zen-ease);
}

a:hover {
    text-shadow: 0 0 12px rgba(74, 123, 157, 0.5);
}

/* --- Scroll snap children --- */
.content-cluster {
    scroll-snap-align: center;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .content-cluster {
        padding: 60px 30px;
    }

    .cluster-left .cluster-inner,
    .cluster-right .cluster-inner {
        flex-direction: column;
        padding: 0;
        gap: 40px;
    }

    .radial-chart {
        width: 260px;
        height: 260px;
    }

    .radial-chart-5 {
        width: 300px;
        height: 300px;
    }

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

    .hero-title {
        font-size: 48px;
    }

    .pull-quote {
        font-size: 22px;
    }

    .constellation-nav {
        top: 12px;
        right: 12px;
        width: 80px;
        height: 110px;
    }

    .nav-label {
        display: none;
    }

    .constellation-diagram {
        width: 240px;
        height: 160px;
    }

    .constellation-svg-wide {
        width: 300px;
        height: 200px;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 36px;
        letter-spacing: 0.08em;
    }

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

    .pull-quote {
        font-size: 20px;
    }

    .content-cluster {
        padding: 50px 20px;
    }

    .radial-chart {
        width: 200px;
        height: 200px;
    }

    .footer-cluster {
        padding: 60px 20px;
    }
}
