/* =========================================================
   storiographer.net — digital story loom
   Bauhaus + kinetic typography + dark-neon palette
   ========================================================= */

:root {
    --c-bg: #0a1628;            /* Midnight Studio */
    --c-surface: #142238;       /* Drafting Slate */
    --c-text: #e0e0e0;          /* Bright Silver */
    --c-text-2: #7f8c9b;        /* Muted Steel */
    --c-teal: #4ecdc4;          /* Story Thread Teal */
    --c-coral: #ff6b6b;         /* Signal Coral */
    --c-indigo: #6c5ce7;        /* Blueprint Indigo */
    --c-grid: #1a2744;          /* Faint Navy */

    --f-display: 'Bebas Neue', 'Space Grotesk', sans-serif;
    --f-head: 'Space Grotesk', 'Inter', sans-serif;
    --f-body: 'Inter', system-ui, sans-serif;
    --f-mono: 'JetBrains Mono', 'Space Mono', monospace;

    --rail-w: 48px;
    --max-w: 1200px;
}

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

html {
    scroll-behavior: smooth;
    background: var(--c-bg);
}

body {
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.625;
    color: var(--c-text);
    background: var(--c-bg);
    overflow-x: hidden;
    cursor: crosshair;
    min-height: 100vh;
    position: relative;
}

/* ========== Blueprint grid overlay ========== */
.blueprint-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, var(--c-grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--c-grid) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.55;
    z-index: 1;
    will-change: transform;
}

/* ========== Background typographic fragments ========== */
.bg-fragments {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    will-change: transform;
}

.frag {
    position: absolute;
    font-family: var(--f-display);
    color: var(--c-text);
    opacity: 0.05;
    font-size: clamp(72px, 12vw, 220px);
    letter-spacing: 0.04em;
    line-height: 1;
    white-space: nowrap;
    transform-origin: center;
    user-select: none;
}

/* ========== Cursor trail canvas ========== */
.cursor-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

/* ========== Vertical navigation rail ========== */
.nav-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--rail-w);
    height: 100vh;
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--c-grid);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    z-index: 100;
}

.nav-item {
    text-decoration: none;
    color: var(--c-text-2);
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.05em;
    padding: 8px 6px;
    position: relative;
    display: flex;
    align-items: center;
    height: 28px;
    overflow: hidden;
    transition: color 280ms ease, background-color 280ms ease;
    border-radius: 2px;
}

.nav-letter {
    display: inline-block;
    transform: rotate(-90deg);
    transform-origin: center;
    font-weight: 500;
    text-transform: uppercase;
}

.nav-full {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    margin-left: 0;
    white-space: nowrap;
    text-transform: uppercase;
    color: var(--c-teal);
    transition: max-width 420ms cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 280ms ease,
                margin-left 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item:hover {
    color: var(--c-teal);
    background: rgba(78, 205, 196, 0.08);
}

.nav-item:hover .nav-letter {
    transform: rotate(0deg);
    color: var(--c-teal);
    transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), color 280ms ease;
}

.nav-item:hover .nav-full {
    max-width: 200px;
    opacity: 1;
    margin-left: 10px;
}

.nav-item.active {
    color: var(--c-teal);
}
.nav-item.active .nav-letter {
    color: var(--c-teal);
}

/* ========== General section structure ========== */
section {
    position: relative;
    z-index: 5;
    padding: 120px 80px 120px calc(var(--rail-w) + 60px);
}

.section-label {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 48px;
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-text-2);
}

.section-label.inline {
    margin-bottom: 24px;
}

.section-label .label-num {
    color: var(--c-teal);
    font-weight: 700;
}

.section-label .label-name {
    position: relative;
    padding-left: 14px;
}

.section-label .label-name::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 1px;
    background: var(--c-text-2);
    transform: translateY(-50%);
}

.section-h2 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(36px, 4.6vw, 56px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.gradient-text {
    background: linear-gradient(110deg, var(--c-text) 10%, var(--c-teal) 95%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.grad-teal {
    background: linear-gradient(110deg, var(--c-text) 0%, var(--c-teal) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.grad-coral {
    background: linear-gradient(110deg, var(--c-text) 0%, var(--c-coral) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.grad-indigo {
    background: linear-gradient(110deg, var(--c-text) 0%, var(--c-indigo) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ========== Reveal animation ========== */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== INTRO / kinetic section ========== */
.intro-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px 80px 120px calc(var(--rail-w) + 60px);
    position: relative;
}

.kinetic-stage {
    display: flex;
    width: 100%;
    height: 32vh;
    min-height: 220px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 56px;
    overflow: hidden;
    position: relative;
}

.kinetic-letter {
    display: inline-block;
    font-family: var(--f-display);
    font-size: clamp(60px, 12vw, 200px);
    line-height: 1;
    color: var(--c-text);
    letter-spacing: 0;
    flex: 1 1 0;
    text-align: center;
    opacity: 0;
    transform: translate(0, 0) scale(1.4);
    will-change: transform, opacity;
}

.kinetic-letter.is-in {
    animation: letter-settle 700ms cubic-bezier(0.18, 1.25, 0.32, 1.05) forwards;
}

@keyframes letter-settle {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 1; transform: translate(0, 0) scale(1); }
}

.intro-meta {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.meta-tag {
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--c-text-2);
    text-transform: uppercase;
}

.intro-tagline {
    max-width: 920px;
}

.tagline-h1 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(32px, 3.6vw, 48px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
    color: var(--c-text);
}

.tagline-sub {
    font-size: 18px;
    line-height: 1.6;
    color: var(--c-text-2);
    max-width: 640px;
}

/* ========== Sweep divider ========== */
.sweep-divider {
    position: relative;
    height: 1px;
    width: 100%;
    background: var(--c-grid);
    overflow: visible;
    z-index: 6;
}

.sweep-divider::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 1px;
    width: 0;
    background: var(--c-teal);
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.6);
    transition: width 800ms ease-out;
}

.sweep-divider.swept::before {
    width: 100%;
}

/* ========== Weave / broken grid ========== */
.weave-section {
    position: relative;
}

.broken-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(220px, auto);
    gap: 24px;
    max-width: var(--max-w);
}

.thread-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.thread-svg path {
    fill: none;
    stroke: var(--c-teal);
    stroke-width: 1.5;
    opacity: 0.6;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1200ms ease-out, opacity 320ms ease, stroke-width 320ms ease;
}

.thread-svg path.drawn {
    stroke-dashoffset: 0;
}

.thread-svg path.solid {
    stroke-dasharray: 1000;
}

.thread-svg path.dashed {
    stroke: var(--c-coral);
}

.thread-svg path.dotted {
    stroke: var(--c-indigo);
}

.thread-svg path.highlighted {
    opacity: 1;
    stroke-width: 2.5;
    filter: drop-shadow(0 0 6px currentColor);
}

.block {
    grid-column: var(--col-start) / span var(--col-span);
    grid-row: var(--row);
    background: var(--c-surface);
    border: 1px solid var(--c-grid);
    padding: 28px 28px 24px;
    position: relative;
    z-index: 2;
    transition: border-color 320ms ease, box-shadow 320ms ease, transform 320ms ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: crosshair;
}

.block::before {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-teal);
    opacity: 0.6;
    animation: pulse-marker 2s ease-in-out infinite;
}

.block.connected,
.block:hover {
    border-color: rgba(78, 205, 196, 0.6);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.15);
}

.block-tag {
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--c-teal);
    text-transform: uppercase;
}

.block-h2 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(22px, 2.2vw, 32px);
    line-height: 1.12;
    letter-spacing: -0.015em;
    color: var(--c-text);
}

.block p {
    color: var(--c-text-2);
    font-size: 15px;
    line-height: 1.65;
}

.block-meta {
    margin-top: auto;
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--c-text-2);
    text-transform: uppercase;
}

@keyframes pulse-marker {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* ========== Cinematic band ========== */
.band-section {
    background: var(--c-surface);
    width: 100vw;
    margin-left: calc(-1 * (var(--rail-w) + 60px));
    padding: 140px 80px 160px calc(var(--rail-w) + 60px);
    position: relative;
    clip-path: polygon(0 3%, 100% 0, 100% 97%, 0 100%);
}

.band-inner {
    max-width: var(--max-w);
}

.band-eyebrow {
    display: inline-block;
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--c-coral);
    text-transform: uppercase;
    margin-bottom: 24px;
}

.band-h2 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(40px, 5.4vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 64px;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.band-accent {
    color: var(--c-teal);
}

.node-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: var(--max-w);
}

.node-card {
    border: 1px solid var(--c-grid);
    background: rgba(10, 22, 40, 0.6);
    padding: 32px 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: border-color 320ms ease, transform 320ms ease;
}

.node-card:hover {
    border-color: var(--c-teal);
    transform: translateY(-4px);
}

.node-shape {
    width: 36px;
    height: 36px;
    background: transparent;
    position: relative;
    animation: pulse-marker 2.4s ease-in-out infinite;
}

.shape-circle {
    border: 2px solid var(--c-teal);
    border-radius: 50%;
}

.shape-square {
    border: 2px solid var(--c-coral);
}

.shape-triangle {
    width: 0;
    height: 0;
    border-top: 18px solid transparent;
    border-bottom: 18px solid transparent;
    border-left: 30px solid var(--c-indigo);
    border-right: none;
    background: transparent;
}

.node-key {
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--c-text);
    text-transform: uppercase;
}

.node-desc {
    color: var(--c-text-2);
    font-size: 15px;
    line-height: 1.6;
}

/* ========== Threads section ========== */
.threads-section {
    padding-top: 140px;
    padding-bottom: 140px;
}

.threads-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 64px;
    max-width: var(--max-w);
    align-items: center;
}

.threads-text p {
    color: var(--c-text-2);
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 520px;
}

.threads-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.threads-list li {
    display: flex;
    gap: 22px;
    padding: 14px 18px;
    border: 1px solid var(--c-grid);
    background: rgba(20, 34, 56, 0.4);
    align-items: baseline;
}

.th-key {
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--c-teal);
    min-width: 70px;
    text-transform: uppercase;
}

.th-val {
    color: var(--c-text);
    font-size: 15px;
}

.threads-visual {
    aspect-ratio: 10 / 9;
    background: var(--c-surface);
    border: 1px solid var(--c-grid);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.threads-diagram {
    width: 100%;
    height: 100%;
    display: block;
}

.diagram-thread {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1400ms ease-out, opacity 320ms ease, stroke-width 320ms ease;
    opacity: 0.7;
}

.diagram-thread.solid-thread {
    stroke-dasharray: 800;
}
.diagram-thread.dashed-thread {
    /* dashed pattern set in svg, animation uses pathLength */
    stroke-dasharray: 6 6;
    stroke-dashoffset: 0;
    opacity: 0;
    transition: opacity 1400ms ease-out 200ms;
}
.diagram-thread.dotted-thread {
    stroke-dasharray: 2 6;
    stroke-dashoffset: 0;
    opacity: 0;
    transition: opacity 1400ms ease-out 400ms;
}

.threads-visual.drawn .solid-thread { stroke-dashoffset: 0; }
.threads-visual.drawn .dashed-thread,
.threads-visual.drawn .dotted-thread { opacity: 0.7; }

.diagram-node {
    fill: var(--c-teal);
}

.diagram-node.alt {
    fill: var(--c-coral);
}

.diagram-node.third {
    fill: var(--c-indigo);
}

.diagram-node.pulse {
    transform-origin: center;
    transform-box: fill-box;
    animation: svg-pulse 2.2s ease-in-out infinite;
}

@keyframes svg-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ========== Studio ========== */
.studio-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: var(--max-w);
}

.studio-col {
    grid-column: var(--col-start) / span var(--col-span);
    background: var(--c-surface);
    border: 1px solid var(--c-grid);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 320ms ease, transform 320ms ease;
}

.studio-col:hover {
    transform: translateY(-3px);
}

.studio-col.indigo {
    border-left: 3px solid var(--c-indigo);
}
.studio-col.coral {
    border-left: 3px solid var(--c-coral);
}
.studio-col.teal {
    border-left: 3px solid var(--c-teal);
}

.studio-col.mono {
    background: rgba(20, 34, 56, 0.5);
}

.studio-h3 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -0.015em;
    color: var(--c-text);
}

.studio-col p {
    color: var(--c-text-2);
    font-size: 15px;
    line-height: 1.65;
}

.studio-lead {
    font-size: 18px !important;
    line-height: 1.6 !important;
    max-width: 620px;
}

.mono-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--f-mono);
    font-size: 14px;
    color: var(--c-text);
    letter-spacing: 0.04em;
}

.mono-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--c-grid);
}

.mono-list .dot {
    width: 6px;
    height: 6px;
    background: var(--c-teal);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========== Manifesto ========== */
.manifesto-section {
    padding: 160px 80px 180px calc(var(--rail-w) + 60px);
    background: linear-gradient(180deg, var(--c-bg) 0%, #061021 100%);
    position: relative;
    overflow: hidden;
    clip-path: polygon(0 3%, 100% 0, 100% 100%, 0 100%);
}

.manifesto-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.huge-word {
    font-family: var(--f-display);
    font-size: clamp(180px, 30vw, 480px);
    color: var(--c-teal);
    opacity: 0.06;
    letter-spacing: 0.02em;
    line-height: 1;
}

.manifesto-inner {
    position: relative;
    max-width: 1080px;
}

.manifesto-h2 {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: clamp(36px, 4.8vw, 64px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 32px;
    color: var(--c-text);
}

.manifesto-body {
    font-size: 19px;
    line-height: 1.65;
    color: var(--c-text-2);
    max-width: 760px;
    margin-bottom: 48px;
}

.manifesto-sig {
    display: flex;
    align-items: center;
    gap: 18px;
    font-family: var(--f-mono);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sig-key {
    color: var(--c-teal);
    border: 1px solid var(--c-teal);
    padding: 6px 12px;
}

.sig-val {
    color: var(--c-text-2);
}

/* ========== Footer ========== */
.site-footer {
    padding: 60px 80px 60px calc(var(--rail-w) + 60px);
    border-top: 1px solid var(--c-grid);
    background: var(--c-bg);
    position: relative;
    z-index: 5;
}

.footer-row {
    display: flex;
    gap: 40px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.footer-row.footer-thin {
    margin-bottom: 0;
}

.footer-mark {
    font-family: var(--f-display);
    font-size: 28px;
    color: var(--c-text);
    letter-spacing: 0.06em;
}

.footer-meta {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--c-text-2);
    text-transform: uppercase;
}

/* ========== Responsive ========== */
@media (max-width: 980px) {
    section {
        padding: 80px 32px 80px calc(var(--rail-w) + 24px);
    }
    .intro-section {
        padding: 80px 32px 100px calc(var(--rail-w) + 24px);
    }
    .band-section {
        margin-left: calc(-1 * (var(--rail-w) + 24px));
        padding: 100px 32px 120px calc(var(--rail-w) + 24px);
    }
    .manifesto-section {
        padding: 100px 32px 120px calc(var(--rail-w) + 24px);
    }
    .site-footer {
        padding: 50px 32px 50px calc(var(--rail-w) + 24px);
    }

    .broken-grid,
    .studio-grid {
        grid-template-columns: 1fr;
    }
    .block,
    .studio-col {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
    }

    .threads-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .node-row {
        grid-template-columns: 1fr;
    }
    .thread-svg {
        display: none;
    }
}

@media (max-width: 600px) {
    .nav-rail {
        gap: 18px;
    }
    .kinetic-stage {
        height: 22vh;
        min-height: 140px;
    }
    .kinetic-letter {
        font-size: clamp(38px, 9vw, 80px);
    }
}
