/* 365Wiki 3D 12-Galaxy Homepage Viewport (Fits Top + Cosmos + Footer cleanly in 100vh) */
body.wiki-page:has(.wiki-home-cosmos) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.wiki-main.wiki-home-cosmos {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  flex: 1 1 0;
  min-height: 280px;
  height: auto;
  background: #020305;
  overflow: hidden;
  user-select: none;
}

@media (max-height: 580px) {
  body.wiki-page:has(.wiki-home-cosmos) {
    height: auto;
    max-height: none;
    overflow: auto;
  }
  .wiki-main.wiki-home-cosmos {
    min-height: 420px;
  }
}

#cosmos-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: none;
  cursor: crosshair;
}

#cosmos-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(2, 3, 5, 0.72) 0%,
    rgba(2, 3, 5, 0) 8%,
    rgba(2, 3, 5, 0) 92%,
    rgba(2, 3, 5, 0.78) 100%
  );
}

#webgl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Minimal Centered Icon-Only Dock: [Back] [Search] [i] */
.cosmos-center-dock {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
}

:is(.cosmos-center-dock, .wiki-galaxy-page-toolbar) .wiki-agent-gate {
  margin: 0;
}

:is(.cosmos-center-dock, .wiki-galaxy-page-toolbar) .wiki-agent-open {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  justify-content: center;
  background: rgba(10, 14, 22, 0.82);
  border: 1px solid #28313f;
  color: #cbd5e1;
  backdrop-filter: blur(8px);
  border-radius: 50%;
}

:is(.cosmos-center-dock, .wiki-galaxy-page-toolbar) .wiki-agent-open > span:not(.wiki-agent-open__icon),
:is(.cosmos-center-dock, .wiki-galaxy-page-toolbar) .wiki-agent-open kbd {
  display: none;
}

:is(.cosmos-center-dock, .wiki-galaxy-page-toolbar) .wiki-agent-open:hover,
:is(.cosmos-center-dock, .wiki-galaxy-page-toolbar) .wiki-agent-open:focus-visible {
  border-color: #0066ff;
  background: #131b29;
  color: #ffffff;
}

.btn-cosmos-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(10, 14, 22, 0.82);
  border: 1px solid #28313f;
  border-radius: 50%;
  color: #cbd5e1;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}

.btn-cosmos-back.visible {
  display: inline-flex;
}

.btn-cosmos-back:hover, .btn-cosmos-back:focus-visible {
  border-color: #0066ff;
  background: #131b29;
  color: #ffffff;
}

.wiki-galaxy-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* Minimal Icon 'i' Button */
.cosmos-center-info {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #28313f;
  background: rgba(10, 14, 22, 0.82);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", Georgia, serif;
  font-size: 0.88rem;
  font-style: italic;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}

.cosmos-center-info:hover {
  border-color: #0066ff;
  color: #ffffff;
  background: #131b29;
}

.cosmos-center-info__tip {
  position: absolute;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 320px;
  padding: 8px 12px;
  background: rgba(9, 12, 17, 0.96);
  border: 1px solid #28313f;
  border-radius: 2px;
  color: #cbd5e1;
  font-style: normal;
  font-size: 0.74rem;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.cosmos-center-info:hover .cosmos-center-info__tip,
.cosmos-center-info:focus-visible .cosmos-center-info__tip {
  opacity: 1;
}

.wiki-galaxy-page-toolbar .cosmos-center-info__tip {
  left: 0;
  transform: none;
  max-width: min(320px, calc(100vw - 136px));
}

/* Hover Tooltip (Shown only on hover) */
#hover-tooltip {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -125%);
  background: rgba(9, 12, 17, 0.94);
  border: 1px solid #28313f;
  border-radius: 2px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: #f1f5f9;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

#hover-tooltip b {
  color: #38bdf8;
  margin-right: 6px;
}

/* Focused Star Direct-Action Card */
#focus-action-badge {
  position: absolute;
  z-index: 35;
  display: none;
  transform: translate(-50%, -130%);
  pointer-events: auto;
  text-decoration: none;
  background: rgba(9, 12, 17, 0.96);
  border: 1px solid #0066ff;
  border-radius: 2px;
  padding: 10px 16px;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.95), 0 0 24px rgba(0, 102, 255, 0.35);
  backdrop-filter: blur(14px);
}

#focus-action-badge:hover {
  border-color: #38bdf8;
}

.badge-eyebrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.badge-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-ext-icon {
  font-size: 0.68rem;
  color: #38bdf8;
  opacity: 0.85;
}

.badge-product {
  color: #38bdf8;
  font-weight: 700;
}

.badge-date {
  color: #64748b;
}

.badge-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.4;
}

/* Minimal Centered Article Counter inline on the same single row */
.wiki-home-stats.cosmos-home-counter {
  display: inline-flex;
  align-items: center;
  height: 36px;
  margin: 0;
  min-height: 36px;
  padding: 0 14px;
  background: rgba(10, 14, 22, 0.82);
  border: 1px solid #28313f;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.76rem;
  color: #cbd5e1;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
}

.wiki-home-stats.cosmos-home-counter:empty {
  display: none;
}

.wiki-home-stats.cosmos-home-counter .wiki-article-count {
  font-size: 0.76rem;
  color: #cbd5e1;
}

/* Empty Channel Subtle Pill */
#channel-empty-pill {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  background: rgba(9, 12, 17, 0.86);
  border: 1px solid #28313f;
  border-radius: 2px;
  padding: 6px 14px;
  font-size: 0.76rem;
  color: #94a3b8;
  pointer-events: none;
}

/* Star map loading and availability */
.cosmos-webgl-fallback {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  text-align: center;
  color: #b8c3d4;
  font-size: 0.875rem;
}

.cosmos-webgl-fallback:has(.cosmos-status-no-script) #cosmos-status-text {
  display: none;
}
