/* Eureka · the explorer of the two constellations (tools/explore.mjs, explore.js): one bar with the title, the search and the buttons,
   then the sky, then its words. The sky floats on the page's own day or night, inside a faint line that shows where it ends, and it stops
   at about four fifths of the window so the words below peek in. «Fill the window» lets it take the whole window. */
.explore-main { position: relative; z-index: 1; width: 100%; max-width: var(--site-w); margin: 0 auto; padding: calc(var(--top-h) + 14px) var(--pad) 56px; }
.explore-intro { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 40px; margin: 26px 4px 0; font-size: 16.5px; line-height: 1.65; color: var(--ink-2); text-shadow: 0 0 14px var(--bg); }
.explore-intro p { margin: 0; }
.explore-intro a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- the bar ---------- */
.explore-bar { display: flex; align-items: center; gap: 10px 16px; margin: 0 0 10px; }
.explore-title { flex: 0 1 auto; margin: 0 auto 0 0; font: 600 clamp(22px, 2.2vw, 30px)/1.15 var(--font-display); letter-spacing: -0.03em; white-space: nowrap; }
.explore-find { position: relative; flex: 0 1 340px; min-width: 0; }
.explore-find svg { position: absolute; z-index: 1; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.explore-find input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--glass-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink); font: 400 14.5px/1 var(--font-body); }
.explore-find input::placeholder { color: var(--ink-3); }
.explore-find input:focus { outline: none; border-color: var(--accent); }
.explore-found { position: absolute; left: 0; right: 0; top: 44px; z-index: 5; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--line-2); border-radius: 14px; background: var(--glass-solid); box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.explore-found button { display: flex; width: 100%; align-items: baseline; gap: 10px; padding: 8px 10px; border: 0; border-radius: 9px; background: none; cursor: pointer; text-align: left; }
.explore-found button:hover, .explore-found button[aria-selected="true"] { background: var(--accent-soft); }
.explore-found b { font: 500 14px/1.3 var(--font-body); color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explore-found small { margin-left: auto; flex: none; font: 500 10.5px/1.3 var(--font-mono); color: var(--c); }
.explore-found .none { padding: 8px 10px; font-size: 13.5px; color: var(--ink-3); }
.explore-buttons { display: flex; gap: 8px; flex: none; }
.explore-button { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--glass-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink-2); font: 500 13.5px/1 var(--font-body); cursor: pointer; white-space: nowrap; }
.explore-button:hover { color: var(--ink); border-color: var(--accent); }
.explore-button svg { width: 16px; height: 16px; flex: none; }
#max .shrink, #max[aria-pressed="true"] .grow { display: none; }
#max[aria-pressed="true"] .shrink { display: block; }

/* ---------- the sky ---------- */
.explore-view { position: relative; height: calc(80svh - var(--top-h) - 62px); min-height: 360px; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line); border-radius: 20px; }
.explore-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; opacity: 0; transition: opacity 0.8s ease; }
.explore-view.is-on canvas { opacity: 1; }
.explore-view.is-dragging canvas { cursor: grabbing; }
.explore-view canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 20px; }
.explore-view .sky-labels { z-index: 1; }
.explore-view .sky-label { text-shadow: 0 0 8px var(--bg), 0 0 3px var(--bg); }
/* a family's name sits on its own bright core, in the core's colour: a halo of the page's colour keeps it readable */
.explore-view .sky-label.is-facet { text-shadow: 0 0 3px var(--bg), 0 0 7px var(--bg), 0 0 14px var(--bg), 0 0 22px var(--bg); }

.explore-sides { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.side-name { position: absolute; left: 0; top: 0; opacity: 0; transition: opacity 0.4s ease; white-space: nowrap;
  font: 600 12px/1 var(--font-display); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink); text-shadow: 0 0 12px var(--bg), 0 0 4px var(--bg); }

.explore-card { position: absolute; right: 14px; bottom: 14px; z-index: 3; width: min(330px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow: auto;
  padding: 16px 18px 14px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--glass-solid); box-shadow: var(--shadow); }
.explore-card p { margin: 0; }
.card-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer; }
.card-close:hover { color: var(--ink); background: var(--line); }
.card-facet { padding-right: 28px; font: 600 10px/1.4 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--c); }
.card-name { margin-top: 8px !important; font: 600 18px/1.25 var(--font-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.card-says { margin-top: 6px !important; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.card-near-title { margin-top: 14px !important; font: 500 10.5px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.card-near { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.card-near button { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: none; cursor: pointer;
  font: 500 12.5px/1.2 var(--font-body); color: var(--ink-2); text-align: left; }
.card-near button::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.card-near button:hover { color: var(--ink); border-color: var(--c); }

/* the controls, in the corner the constellations' names never reach */
.explore-how { position: absolute; left: 14px; bottom: 14px; z-index: 2; max-width: calc(100% - 28px); padding: 7px 11px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: var(--ink-3); font: 500 11px/1.55 var(--font-mono); letter-spacing: 0.02em; pointer-events: none; }
.explore-how ul { margin: 0; padding: 0; list-style: none; }
.how-touch { display: none; }
@media (hover: none), (pointer: coarse) { .how-mouse { display: none; } .how-touch { display: block; } }
.explore-none { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; color: var(--ink-2); }
.explore-none[hidden] { display: none; }

/* ---------- filling the window ---------- */
.explore-stage.is-max { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; padding: 12px var(--pad);
  background: radial-gradient(60% 50% at 72% 30%, var(--nebula-1), transparent 70%), radial-gradient(50% 45% at 20% 75%, var(--nebula-2), transparent 70%), linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.explore-stage.is-max .explore-view { flex: 1; height: auto; min-height: 0; }
html.explore-max { overflow: hidden; }
/* the stage is fixed inside the page's column, whose own layer sits under the header and the footer: that layer comes up with it */
html.explore-max .explore-main { z-index: 90; }

@media (max-width: 699px) {
  .explore-main { padding-top: calc(var(--top-h) + 10px); padding-bottom: 40px; }
  .explore-bar { flex-wrap: wrap; gap: 8px; }
  .explore-title { flex-basis: 100%; margin: 0; }
  .explore-find { flex: 1 1 auto; }
  .explore-button { width: 38px; padding: 0; justify-content: center; }
  .explore-button span { display: none; }
  .explore-intro { margin-top: 20px; font-size: 16px; }
  .explore-view { height: calc(80svh - var(--top-h) - 96px); border-radius: 16px; }
  .explore-card { left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 46%; padding: 14px 16px 12px; }
  .explore-view.has-card .explore-how { display: none; }
  .explore-how { left: 10px; bottom: 10px; padding: 6px 9px; font-size: 10px; }
  .explore-found b { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .explore-view canvas, .side-name { transition: none; }
}
