/* The archive shares the sky with the rest of the site: content is never a panel. */
:root[data-mode] .cosmic-theatre .articles-canvas-wrap { --archive-line: color-mix(in srgb, var(--theatre-light) 28%, transparent); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-masthead,
:root[data-mode] .cosmic-theatre .articles-canvas-wrap:has(.timeline-empty-board) .archive-masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  min-height: 156px; margin: 0 0 24px; padding: 0; border: 0;
}
.archive-heading { position: relative; z-index: 1; min-width: 0; }
.archive-kicker { display: block; margin-bottom: 10px; color: var(--cosmic-canvas-muted); font: 10px/1.4 var(--mono); letter-spacing: .2em; }
:root[data-mode] .cosmic-theatre .archive-masthead h1 { margin: 0 0 8px; padding: 0; font-size: clamp(36px, 4vw, 50px); letter-spacing: .035em; }
:root[data-mode] .cosmic-theatre .archive-masthead .stellar-page-count { font-size: 14px; }
.archive-total-hint { opacity: .8; }
.archive-sky { position: relative; flex: 0 0 250px; width: 250px; height: 156px; color: var(--theatre-light); }
.archive-constellation { display: block; width: 100%; height: 100%; overflow: visible; fill: none; opacity: .65; transition: opacity .5s ease, filter .5s ease, transform .7s ease; }
.archive-star-toggle { position: absolute; left: 51%; top: 57.5%; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; transform: translate(-50%, -50%); border: 0; border-radius: 50%; background: transparent; color: var(--theatre-light); cursor: grab; touch-action: none; font-size: 20px; text-shadow: 0 0 8px var(--theatre-light); }
.is-dragging-star .archive-star-toggle { cursor: grabbing; }
.archive-star-toggle[hidden] { display: none; }
.archive-star-toggle span { transition: transform .45s ease, text-shadow .45s ease; }
.archive-star-toggle:is(:hover, :focus-visible) span { transform: scale(1.3); }
.archive-sky.is-awake .archive-constellation { opacity: 1; filter: drop-shadow(0 0 8px var(--theatre-light)); transform: rotate(3deg); }
.archive-sky.is-awake .archive-star-toggle span { transform: scale(1.4) rotate(45deg); text-shadow: 0 0 14px var(--theatre-light); }
.archive-star-feedback { position: absolute; right: 0; bottom: 0; color: var(--cosmic-canvas-muted); font: 11px/1.5 var(--sans); white-space: nowrap; }

/* One compact form keeps search, category, tags and the view switch in sync. */
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-toolbar { display: block; margin: 0 0 22px; }
.archive-controls { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(130px, 180px) auto auto; gap: 12px 22px; align-items: end; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-search-input-wrap {
  display: flex; align-items: center; min-width: 0; gap: 8px; padding: 0; border: 0; border-bottom: 1px solid var(--archive-line);
  border-radius: 0; background: transparent; box-shadow: none;
}
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .search-prefix-icon { margin: 0; color: var(--cosmic-canvas-muted); font-size: 19px; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-search-input-wrap input[type="search"] { width: 100%; min-width: 0; height: 46px; padding: 0 4px; border: 0; background: transparent; color: var(--cosmic-canvas-ink); font: 14px var(--sans); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-search-input-wrap input::placeholder { color: var(--cosmic-canvas-muted); opacity: .8; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-search-submit { min-height: 44px; padding: 0 4px 0 12px; border: 0; border-radius: 0; background: transparent; color: var(--cosmic-canvas-ink); font: 13px var(--sans); }
.archive-category { min-width: 0; }
.archive-category > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.archive-category-select { width: 100%; min-width: 0; min-height: 46px; padding: 0 20px 0 2px; border: 0; border-bottom: 1px solid var(--archive-line); border-radius: 0; background: transparent; color: var(--cosmic-canvas-ink); font: 13px var(--sans); cursor: pointer; }
.archive-category-select option { color: var(--cosmic-canvas-ink); background: var(--cosmic-solid); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-filters { position: relative; z-index: 8; margin: 0; min-width: 0; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-filters[open] { order: 0; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-filters > summary,
.archive-view-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 2px; border: 0; background: transparent; color: var(--cosmic-canvas-ink); font: 13px/1.5 var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; list-style: none; }
.archive-filters > summary::-webkit-details-marker { display: none; }
.archive-filter-chevron { color: var(--cosmic-canvas-muted); transition: transform .25s ease; }
.archive-filters[open] .archive-filter-chevron { transform: rotate(180deg); }
.archive-view-toggle > span { color: var(--theatre-light); font-size: 18px; }
.archive-controls :is(a, button, select, summary):is(:hover, :focus-visible) { color: var(--theatre-light); }
.archive-tag-popover { position: absolute; top: calc(100% + 8px); right: 0; width: min(290px, calc(100vw - 40px)); padding: 16px; border: 1px solid var(--archive-line); border-radius: 8px; background: var(--cosmic-solid); box-shadow: 0 14px 35px #0009; color: var(--cosmic-canvas-ink); }
.archive-tag-hint, .archive-tag-empty { margin: 0 0 10px; color: var(--cosmic-canvas-muted); font: 12px/1.6 var(--sans); }
.archive-tag-popover fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.archive-tag-list { max-height: min(38vh, 260px); overflow-y: auto; overscroll-behavior: contain; }
.archive-tag-option { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font: 13px/1.5 var(--sans); }
.archive-tag-option input { width: 17px; height: 17px; accent-color: var(--theatre-light); }
.archive-tag-option span { min-width: 0; overflow-wrap: anywhere; }
.archive-tag-option small { margin-left: auto; color: var(--cosmic-canvas-muted); }
.archive-tag-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding-top: 10px; border-top: 1px solid var(--archive-line); }
.archive-tag-actions :is(a, button) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 3px; border: 0; background: none; color: var(--cosmic-canvas-ink); font: 13px var(--sans); cursor: pointer; text-decoration: none; }
.archive-tag-actions button { color: var(--theatre-light); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-search-status { gap: 5px; margin: 10px 0 0; padding: 0; font-size: 13px; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-clear-search { min-height: 0; margin-left: 8px; text-decoration: underline; text-underline-offset: 4px; }

/* Empty, list and timeline states sit directly on the sky. */
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-empty-board { padding: 36px 0 48px; border: 0; background: none; box-shadow: none; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty { grid-template-columns: minmax(0, 1fr) minmax(150px, 29%); gap: 5px 32px; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty .stellar-illustration { width: min(100%, 200px); fill: none; opacity: .5; background: none; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty h3 { font-size: 25px; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty .timeline-clear-btn { min-height: 44px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--cosmic-canvas-ink); text-decoration: underline; text-underline-offset: 6px; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty .timeline-clear-btn:is(:hover, :focus-visible) { background: none; color: var(--theatre-light); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-list::before { display: none; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry { grid-template-columns: 40px minmax(0, 1fr) 144px; gap: 20px; padding: 24px 0; border-color: var(--archive-line); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry-number,
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:first-child .archive-entry-number { width: 40px; height: auto; border: 0; background: none; box-shadow: none; color: var(--cosmic-canvas-muted); font: 12px/1 var(--mono); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry > .archive-entry-copy,
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:first-child > .archive-entry-copy {
  background: radial-gradient(ellipse 50% 50% at center, color-mix(in srgb, var(--theatre-veil) 80%, transparent) 0 40%, transparent 100%);
  text-shadow: 0 1px 10px #020714c9;
}
/* A reading is a point on a star chart; the marks are decorative, not labels. */
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry-number,
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:first-child .archive-entry-number { display: flex; flex-direction: column; align-items: center; align-self: start; gap: 9px; padding-top: 7px; font-size: 11px; }
.archive-entry-number::before { content: "✦"; color: var(--theatre-light); font: 16px/1 var(--serif); text-shadow: 0 0 12px var(--theatre-light); }
.archive-entry-number::after { content: ""; position: absolute; top: 1px; left: 50%; width: 28px; height: 28px; border: 1px solid var(--archive-line); border-radius: 50%; transform: translateX(-50%); transition: transform .35s ease, border-color .35s ease; }
.archive-entry::before { content: ""; position: absolute; left: 20px; top: 58px; bottom: 0; width: 1px; background: linear-gradient(var(--archive-line), transparent); pointer-events: none; }
.archive-entry h2 a { display: inline-block; padding-block: 8px; margin-block: -8px; text-decoration: underline; text-decoration-color: var(--archive-line); text-underline-offset: .22em; }
.archive-entry h2 a::after { content: none; }
.archive-entry h2 a:is(:hover, :focus-visible) { color: var(--theatre-light); text-decoration-color: currentColor; }
.archive-entry-art { position: relative; overflow: visible; border-radius: 0; opacity: .8; transition: opacity .35s ease, transform .35s ease; }
.archive-entry-art .archive-entry-orbit { fill: none; color: var(--theatre-light); opacity: .72; transition: transform .55s ease, opacity .35s ease; }
.archive-entry:nth-child(even) .archive-entry-orbit { transform: scaleX(-1) rotate(-6deg); }
.archive-entry-art:has(img)::before { content: ""; position: absolute; width: 100%; height: 54%; border: 1px solid var(--archive-line); border-radius: 50%; transform: rotate(-22deg); pointer-events: none; }
.archive-entry-art:has(img)::after { content: ""; position: absolute; top: 15%; right: 16%; width: 5px; height: 5px; border-radius: 50%; background: var(--theatre-light); box-shadow: 0 0 10px var(--theatre-light); pointer-events: none; }
.cosmic-theatre .archive-entry-art img { position: relative; width: min(82%, 82px); height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.archive-entry:hover .archive-entry-art, .archive-entry:focus-within .archive-entry-art { opacity: 1; transform: translateX(5px); }
.archive-entry:is(:hover, :focus-within) .archive-entry-number::after { border-color: var(--theatre-light); transform: translateX(-50%) scale(1.12); }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap :is(.timeline-scroll-shell, .timeline-viewport, .timeline-photo) { background: transparent; border: 0; box-shadow: none; }
:root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-browse-bar { padding-inline: 0; border-color: var(--archive-line); }

@media (min-width: 1200px) {
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap { max-width: 1720px; padding-inline: clamp(36px, 3.75vw, 72px); }
  .articles-canvas-wrap .archive-controls { grid-template-columns: minmax(280px, 720px) minmax(130px, 180px) auto auto; justify-content: start; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; column-gap: clamp(36px, 4vw, 72px); }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry { grid-template-columns: 40px minmax(0, 1fr) 120px; gap: 16px; min-height: 166px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:only-child { grid-column: 1 / -1; }
  .cosmic-theatre .articles-canvas-wrap .archive-entry-art { width: 120px; height: 96px; }
}

/* The reading page keeps its measure and outline without a paper-shaped container. */
:root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .reading-sheet { background: none; border: 0; box-shadow: none; }
:root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .reading-layout > .prose { padding-inline: 0; background: none; border-radius: 0; text-shadow: 0 1px 10px #020714b3; }
:root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .reader-photo { background: none; border: 0; box-shadow: none; }
:root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .reader-photo-caption { padding-inline: 0; }
:root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .article-toc { background: none; border-radius: 0; }
:root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .article-toc a[aria-current] { background: none; }

/* Independent, short movements introduce each part without moving the page on scroll. */
@keyframes archive-appear { from { opacity: .4; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes archive-sky-in { from { opacity: .25; transform: scale(.94) rotate(-4deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes archive-menu-in { from { opacity: .3; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
:root[data-cosmos-motion="animated"] .cosmic-theatre :is(.archive-heading, .archive-controls, .timeline-empty-board, .archive-entry, .timeline-scroll-shell, .reading-wrap:not(.about-wrap) .article-header, .reading-wrap:not(.about-wrap) .reader-photo, .reading-wrap:not(.about-wrap) .reading-layout, .reading-wrap:not(.about-wrap) .memory-browse) { animation: archive-appear .55s both; }
:root[data-cosmos-motion="animated"] .cosmic-theatre :is(.archive-controls, .reading-wrap:not(.about-wrap) .reader-photo) { animation-delay: .08s; }
:root[data-cosmos-motion="animated"] .cosmic-theatre :is(.timeline-empty-board, .timeline-scroll-shell, .reading-wrap:not(.about-wrap) .reading-layout) { animation-delay: .14s; }
:root[data-cosmos-motion="animated"] .cosmic-theatre .archive-entry:nth-child(2) { animation-delay: .04s; }
:root[data-cosmos-motion="animated"] .cosmic-theatre .archive-entry:nth-child(3) { animation-delay: .08s; }
:root[data-cosmos-motion="animated"] .cosmic-theatre .archive-entry:nth-child(n+4) { animation-delay: .12s; }
:root[data-cosmos-motion="animated"] .cosmic-theatre .archive-sky { animation: archive-sky-in .8s both; }
:root[data-cosmos-motion="animated"] .cosmic-theatre .archive-filters[open] .archive-tag-popover { animation: archive-menu-in .2s both; }
@media (max-width: 760px) {
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-masthead,
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap:has(.timeline-empty-board) .archive-masthead { min-height: 98px; margin-bottom: 14px; gap: 8px; }
  :root[data-mode] .cosmic-theatre .archive-masthead h1 { padding: 0; font-size: 31px; }
  .archive-kicker { margin-bottom: 5px; font-size: 9px; }
  .archive-sky { flex-basis: 120px; width: 120px; height: 96px; }
  .archive-star-feedback { right: 0; bottom: -4px; font-size: 10px; }
  .archive-controls { position: relative; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-filters { position: static; }
  .archive-tag-popover { top: calc(100% + 8px); left: 0; right: 0; width: auto; }
  .archive-controls .timeline-search-input-wrap { grid-column: 1 / -1; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-search-input-wrap input[type="search"] { font-size: 16px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-toolbar { margin-bottom: 12px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .timeline-empty-board { padding: 22px 0 28px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty { grid-template-columns: minmax(0, 1fr) 82px; gap: 3px 10px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty .stellar-illustration { width: 82px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .stellar-empty h3 { font-size: 21px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry { grid-template-columns: 25px minmax(0, 1fr) 44px; gap: 8px; padding: 18px 0; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry > .archive-entry-copy,
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:first-child > .archive-entry-copy { padding-right: 0; }
  .cosmic-theatre .articles-canvas-wrap .archive-entry-art { width: 44px; height: 56px; }
  .cosmic-theatre .articles-canvas-wrap .archive-entry-orbit { width: 50px; height: 40px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry-number,
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:first-child .archive-entry-number { width: 25px; font-size: 11px; }
  .cosmic-theatre .articles-canvas-wrap .archive-entry::before { left: 12px; top: 55px; }
  .archive-entry-number::after { width: 24px; height: 24px; top: 3px; }
  :root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .article-toc { padding: 0; border: 0; border-block: 1px solid var(--cosmic-canvas-line); background: none; }
}
@media (max-width: 360px) {
  .archive-controls { gap: 4px 9px; }
  .archive-category-select, :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-filters > summary, .archive-view-toggle { font-size: 12px; }
  .archive-sky { flex-basis: 100px; width: 100px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry { grid-template-columns: 20px minmax(0, 1fr) 44px; gap: 8px; }
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry-number,
  :root[data-mode] .cosmic-theatre .articles-canvas-wrap .archive-entry:first-child .archive-entry-number { width: 20px; }
  .cosmic-theatre .articles-canvas-wrap .archive-entry::before { left: 10px; }
  .cosmic-theatre .archive-entry-art { width: 44px; height: 56px; }
  .cosmic-theatre .archive-entry-orbit { width: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-cosmos-motion] .cosmic-theatre :is(.archive-heading, .archive-controls, .timeline-empty-board, .archive-entry, .timeline-scroll-shell, .reading-wrap:not(.about-wrap) .article-header, .reading-wrap:not(.about-wrap) .reader-photo, .reading-wrap:not(.about-wrap) .reading-layout, .reading-wrap:not(.about-wrap) .memory-browse, .archive-sky, .archive-tag-popover) { animation: none; transition: none; }
  .archive-entry-art, .archive-entry-orbit, .archive-entry-number::after { transition: none; }
  .archive-entry:is(:hover, :focus-within) .archive-entry-art { transform: none; }
  .archive-entry:is(:hover, :focus-within) .archive-entry-number::after { transform: translateX(-50%); }
}
:root[data-cosmos-motion="still"] .cosmic-theatre :is(.archive-entry-art, .archive-entry-orbit),
:root[data-cosmos-motion="still"] .cosmic-theatre .archive-entry-number::after { transition: none; }
:root[data-cosmos-motion="still"] .cosmic-theatre .archive-entry:is(:hover, :focus-within) .archive-entry-art { transform: none; }
:root[data-cosmos-motion="still"] .cosmic-theatre .archive-entry:is(:hover, :focus-within) .archive-entry-number::after { transform: translateX(-50%); }
@media print {
  .archive-sky, .archive-controls { display: none !important; }
  :root[data-mode] .cosmic-theatre .reading-wrap:not(.about-wrap) .reading-layout > .prose { text-shadow: none; }
}
