/* ==========================================================================
   GGIGGL.com — Late-night research terminal × scholarly parchment
   Compliance tokens from DESIGN.md: (Google IntersectionObserver`. Stagger children by 100ms. dominates oversized scale (clamp(2.5rem
   ========================================================================== */

:root {
    /* Palette */
    --bg-parchment: #f5f0e8;
    --bg-parchment-warm: #ece5d8;
    --bg-walnut: #2c2418;
    --bg-moss: #1e2a18;

    --ink-charred: #1a1612;
    --ink-linen: #e8e0d0;

    --accent-phosphor: #5a8a3c;
    --accent-copper: #7a9e6b;
    --accent-sienna: #c47a4a;
    --accent-amber: #d4a853;

    --muted-sage: #b8b0a0;
    --muted-charcoal: #1a1612;

    /* Type */
    --ff-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --ff-body: "Inter", system-ui, sans-serif;
    --ff-mono: "JetBrains Mono", "Space Mono", Menlo, monospace;

    --track-display: -0.02em;
    --track-display-tight: -0.03em;
}

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

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

body {
    font-family: var(--ff-body);
    font-weight: 400;
    color: var(--ink-charred);
    background:
        linear-gradient(180deg, var(--bg-parchment) 0%, var(--bg-parchment-warm) 50%, var(--bg-parchment) 100%);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ------ Paper grain (inline SVG noise) ------ */
.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0.06;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 300px 300px;
}

/* ------ Dotted grid underlay ------ */
.dot-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
    background-image: radial-gradient(circle, var(--muted-sage) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ==========================================================================
   CHAPTER 1 — OPENING TERMINAL
   ========================================================================== */
.chapter {
    position: relative;
    padding: clamp(4rem, 8vw, 7rem) clamp(1.25rem, 4vw, 4rem);
    z-index: 5;
}

.terminal-boot {
    min-height: 100vh;
    background: radial-gradient(ellipse at 50% 40%, #0c1408 0%, #050703 80%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: clamp(2rem, 6vw, 5rem);
    animation: terminalWarmUp 3.6s ease-out 7.5s forwards;
}

@keyframes terminalWarmUp {
    0%   { background: radial-gradient(ellipse at 50% 40%, #0c1408 0%, #050703 80%); }
    100% { background: radial-gradient(ellipse at 50% 40%, var(--bg-parchment-warm) 0%, var(--bg-parchment) 80%); }
}

.terminal-boot .phosphor-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(90, 138, 60, 0.15) 0%, transparent 60%);
    pointer-events: none;
    animation: phosphorFade 3.6s ease-out 7.5s forwards;
}

@keyframes phosphorFade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

.terminal-boot .scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(90, 138, 60, 0.08) 0 1px,
        transparent 1px 3px
    );
    pointer-events: none;
    animation: scanlineFade 3.6s ease-out 7.5s forwards;
}

@keyframes scanlineFade {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* Terminal shell */
.terminal-shell {
    position: relative;
    z-index: 2;
    width: min(820px, 92vw);
    background: rgba(8, 14, 6, 0.88);
    border: 1px solid rgba(90, 138, 60, 0.4);
    box-shadow:
        0 0 30px rgba(90, 138, 60, 0.25),
        0 0 100px rgba(90, 138, 60, 0.1),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    animation: shellTransform 3.6s ease-out 7.5s forwards;
}

@keyframes shellTransform {
    0%   {
        background: rgba(8, 14, 6, 0.88);
        border-color: rgba(90, 138, 60, 0.4);
        box-shadow: 0 0 30px rgba(90, 138, 60, 0.25), 0 0 100px rgba(90, 138, 60, 0.1), inset 0 0 60px rgba(0, 0, 0, 0.5);
    }
    100% {
        background: rgba(245, 240, 232, 0.96);
        border-color: rgba(26, 22, 18, 0.15);
        box-shadow:
            0 14px 40px -10px rgba(26, 22, 18, 0.25),
            0 2px 8px rgba(26, 22, 18, 0.08);
    }
}

.terminal-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(90, 138, 60, 0.2);
    animation: topbarTransform 3.6s ease-out 7.5s forwards;
}

@keyframes topbarTransform {
    0%   { border-bottom-color: rgba(90, 138, 60, 0.2); background: rgba(14, 22, 10, 0.6); }
    100% { border-bottom-color: rgba(26, 22, 18, 0.12); background: rgba(236, 229, 216, 0.7); }
}

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

.dot-sienna   { background: var(--accent-sienna); }
.dot-amber    { background: var(--accent-amber); }
.dot-phosphor { background: var(--accent-phosphor); }

.term-title {
    font-family: var(--ff-mono);
    font-size: 0.72rem;
    color: var(--accent-phosphor);
    margin-left: 10px;
    letter-spacing: 0.02em;
    animation: titleTransform 3.6s ease-out 7.5s forwards;
}

@keyframes titleTransform {
    0%   { color: var(--accent-phosphor); }
    100% { color: var(--ink-charred); }
}

.terminal-body {
    padding: clamp(1.4rem, 3vw, 2.4rem);
    font-family: var(--ff-mono);
    font-size: clamp(0.82rem, 1.2vw, 0.95rem);
    line-height: 1.75;
    color: var(--accent-phosphor);
    text-shadow: 0 0 6px rgba(90, 138, 60, 0.6);
    animation: bodyTransform 3.6s ease-out 7.5s forwards;
    min-height: 260px;
}

@keyframes bodyTransform {
    0%   { color: var(--accent-phosphor); text-shadow: 0 0 6px rgba(90, 138, 60, 0.6); }
    100% { color: var(--ink-charred); text-shadow: none; }
}

.term-line {
    opacity: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.term-line-thesis {
    font-family: var(--ff-display);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    line-height: 1.45;
    color: var(--accent-amber);
    letter-spacing: var(--track-display);
    padding: 0.6rem 0;
    animation: thesisTransform 3.6s ease-out 7.5s forwards;
}

@keyframes thesisTransform {
    0%   { color: var(--accent-amber); text-shadow: 0 0 10px rgba(212, 168, 83, 0.4); }
    100% { color: var(--accent-sienna); text-shadow: none; }
}

.term-line-quiet { min-height: 1.2em; }

.cursor-blink {
    display: inline-block;
    width: 0.55em;
    height: 1em;
    background: currentColor;
    margin-left: 0.2em;
    vertical-align: text-bottom;
    animation: blink 1.06s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* Boot marginalia */
.boot-marginalia {
    position: absolute;
    top: 12%;
    right: clamp(1rem, 4vw, 3rem);
    max-width: 220px;
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    color: rgba(232, 224, 208, 0.6);
    border-left: 2px solid rgba(90, 138, 60, 0.5);
    padding-left: 0.9rem;
    line-height: 1.55;
    z-index: 3;
    opacity: 0;
    animation:
        margFadeIn 1.5s ease-out 5.2s forwards,
        margTransform 3.6s ease-out 7.5s forwards;
}

@keyframes margFadeIn {
    to { opacity: 1; }
}

@keyframes margTransform {
    0%   { color: rgba(232, 224, 208, 0.6); border-left-color: rgba(90, 138, 60, 0.5); }
    100% { color: var(--muted-sage); border-left-color: var(--muted-sage); }
}

.boot-marginalia .marg-tag {
    display: block;
    color: var(--accent-amber);
    margin-bottom: 0.35rem;
    letter-spacing: 0.05em;
}

.boot-marginalia p {
    margin: 0;
}

/* ==========================================================================
   SHARED — Chapter header
   ========================================================================== */
.chapter-header {
    position: relative;
    max-width: 1200px;
    margin: 0 auto clamp(2.5rem, 5vw, 4.5rem);
    padding-left: clamp(1rem, 4vw, 3rem);
}

.chapter-marker {
    display: inline-block;
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--accent-sienna);
    letter-spacing: 0.14em;
    padding-bottom: 0.4rem;
    border-bottom: 1px dashed var(--muted-sage);
    margin-bottom: 1.25rem;
}

.chapter-title {
    font-family: var(--ff-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4.25rem);
    line-height: 1.02;
    letter-spacing: var(--track-display-tight);
    margin-bottom: 0.9rem;
    color: var(--ink-charred);
    max-width: 18ch;
}

.chapter-lede {
    font-family: var(--ff-body);
    font-size: clamp(1rem, 1.3vw, 1.1rem);
    max-width: 48ch;
    color: var(--ink-charred);
    opacity: 0.8;
}

/* ==========================================================================
   CHAPTER 2 — ARCHIVE (Broken grid)
   ========================================================================== */
.chapter-archive {
    position: relative;
    padding-top: clamp(5rem, 9vw, 8rem);
}

.broken-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(40px, auto);
    gap: 14px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 3rem);
}

/* Card base */
.archive-card {
    position: relative;
    background: rgba(245, 240, 232, 0.94);
    border: 1px solid var(--muted-sage);
    padding: clamp(1.2rem, 2vw, 1.8rem);
    box-shadow:
        0 1px 2px rgba(26, 22, 18, 0.04),
        0 10px 30px -14px rgba(26, 22, 18, 0.2);
    will-change: transform;
    transform: perspective(800px) rotateX(0deg) rotateY(0deg);
    transition: transform 280ms ease-out, box-shadow 300ms ease-out;
    z-index: 2;
}

.archive-card:hover {
    box-shadow:
        0 2px 4px rgba(26, 22, 18, 0.08),
        0 20px 40px -14px rgba(26, 22, 18, 0.3);
}

.card-back-panel {
    position: absolute;
    inset: -16px -10px -10px 18px;
    background: var(--bg-parchment-warm);
    border: 1px solid var(--muted-sage);
    z-index: -1;
    transform: rotate(-1.2deg);
    opacity: 0.85;
}

.card-back-sienna {
    background: rgba(196, 122, 74, 0.22);
    transform: rotate(1.4deg);
    inset: -14px 14px -14px -8px;
}

.card-back-walnut {
    background: var(--bg-walnut);
    transform: rotate(-0.8deg);
    inset: -12px -14px -10px 10px;
    opacity: 0.9;
}

.card-back-amber {
    background: rgba(212, 168, 83, 0.28);
    transform: rotate(2deg);
    inset: -10px 10px -12px -6px;
}

.card-head {
    margin-bottom: 0.8rem;
}

.card-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--accent-copper);
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.archive-card h3 {
    font-family: var(--ff-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 1.7vw, 1.6rem);
    letter-spacing: var(--track-display);
    line-height: 1.15;
    color: var(--ink-charred);
}

.archive-card p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--ink-charred);
}

.archive-card .card-excerpt {
    background: var(--bg-moss);
    color: var(--accent-phosphor);
    padding: 0.6rem 0.8rem;
    margin-top: 0.8rem;
    border-left: 3px solid var(--accent-phosphor);
    font-size: 0.78rem;
}

.card-foot {
    display: block;
    margin-top: 1rem;
    font-size: 0.72rem;
    color: var(--accent-sienna);
    letter-spacing: 0.05em;
}

/* Card placements — deliberate broken rhythm */
.card-large  { grid-column: 2 / span 6; grid-row: 1 / span 3; transform: translateY(8px); }
.card-medium { grid-column: 8 / span 4; grid-row: 2 / span 2; transform: translateY(24px); }
.card-tall   { grid-column: 3 / span 4; grid-row: 4 / span 3; transform: translateY(-10px); }
.card-small  { grid-column: 9 / span 3; grid-row: 5 / span 2; transform: translateY(16px); }

.card-small p.small {
    font-size: 0.82rem;
    color: var(--ink-charred);
    opacity: 0.85;
}

/* Marginalia */
.marginalia {
    position: relative;
    font-family: var(--ff-body);
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--ink-charred);
    max-width: 230px;
    padding: 0.6rem 0 0.6rem 0;
    opacity: 0.85;
}

.marginalia .marg-tag {
    display: block;
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    color: var(--accent-sienna);
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.marg-1 { grid-column: 10 / span 2; grid-row: 1 / span 2; align-self: start; padding-left: 0.4rem; }
.marg-2 { grid-column: 1 / span 2; grid-row: 4 / span 2; align-self: center; text-align: right; padding-right: 0.4rem; }

.dotted-connector {
    position: absolute;
    width: 90px;
    height: 20px;
    top: 36px;
    left: -84px;
    pointer-events: none;
}

.connector-right {
    left: auto;
    right: -84px;
}

/* Archive graph fragment */
.archive-graph-frag {
    grid-column: 7 / span 5;
    grid-row: 6 / span 2;
    opacity: 0.55;
    padding: 1rem;
    align-self: end;
}

.archive-graph-frag svg { width: 100%; height: auto; }

/* Fern watermarks */
.fern-watermark {
    position: absolute;
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
}

.fern-left {
    width: 220px;
    height: 300px;
    top: 18%;
    left: -40px;
    transform: rotate(-8deg);
}

/* ==========================================================================
   DIVIDERS
   ========================================================================== */
.divider {
    max-width: 900px;
    margin: clamp(3rem, 5vw, 5rem) auto;
    padding: 0 2rem;
    text-align: center;
}

.divider-dashed .mono {
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    color: var(--muted-sage);
    letter-spacing: 0.08em;
}

.divider-solid {
    border-top: 1px solid var(--muted-sage);
    opacity: 0.5;
}

.divider-squiggle svg {
    width: 100%;
    max-width: 500px;
    height: 18px;
    opacity: 0.6;
}

/* ==========================================================================
   CHAPTER 3 — READING ROOM (Dark)
   ========================================================================== */
.chapter-reading-room {
    background: var(--bg-walnut);
    color: var(--ink-linen);
    padding: clamp(5rem, 9vw, 8rem) clamp(1rem, 4vw, 4rem);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.chapter-reading-room::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(184, 176, 160, 0.12) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

.reading-room-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(184, 176, 160, 0.04) 0 1px,
        transparent 1px 3px
    );
    pointer-events: none;
    z-index: 0;
}

.chapter-header-dark {
    z-index: 2;
    position: relative;
}

.chapter-marker-dark { color: var(--accent-amber); border-bottom-color: rgba(184, 176, 160, 0.35); }
.chapter-title-dark { color: var(--ink-linen); }

.reading-room-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    max-width: 1280px;
    margin: 0 auto;
}

.terminal-window {
    position: relative;
    background: var(--bg-moss);
    border: 1px solid rgba(184, 176, 160, 0.22);
    box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    overflow: hidden;
}

.terminal-topbar-dark {
    background: rgba(0, 0, 0, 0.35);
    border-bottom-color: rgba(184, 176, 160, 0.2);
    padding: 9px 14px;
}

.term-title-dark { color: var(--muted-sage); }

.terminal-body-dark {
    padding: 1.4rem 1.6rem;
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    color: var(--ink-linen);
    line-height: 1.75;
}

.terminal-body-dark p { margin-bottom: 0.7rem; }
.terminal-body-dark p:last-child { margin-bottom: 0; }

.terminal-body-dark p:not(.mono) {
    font-family: var(--ff-body);
    font-size: 0.95rem;
    color: var(--ink-linen);
    opacity: 0.9;
    padding-left: 0.6rem;
    border-left: 1px solid rgba(184, 176, 160, 0.25);
}

.prompt-green { color: var(--accent-phosphor); }
.color-sage { color: var(--accent-copper); }
.color-amber { color: var(--accent-amber); }

.tw-primary   { grid-column: 1 / span 6; grid-row: 1; }
.tw-secondary { grid-column: 8 / span 5; grid-row: 2; transform: translateY(-30px); }

/* Pull quote */
.pull-quote {
    grid-column: 7 / span 6;
    grid-row: 1;
    position: relative;
    padding: 1rem 0 1rem 1.5rem;
    transform: translateY(18px);
}

.pull-quote p {
    font-family: var(--ff-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 4.6vw, 4rem);
    letter-spacing: var(--track-display-tight);
    line-height: 1.05;
    color: var(--ink-linen);
}

.pull-quote p em {
    font-style: italic;
    color: var(--accent-amber);
    font-weight: 700;
}

.quote-underline {
    display: block;
    width: min(400px, 70%);
    height: 18px;
    margin-top: 0.8rem;
}

.quote-underline-path {
    stroke-dasharray: 460;
    stroke-dashoffset: 460;
    transition: stroke-dashoffset 1.2s ease-out;
}

.pull-quote.in-view .quote-underline-path {
    stroke-dashoffset: 0;
}

.pull-quote cite {
    display: block;
    margin-top: 1rem;
    font-family: var(--ff-mono);
    font-size: 0.78rem;
    color: var(--muted-sage);
    font-style: normal;
    letter-spacing: 0.06em;
}

.marginalia-dark {
    grid-column: 1 / span 5;
    grid-row: 2;
    color: var(--ink-linen);
    opacity: 0.85;
    border-left: 2px solid rgba(212, 168, 83, 0.6);
    padding-left: 1rem;
    align-self: start;
}

.marg-tag-dark { color: var(--accent-amber); }

/* ==========================================================================
   CHAPTER 4 — KNOWLEDGE GRAPH
   ========================================================================== */
.chapter-graph {
    padding: clamp(5rem, 9vw, 8rem) clamp(1rem, 4vw, 4rem);
    position: relative;
}

.graph-container {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem clamp(0.5rem, 2vw, 2rem);
    background: rgba(245, 240, 232, 0.5);
    border: 1px solid var(--muted-sage);
    border-radius: 2px;
    box-shadow: inset 0 0 60px rgba(184, 176, 160, 0.2);
    overflow: hidden;
}

.graph-container::before {
    content: "// knowledge.graph.v1 //";
    position: absolute;
    top: 8px;
    left: 14px;
    font-family: var(--ff-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--accent-sienna);
    opacity: 0.7;
}

.knowledge-graph {
    width: 100%;
    height: auto;
    display: block;
    max-height: 620px;
}

.graph-edges line {
    transition: stroke 300ms ease, stroke-width 300ms ease, stroke-opacity 300ms ease;
    stroke-opacity: 0.5;
}

.graph-edges line.edge-highlighted {
    stroke: var(--accent-phosphor) !important;
    stroke-width: 2;
    stroke-opacity: 1;
}

.node {
    cursor: pointer;
    transition: transform 200ms ease;
}

.node:hover { transform: scale(1.12); }

.node-label {
    font-family: var(--ff-mono);
    font-size: 14px;
    fill: var(--ink-charred);
    letter-spacing: 0.03em;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 200ms ease, fill 200ms ease;
}

.node-label-hub { fill: var(--accent-sienna); opacity: 0.9; font-weight: 500; }

.node:hover .node-label { opacity: 1; fill: var(--accent-phosphor); }

.node-halo { transform-origin: center; animation: halo 4s ease-in-out infinite; }

.node-hub .node-halo { animation-duration: 3s; }

@keyframes halo {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50%      { transform: scale(1.3); opacity: 0.1; }
}

.graph-tooltip {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    background: var(--bg-walnut);
    color: var(--ink-linen);
    font-family: var(--ff-mono);
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
    border-radius: 2px;
    border: 1px solid var(--accent-amber);
    transform: translate(-50%, -130%);
    transition: opacity 180ms ease;
    white-space: nowrap;
    z-index: 10;
}

.graph-tooltip.visible { opacity: 1; }

.graph-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -5px;
    transform: translateX(-50%) rotate(45deg);
    width: 6px;
    height: 6px;
    background: var(--bg-walnut);
    border-right: 1px solid var(--accent-amber);
    border-bottom: 1px solid var(--accent-amber);
}

.graph-legend {
    max-width: 1280px;
    margin: 1.5rem auto 0;
    padding: 0 clamp(1rem, 3vw, 3rem);
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--ink-charred);
    opacity: 0.75;
    letter-spacing: 0.05em;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.legend-dot-muted { background: var(--muted-sage); }
.legend-dot-hub { background: var(--accent-amber); }

.legend-line {
    display: inline-block;
    width: 24px;
    height: 1px;
    background: var(--muted-sage);
}

/* ==========================================================================
   CHAPTER 5 — COLOPHON
   ========================================================================== */
.colophon {
    background: var(--bg-moss);
    color: var(--ink-linen);
    padding: clamp(4rem, 7vw, 6rem) clamp(1rem, 4vw, 4rem) clamp(3rem, 5vw, 4rem);
    position: relative;
    overflow: hidden;
}

.colophon::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(90, 138, 60, 0.04) 0 1px, transparent 1px 3px);
    pointer-events: none;
}

.colophon-inner {
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.colophon-header {
    margin-bottom: clamp(2rem, 4vw, 3rem);
    border-bottom: 1px dashed rgba(184, 176, 160, 0.3);
    padding-bottom: 1.5rem;
}

.colophon-marker {
    display: block;
    color: var(--accent-phosphor);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    margin-bottom: 0.6rem;
}

.colophon-title {
    font-family: var(--ff-display);
    font-weight: 500;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    letter-spacing: var(--track-display);
    color: var(--ink-linen);
}

.colophon-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
}

.colophon-block { grid-column: span 4; }
.colophon-block:nth-child(1) { grid-column: 1 / span 4; }
.colophon-block:nth-child(2) { grid-column: 5 / span 4; }
.colophon-block:nth-child(3) { grid-column: 9 / span 4; }

.colophon-hello {
    color: var(--accent-phosphor);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
    letter-spacing: 0.05em;
}

.colophon-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.colophon-link {
    color: var(--ink-linen);
    font-size: 0.88rem;
    text-decoration: none;
    padding: 0.25rem 0;
    letter-spacing: 0.02em;
    transition: color 200ms ease, transform 200ms ease;
    display: inline-block;
}

.colophon-link:hover {
    color: var(--accent-amber);
    transform: translateX(4px);
}

.colophon-meta,
.colophon-sign {
    color: var(--muted-sage);
    font-size: 0.8rem;
    line-height: 1.8;
    letter-spacing: 0.02em;
}

.colophon-sign { color: var(--accent-sienna); }
.colophon-sign.small { color: var(--muted-sage); font-size: 0.76rem; }

.colophon-block-sign { text-align: right; }

/* ==========================================================================
   UTILITY — Mono, small
   ========================================================================== */
.mono {
    font-family: var(--ff-mono);
}

.small { font-size: 0.78rem; }

/* ==========================================================================
   REVEAL ANIMATIONS
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
    transition-delay: var(--d, 0ms);
}

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

.archive-card.reveal {
    transform: translateY(20px);
}

.archive-card.reveal.in-view.card-large  { transform: translateY(8px); }
.archive-card.reveal.in-view.card-medium { transform: translateY(24px); }
.archive-card.reveal.in-view.card-tall   { transform: translateY(-10px); }
.archive-card.reveal.in-view.card-small  { transform: translateY(16px); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .broken-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .card-large,
    .card-medium,
    .card-tall,
    .card-small,
    .archive-graph-frag {
        grid-column: 1;
        grid-row: auto;
        transform: none;
    }
    .archive-card.reveal.in-view.card-large,
    .archive-card.reveal.in-view.card-medium,
    .archive-card.reveal.in-view.card-tall,
    .archive-card.reveal.in-view.card-small {
        transform: none;
    }
    .marg-1, .marg-2 {
        grid-column: 1;
        grid-row: auto;
        text-align: left;
        max-width: 100%;
        padding-left: 0.8rem;
        border-left: 1px dashed var(--muted-sage);
    }
    .dotted-connector { display: none; }

    .reading-room-grid,
    .colophon-grid {
        grid-template-columns: 1fr;
    }
    .tw-primary,
    .tw-secondary,
    .pull-quote,
    .marginalia-dark,
    .colophon-block,
    .colophon-block:nth-child(1),
    .colophon-block:nth-child(2),
    .colophon-block:nth-child(3) {
        grid-column: 1;
        grid-row: auto;
        transform: none;
        text-align: left;
    }
    .boot-marginalia {
        position: relative;
        top: auto;
        right: auto;
        margin-top: 2rem;
    }
    .fern-left { display: none; }
}
