/* ================================================================
   continua.quest — graffiti-as-information-architecture
   palette: muted vintage · type: Playfair + Lora + IBM Plex Mono
   Named faces mirror the DESIGN.md Google Fonts direction without fetching external assets:
   Playfair Display" (Google Fonts), Lora" (Google Fonts), IBM Plex Mono" (Google Fonts), IBM Plex Mono`.
   Intersection Observer triggers for section entry: each data visualization begins its draw/reveal animation when its section enters the viewport (60% threshold).
   Playfair Display's elegant high-contrast serifs and the spray-paint drip effects creates a visual paradox — scholarly rebellion.
   ================================================================ */

:root {
    --bg-primary:   #1c1a17;  /* charcoal concrete  */
    --bg-secondary: #2a2621;  /* smoke plaster     */
    --amber:        #c4975a;  /* oxidized amber    */
    --teal:         #5a8a7c;  /* faded teal        */
    --rose:         #a6736b;  /* dusty rose        */
    --parchment:    #d4c8b8;  /* warm off-white    */
    --stone:        #9a8b7a;  /* weathered stone   */
    --brick:        #8b4a3a;  /* signal brick fade */

    --font-display: "Playfair Display", "Lora", Georgia, serif;
    --font-body:    "Lora", Georgia, serif;
    --font-mono:    "IBM Plex Mono", "Space Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--parchment);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    position: relative;
}

/* Hidden shared defs SVG should take no space */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Full-viewport concrete grain on top of everything */
.global-grain {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    opacity: 0.045;
    z-index: 100;
    mix-blend-mode: overlay;
}

/* ----------------------------------------------------------------
   Shared section scaffolding
---------------------------------------------------------------- */
section {
    position: relative;
    width: 100vw;
    overflow: hidden;
    isolation: isolate;
}

.grid-underlay {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg,
            transparent, transparent 59px,
            rgba(154, 139, 122, 0.055) 59px,
            rgba(154, 139, 122, 0.055) 60px),
        repeating-linear-gradient(90deg,
            transparent, transparent 59px,
            rgba(154, 139, 122, 0.055) 59px,
            rgba(154, 139, 122, 0.055) 60px);
    pointer-events: none;
    z-index: 1;
}

.noise-overlay {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(196, 151, 90, 0.04), transparent 40%),
        radial-gradient(circle at 82% 70%, rgba(90, 138, 124, 0.05), transparent 45%),
        radial-gradient(circle at 50% 90%, rgba(139, 74, 58, 0.035), transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* ----------------------------------------------------------------
   THE WALL  (Hero)
---------------------------------------------------------------- */
.the-wall {
    height: 100vh;
    min-height: 680px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.continuum-line {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.continuum-path,
.continuum-glow {
    fill: none;
    stroke: var(--amber);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 4200;
    stroke-dashoffset: 4200;
    animation: draw-line 4s ease-in-out 0.8s forwards;
}

.continuum-glow {
    stroke-width: 10;
    opacity: 0.18;
    filter: blur(8px);
    animation-duration: 4.2s;
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

.circuit-traces {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.circuit-traces polyline {
    fill: none;
    stroke: var(--stone);
    stroke-opacity: 0.18;
    stroke-width: 1;
}

.circuit-traces .trace-teal {
    stroke: var(--teal);
    stroke-opacity: 0.22;
}

.crosshair-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.crosshair {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--stone);
    opacity: 0.35;
    text-transform: uppercase;
    white-space: nowrap;
}

.hero-title-wrap {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 0 2rem;
    max-width: 100vw;
}

.stencil-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 10rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--amber);
    margin: 0;
    position: relative;
    display: inline-block;
    text-shadow:
        0 0 2px var(--amber),
        0 0 15px rgba(196, 151, 90, 0.2),
        0 0 40px rgba(196, 151, 90, 0.12);
    transform: rotate(-1deg);
}

/* Drip pseudo-elements under the stencil title */
.stencil-title::before,
.stencil-title::after {
    content: "";
    position: absolute;
    bottom: -0.15em;
    width: 6px;
    height: 0.45em;
    background: linear-gradient(to bottom, var(--amber), transparent);
    border-radius: 0 0 3px 3px;
    opacity: 0.85;
    filter: blur(0.3px);
}

.stencil-title::before {
    left: 18%;
    height: 0.6em;
}

.stencil-title::after {
    right: 28%;
    height: 0.4em;
    width: 5px;
}

.quest-suffix {
    display: inline-block;
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.6rem, 4.8vw, 4rem);
    color: var(--parchment);
    margin-top: 0.2em;
    transform: rotate(-2deg) translateX(18%);
    text-shadow: 0 0 12px rgba(212, 200, 184, 0.15);
}

.hero-tag {
    margin: 1.6rem auto 0;
    max-width: 42ch;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--stone);
    opacity: 0.55;
    transform: rotate(1deg);
}

.pulse-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.pulse-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow:
        0 0 6px var(--amber),
        0 0 18px rgba(196, 151, 90, 0.55),
        0 0 38px rgba(196, 151, 90, 0.28);
    animation: pulse-attention 2.4s ease-in-out infinite;
}

.pulse-dot:nth-child(1) { animation-delay: 0s;    }
.pulse-dot:nth-child(2) { animation-delay: 0.35s; background: var(--teal); box-shadow: 0 0 6px var(--teal), 0 0 18px rgba(90,138,124,0.55); }
.pulse-dot:nth-child(3) { animation-delay: 0.7s;  }
.pulse-dot:nth-child(4) { animation-delay: 1.05s; background: var(--rose); box-shadow: 0 0 6px var(--rose), 0 0 18px rgba(166,115,107,0.55); }
.pulse-dot:nth-child(5) { animation-delay: 1.4s;  }
.pulse-dot:nth-child(6) { animation-delay: 1.75s; }

@keyframes pulse-attention {
    0%, 100% { transform: scale(1);   opacity: 1;   }
    50%      { transform: scale(1.8); opacity: 0.3; }
}

.stencil-mark {
    position: absolute;
    z-index: 4;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(0.95rem, 1.4vw, 1.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bg-primary);
    background: var(--amber);
    padding: 0.22em 0.55em;
    box-shadow:
        0 0 0 1px rgba(196, 151, 90, 0.4),
        0 0 14px rgba(196, 151, 90, 0.35);
}

.stencil-mark.mark-teal {
    background: var(--teal);
    color: var(--bg-primary);
    box-shadow:
        0 0 0 1px rgba(90, 138, 124, 0.4),
        0 0 14px rgba(90, 138, 124, 0.35);
}

.scroll-chevron {
    position: absolute;
    left: 50%;
    bottom: 2.4rem;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    pointer-events: none;
}

.scroll-chevron svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--stone);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    animation: chevron-bob 2.5s ease-in-out infinite;
}

.scroll-chevron em {
    font-family: var(--font-mono);
    font-style: normal;
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--stone);
    opacity: 0.6;
}

@keyframes chevron-bob {
    0%, 100% { transform: translateY(0);   opacity: 0.8; }
    50%      { transform: translateY(8px); opacity: 0.3; }
}

/* ----------------------------------------------------------------
   DATA MURAL SECTIONS (scatter / network / histogram)
---------------------------------------------------------------- */
.mural {
    min-height: 100vh;
    padding: 6rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mural-scatter   { background: var(--bg-primary); }
.mural-network   { background: var(--bg-secondary); }
.mural-histogram { background: var(--bg-primary); }

.viz {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.4s ease-out;
}

.mural.is-visible .viz { opacity: 1; }

.mural-caption {
    position: relative;
    z-index: 4;
    max-width: 36ch;
    padding: 1.8rem 2rem;
    background: rgba(28, 26, 23, 0.55);
    backdrop-filter: blur(2px);
    border-left: 2px solid var(--amber);
    mix-blend-mode: normal;
}

.mural-caption.caption-tl { margin: 4rem auto 8rem 6vw; }
.mural-caption.caption-tr { margin: 4rem 6vw 8rem auto; }
.mural-caption.caption-br { margin: 8rem 6vw 4rem auto; }

.kicker {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 0.9rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(154, 139, 122, 0.25);
}

.mural-heading {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--parchment);
    margin: 0 0 1.1rem;
    text-shadow:
        0 0 2px rgba(196, 151, 90, 0.4),
        0 0 16px rgba(196, 151, 90, 0.15);
}

.mural-heading em {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 700;
    color: var(--amber);
}

.mural-caption p {
    color: var(--parchment);
    margin: 0 0 1rem;
    font-size: clamp(0.95rem, 1.3vw, 1.05rem);
}

.inline-stencil {
    background: var(--amber);
    color: var(--bg-primary);
    padding: 0.05em 0.32em;
    font-weight: 700;
    display: inline-block;
    transform: rotate(-1deg);
    margin: 0 0.08em;
}

.data-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.12em;
    color: var(--stone);
    opacity: 0.72;
    margin-top: 0.6rem;
}

.mural-axis {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 3rem;
    z-index: 2;
    display: flex;
    justify-content: space-around;
    padding: 0 6vw;
    pointer-events: none;
}

.mural-axis span {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--stone);
    opacity: 0.4;
}

/* Scatter points get sprayed-edge look */
.viz-scatter circle {
    filter: url(#spraypaint);
    transform-origin: center;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 1.4s ease-out, transform 1.4s ease-out;
}

.mural.is-visible .viz-scatter circle {
    opacity: var(--dot-opacity, 0.85);
    transform: scale(1);
    transition-delay: var(--delay, 0s);
}

/* Network nodes and edges */
.viz-network .edge {
    stroke: var(--stone);
    stroke-opacity: 0.32;
    stroke-width: 1.25;
    stroke-dasharray: 3 2;
    fill: none;
    animation: net-breathe 6s ease-in-out infinite;
}

.viz-network .node {
    filter: url(#spraypaint-soft);
    transform-box: fill-box;
    transform-origin: center;
    animation: node-drift 6s ease-in-out infinite;
}

@keyframes node-drift {
    0%, 100% { transform: translate(0, 0); }
    25%      { transform: translate(2px, -1.5px); }
    50%      { transform: translate(-1.5px, 2px); }
    75%      { transform: translate(1.2px, 1.8px); }
}

@keyframes net-breathe {
    0%, 100% { stroke-opacity: 0.32; }
    50%      { stroke-opacity: 0.18; }
}

/* Histogram bars with dripping tops */
.viz-histogram .bar {
    fill: var(--amber);
    transform: scaleY(0);
    transform-origin: center bottom;
    transform-box: fill-box;
    transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mural-histogram.is-visible .viz-histogram .bar {
    transform: scaleY(1);
    transition-delay: var(--delay, 0s);
}

.viz-histogram .drip {
    fill: var(--amber);
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.mural-histogram.is-visible .viz-histogram .drip {
    opacity: 0.72;
    transition-delay: calc(var(--delay, 0s) + 0.9s);
}

/* ----------------------------------------------------------------
   SIGNAL STRIP
---------------------------------------------------------------- */
.signal-strip {
    height: 15vh;
    min-height: 110px;
    background: var(--bg-primary);
    border-top: 1px solid rgba(154, 139, 122, 0.1);
    border-bottom: 1px solid rgba(154, 139, 122, 0.1);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.signal-strip::before,
.signal-strip::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12vw;
    z-index: 2;
    pointer-events: none;
}

.signal-strip::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-primary), transparent);
}

.signal-strip::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-primary), transparent);
}

.ticker-track {
    display: flex;
    flex-shrink: 0;
    white-space: nowrap;
    animation: ticker 40s linear infinite;
    will-change: transform;
}

.ticker-track span {
    flex-shrink: 0;
    padding: 0 2.4rem;
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: rgba(154, 139, 122, 0.4);
    text-transform: uppercase;
}

.ticker-track span.hot {
    color: rgba(196, 151, 90, 0.55);
}

@keyframes ticker {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ----------------------------------------------------------------
   THE EXIT
---------------------------------------------------------------- */
.the-exit {
    min-height: 100vh;
    background: var(--bg-secondary);
    padding: 6rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exit-curve {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.exit-path,
.exit-glow {
    fill: none;
    stroke: var(--amber);
    stroke-width: 3;
    stroke-linecap: round;
}

.exit-glow {
    stroke-width: 14;
    opacity: 0.22;
    filter: blur(10px);
}

.exit-title-wrap {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 0 2rem;
    mix-blend-mode: screen;
}

.stencil-faded {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 9vw, 8rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: rgba(212, 200, 184, 0.32);
    margin: 0;
    transform: rotate(-1.5deg);
    text-shadow: 0 0 30px rgba(212, 200, 184, 0.1);
}

.exit-signoff {
    margin: 2rem auto 0;
    max-width: 50ch;
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    color: var(--parchment);
    opacity: 0.85;
}

.exit-signoff em {
    color: var(--amber);
    font-weight: 700;
}

.exit-signoff .data-label {
    margin-top: 0.8rem;
    opacity: 0.55;
}

/* ----------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */
@media (max-width: 720px) {
    .mural-caption.caption-tl,
    .mural-caption.caption-tr,
    .mural-caption.caption-br {
        margin: 3rem 5vw;
        max-width: 90vw;
    }
    .hero-tag { letter-spacing: 0.18em; }
    .quest-suffix { transform: rotate(-2deg) translateX(0); }
    .stencil-mark { display: none; }
    .crosshair { font-size: 9px; opacity: 0.25; }
}

/* Reduced motion: kill drifts, keep static layout */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
    .continuum-path,
    .continuum-glow,
    .exit-path,
    .exit-glow { stroke-dashoffset: 0; }
    .viz { opacity: 1; }
}
