/* =====================================================================
   home — the star map
   ===================================================================== */

.home-body {
  overflow: hidden;
  background: #06070d;
  color: #f2f0ea;
  --home-ink: #f2f0ea;
  --home-muted: #9d9bb0;
  --home-faint: #6d6a82;
  --home-line: rgba(180, 178, 210, 0.18);
  --home-panel: rgba(12, 12, 20, 0.72);
  --home-panel-strong: #0a0b12;
  --home-accent: #b9c9ff;
}

.home-body a {
  color: inherit;
}

#star-map {
  position: fixed;
  inset: 0;
  z-index: 0;
  touch-action: none;
}

#star-map canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.star-loading {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #06070d;
  color: var(--home-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.star-loading.is-done {
  opacity: 0;
  visibility: hidden;
}

.home-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.home-overlay > * {
  pointer-events: auto;
}

/* ------------------------------ header ------------------------------ */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2.4vw, 1.8rem) clamp(1.1rem, 3.4vw, 2.6rem);
  background: linear-gradient(to bottom, rgba(5, 6, 12, 0.82), transparent);
  pointer-events: none;
}

.home-header > * {
  pointer-events: auto;
}

.home-brand {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.home-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.home-action {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  height: 34px;
  padding: 0 0.35rem;
  color: #a9a6bf;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.home-action:hover {
  color: #fff;
}

.home-action svg {
  width: 14px;
  height: 14px;
}

/* --------------------------- instructions --------------------------- */
.home-instructions {
  position: absolute;
  left: clamp(1.1rem, 3.4vw, 2.6rem);
  bottom: clamp(1.1rem, 3vw, 1.8rem);
  width: min(34ch, calc(100vw - 2.2rem));
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: #8c89a2;
  pointer-events: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------- shared with the not-found page ------------------ */
.home-kicker {
  margin: 0 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #8d8aa6;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dfe5ff;
  border-bottom: 1px solid rgba(185, 201, 255, 0.28);
  padding-bottom: 0.28rem;
  transition: gap 0.2s ease, border-color 0.2s ease;
}

.home-cta:hover {
  gap: 0.85rem;
  border-color: #dfe5ff;
}

.home-cta span {
  font-size: 0.9rem;
}

/* ------------------------------ tooltip ----------------------------- */
.star-tooltip {
  position: fixed;
  z-index: 30;
  width: max-content;
  max-width: 270px;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(190, 200, 255, 0.2);
  border-radius: 9px;
  background: #0a0b14;
  pointer-events: none;
  transform: translate(14px, 14px);
  animation: fade-in 0.12s ease;
}

.star-tooltip[hidden] {
  display: none;
}

.star-tooltip-kind {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7d7a97;
  margin-bottom: 0.2rem;
}

.star-tooltip-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.star-tooltip-meta {
  margin-top: 0.24rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: #9b98b1;
}

.star-tooltip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.24rem;
  margin-top: 0.42rem;
}

.star-tooltip-tags span {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  color: #a9b6dd;
  border: 1px solid rgba(169, 182, 221, 0.2);
  border-radius: 999px;
  padding: 0.02rem 0.36rem;
}

/* ------------------------------ search ------------------------------ */
.home-search {
  position: fixed;
  z-index: 50;
  top: clamp(4.2rem, 9vh, 6rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 2rem));
}

.home-search[hidden] {
  display: none;
}

.home-search-box {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(190, 200, 255, 0.22);
  border-radius: 12px;
  background: var(--home-panel-strong);
}

.home-search-box svg {
  width: 18px;
  height: 18px;
  color: #85829d;
  flex: none;
}

.home-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: #fff;
  font-size: 1rem;
}

.home-search-input::placeholder {
  color: #6f6c86;
}

.home-search-close {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: #85829d;
  border: 1px solid rgba(190, 200, 255, 0.16);
  border-radius: 4px;
  padding: 0.16rem 0.4rem;
}

.home-search-results {
  margin-top: 0.45rem;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  border: 1px solid rgba(190, 200, 255, 0.16);
  border-radius: 10px;
  background: var(--home-panel-strong);
}

.home-search-results:empty {
  display: none;
}

.home-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(190, 200, 255, 0.08);
  color: #d8d6e6;
  font-size: 0.85rem;
}

.home-result:last-child {
  border-bottom: 0;
}

.home-result:hover,
.home-result[aria-selected="true"] {
  background: rgba(185, 201, 255, 0.1);
  color: #fff;
}

.home-result small {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #75728c;
}

.home-result-empty {
  padding: 1rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: #75728c;
}

/* ------------------------------ list -------------------------------- */
.home-list {
  position: fixed;
  z-index: 45;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--home-panel-strong);
  border-left: 1px solid rgba(190, 200, 255, 0.16);
  animation: panel-in 0.3s var(--ease);
}

.home-list[hidden] {
  display: none;
}

@keyframes panel-in {
  from { transform: translateX(100%); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

.home-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.25rem 0.9rem;
  border-bottom: 1px solid rgba(190, 200, 255, 0.12);
}

.home-list-header h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a9a6bf;
}

.home-list-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(190, 200, 255, 0.16);
  color: #a9a6bf;
  font-size: 1.1rem;
  line-height: 1;
}

.home-list-close:hover {
  color: #fff;
  background: rgba(185, 201, 255, 0.1);
}

.home-list-sections {
  overflow-y: auto;
  padding: 0.8rem 1.25rem 2rem;
}

.home-list-sections section {
  margin-bottom: 1.5rem;
}

.home-list-sections h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8c89a2;
}

.home-list-sections h3 small {
  margin-left: auto;
  color: #5f5c72;
  font-size: 0.56rem;
  letter-spacing: 0.04em;
}

.home-list-sections ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-list-sections li {
  border-bottom: 1px solid rgba(190, 200, 255, 0.06);
}

.home-list-sections li a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.4rem 0.1rem;
  color: #cbc9da;
  font-size: 0.82rem;
  line-height: 1.35;
}

.home-list-sections li a:hover {
  color: #fff;
  padding-left: 0.35rem;
}

.home-list-sections li small {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  color: #66637a;
}

/* ------------------------------ error ------------------------------- */
.star-error {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.4rem;
  padding: 2rem;
  background: rgba(6, 7, 13, 0.94);
  text-align: center;
}

.star-error[hidden] {
  display: none;
}

.star-error h2 {
  margin: 0;
  color: #fff;
}

.star-error p {
  max-width: 42ch;
  color: #9b98b1;
}

.star-error .home-action {
  margin-top: 0.8rem;
  height: 38px;
  padding: 0 1rem;
}

/* ------------------------------ labels ------------------------------ */
.star-label {
  position: fixed;
  z-index: 12;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(210, 214, 245, 0.55);
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.star-label.is-section {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  color: rgba(226, 230, 255, 0.78);
}

.star-label.is-genre {
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  color: rgba(180, 200, 235, 0.34);
}

.star-label.is-hidden {
  opacity: 0;
}

/* ------------------------------ responsive -------------------------- */
@media (max-width: 760px) {
  .home-nav .home-action {
    width: auto;
    padding: 0 0.3rem;
    justify-content: center;
  }

  .home-nav .home-action[data-home-action="search"] {
    width: 34px;
    padding: 0;
  }

  .home-nav .home-action[data-home-action="search"] span {
    display: none;
  }

  .home-header {
    padding-top: 0.9rem;
  }
}
