/* =========================================================
   namu.quest -- an inquiry into branching systems
   Dark academia + clandestine engineering
   Garamond-Classic + IBM Plex Mono
   ========================================================= */

:root {
    /* Palette -- Earth-Tones with Scholar's Neon */
    --color-bg-deep:        #1A1610;
    --color-bg-deeper:      #0D0B08;
    --color-bg-panel:       #2C2419;
    --color-text-primary:   #E8DCC8;
    --color-text-secondary: #C4B69A;
    --color-text-tertiary:  #8A7B65;
    --color-accent-green:   #4ADE80;
    --color-accent-amber:   #D4A84B;
    --color-border:         #7B6F4A;
    --color-alert:          #C4604A;
    --color-walnut-warm:    #A69070;

    /* Typography */
    --font-display: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
    --font-body:    'EB Garamond', 'Cormorant Garamond', Georgia, serif;
    --font-mono:    'IBM Plex Mono', 'Space Mono', 'Inter', ui-monospace, monospace;

    /* Motion */
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --ease-soft:    cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --content-offset: 15%;
    --content-max:    680px;
    --hud-edge:       24px;
}

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

html, body {
    background: var(--color-bg-deep);
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    font-size: 19px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(212, 168, 75, 0.05) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(74, 222, 128, 0.04) 0%, transparent 60%),
        var(--color-bg-deep);
    position: relative;
}

/* =========================================================
   Texture layers
   ========================================================= */
.noise-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 90;
    opacity: 0.55;
    mix-blend-mode: overlay;
}

.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 91;
    background: radial-gradient(ellipse at center,
        transparent 35%,
        rgba(0, 0, 0, 0.30) 75%,
        rgba(0, 0, 0, 0.60) 100%);
}

/* =========================================================
   HUD Frame
   ========================================================= */
.hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    color: var(--color-accent-green);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 1.6s var(--ease-soft) 1.0s, transform 1.6s var(--ease-soft) 1.0s;
}
.hud.is-ready {
    opacity: 1;
    transform: translateY(0);
}

/* Top edge */
.hud-top {
    position: absolute;
    top: 16px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(123, 111, 74, 0.4);
    padding-top: 12px;
}
.hud-corner {
    color: var(--color-accent-green);
    opacity: 0.7;
    flex: 0 0 16px;
    line-height: 0;
}
.hud-breadcrumb {
    flex: 1 1 auto;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--color-walnut-warm);
    transition: opacity 0.4s var(--ease-elastic), transform 0.4s var(--ease-elastic);
}
.hud-breadcrumb.is-flipping {
    opacity: 0;
    transform: translateY(-3px);
}

/* Right edge -- scroll depth */
.hud-right {
    position: absolute;
    top: 80px;
    bottom: 80px;
    right: var(--hud-edge);
    width: 28px;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    flex-direction: row;
}
.hud-ticks {
    list-style: none;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    margin-right: 6px;
}
.hud-ticks li {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--color-walnut-warm);
    opacity: 0.55;
    position: relative;
    padding-right: 8px;
    transition: color 0.5s var(--ease-soft), opacity 0.5s var(--ease-soft), transform 0.5s var(--ease-elastic);
}
.hud-ticks li::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 6px;
    height: 1px;
    background: currentColor;
}
.hud-ticks li.is-active {
    color: var(--color-accent-green);
    opacity: 1;
    transform: scale(1.05);
}
.hud-scroll-track {
    width: 2px;
    background: rgba(123, 111, 74, 0.25);
    position: relative;
    overflow: hidden;
}
.hud-scroll-fill {
    position: absolute;
    inset: 0 0 auto 0;
    height: 0%;
    background: linear-gradient(to bottom,
        rgba(74, 222, 128, 0.0),
        var(--color-accent-green) 30%,
        var(--color-accent-green) 100%);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.7), 0 0 16px rgba(74, 222, 128, 0.35);
    transition: height 0.18s linear;
}

/* Left edge -- circuit trace */
.hud-left {
    position: absolute;
    top: 80px;
    bottom: 80px;
    left: var(--hud-edge);
    width: 24px;
}
.left-trace {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.45));
}
.trace-node {
    transform-origin: center;
    transform-box: fill-box;
    animation: nodePulse 3.4s var(--ease-soft) infinite;
    opacity: 0.4;
}
.trace-node.tn1 { animation-delay: 0.0s;  }
.trace-node.tn2 { animation-delay: 0.6s; }
.trace-node.tn3 { animation-delay: 1.2s; }
.trace-node.tn4 { animation-delay: 1.8s; }
.trace-node.tn5 { animation-delay: 2.4s; }
.trace-node.tn6 { animation-delay: 3.0s; }

@keyframes nodePulse {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.85; }
}

/* Bottom edge */
.hud-bottom {
    position: absolute;
    bottom: 16px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(123, 111, 74, 0.4);
    padding-bottom: 12px;
}
.hud-coord {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--color-walnut-warm);
    opacity: 0.6;
}
.hud-status {
    flex: 1 1 auto;
    text-align: center;
    font-family: var(--font-display);
    font-feature-settings: "smcp" 1, "c2sc" 1;
    font-variant: small-caps;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--color-walnut-warm);
    transition: opacity 0.4s var(--ease-elastic), transform 0.4s var(--ease-elastic);
}
.hud-status.is-flipping {
    opacity: 0;
    transform: translateY(3px);
}

/* =========================================================
   Manuscript / Chapters
   ========================================================= */
.manuscript {
    position: relative;
    z-index: 1;
    padding-top: 0;
}

.chapter {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 14vh 0 14vh;
    overflow: hidden;
}

.chapter.panel {
    background: linear-gradient(180deg,
        var(--color-bg-deep) 0%,
        var(--color-bg-panel) 18%,
        var(--color-bg-panel) 82%,
        var(--color-bg-deep) 100%);
}

.chapter-inner {
    width: 100%;
    max-width: 100%;
    padding-left: var(--content-offset);
    padding-right: 5%;
}

.chapter-inner.two-col {
    display: grid;
    grid-template-columns: minmax(0, var(--content-max)) minmax(0, 1fr);
    gap: 80px;
    align-items: start;
}

.chapter-inner.two-col.dense {
    gap: 64px;
}

.content-col {
    max-width: var(--content-max);
}

.margin-col {
    padding-top: 80px;
    position: relative;
    color: var(--color-text-tertiary);
}

/* =========================================================
   Cover (Chapter I & Colophon)
   ========================================================= */
.chapter-i {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 70% 50%, rgba(74, 222, 128, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse at 18% 30%, rgba(212, 168, 75, 0.05) 0%, transparent 50%),
        var(--color-bg-deep);
}

.cover-mark {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
    max-width: var(--content-max);
}
.cover-mark .mark-line {
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(123, 111, 74, 0.5), transparent);
    max-width: 80px;
}
.cover-mark .mark-text {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.32em;
    color: var(--color-walnut-warm);
    opacity: 0.8;
}

.cover-art {
    position: absolute;
    right: 6vw;
    top: 50%;
    transform: translateY(-50%);
    width: 460px;
    height: 460px;
    max-width: 40vw;
    max-height: 70vh;
    pointer-events: none;
    opacity: 0.95;
}
.cover-art.small {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    margin: 0 auto 32px;
    width: 320px;
    height: 320px;
    max-width: 80vw;
}
.circuit-tree {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.circuit-tree .grow {
    stroke-dasharray: 240;
    stroke-dashoffset: 240;
    animation: growPath 4.2s var(--ease-elastic) forwards;
    opacity: 0;
}
.circuit-tree.is-active .grow {
    animation-play-state: running;
    opacity: 1;
}
.circuit-tree .grow:nth-child(1)  { animation-delay: 0.10s; }
.circuit-tree .grow:nth-child(2)  { animation-delay: 0.30s; }
.circuit-tree .grow:nth-child(3)  { animation-delay: 0.55s; }
.circuit-tree .grow:nth-child(4)  { animation-delay: 0.85s; }
.circuit-tree .grow:nth-child(5)  { animation-delay: 1.05s; }
.circuit-tree .grow:nth-child(6)  { animation-delay: 0.30s; }
.circuit-tree .grow:nth-child(7)  { animation-delay: 0.55s; }
.circuit-tree .grow:nth-child(8)  { animation-delay: 0.85s; }
.circuit-tree .grow:nth-child(9)  { animation-delay: 1.05s; }
.circuit-tree .grow:nth-child(10) { animation-delay: 0.40s; }
.circuit-tree .grow:nth-child(11) { animation-delay: 0.70s; }
.circuit-tree .grow:nth-child(12) { animation-delay: 0.70s; }
.circuit-tree .grow:nth-child(13) { animation-delay: 1.10s; }
.circuit-tree .grow:nth-child(14) { animation-delay: 1.30s; }
.circuit-tree .grow:nth-child(15) { animation-delay: 1.30s; }

@keyframes growPath {
    0%   { stroke-dashoffset: 240; opacity: 0; }
    20%  { opacity: 1; }
    100% { stroke-dashoffset: 0;   opacity: 1; }
}

.circuit-tree .node {
    fill: var(--color-accent-green);
    opacity: 0;
    transform-origin: center;
    transform-box: fill-box;
    animation: nodeAppear 0.8s var(--ease-elastic) forwards 1.6s,
               nodeBreath 4.2s var(--ease-soft) infinite 2.6s;
}
.circuit-tree .node:nth-child(odd)  { animation-delay: 1.7s, 2.7s; }
.circuit-tree .node:nth-child(even) { animation-delay: 1.9s, 2.9s; }

@keyframes nodeAppear {
    0%   { opacity: 0; transform: scale(0.4); }
    60%  { opacity: 1; transform: scale(1.25); }
    100% { opacity: 0.85; transform: scale(1); }
}
@keyframes nodeBreath {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.95; }
}

.circuit-tree.retract .grow {
    animation: retractPath 5s var(--ease-elastic) forwards;
}
.circuit-tree.retract.is-active .grow {
    animation-play-state: running;
}

@keyframes retractPath {
    0%   { stroke-dashoffset: 240; opacity: 0; }
    20%  { stroke-dashoffset: 0;   opacity: 1; }
    80%  { stroke-dashoffset: 0;   opacity: 1; }
    100% { stroke-dashoffset: 240; opacity: 0.2; }
}

/* Cover stack */
.cover-stack {
    max-width: var(--content-max);
}
.cover-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(56px, 8vw, 88px);
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--color-text-primary);
    margin-bottom: 20px;
    text-shadow: 0 0 18px rgba(232, 220, 200, 0.08);
}
.cover-title.small {
    font-size: clamp(40px, 5vw, 56px);
    margin-bottom: 14px;
}
.cover-title .title-dot {
    color: var(--color-accent-green);
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.7), 0 0 28px rgba(74, 222, 128, 0.4);
}
.cover-tag {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.18em;
    color: var(--color-accent-green);
    margin-bottom: 32px;
    text-transform: lowercase;
    opacity: 0.9;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}
.cover-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--color-walnut-warm);
    margin-bottom: 64px;
}
.meta-cell { display: inline-block; }
.meta-sep { color: var(--color-border); opacity: 0.7; }

.cover-quiet {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: var(--content-max);
}
.cover-quiet .quiet-rule {
    width: 32px;
    height: 1px;
    background: var(--color-border);
    opacity: 0.6;
}
.cover-quiet .quiet-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 14px;
    color: var(--color-text-tertiary);
    letter-spacing: 0.04em;
}

/* =========================================================
   Chapter mark (numerals + label)
   ========================================================= */
.chapter-mark {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 32px;
}
.mark-numeral {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 22px;
    color: var(--color-accent-green);
    letter-spacing: 0.04em;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}
.mark-rule {
    flex: 0 0 60px;
    height: 1px;
    background: linear-gradient(to right, var(--color-accent-green), transparent);
    opacity: 0.5;
}
.mark-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.32em;
    color: var(--color-walnut-warm);
    text-transform: uppercase;
}

.chapter-heading {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(36px, 4.6vw, 56px);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: var(--color-text-primary);
    margin-bottom: 36px;
    max-width: 580px;
}

.body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 19px;
    line-height: 1.8;
    color: var(--color-text-secondary);
    margin: 0;
    text-indent: 2em;
}
.body + .body { margin-top: 0; }
.body.lead {
    text-indent: 0;
    font-size: 20px;
    color: var(--color-text-primary);
    margin-bottom: 48px;
    max-width: 600px;
    font-style: italic;
    border-left: 1px solid rgba(74, 222, 128, 0.4);
    padding-left: 22px;
    line-height: 1.7;
}

.body em {
    font-style: italic;
    color: var(--color-text-primary);
}

/* Highlight / yellow-marker */
.body mark.hl {
    background: rgba(212, 168, 75, 0.16);
    color: var(--color-text-primary);
    padding: 0 4px;
    border-radius: 1px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.inline-rule {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 48px 0 0;
    max-width: 280px;
}
.inline-rule .rule-seg {
    flex: 1 1 auto;
    height: 1px;
    background: var(--color-border);
    opacity: 0.4;
}
.inline-rule .rule-node {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.6), 0 0 14px rgba(74, 222, 128, 0.3);
}

/* =========================================================
   Margin column (right marginalia)
   ========================================================= */
.pull-quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(22px, 2.4vw, 32px);
    line-height: 1.4;
    color: var(--color-accent-amber);
    letter-spacing: 0.01em;
    border-left: 1px solid rgba(212, 168, 75, 0.4);
    padding-left: 20px;
    margin-bottom: 36px;
    max-width: 360px;
    text-shadow: 0 0 14px rgba(212, 168, 75, 0.18);
}

.margin-note {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-tertiary);
    margin-bottom: 24px;
    max-width: 320px;
}
.margin-note em strong { font-weight: 500; color: var(--color-walnut-warm); }
.margin-note em { color: var(--color-text-tertiary); }

.margin-glyph {
    width: 80px;
    height: 120px;
    margin: 12px 0 24px;
    filter: drop-shadow(0 0 4px rgba(123, 111, 74, 0.2));
}
.margin-glyph.small {
    width: 56px;
    height: 76px;
}
.margin-glyph.small.alt {
    margin-top: 16px;
}

.annot-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 100px;
}

.margin-annot {
    font-family: var(--font-display);
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-text-tertiary);
    max-width: 320px;
    margin-bottom: 8px;
}
.annot-mark {
    color: var(--color-accent-amber);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    margin-right: 6px;
    opacity: 0.85;
}
.margin-annot em {
    font-style: italic;
}
.margin-annot em strong {
    font-weight: 600;
    color: var(--color-walnut-warm);
}

/* =========================================================
   Chapter III -- Index
   ========================================================= */
.index-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 36px 56px;
    max-width: 880px;
}

.index-entry {
    position: relative;
    padding-left: 26px;
    transition-delay: calc(var(--i, 0) * 80ms);
}

.index-entry .entry-bullet {
    position: absolute;
    left: 0;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.7), 0 0 14px rgba(74, 222, 128, 0.35);
}
.index-entry .entry-bullet::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 16px;
    height: 1px;
    background: var(--color-border);
    opacity: 0.5;
}

.index-entry .entry-num {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 13px;
    color: var(--color-walnut-warm);
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    display: block;
}

.index-entry .entry-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 24px;
    line-height: 1.2;
    color: var(--color-text-primary);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.index-entry .entry-text {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--color-text-secondary);
}
.index-entry .entry-text em {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--color-walnut-warm);
}

/* =========================================================
   Footer circuit (Chapter IV)
   ========================================================= */
.footer-circuit {
    margin-top: 56px;
    width: 100%;
    height: 80px;
    opacity: 0.7;
}
.footer-circuit svg {
    width: 100%;
    height: 100%;
}

/* =========================================================
   Transition zones
   ========================================================= */
.transition-zone {
    position: relative;
    height: 40vh;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-deep);
    overflow: hidden;
}
.morph-art {
    width: min(80%, 900px);
    height: 60%;
    opacity: 0;
    transition: opacity 1s var(--ease-soft);
}
.transition-zone.is-active .morph-art {
    opacity: 1;
}
.morph-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2.4s var(--ease-elastic);
}
.transition-zone.is-active .morph-path {
    stroke-dashoffset: 0;
}
.morph-art .node {
    fill: var(--color-accent-green);
    opacity: 0;
    transition: opacity 0.8s var(--ease-elastic) 1.4s;
}
.transition-zone.is-active .morph-art .node {
    opacity: 0.85;
    animation: nodeBreath 4s var(--ease-soft) infinite 2.2s;
}

/* =========================================================
   Colophon
   ========================================================= */
.colophon {
    background: linear-gradient(180deg,
        var(--color-bg-deep) 0%,
        var(--color-bg-deeper) 60%,
        #000 100%);
    min-height: 60vh;
    text-align: left;
}
.colophon .chapter-inner {
    text-align: center;
    padding-left: 8%;
    padding-right: 8%;
    max-width: 900px;
    margin: 0 auto;
}
.colophon .cover-stack {
    margin: 0 auto;
    text-align: center;
}
.colophon .cover-meta {
    justify-content: center;
}
.colophon .cover-quiet {
    justify-content: center;
    margin: 0 auto;
}

/* =========================================================
   Reveal animation system (intersection observed)
   ========================================================= */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.8s var(--ease-elastic),
        transform 0.8s var(--ease-elastic);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.chapter .reveal:nth-child(1)  { transition-delay: 0.05s; }
.chapter .reveal:nth-child(2)  { transition-delay: 0.15s; }
.chapter .reveal:nth-child(3)  { transition-delay: 0.25s; }
.chapter .reveal:nth-child(4)  { transition-delay: 0.35s; }
.chapter .reveal:nth-child(5)  { transition-delay: 0.45s; }
.chapter .reveal:nth-child(6)  { transition-delay: 0.55s; }
.chapter .reveal:nth-child(7)  { transition-delay: 0.65s; }

/* Index entries cascade with --i */
.index-entry.reveal {
    transition:
        opacity 0.8s var(--ease-elastic) calc(var(--i) * 80ms),
        transform 0.8s var(--ease-elastic) calc(var(--i) * 80ms);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px) {
    :root {
        --content-offset: 8%;
    }
    .cover-art {
        right: 2vw;
        width: 360px;
        height: 360px;
    }
}

@media (max-width: 880px) {
    :root {
        --content-offset: 8%;
        --hud-edge: 14px;
    }
    body { font-size: 17px; }
    .chapter { padding: 12vh 0; }

    .chapter-inner.two-col {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .margin-col {
        padding-top: 0;
        border-top: 1px solid rgba(123, 111, 74, 0.3);
        padding-top: 32px;
    }
    .annot-col { padding-top: 32px; }

    .cover-art {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 240px;
        height: 240px;
        max-width: 60vw;
        margin: 0 0 32px;
    }
    .cover-art.small {
        width: 220px;
        height: 220px;
    }

    .index-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .hud-right {
        right: 8px;
        top: 60px;
        bottom: 60px;
    }
    .hud-left {
        left: 8px;
        width: 16px;
    }
    .hud-top, .hud-bottom { left: 12px; right: 12px; }
    .hud-coord:first-child { display: none; }
    .hud-coord:last-child { display: none; }

    .pull-quote { max-width: 100%; padding-left: 14px; }
    .margin-note, .margin-annot { max-width: 100%; }
}

@media (max-width: 540px) {
    .cover-meta { font-size: 9px; gap: 8px; letter-spacing: 0.16em; }
    .chapter-heading { font-size: 32px; }
    .body { font-size: 17px; }
    .body.lead { font-size: 17px; padding-left: 14px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal { opacity: 1; transform: none; }
    .circuit-tree .grow { stroke-dashoffset: 0; opacity: 1; }
    .circuit-tree .node { opacity: 0.85; }
    .morph-path { stroke-dashoffset: 0; }
}
