/* ==========================================================================
   archetype.moe  -  Light-academia meets moe subculture
   A scholarly monograph of five chapters, five archetypes, five dimensions.
   ========================================================================== */

:root {
    /* Palette (exact hex values from DESIGN.md) */
    --parchment:       #faf6f0;
    --parchment-dark:  #d4cec4;   /* rule / border */
    --walnut:          #2c2418;   /* body text */
    --umber:           #1a1410;   /* dark panel */
    --burnt-orange:    #c17636;   /* primary accent */
    --amber-gold:      #d4943a;   /* secondary accent */
    --sienna-star:     #e8a84c;   /* celestial highlight */
    --terracotta:      #a85a2a;   /* data-viz stroke */
    --faded-ochre:     #b89870;   /* muted annotation */

    /* Fonts */
    --font-display: 'Space Grotesk', 'Inter', 'Space', sans-serif;
    --font-body:    'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-label:   'Space Grotesk', 'Inter', sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--walnut);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.8;
    letter-spacing: 0.01em;
    overflow: hidden;
    position: relative;
    min-height: 100vh;
}

/* A very faint scatter of star-dots over the whole page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle at 12% 18%, rgba(184, 152, 112, 0.22) 0.6px, transparent 1.2px),
        radial-gradient(circle at 82% 24%, rgba(184, 152, 112, 0.18) 0.6px, transparent 1.2px),
        radial-gradient(circle at 45% 62%, rgba(184, 152, 112, 0.16) 0.6px, transparent 1.2px),
        radial-gradient(circle at 68% 78%, rgba(184, 152, 112, 0.2)  0.6px, transparent 1.2px),
        radial-gradient(circle at 28% 88%, rgba(184, 152, 112, 0.18) 0.6px, transparent 1.2px),
        radial-gradient(circle at 92% 58%, rgba(184, 152, 112, 0.14) 0.6px, transparent 1.2px),
        radial-gradient(circle at 8% 72%, rgba(184, 152, 112, 0.16) 0.6px, transparent 1.2px);
    background-size: 220px 220px, 260px 260px, 300px 300px, 240px 240px, 280px 280px, 320px 320px, 260px 260px;
    opacity: 0.6;
}

/* ==========================================================================
   Global ambient star field (subtle twinkle layer behind everything)
   ========================================================================== */
.ambient-stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.ambient-star {
    position: absolute;
    background: var(--sienna-star);
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 4.5s ease-in-out infinite;
    box-shadow: 0 0 4px rgba(232, 168, 76, 0.5);
}

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50%      { opacity: 0.55; transform: scale(1); }
}

/* ==========================================================================
   Scroll container / chapters
   ========================================================================== */
.scroll-container {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    z-index: 1;
    /* Hide scrollbar (cosmetic) */
    scrollbar-width: thin;
    scrollbar-color: var(--faded-ochre) transparent;
}

.scroll-container::-webkit-scrollbar { width: 4px; }
.scroll-container::-webkit-scrollbar-track { background: transparent; }
.scroll-container::-webkit-scrollbar-thumb { background: var(--faded-ochre); border-radius: 2px; }

.chapter {
    position: relative;
    height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chapter-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.chapter-bg.dark-panel {
    background-color: var(--umber);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(232, 168, 76, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(193, 118, 54, 0.05) 0%, transparent 55%);
}

/* Star-dot ornamental divider between chapters (rendered by ::after) */
.chapter::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: 320px;
    height: 14px;
    background-image:
        radial-gradient(circle, var(--faded-ochre) 1px, transparent 1.4px);
    background-size: 16px 14px;
    background-repeat: repeat-x;
    opacity: 0.55;
    z-index: 2;
}

.chapter-radar::after {
    background-image:
        radial-gradient(circle, rgba(232, 168, 76, 0.7) 1px, transparent 1.4px);
}

.chapter-colophon::after { display: none; }

.chapter-inner {
    position: relative;
    width: 100%;
    max-width: 1440px;
    padding: 0 40px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    gap: 1.5rem;
}

.chapter-inner--wide {
    max-width: 1100px;
}

/* Narrow reading corridor (680px max) per DESIGN.md */
.reading-corridor {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

/* ==========================================================================
   Chapter headers (numeral, rule, title)
   ========================================================================== */
.chapter-header {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.chapter-numeral {
    display: inline-block;
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    color: var(--burnt-orange);
    text-transform: uppercase;
}

.chapter-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    margin: 0.9rem auto;
    color: var(--faded-ochre);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

.chapter-rule span:nth-child(2n+1) { color: var(--burnt-orange); }

.chapter-rule--light { color: rgba(212, 202, 196, 0.55); }
.chapter-rule--light span:nth-child(2n+1) { color: var(--sienna-star); }

.chapter-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--walnut);
    line-height: 1.05;
}

.chapter-title--light { color: var(--parchment); }

.chapter-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    color: var(--faded-ochre);
    margin-top: 0.65rem;
}

.chapter-subtitle--light { color: rgba(212, 202, 196, 0.75); }

/* Chapter body appear */
.chapter-body {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.9s ease 0.2s, transform 0.9s ease 0.2s;
}

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

.chapter-text {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.8;
    letter-spacing: 0.01em;
    color: var(--walnut);
    margin-bottom: 1.75rem;
}

.chapter-text em {
    font-style: italic;
    color: var(--burnt-orange);
    font-weight: 600;
}

.chapter-footnote {
    margin-top: 1.5rem;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--faded-ochre);
    line-height: 1.5;
    border-top: 1px solid var(--parchment-dark);
    padding-top: 0.85rem;
}

.inline-contested {
    font-style: italic;
    color: var(--burnt-orange);
    font-weight: 600;
}

/* ==========================================================================
   Annotation gutters (sticky sidenotes at >1200px)
   ========================================================================== */
.gutter {
    position: absolute;
    top: 12vh;
    bottom: 12vh;
    width: 220px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
    pointer-events: none;
}

.gutter-left  { left: 32px; text-align: left; }
.gutter-right { right: 32px; text-align: right; }

.gutter-item {
    opacity: 0;
    transform: translateY(-16px);
    transition: opacity 1s ease, transform 1s ease;
    will-change: transform;
}

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

.in-view .gutter-item-2 { transition-delay: 0.25s; }

.sidenote-tag {
    display: inline-block;
    font-family: var(--font-label);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--burnt-orange);
    padding: 0.25em 0.6em;
    border: 1px solid var(--burnt-orange);
    margin-bottom: 0.35rem;
    background: rgba(250, 246, 240, 0.6);
}

.sidenote-label {
    display: block;
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--faded-ochre);
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
}

.sparkline {
    display: block;
    margin-bottom: 0.2rem;
}

.gutter-right .sidenote-tag,
.gutter-right .sidenote-label,
.gutter-right .sparkline { margin-left: auto; }

.annotation-quote {
    border-top: 1px solid var(--parchment-dark);
    border-bottom: 1px solid var(--parchment-dark);
    padding: 0.75rem 0;
    position: relative;
}

.annotation-quote p {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--faded-ochre);
    line-height: 1.55;
}

.quote-mark {
    font-family: var(--font-body);
    font-size: 1.5rem;
    color: var(--burnt-orange);
    line-height: 1;
}

.quote-attrib {
    display: block;
    font-family: var(--font-label);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--burnt-orange);
    margin-top: 0.4rem;
}

/* Dark-panel variant of gutter contents - not used, chapter 3 has no gutters.
   Kept as safety for any class reuse. */

/* ==========================================================================
   CHAPTER I : CARTOUCHE
   ========================================================================== */
.chapter-cartouche { padding-top: 4vh; }

.cartouche-wrap {
    padding-top: 4vh;
}

.cartouche {
    display: flex;
    justify-content: center;
    width: 100%;
}

.cartouche-border {
    position: relative;
    padding: 3.25rem 4.5rem 2.75rem;
    border: 1px solid var(--faded-ochre);
    background: rgba(250, 246, 240, 0.55);
    backdrop-filter: blur(1px);
}

.cartouche-border::before,
.cartouche-border::after {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    height: 1px;
    background: var(--faded-ochre);
    opacity: 0.45;
}

.cartouche-border::before { top: 6px; }
.cartouche-border::after  { bottom: 6px; }

/* Star markers at corners + midpoints */
.cartouche-star {
    position: absolute;
    color: var(--burnt-orange);
    font-size: 14px;
    line-height: 1;
    text-shadow: 0 0 10px rgba(232, 168, 76, 0.55);
    opacity: 0;
    animation: fadeIn 1.2s ease forwards 0.15s;
}
.cartouche-star-tl { top: -7px;  left: -7px; }
.cartouche-star-tr { top: -7px;  right: -7px; }
.cartouche-star-bl { bottom: -7px; left: -7px; }
.cartouche-star-br { bottom: -7px; right: -7px; }
.cartouche-star-tm { top: -7px;  left: 50%; transform: translateX(-50%); }
.cartouche-star-bm { bottom: -7px; left: 50%; transform: translateX(-50%); }

.cartouche-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
}

.cartouche-eyebrow {
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--burnt-orange);
    opacity: 0;
    animation: fadeUp 0.9s ease forwards 0.35s;
}

.cartouche-constellation {
    opacity: 0;
    animation: fadeIn 1.1s ease forwards 0.55s;
}

.cartouche-constellation .cc-lines line {
    stroke: var(--amber-gold);
    stroke-width: 0.75;
    opacity: 0.65;
}

.cartouche-constellation .cc-stars circle {
    fill: var(--sienna-star);
    filter: drop-shadow(0 0 3px rgba(232, 168, 76, 0.7));
}

.site-title {
    font-family: var(--font-display);
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--walnut);
    line-height: 1;
    opacity: 0;
    animation: fadeUp 0.9s ease forwards 0.85s;
}

.site-title .title-sep {
    color: var(--burnt-orange);
    font-size: 0.65em;
    margin: 0 0.05em;
    vertical-align: 0.05em;
    text-shadow: 0 0 14px rgba(232, 168, 76, 0.55);
}

.title-rule {
    width: 56px;
    height: 1px;
    background: var(--burnt-orange);
    opacity: 0;
    animation: fadeIn 0.7s ease forwards 1.05s;
}

.subtitle {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-style: italic;
    color: var(--amber-gold);
    line-height: 1.5;
    opacity: 0;
    animation: fadeUp 0.9s ease forwards 1.15s;
}

.cartouche-meta {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faded-ochre);
    margin-top: 0.6rem;
    opacity: 0;
    animation: fadeIn 0.9s ease forwards 1.35s;
}

.meta-dot { color: var(--burnt-orange); }

.scroll-indicator {
    position: absolute;
    bottom: 3.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.75s;
}

.scroll-indicator-text {
    font-family: var(--font-label);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--faded-ochre);
}

.scroll-indicator-line {
    width: 1px;
    height: 38px;
    background: linear-gradient(to bottom, var(--burnt-orange), transparent);
    animation: scrollPulse 2.2s ease-in-out infinite 2.5s;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.25; transform: scaleY(0.85); }
    50%      { opacity: 1;    transform: scaleY(1.15); }
}

/* ==========================================================================
   CHAPTER II : TAXONOMY
   ========================================================================== */
.archetype-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--parchment-dark);
    border-bottom: 1px solid var(--parchment-dark);
    margin: 1rem 0 0.25rem;
}

.archetype-row {
    display: grid;
    grid-template-columns: 22px 28px auto auto 1fr;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0.25rem;
    border-bottom: 1px dotted var(--parchment-dark);
    transition: background-color 0.3s ease, padding-left 0.3s ease;
}

.archetype-row:last-child { border-bottom: none; }

.archetype-row:hover {
    background-color: rgba(193, 118, 54, 0.06);
    padding-left: 0.6rem;
}

.archetype-glyph {
    flex-shrink: 0;
    display: block;
}

.archetype-glyph .glyph-star {
    fill: none;
    stroke: var(--amber-gold);
    stroke-width: 0.9;
    stroke-linejoin: round;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.archetype-glyph .glyph-motif {
    stroke: var(--terracotta);
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.archetype-row:hover .archetype-glyph .glyph-star {
    fill: rgba(232, 168, 76, 0.35);
    stroke: var(--burnt-orange);
}

.archetype-numeral {
    font-family: var(--font-label);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--faded-ochre);
    letter-spacing: 0.1em;
}

.archetype-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--walnut);
}

.archetype-tag {
    font-family: var(--font-label);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.22em 0.7em;
    border: 1px solid currentColor;
    cursor: help;
    transition: background-color 0.25s ease;
    user-select: none;
}

.tag--stable {
    color: var(--faded-ochre);
}
.tag--stable:hover {
    background-color: rgba(184, 152, 112, 0.12);
}

.tag--contested {
    color: var(--terracotta);
    position: relative;
}

.tag--contested:hover {
    animation: archetype-shake 0.3s ease-in-out;
    background-color: rgba(168, 90, 42, 0.1);
}

/* Signature shake-error animation (DESIGN.md prompt) */
@keyframes archetype-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-3px); }
    40%      { transform: translateX(3px); }
    60%      { transform: translateX(-2px); }
    80%      { transform: translateX(2px); }
}

.archetype-summary {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.88rem;
    color: var(--walnut);
    opacity: 0.75;
    line-height: 1.45;
}

/* ==========================================================================
   CHAPTER III : THE RADAR (dark-panel breakout)
   ========================================================================== */
.chapter-radar .chapter-inner { max-width: 1100px; }

.radar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.radar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-label);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(212, 202, 196, 0.8);
    cursor: pointer;
    transition: color 0.25s ease, transform 0.25s ease;
    padding: 0.35em 0.6em;
    border: 1px solid transparent;
}

.legend-item:hover {
    color: var(--parchment);
    border-color: rgba(232, 168, 76, 0.35);
    transform: translateY(-1px);
}

.legend-item.is-dimmed { opacity: 0.35; }

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(232, 168, 76, 0.4);
}

.radar-container {
    position: relative;
    width: 100%;
    max-width: 460px;
}

.radar-chart {
    display: block;
    width: 100%;
    height: auto;
}

.radar-grid polygon,
.radar-ring {
    fill: none;
    stroke: rgba(232, 168, 76, 0.22);
    stroke-width: 0.75;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.radar-axes line {
    stroke: rgba(232, 168, 76, 0.18);
    stroke-width: 0.5;
    stroke-dasharray: 3, 4;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.radar-ready .radar-grid polygon,
.radar-ready .radar-ring,
.radar-ready .radar-axes line { opacity: 1; }

.radar-label {
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 500;
    fill: var(--sienna-star);
    letter-spacing: 0.25em;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.radar-ready .radar-label { opacity: 1; transition-delay: 1.2s; }

/* Profile strokes + fills */
.radar-profile { pointer-events: auto; }

.profile-stroke {
    fill: none;
    stroke-width: 1.5;
    stroke-linejoin: round;
    opacity: 0;
    transition: opacity 0.5s ease, stroke-width 0.25s ease;
}

.profile-fill {
    stroke: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Per-profile colors (palette-compliant) */
[data-profile="tsundere"] .profile-stroke { stroke: var(--burnt-orange); }
[data-profile="tsundere"] .profile-fill   { fill:   rgba(193, 118, 54, 0.18); }

[data-profile="kuudere"]  .profile-stroke { stroke: var(--amber-gold); }
[data-profile="kuudere"]  .profile-fill   { fill:   rgba(212, 148, 58, 0.16); }

[data-profile="genki"]    .profile-stroke { stroke: var(--sienna-star); }
[data-profile="genki"]    .profile-fill   { fill:   rgba(232, 168, 76, 0.16); }

[data-profile="yandere"]  .profile-stroke { stroke: var(--terracotta); }
[data-profile="yandere"]  .profile-fill   { fill:   rgba(168, 90, 42, 0.2); }

.radar-profile.is-visible .profile-stroke { opacity: 1; }
.radar-profile.is-visible .profile-fill   { opacity: 1; }

.radar-profile.is-hidden  .profile-stroke { opacity: 0.06; }
.radar-profile.is-hidden  .profile-fill   { opacity: 0.02; }

.radar-profile.is-emphasized .profile-stroke { stroke-width: 2.25; }

.radar-caption {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.85rem;
    color: rgba(212, 202, 196, 0.65);
    text-align: center;
    max-width: 520px;
    line-height: 1.55;
    margin-top: 0.5rem;
}

/* ==========================================================================
   CHAPTER IV : CONSTELLATIONS
   ========================================================================== */
.constellation-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 1rem 0 0.5rem;
    width: 100%;
}

.constellation-map {
    display: block;
    max-width: 100%;
    height: auto;
    overflow: visible;
}

.constellation-edge {
    stroke: var(--amber-gold);
    stroke-width: 0.8;
    stroke-dasharray: 4, 3;
    opacity: 0;
    transition:
        opacity 0.6s ease,
        stroke-width 0.3s ease,
        stroke 0.3s ease,
        stroke-dasharray 0.5s ease;
}

.in-view .constellation-edge { opacity: 0.55; }

.constellation-edge.is-active {
    stroke: var(--burnt-orange);
    stroke-dasharray: 0;
    stroke-width: 1.6;
    opacity: 1;
}

.constellation-edge.is-dim { opacity: 0.08; }

/* Nodes - stars with glow */
.constellation-node { cursor: pointer; }

.node-glow {
    fill: var(--sienna-star);
    opacity: 0;
    transition: opacity 0.4s ease;
    filter: blur(6px);
}

.node-star {
    fill: var(--sienna-star);
    filter: drop-shadow(0 0 6px rgba(232, 168, 76, 0.7));
    opacity: 0;
    transform-origin: center;
    transform-box: fill-box;
    transition: opacity 0.5s ease, r 0.3s ease;
}

.node-core {
    fill: var(--parchment);
    opacity: 0;
    transition: opacity 0.5s ease 0.15s;
}

.node-label {
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    fill: var(--burnt-orange);
    opacity: 0;
    transition: opacity 0.5s ease 0.3s, fill 0.25s ease;
}

.in-view .node-star,
.in-view .node-core,
.in-view .node-label { opacity: 1; }

.in-view .node-glow { opacity: 0.35; }

.constellation-node:hover .node-star { r: 7; }
.constellation-node:hover .node-glow { opacity: 0.75; }
.constellation-node:hover .node-label { fill: var(--terracotta); }

.constellation-node.is-active .node-star { r: 8; }
.constellation-node.is-active .node-glow { opacity: 0.9; }

.constellation-node.is-dim .node-star,
.constellation-node.is-dim .node-core,
.constellation-node.is-dim .node-label { opacity: 0.35; }

.constellation-node.is-dim .node-glow { opacity: 0.12; }

.constellation-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    background: var(--walnut);
    color: var(--parchment);
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.35em 0.75em;
    border: 1px solid var(--burnt-orange);
    opacity: 0;
    transform: translate(-50%, -140%);
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 5;
}

.constellation-tooltip.is-visible { opacity: 1; }

/* ==========================================================================
   CHAPTER V : COLOPHON
   ========================================================================== */
.colophon-finis-text {
    font-style: italic;
    color: var(--walnut);
    opacity: 0.88;
    margin-bottom: 1.5rem;
}

.colophon-details {
    margin: 1rem 0 2rem;
    border-top: 1px solid var(--parchment-dark);
    border-bottom: 1px solid var(--parchment-dark);
}

.colophon-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    padding: 0.65rem 0;
    border-bottom: 1px dotted var(--parchment-dark);
}

.colophon-row:last-child { border-bottom: none; }

.colophon-key {
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--burnt-orange);
}

.colophon-value {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--walnut);
}

.colophon-monogram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}

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

.colophon-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--walnut);
}

.colophon-sep {
    color: var(--burnt-orange);
    font-size: 0.7em;
    margin: 0 0.08em;
    vertical-align: 0.05em;
    text-shadow: 0 0 12px rgba(232, 168, 76, 0.5);
}

.colophon-finis {
    font-family: var(--font-label);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--faded-ochre);
}

/* ==========================================================================
   Fixed chapter indicator (star fill + numeral)
   ========================================================================== */
.chapter-indicator {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.85rem;
    background: rgba(250, 246, 240, 0.8);
    border: 1px solid var(--faded-ochre);
    backdrop-filter: blur(6px);
    transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

/* When user is on the dark panel chapter, invert */
.chapter-indicator.on-dark {
    background: rgba(26, 20, 16, 0.8);
    border-color: var(--burnt-orange);
    color: var(--parchment);
}

.chapter-indicator.on-dark .indicator-numeral {
    color: var(--sienna-star);
}

.indicator-star {
    position: relative;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.indicator-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--faded-ochre);
}

.indicator-full {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--burnt-orange);
    clip-path: inset(100% 0 0 0);
    transition: clip-path 0.45s cubic-bezier(0.2, 0.8, 0.3, 1), color 0.3s ease;
    text-shadow: 0 0 8px rgba(232, 168, 76, 0.6);
}

.chapter-indicator.on-dark .indicator-full {
    color: var(--sienna-star);
}

.indicator-numeral {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--burnt-orange);
    min-width: 1.5em;
    text-align: center;
    transition: color 0.35s ease, opacity 0.25s ease;
}

/* ==========================================================================
   Animations (shared)
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .gutter { display: none; }
}

@media (max-width: 900px) {
    .chapter-title   { font-size: 2.25rem; }
    .site-title      { font-size: 3.25rem; }
    .chapter-inner   { padding: 0 24px; }
    .cartouche-border { padding: 2.5rem 2.25rem; }
    .archetype-row   { grid-template-columns: 18px 24px auto auto; grid-template-rows: auto auto; }
    .archetype-summary { grid-column: 1 / -1; margin-top: 0.2rem; }
    .colophon-row    { grid-template-columns: 110px 1fr; }
}

@media (max-width: 600px) {
    .chapter-title     { font-size: 1.85rem; }
    .site-title        { font-size: 2.25rem; }
    .cartouche-border  { padding: 2rem 1.5rem; }
    .chapter-text      { font-size: 1rem; line-height: 1.7; }
    .radar-legend      { gap: 0.75rem; }
    .legend-item       { font-size: 0.65rem; letter-spacing: 0.08em; }
    .chapter-indicator { top: 1rem; right: 1rem; padding: 0.4rem 0.6rem; }
    .colophon-row      { grid-template-columns: 1fr; gap: 0.1rem; padding: 0.75rem 0; }
    .colophon-title    { font-size: 1.5rem; }
}
