/* Star atlas — the sky is the archive.
 *
 * One set of links, two readings. Unstyled, or with .is-list, they are a plain
 * list grouped by constellation. Otherwise each link is a star placed by its
 * chart coordinates (--x, --y: pole at the origin, y up, radius 1), and the
 * chart is drawn from its pole with --S pixels to the unit.
 *
 * .atlas--plate is a still plate that needs no script. .atlas.is-live is the
 * same chart handed to atlas.js, which moves it with the camera.
 *
 * Contents: tokens · list · chart · stars · card · plate · live · mini
 */
:root { --star: #efe2bf; --star-line: rgba(239, 226, 191, .30); --noise: #98a1b5; --tide: #6fd0e6; }
html[data-theme="day"] { --star: #1d3566; --star-line: rgba(29, 53, 102, .36); --noise: #6f7684; --tide: #2e8fa8; }

/* List --------------------------------------------------------------------- */
.atlas { position: relative; }
.atlas__lines { display: none; }
.atlas__chart { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 56px 48px; align-items: start; }
.atlas-group__name { margin: 0; font: 400 clamp(26px, 2.6vw, 34px)/1.2 var(--serif); letter-spacing: .04em; }
html[lang^="en"] .atlas-group__name { letter-spacing: 0; }
.atlas-group__name a { display: inline-flex; align-items: baseline; gap: 14px; color: var(--ink); }
.atlas-group__name small { color: var(--ink-faint); font: 400 13px/1 var(--sans); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.atlas-group__name a:hover span { color: var(--star); }
.atlas-group__line { max-width: 30em; margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.8; }
.atlas-group__stars { margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.atlas-star { display: block; padding: 13px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.atlas-star__dot { display: none; }
.atlas-star__text { display: grid; grid-template-columns: 6.4em 1fr auto; gap: 14px; align-items: baseline; }
.atlas-star__text time, .atlas-star__text em { color: var(--ink-faint); font: 400 12px/1.6 var(--sans); font-style: normal; letter-spacing: .03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.atlas-star__text b { font: 400 16px/1.55 var(--serif); letter-spacing: .02em; transition: color .2s ease; }
.atlas-star:hover b, .atlas-star:focus-visible b { color: var(--star); }

/* Chart -------------------------------------------------------------------- */
.atlas:not(.is-list) .atlas__sky { position: relative; container-type: inline-size; }
.atlas:not(.is-list) .atlas__chart { display: block; position: absolute; width: 0; height: 0; --S: 46cqi; }
.atlas:not(.is-list) .atlas__lines { display: block; position: absolute; left: calc(var(--S) * -1); top: calc(var(--S) * -1.12); width: calc(var(--S) * 2); height: calc(var(--S) * 1.12); max-width: none; overflow: visible; pointer-events: none; }
.atlas__lines polyline { fill: none; stroke: var(--star-line); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; transition: opacity .5s ease; }
.atlas__lines polyline.is-dim { opacity: .28; }
.atlas:not(.is-list) .atlas-group { display: contents; }
.atlas:not(.is-list) .atlas-group__line, .atlas:not(.is-list) .atlas-group__stars { margin: 0; border: 0; }
.atlas:not(.is-list) .atlas-group__line { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.atlas:not(.is-list) .atlas-group__stars li { display: contents; }
.atlas:not(.is-list) .atlas-group__name { position: absolute; left: calc(var(--x) * var(--S)); top: calc(var(--y) * var(--S) * -1); width: max-content; font-size: clamp(15px, 1.5cqi, 21px); letter-spacing: .12em; transform: translate(-50%, -50%) rotate(var(--upright, 0deg)); }
html[lang^="en"] .atlas:not(.is-list) .atlas-group__name { font: italic 500 clamp(17px, 1.7cqi, 24px)/1.2 var(--display-serif); letter-spacing: .01em; }
.atlas:not(.is-list) .atlas-group__name a { gap: 10px; color: var(--ink-soft); }
.atlas:not(.is-list) .atlas-group__name small { font-size: 11px; }
.atlas-group.is-dim .atlas-group__name, .atlas-group.is-dim .atlas-star { opacity: .34; }

/* Stars -------------------------------------------------------------------- */
.atlas:not(.is-list) .atlas-star { position: absolute; left: calc(var(--x) * var(--S)); top: calc(var(--y) * var(--S) * -1); display: grid; place-items: center; width: 30px; height: 30px; margin: -15px 0 0 -15px; padding: 0; border: 0; border-radius: 50%; }
.atlas:not(.is-list) .atlas-star__dot { display: block; width: calc(3px + var(--mag) * 4px); height: calc(3px + var(--mag) * 4px); border-radius: 50%; background: var(--star); box-shadow: 0 0 calc(5px + var(--mag) * 9px) color-mix(in srgb, var(--star) 70%, transparent); transition: transform .3s var(--motion-ease), box-shadow .3s ease; }
html[data-theme="day"] .atlas:not(.is-list) .atlas-star__dot { box-shadow: none; }
.atlas:not(.is-list) .atlas-star.is-tip .atlas-star__dot { width: 8px; height: 8px; }
.atlas:not(.is-list) .atlas-star:hover .atlas-star__dot, .atlas:not(.is-list) .atlas-star:focus-visible .atlas-star__dot, .atlas:not(.is-list) .atlas-star.is-held .atlas-star__dot { transform: scale(1.9); box-shadow: 0 0 22px var(--star); }
.atlas:not(.is-list) .atlas-star:focus-visible { outline: 1px solid var(--star); outline-offset: 2px; }
/* A star keeps its name to itself until it is asked; the newest on each route always shows. */
.atlas:not(.is-list) .atlas-star__text { position: absolute; left: 50%; top: 50%; display: block; width: max-content; max-width: min(22em, 46cqi); padding: 0; opacity: 0; pointer-events: none; transform: rotate(var(--upright, 0deg)) translate(16px, -50%); transform-origin: 0 0; transition: opacity .25s ease; }
.atlas:not(.is-list) .atlas-star__text time, .atlas:not(.is-list) .atlas-star__text em { display: none; }
.atlas:not(.is-list) .atlas-star__text b { display: block; overflow: hidden; color: var(--ink); font-size: 14px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 14px var(--bg), 0 0 3px var(--bg); }
.atlas:not(.is-list) .atlas-star.is-tip .atlas-star__text, .atlas:not(.is-list) .atlas-star:hover .atlas-star__text, .atlas:not(.is-list) .atlas-star:focus-visible .atlas-star__text { opacity: 1; }
.atlas:not(.is-list) .atlas-star.is-left .atlas-star__text { transform: rotate(var(--upright, 0deg)) translate(calc(-100% - 16px), -50%); }
.atlas:not(.is-list) .atlas-star:hover, .atlas:not(.is-list) .atlas-star:focus-visible { z-index: 3; }

/* Plate: a still chart, pole at the bottom centre --------------------------- */
.atlas:not(.is-live):not(.is-list) .atlas__sky { container-type: size; aspect-ratio: 2 / 1.1; max-height: min(66vh, 620px); margin-inline: auto; }
.atlas:not(.is-live):not(.is-list) .atlas__chart { left: 50%; bottom: 3%; --S: min(40cqi, 86cqb); }

/* Mini: one route, one star marked ------------------------------------------ */
.atlas-mini { display: block; width: auto; height: 100%; aspect-ratio: var(--ratio, 1); overflow: visible; }
.atlas-mini polyline { fill: none; stroke: var(--star-line); vector-effect: non-scaling-stroke; stroke-width: 1px; stroke-linejoin: round; }
.atlas-mini__star { fill: var(--ink-faint); }
.atlas-mini__halo { fill: none; stroke: var(--star); stroke-width: 1px; vector-effect: non-scaling-stroke; opacity: .6; }
.atlas-mini .is-current .atlas-mini__star { fill: var(--star); }

/* On a still plate a route's name stands outside its stars, not over them, and
   leaves the counting to the filter beside it. */
.atlas:not(.is-live):not(.is-list) .atlas-group__name small { display: none; }
.atlas:not(.is-live):not(.is-list) .atlas-group__name:not([data-side="top"]) { max-width: 6.5em; }
.atlas:not(.is-live):not(.is-list) .atlas-group__name[data-side="left"] { text-align: right; }
.atlas:not(.is-live):not(.is-list) .atlas-group__name[data-side="right"] { transform: translate(8px, -50%); }
.atlas:not(.is-live):not(.is-list) .atlas-group__name[data-side="left"] { transform: translate(calc(-100% - 8px), -50%); }
.atlas:not(.is-live):not(.is-list) .atlas-group__name[data-side="top"] { transform: translate(-50%, -110%); }
/* On a still plate a star keeps its name until it is asked; only the routes are named. */
.atlas:not(.is-live):not(.is-list) .atlas-star.is-tip:not(:hover):not(:focus-visible) .atlas-star__text { opacity: 0; }

/* Small plates: a picture of the sky, with the list below doing the work -------- */
@media (max-width: 700px) {
  .atlas:not(.is-live):not(.is-list) { overflow: clip; }
  .atlas:not(.is-live):not(.is-list) .atlas-star { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
  .atlas:not(.is-live):not(.is-list) .atlas-star .atlas-star__text { display: none; }
  .atlas:not(.is-live):not(.is-list) .atlas-group__name { display: none; }
}
