/* ═══════════════════════════════════════════════════════════════════════════
   atlas.css — shared pieces of the landing and about pages ("An Atlas of the
   Night"): the star canvas, the pointer follower, the text fill, the marquee,
   the engraved plate frame and the chapter rail. Driven by js/atlas.js.
   Byte-identical in both editions; tokens only, like pages/about.css.
   ═══════════════════════════════════════════════════════════════════════════ */

:root { --gutter: clamp(20px, 5vw, 88px); }

/* ─── sky ───────────────────────────────────────────────────────────────── */
.sky {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s var(--ease-out);
}
html.atlas-js .sky { opacity: 1; }

/* ─── pointer follower (fine pointers; the system cursor stays visible) ──── */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9997;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
    border-radius: 50%;
    pointer-events: none;
    transition: width var(--dur-2) var(--ease-out), height var(--dur-2) var(--ease-out),
                margin var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-out),
                opacity var(--dur-2) var(--ease);
}
.cursor::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 3px;
    margin: -1.5px 0 0 -1.5px;
    border-radius: 50%;
    background: var(--ember);
}
.cursor.is-hot {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.cursor.is-down { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.cursor.is-off { opacity: 0; }

/* ─── text fill: words light up with the scene (atlas.js sets --lit) ────── */
.fill-w { opacity: calc(0.16 + var(--lit, 1) * 0.84); transition: opacity 0.25s linear; }

/* ─── CJK dash: the Latin display face draws "——" as two spaced dashes ───── */
.cjk-dash { font-family: 'Noto Serif TC', 'Songti TC', 'PMingLiU', serif; letter-spacing: 0; }

/* ─── split headline characters (hero titles) ───────────────────────────── */
.ch { display: inline-block; }
.w { display: inline-block; white-space: nowrap; }

/* ─── marquee ───────────────────────────────────────────────────────────── */
.marquee {
    position: relative;
    overflow: hidden;
    padding-block: clamp(18px, 3vw, 34px);
    border-block: 1px solid var(--border);
    -webkit-mask-image: linear-gradient(90deg, transparent, var(--bg) 8%, var(--bg) 92%, transparent);
            mask-image: linear-gradient(90deg, transparent, var(--bg) 8%, var(--bg) 92%, transparent);
}
.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 46s linear infinite;
}
.marquee-group { display: flex; align-items: center; flex: none; }
.marquee-item {
    padding-inline: clamp(18px, 2.4vw, 40px);
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 1.2rem + 4.2vw, 5.6rem);
    line-height: 1.1;
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: var(--text-strong);
}
.marquee-item--hollow {
    color: transparent;
    -webkit-text-stroke: 1px color-mix(in srgb, var(--text-strong) 55%, transparent);
}
:lang(en) .marquee-item { font-style: italic; letter-spacing: -0.01em; }
.marquee-star { flex: none; width: clamp(14px, 1.4vw, 22px); height: auto; fill: var(--gold); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ─── plate: an engraved frame with corner ticks ────────────────────────── */
.plate {
    position: relative;
    border: 1px solid var(--border-strong);
}
.plate::before, .plate::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--gold);
    pointer-events: none;
}
.plate::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.plate::after { right: -5px; bottom: -5px; border-left: 0; border-top: 0; }

/* catalogue label: PL. I, coordinates, figure numbers */
.cat {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.cat--gold { color: var(--gold); }

/* ─── chapter rail (about) ──────────────────────────────────────────────── */
.chapter-rail {
    position: fixed;
    top: 50%;
    right: clamp(12px, 1.6vw, 28px);
    z-index: 50;
    display: grid;
    gap: 10px;
    translate: 0 -50%;
    pointer-events: none;
}
.chapter-rail-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.16em;
    color: var(--text-dim);
    opacity: 0.45;
    transition: opacity var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.chapter-rail-item::after {
    content: '';
    width: 14px;
    height: 1px;
    background: currentColor;
    transition: width var(--dur-3) var(--ease-out);
}
.chapter-rail-item.is-past { opacity: 0.7; }
.chapter-rail-item.is-on { opacity: 1; color: var(--gold); }
.chapter-rail-item.is-on::after { width: 34px; }
@media (max-width: 1100px) { .chapter-rail { display: none; } }

/* ─── a quiet link with a drawn underline ───────────────────────────────── */
.ink-link {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 0.5em;
    padding-block: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: var(--fs-lg);
}
.ink-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0.18);
    transform-origin: left;
    transition: transform var(--dur-3) var(--ease-out);
}
.ink-link:hover { color: var(--text-strong); }
.ink-link:hover::after, .ink-link:focus-visible::after { transform: none; }
.ink-link .arrow { transition: transform var(--dur-2) var(--ease); }
.ink-link:hover .arrow { transform: translateX(4px); }

/* magnetic buttons ride on --tx / --ty */
[data-magnet] { translate: var(--tx, 0px) var(--ty, 0px); transition: translate 0.5s var(--ease-out), transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }

@media (prefers-reduced-motion: reduce) {
    .marquee-track { animation: none; }
    .sky { transition: none; }
    [data-magnet] { translate: none; }
}
@media print { .sky, .cursor, .chapter-rail, .marquee { display: none !important; } }
