/* archetype.works — Design Language Stylesheet
   Fonts: Space Grotesk, IBM Plex Sans, IBM Plex Mono (Google Fonts).
   Scroll reveals use `IntersectionObserver` with a threshold
   array at 0.1 increments — no scroll-jacking, native scroll preserved.
   Palette:
     #1A1816 Charcoal Ground
     #5C1A1A Oxblood
     #2A1F18 Dark Walnut
     #0D0B0E Deep Void
     #8B9DAF Constellation Silver
     #E8E0D4 Ivory Signal
     #A8935F Burnished Gold
     #F5F2ED Star White
*/

:root {
    --c-void: #0D0B0E;
    --c-charcoal: #1A1816;
    --c-walnut: #2A1F18;
    --c-oxblood: #5C1A1A;
    --c-ivory: #E8E0D4;
    --c-gold: #A8935F;
    --c-silver: #8B9DAF;
    --c-star: #F5F2ED;

    --font-display: "Space Grotesk", "Space", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", "Inter", "Lato", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "Space", ui-monospace, monospace;

    --gutter: 40px;
    --void-gap: 200px;
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--c-ivory);
    background: var(--c-void);
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------
   Celestial Waypoint Indicator
-------------------------------------------------------- */
.waypoint-indicator {
    position: fixed;
    top: 50%;
    right: 32px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 100;
    mix-blend-mode: difference;
    padding: 16px 8px;
}

.waypoint-indicator::before {
    content: "";
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 50%;
    width: 1px;
    background: rgba(245, 242, 237, 0.22);
    transform: translateX(-50%);
}

.waypoint-dot {
    position: relative;
    width: 14px;
    height: 14px;
    display: block;
    background: transparent;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    z-index: 1;
}

.waypoint-dot::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(45deg, transparent 42%, var(--c-ivory) 42%, var(--c-ivory) 58%, transparent 58%),
        linear-gradient(-45deg, transparent 42%, var(--c-ivory) 42%, var(--c-ivory) 58%, transparent 58%),
        linear-gradient(90deg, transparent 42%, var(--c-ivory) 42%, var(--c-ivory) 58%, transparent 58%),
        linear-gradient(0deg, transparent 42%, var(--c-ivory) 42%, var(--c-ivory) 58%, transparent 58%);
    opacity: 0.35;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    transition: opacity 0.5s ease, transform 0.5s ease;
    background-color: var(--c-ivory);
    background-image: none;
}

.waypoint-dot.active::before {
    opacity: 1;
    animation: pulse-star 2.4s ease-in-out infinite;
}

.waypoint-dot:hover::before {
    opacity: 0.85;
    transform: scale(1.2);
}

@keyframes pulse-star {
    0%, 100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 2px var(--c-star)); }
    50% { transform: scale(1.25); opacity: 0.75; filter: drop-shadow(0 0 6px var(--c-star)); }
}

/* --------------------------------------------------------
   Narrative layout
-------------------------------------------------------- */
.narrative {
    position: relative;
    width: 100%;
}

.chapter {
    position: relative;
    min-height: 100vh;
    width: 100%;
    padding: 120px 8vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.chapter-void {
    height: var(--void-gap);
    background: var(--c-void);
    position: relative;
}

.chapter-void::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168, 147, 95, 0.3) 20%, rgba(168, 147, 95, 0.3) 80%, transparent);
}

.chapter-void::before {
    content: "✦";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--c-gold);
    opacity: 0.6;
    font-size: 0.85rem;
    background: var(--c-void);
    padding: 0 12px;
    font-family: var(--font-mono);
    z-index: 1;
}

/* 6-column grid; content occupies 4 columns with shifting placement */
.grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--gutter);
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
}

.grid-cols-1-4 > * {
    grid-column: span 4;
}
.grid-cols-1-4 .manifesto-meta {
    grid-column: 1 / span 1;
    grid-row: 1;
}
.grid-cols-1-4 .manifesto-heading,
.grid-cols-1-4 .evidence-text {
    grid-column: 2 / span 4;
}
.grid-cols-1-4 .manifesto-body,
.grid-cols-1-4 .pull-quote {
    grid-column: 2 / span 4;
}
.grid-cols-1-4 .evidence-canvas-wrap {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
}

.grid-cols-2-5 .evidence-canvas-wrap,
.grid-cols-2-5 .evidence-canvas-left {
    grid-column: 2 / span 2;
}
.grid-cols-2-5 .evidence-text {
    grid-column: 4 / span 3;
}

.grid-cols-3-6 .evidence-text {
    grid-column: 1 / span 4;
}
.grid-cols-3-6 .evidence-canvas-wrap {
    grid-column: 5 / span 2;
}

/* --------------------------------------------------------
   Section numbering (rotated mono labels)
-------------------------------------------------------- */
.section-number {
    position: absolute;
    top: 120px;
    left: 3vw;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--c-gold);
    opacity: 0.5;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    transform-origin: center;
}

/* Meta labels (inline) */
.meta-label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-gold);
    margin-bottom: 24px;
}

/* --------------------------------------------------------
   Chapter 0: Hero / Constellation
-------------------------------------------------------- */
.chapter-hero {
    background: radial-gradient(ellipse at center, #15121A 0%, var(--c-void) 60%, #050406 100%);
    min-height: 100vh;
    padding: 0 8vw;
    align-items: center;
    justify-content: center;
}

.constellation-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.constellation-map .star {
    fill: var(--c-star);
    opacity: 0;
    filter: drop-shadow(0 0 3px rgba(245, 242, 237, 0.8));
    animation: star-appear 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes star-appear {
    from { opacity: 0; transform: scale(0.3); }
    to   { opacity: 1; transform: scale(1); }
}

.constellation-map .line {
    stroke: var(--c-silver);
    stroke-width: 0.5;
    fill: none;
    opacity: 0.4;
    stroke-dasharray: var(--len, 200);
    stroke-dashoffset: var(--len, 200);
    animation: line-draw 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 1200px;
}

.logotype {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(3rem, 11vw, 9rem);
    color: var(--c-ivory);
    text-transform: uppercase;
    letter-spacing: -0.45em;
    opacity: 0;
    transition:
        letter-spacing 1.6s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 1s ease;
    text-shadow:
        1px 1px 0 rgba(0, 0, 0, 0.55),
        -1px -1px 0 rgba(245, 242, 237, 0.12);
    line-height: 1;
    white-space: nowrap;
    margin-bottom: 32px;
}

.logotype.spread {
    letter-spacing: 0.08em;
    opacity: 1;
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-gold);
    opacity: 0;
    transition: opacity 1.2s ease 0.6s;
}

.logotype.spread + .hero-subtitle {
    opacity: 0.85;
}

/* --------------------------------------------------------
   Leather texture (pure CSS)
-------------------------------------------------------- */
.leather-accent {
    position: absolute;
    top: 10%;
    bottom: 10%;
    width: 10px;
    background-color: var(--c-oxblood);
    background-image:
        radial-gradient(circle at 20% 20%, rgba(0,0,0,0.35) 0.8px, transparent 1.4px),
        radial-gradient(circle at 80% 60%, rgba(0,0,0,0.3) 0.7px, transparent 1.3px),
        radial-gradient(circle at 40% 80%, rgba(245, 242, 237, 0.08) 0.6px, transparent 1.2px),
        radial-gradient(circle at 60% 30%, rgba(0,0,0,0.25) 1px, transparent 1.8px),
        linear-gradient(90deg, rgba(0,0,0,0.4), transparent 30%, transparent 70%, rgba(0,0,0,0.4));
    background-size: 6px 6px, 8px 8px, 10px 10px, 12px 12px, 100% 100%;
    box-shadow:
        inset 1px 0 0 rgba(245, 242, 237, 0.08),
        inset -1px 0 0 rgba(0, 0, 0, 0.6),
        0 0 20px rgba(92, 26, 26, 0.35);
    border-radius: 2px;
}

.leather-accent-left {
    left: 4vw;
}

/* --------------------------------------------------------
   Chapter 1: Manifesto
-------------------------------------------------------- */
.chapter-manifesto {
    background: var(--c-void);
}

.manifesto-heading {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.25rem, 5.5vw, 4.5rem);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.08;
    color: var(--c-ivory);
    margin-bottom: 64px;
}

.manifesto-body {
    font-size: 1.15rem;
    line-height: 1.8;
    color: rgba(232, 224, 212, 0.85);
    max-width: 60ch;
    margin-bottom: 48px;
}

.pull-quote {
    position: relative;
    padding: 48px 64px;
    margin-top: 32px;
    background-color: var(--c-walnut);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(0,0,0,0.35) 1px, transparent 2px),
        radial-gradient(circle at 75% 50%, rgba(0,0,0,0.3) 0.8px, transparent 1.8px),
        radial-gradient(circle at 30% 75%, rgba(245, 242, 237, 0.05) 0.7px, transparent 1.3px),
        radial-gradient(circle at 60% 30%, rgba(92, 26, 26, 0.2) 1.2px, transparent 2px),
        linear-gradient(135deg, rgba(0,0,0,0.3), transparent 40%, rgba(245, 242, 237, 0.03) 60%, transparent);
    background-size: 9px 9px, 13px 13px, 7px 7px, 15px 15px, 100% 100%;
    box-shadow:
        inset 0 0 0 1px rgba(168, 147, 95, 0.2),
        inset 1px 1px 0 rgba(245, 242, 237, 0.06),
        inset -1px -1px 0 rgba(0, 0, 0, 0.6),
        0 8px 32px rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    overflow: hidden;
}

.pull-quote p {
    position: relative;
    font-family: var(--font-display);
    font-weight: 400;
    font-style: normal;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    line-height: 1.4;
    color: var(--c-ivory);
    letter-spacing: 0.01em;
    z-index: 2;
}

.quote-mark {
    position: absolute;
    top: -24px;
    left: 16px;
    font-family: var(--font-display);
    font-size: 8rem;
    line-height: 1;
    color: var(--c-silver);
    opacity: 0.2;
    z-index: 1;
    user-select: none;
}

/* --------------------------------------------------------
   Chapter 2: Evidence
-------------------------------------------------------- */
.chapter-evidence {
    background: var(--c-charcoal);
    padding-top: 160px;
    padding-bottom: 160px;
    gap: 160px;
}

.evidence-block {
    position: relative;
    width: 100%;
    padding: 40px 0;
}

.evidence-block + .evidence-block {
    margin-top: 80px;
}

.evidence-heading {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--c-ivory);
    margin-bottom: 32px;
}

.evidence-body {
    font-size: 1.125rem;
    line-height: 1.8;
    color: rgba(232, 224, 212, 0.82);
    margin-bottom: 24px;
    max-width: 62ch;
}

.evidence-canvas-wrap {
    position: relative;
    aspect-ratio: 1 / 1.15;
    min-height: 300px;
    width: 100%;
    background: radial-gradient(ellipse at center, #17141A 0%, var(--c-void) 80%);
    border-radius: 2px;
    box-shadow:
        inset 0 0 0 1px rgba(168, 147, 95, 0.18),
        inset 0 0 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.starfield {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* --------------------------------------------------------
   Chapter 3: Mark
-------------------------------------------------------- */
.chapter-mark {
    background: var(--c-void);
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100vh;
    padding: 160px 8vw;
}

.signature-constellation {
    width: min(400px, 60vw);
    height: auto;
    margin-bottom: 48px;
    opacity: 0.8;
}

.signature-constellation .sig-star {
    fill: var(--c-star);
    filter: drop-shadow(0 0 4px rgba(245, 242, 237, 0.8));
}

.signature-constellation .sig-line {
    stroke: var(--c-silver);
    stroke-width: 0.5;
    fill: none;
    opacity: 0.5;
}

.email-mark {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.6rem, 5vw, 3.5rem);
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--c-ivory);
    text-decoration: none;
    display: inline-block;
    padding: 16px 0;
    transition: color 0.5s ease, letter-spacing 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.embossed {
    text-shadow:
        1px 1px 0 rgba(0, 0, 0, 0.75),
        -1px -1px 0 rgba(245, 242, 237, 0.15),
        2px 2px 10px rgba(0, 0, 0, 0.4);
}

.email-mark:hover {
    color: var(--c-gold);
    letter-spacing: 0.06em;
}

.mark-footnote {
    margin-top: 48px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-gold);
    opacity: 0.55;
}

/* --------------------------------------------------------
   Reveal animations (IntersectionObserver targets)
-------------------------------------------------------- */
.reveal-words .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.evidence-block {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
        transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.evidence-block.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* --------------------------------------------------------
   Responsive
-------------------------------------------------------- */
@media (max-width: 960px) {
    .waypoint-indicator { right: 16px; gap: 20px; }
    .section-number { top: 80px; left: 2vw; font-size: 0.7rem; }
    .chapter { padding: 100px 6vw; }

    .grid { grid-template-columns: repeat(6, 1fr); gap: 24px; }

    .grid-cols-1-4 .manifesto-meta { grid-column: 1 / -1; grid-row: auto; }
    .grid-cols-1-4 .manifesto-heading,
    .grid-cols-1-4 .manifesto-body,
    .grid-cols-1-4 .pull-quote,
    .grid-cols-1-4 .evidence-text,
    .grid-cols-1-4 .evidence-canvas-wrap,
    .grid-cols-2-5 .evidence-text,
    .grid-cols-2-5 .evidence-canvas-wrap,
    .grid-cols-2-5 .evidence-canvas-left,
    .grid-cols-3-6 .evidence-text,
    .grid-cols-3-6 .evidence-canvas-wrap {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .evidence-canvas-wrap {
        min-height: 260px;
        aspect-ratio: 1.4 / 1;
    }

    .pull-quote { padding: 32px 32px; }
    .quote-mark { top: -12px; font-size: 5rem; }

    .leather-accent-left { left: 2vw; width: 6px; }
}

@media (max-width: 560px) {
    .logotype { letter-spacing: -0.35em; }
    .logotype.spread { letter-spacing: 0.04em; }
    .manifesto-heading { font-size: clamp(1.75rem, 8vw, 2.5rem); }
    .email-mark { font-size: clamp(1.25rem, 6.5vw, 2rem); }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.2s !important; }
    html { scroll-behavior: auto; }
}
