/* ==========================================================================
   mystical.day v2 — finding the uncanny in the ordinary
   Palette: cool-grays (overcast light)
   Type:    Syne (display) / Inter (body) / Fira Code (data)
   ========================================================================== */

:root {
    --overcast-light: #D0D0D4;
    --overcast-mid: #A0A0A8;
    --slate-dark: #3A3A40;
    --mesh-blue: #6088B0;
    --mesh-rose: #B07888;
    --mesh-green: #70A888;
    --city-glow: #E0D890;
    --card-white: #F0F0F2;

    --grid-gutter: 20px;
    --section-pad: clamp(40px, 6vw, 96px);
    --diffuse-shadow: 0 20px 40px rgba(58, 58, 64, 0.08);
    --diffuse-shadow-hover: 0 28px 60px rgba(58, 58, 64, 0.14);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 16px);
    line-height: 1.75;
    color: var(--slate-dark);
    background: var(--overcast-light);
    overflow-x: hidden;
}

/* Headings & shared type ---------------------------------------------------- */

h1, h2, h3 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--slate-dark);
}

pre, code {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.6;
}

.section-label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-dark);
}

/* ==========================================================================
   DAWN VIEWPORT
   ========================================================================== */

.dawn-viewport {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, var(--overcast-light) 0%, var(--overcast-mid) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--section-pad);
}

.generative-mesh {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(96, 136, 176, 0.45) 0%, transparent 60%),
        radial-gradient(ellipse 55% 45% at 78% 24%, rgba(176, 120, 136, 0.40) 0%, transparent 60%),
        radial-gradient(ellipse 70% 60% at 45% 80%, rgba(112, 168, 136, 0.42) 0%, transparent 60%),
        radial-gradient(ellipse 40% 35% at 85% 70%, rgba(224, 216, 144, 0.30) 0%, transparent 60%);
    background-size: 140% 140%;
    background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
    animation: meshDrift 30s ease-in-out infinite alternate;
    filter: blur(2px);
    opacity: 0.85;
    pointer-events: none;
}

@keyframes meshDrift {
    0% {
        background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
        background-size: 140% 140%, 130% 130%, 150% 150%, 120% 120%;
    }
    50% {
        background-position: 30% 20%, 70% 30%, 25% 70%, 80% 60%;
        background-size: 160% 160%, 150% 150%, 130% 130%, 140% 140%;
    }
    100% {
        background-position: 60% 50%, 40% 60%, 50% 40%, 60% 50%;
        background-size: 130% 130%, 160% 160%, 140% 140%, 150% 150%;
    }
}

.dawn-content {
    position: relative;
    z-index: 2;
    max-width: 880px;
    width: 100%;
    text-align: left;
    opacity: 0;
    animation: dawnFade 1000ms ease-out 200ms forwards;
}

@keyframes dawnFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dawn-label {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--slate-dark);
    padding: 6px 12px;
    border: 1px solid var(--slate-dark);
    margin-bottom: 32px;
    background: rgba(240, 240, 242, 0.4);
}

.dawn-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 124px);
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: var(--slate-dark);
    margin-bottom: 24px;
}

.dawn-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.4vw, 20px);
    line-height: 1.5;
    max-width: 560px;
    color: var(--slate-dark);
    margin-bottom: 36px;
}

.dawn-code {
    display: inline-block;
    background: rgba(240, 240, 242, 0.55);
    border-left: 2px solid var(--mesh-blue);
    padding: 14px 18px;
    color: var(--slate-dark);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
}

.dawn-scroll-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--slate-dark);
    opacity: 0;
    animation: dawnFade 1000ms ease-out 1200ms forwards;
}

.dawn-scroll-line {
    display: block;
    width: 1px;
    height: 40px;
    background: var(--slate-dark);
    transform-origin: top;
    animation: scrollLine 2.4s ease-in-out infinite;
}

@keyframes scrollLine {
    0%   { transform: scaleY(0.2); opacity: 0.4; }
    50%  { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(0.2); opacity: 0.4; }
}

/* ==========================================================================
   GENERATIVE INTERLUDES
   ========================================================================== */

.generative-interlude {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
    background: var(--overcast-mid);
}

.interlude-mesh {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse 50% 60% at 15% 50%, rgba(96, 136, 176, 0.55) 0%, transparent 65%),
        radial-gradient(ellipse 55% 50% at 55% 30%, rgba(176, 120, 136, 0.45) 0%, transparent 65%),
        radial-gradient(ellipse 50% 60% at 85% 70%, rgba(112, 168, 136, 0.50) 0%, transparent 65%);
    background-size: 130% 130%;
    animation: meshDrift 36s ease-in-out infinite alternate;
    filter: blur(3px);
}

.interlude-mesh-alt {
    background-image:
        radial-gradient(ellipse 60% 50% at 25% 70%, rgba(112, 168, 136, 0.50) 0%, transparent 65%),
        radial-gradient(ellipse 50% 55% at 65% 45%, rgba(224, 216, 144, 0.40) 0%, transparent 65%),
        radial-gradient(ellipse 55% 60% at 80% 25%, rgba(96, 136, 176, 0.50) 0%, transparent 65%);
    animation-duration: 42s;
}

.interlude-mesh-third {
    background-image:
        radial-gradient(ellipse 55% 60% at 30% 35%, rgba(176, 120, 136, 0.55) 0%, transparent 65%),
        radial-gradient(ellipse 60% 50% at 70% 65%, rgba(96, 136, 176, 0.50) 0%, transparent 65%),
        radial-gradient(ellipse 45% 55% at 90% 35%, rgba(224, 216, 144, 0.45) 0%, transparent 65%);
    animation-duration: 48s;
}

.interlude-caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 64px);
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}

.interlude-tick {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--slate-dark);
    letter-spacing: 0.05em;
}

.interlude-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: var(--slate-dark);
    font-style: italic;
}

/* ==========================================================================
   OBSERVATIONS SECTION
   ========================================================================== */

.observations-section,
.patterns-section,
.map-section {
    padding: var(--section-pad);
    max-width: 1320px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 24px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--overcast-mid);
}

.section-meta {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--slate-dark);
    opacity: 0.7;
    letter-spacing: 0.04em;
}

.observation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 1fr;
    gap: var(--grid-gutter);
}

.observation-card {
    position: relative;
    background: var(--card-white);
    border: 1px solid var(--overcast-mid);
    padding: 32px 28px;
    box-shadow: var(--diffuse-shadow);
    transition: border-color 300ms ease,
                box-shadow 400ms ease,
                transform 400ms ease;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: hidden;
}

.observation-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 90% 100% at 100% 0%, transparent 0%, transparent 70%, rgba(96, 136, 176, 0.04) 100%);
    pointer-events: none;
    transition: opacity 400ms ease;
    opacity: 1;
}

.observation-card[data-accent="rose"]::before {
    background: radial-gradient(ellipse 90% 100% at 100% 0%, transparent 0%, transparent 70%, rgba(176, 120, 136, 0.05) 100%);
}

.observation-card[data-accent="green"]::before {
    background: radial-gradient(ellipse 90% 100% at 100% 0%, transparent 0%, transparent 70%, rgba(112, 168, 136, 0.05) 100%);
}

.observation-card.is-active {
    border-color: var(--mesh-blue);
}

.observation-card[data-accent="rose"].is-active {
    border-color: var(--mesh-rose);
}

.observation-card[data-accent="green"].is-active {
    border-color: var(--mesh-green);
}

.observation-card:hover {
    box-shadow: var(--diffuse-shadow-hover);
    transform: translateY(-2px);
}

.card-label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mesh-blue);
}

.observation-card[data-accent="rose"] .card-label { color: var(--mesh-rose); }
.observation-card[data-accent="green"] .card-label { color: var(--mesh-green); }

.card-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: clamp(22px, 1.8vw, 28px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--slate-dark);
}

.card-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.75;
    color: var(--slate-dark);
    flex: 1;
}

.underline-draw {
    display: inline;
    position: relative;
    background-image: linear-gradient(var(--mesh-blue), var(--mesh-blue));
    background-size: 0% 1px;
    background-position: 0% 100%;
    background-repeat: no-repeat;
    transition: background-size 400ms ease, text-shadow 300ms ease;
    padding-bottom: 2px;
}

.observation-card[data-accent="rose"] .underline-draw {
    background-image: linear-gradient(var(--mesh-rose), var(--mesh-rose));
}

.observation-card[data-accent="green"] .underline-draw {
    background-image: linear-gradient(var(--mesh-green), var(--mesh-green));
}

.underline-draw.is-drawn {
    background-size: 100% 1px;
}

.observation-card:hover .underline-draw {
    text-shadow: 0 0 8px rgba(96, 136, 176, 0.3);
}

.observation-card[data-accent="rose"]:hover .underline-draw {
    text-shadow: 0 0 8px rgba(176, 120, 136, 0.3);
}

.observation-card[data-accent="green"]:hover .underline-draw {
    text-shadow: 0 0 8px rgba(112, 168, 136, 0.3);
}

.card-code {
    background: var(--overcast-light);
    border-left: 2px solid var(--mesh-blue);
    padding: 12px 14px;
    color: var(--slate-dark);
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
    overflow-x: auto;
}

.observation-card[data-accent="rose"] .card-code { border-left-color: var(--mesh-rose); }
.observation-card[data-accent="green"] .card-code { border-left-color: var(--mesh-green); }

/* ==========================================================================
   PATTERNS SECTION
   ========================================================================== */

.pattern-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--overcast-mid);
}

.pattern-row {
    display: grid;
    grid-template-columns: 60px 1fr 110px 200px;
    align-items: baseline;
    gap: 24px;
    padding: 20px 0;
    border-bottom: 1px solid var(--overcast-mid);
    transition: background-color 300ms ease, padding-left 300ms ease;
}

.pattern-row:hover {
    background-color: rgba(240, 240, 242, 0.5);
    padding-left: 12px;
}

.pattern-index {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--mesh-blue);
    letter-spacing: 0.05em;
}

.pattern-name {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
    color: var(--slate-dark);
}

.pattern-frequency {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--slate-dark);
    text-align: right;
}

.pattern-context {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: var(--slate-dark);
    opacity: 0.75;
    text-align: right;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   URBAN PATTERN MAP
   ========================================================================== */

.map-container {
    position: relative;
    width: 100%;
    background: var(--overcast-light);
    border: 1px solid var(--overcast-mid);
    padding: 32px;
    overflow: hidden;
}

.urban-grid {
    width: 100%;
    height: auto;
    display: block;
}

.urban-grid line {
    stroke: var(--overcast-mid);
    stroke-width: 1;
    fill: none;
}

.urban-grid line.major {
    stroke: var(--slate-dark);
    stroke-width: 1.2;
    opacity: 0.5;
}

.urban-grid .node {
    fill: var(--overcast-mid);
    transition: fill 600ms ease, r 600ms ease;
}

.urban-grid .node-glow {
    fill: var(--city-glow);
    transition: opacity 800ms ease, r 800ms ease;
    opacity: 0;
}

.urban-grid .node-glow.is-active {
    opacity: 0.85;
}

.urban-grid .traversal {
    stroke: var(--mesh-blue);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 4 6;
    opacity: 0.55;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--overcast-mid);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-dark);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot-bright {
    background: var(--city-glow);
    box-shadow: 0 0 8px rgba(224, 216, 144, 0.6);
}

.legend-dot-dim {
    background: var(--overcast-mid);
}

.legend-line {
    display: inline-block;
    width: 22px;
    height: 1px;
    background-image: linear-gradient(90deg, var(--mesh-blue) 50%, transparent 50%);
    background-size: 6px 1px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
    padding: var(--section-pad);
    background: var(--slate-dark);
    color: var(--card-white);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gutter);
    max-width: 1320px;
    margin: 0 auto 56px;
}

.footer-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.footer-label {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--city-glow);
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(240, 240, 242, 0.2);
}

.footer-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.75;
    color: var(--card-white);
    opacity: 0.85;
}

.footer-stamp {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 1320px;
    margin: 0 auto;
    padding-top: 28px;
    border-top: 1px solid rgba(240, 240, 242, 0.2);
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: var(--card-white);
    opacity: 0.7;
    letter-spacing: 0.06em;
}

.footer-divider {
    display: inline-block;
    width: 16px;
    height: 1px;
    background: var(--card-white);
    opacity: 0.5;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 960px) {
    .observation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .pattern-row {
        grid-template-columns: 60px 1fr;
        row-gap: 6px;
    }
    .pattern-frequency,
    .pattern-context {
        grid-column: 2;
        text-align: left;
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .observation-grid {
        grid-template-columns: 1fr;
    }
    .dawn-title {
        font-size: clamp(40px, 14vw, 68px);
    }
    .interlude-caption {
        width: calc(100% - 32px);
    }
    .footer-stamp {
        flex-direction: column;
        gap: 8px;
    }
    .footer-divider {
        display: none;
    }
}
