/* ============================================
   COSMOLOGY — /ourotheia/cosmology.css
   Two-panel: orrery (left) + sidebar (right)
   ============================================ */

/* ----------------------------------------
   BASE
   ---------------------------------------- */
html:has(.o-cosmology) {
  overflow: hidden;
}

.o-cosmology {
  color: var(--o-text);
  font-family: var(--o-font-body);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Kill cursor trail */
.o-cosmology .cursor-trail,
.o-cosmology #cursorCanvas,
body:has(.o-cosmology) > canvas:not(#cosmosCanvas) {
  display: none !important;
}


/* ----------------------------------------
   BACKGROUND — bruised sunset fog
   ---------------------------------------- */
.o-cosmology::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 25% 40%, rgba(138,94,122,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 60%, rgba(184,152,96,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(42,26,50,0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 20%, rgba(220,80,80,0.05) 0%, transparent 40%),
    url('/assets/images/backgrounds/blackstars.png') repeat,
    var(--o-void);
  animation: cosmo-fog-drift 30s ease-in-out infinite alternate;
}

@keyframes cosmo-fog-drift {
  0% {
    background-position: 0% 0%, 100% 100%, 50% 50%, 60% 20%;
  }
  50% {
    background-position: 10% 20%, 80% 70%, 40% 60%, 70% 30%;
  }
  100% {
    background-position: 20% 10%, 90% 80%, 60% 40%, 50% 40%;
  }
}

.o-cosmology > * {
  position: relative;
  z-index: 1;
}


/* ----------------------------------------
   TITLE
   ---------------------------------------- */
.o-cosmo-title {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  font-family: 'Starstruck';
  font-size: 2rem;
  letter-spacing: 0.2em;
  color: var(--o-gold-light);
  pointer-events: none;
  text-shadow:
    0 0 10px rgba(8,6,16,1),
    0 0 30px rgba(8,6,16,1),
    0 0 4px var(--o-gold-dark),
    0 0 12px var(--o-glow-gold);
}


/* ----------------------------------------
   LAYOUT — two panels
   ---------------------------------------- */
.cosmo-layout {
  display: flex;
  gap: 1.5rem;
  padding: 3.5rem 2rem 2rem;
  height: 100vh;
  box-sizing: border-box;
}


/* ----------------------------------------
   ORRERY CONTAINER (left)
   ---------------------------------------- */
.cosmo-orrery-wrap {
  flex: 1 1 60%;
  position: relative;
  min-width: 0;
  background: #000 url('/assets/images/backgrounds/stars.gif') repeat center center;
  background-size: auto;
  overflow: hidden;
}

#cosmosCanvas {
  display: block;
  width: 100%;
  height: 100%;
}


/* ----------------------------------------
   SIDEBAR (right)
   ---------------------------------------- */
.cosmo-sidebar {
  flex: 0 0 36%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  background: rgba(8, 6, 16, 0.92);
  overflow: hidden;
  position: relative;
}

.cosmo-sidebar-inner {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--o-bruise-light) rgba(8,6,16,0.3);
}

.cosmo-sidebar-inner::-webkit-scrollbar {
  width: 5px;
}

.cosmo-sidebar-inner::-webkit-scrollbar-track {
  background: rgba(8,6,16,0.3);
}

.cosmo-sidebar-inner::-webkit-scrollbar-thumb {
  background: var(--o-bruise-light);
  border-radius: 3px;
}

.cosmo-sidebar-inner::-webkit-scrollbar-thumb:hover {
  background: var(--o-mauve-deep);
}


/* ----------------------------------------
   SIDEBAR — back button
   ---------------------------------------- */
.cosmo-back-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  z-index: 10;
  background: none;
  border: none;
  font-family: 'Magician';
  font-size: 0.95rem;
  color: var(--o-text-faint);
  cursor: pointer;
  padding: 0.2em 0.5em;
  transition: color 200ms ease;
  display: none;
}

.cosmo-back-btn.visible {
  display: block;
}

.cosmo-back-btn:hover {
  color: var(--o-mauve-light);
}


/* ----------------------------------------
   SIDEBAR — default state (no selection)
   ---------------------------------------- */
.cosmo-default {
  transition: opacity 300ms ease;
}

.cosmo-default.hidden {
  display: none;
}

.cosmo-default-title {
  font-family: 'Starstruck';
  font-size: 1.4rem;
  color: var(--o-gold-light);
  letter-spacing: 0.1em;
  margin-bottom: 0.3em;
}

.cosmo-default-intro {
  font-size: 0.88rem;
  font-family: 'darkage';
  color: var(--o-text-dim);
  line-height: 1.65;
  letter-spacing: 0.0002em;
  margin-bottom: 1.5em;
}

.cosmo-default-nav-title {
  font-family: 'Quadrata';
  font-size: 2.5rem;
  color: var(--o-seaglass-light);
  letter-spacing: 0.008em;
  margin-bottom: 0.3em;
}

.cosmo-default-nav-text {
  font-size: 0.85rem;
  font-family: 'darkage';
  color: var(--o-text-faint);
  font-style: italic;
  line-height: 1.6;
  letter-spacing: 0.0002em;
}


/* ----------------------------------------
   SIDEBAR — node detail state
   ---------------------------------------- */
.cosmo-detail {
  display: none;
  transition: opacity 300ms ease;
}

.cosmo-detail.visible {
  display: block;
}

.cosmo-panel-name {
  font-family: 'Starstruck';
  font-size: 1.5rem;
  color: var(--o-gold-light);
  margin-bottom: 0.15em;
}

.cosmo-panel-subtitle {
  font-family: 'kingjola';
  font-size: 2.5rem;
  color: var(--o-text-faint);
  margin-bottom: 0.3em;
  letter-spacing: 0.0008em;
}

.cosmo-panel-body {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--o-text);
}

.cosmo-panel-body h3 {
  font-family: 'Quadrata';
  font-size: 2.5rem;
  letter-spacing: 0.008em;
  color: var(--o-mauve-light);
  margin: 1.2em 0 0.2em;
}

.cosmo-panel-body p {
  margin: 0 0 0.8em;
  font-family: 'darkage';
  letter-spacing: 0.0002em;
  font-size: .85rem;
}

.cosmo-panel-body a {
  color: var(--o-seaglass-light);
  text-decoration: none;
  transition: color 200ms ease, text-shadow 400ms ease;
}

.cosmo-panel-body a:hover {
  color: var(--o-seaglass-pale);
  text-shadow: 0 0 8px var(--o-glow-seaglass);
}

/* Collapsible sub-sections */
.cosmo-section-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--o-font-display);
  font-size: 0.95rem;
  color: var(--o-mauve);
  padding: 0.6em 0;
  cursor: pointer;
  transition: color 200ms ease;
}

.cosmo-section-toggle:hover {
  color: var(--o-gold-light);
}

.cosmo-section-toggle::before {
  content: '▸ ';
  display: inline-block;
}

.cosmo-section-toggle.open::before {
  content: '▾ ';
}

.cosmo-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease;
}

.cosmo-section-content.open {
  max-height: 2000px;
}


/* ----------------------------------------
   DIVIDERS (image-based)
   ---------------------------------------- */
.cosmo-divider {
  border: none;
  background: none;
  height: 25px;
  width: 80%;
  margin: 0.8rem auto;
  background-image: url('/assets/images/borders/moonandsundiv.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.7;
}

.cosmo-divider--sm {
  height: 18px;
  width: 50%;
  opacity: 0.5;
}


/* ----------------------------------------
   TAGS — sunset gradient text
   ---------------------------------------- */
.cosmo-panel-tags {
  margin-top: 1em;
}

.cosmo-panel-tags .tag {
  background: transparent;
  border: 1px solid var(--o-border);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-image: linear-gradient(
    90deg,
    #d4b878 0%,
    #fca5a5 30%,
    #f472b6 60%,
    #c084fc 100%
  );
  font-family: var(--o-font-mono);
  font-size: 0.72rem;
  padding: 0.15em 0.55em;
  margin: 0.15em 0.2em;
  display: inline-block;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 200ms ease, box-shadow 300ms ease;
}

.cosmo-panel-tags .tag:hover {
  border-color: var(--o-gold);
  box-shadow: 0 0 6px var(--o-glow-gold);
}


/* ----------------------------------------
   BACK LINK (page-level)
   ---------------------------------------- */
.o-cosmo-back {
  position: fixed;
  bottom: 0.5rem;
  left: 2rem;
  z-index: 50;
  font-family: var(--o-font-mono);
  font-size: 0.75rem;
  color: var(--o-text-faint);
  text-decoration: none;
  transition: color 200ms ease;
}

.o-cosmo-back:hover {
  color: var(--o-mauve);
}


/* ----------------------------------------
   VIGNETTE
   ---------------------------------------- */
.o-cosmology .o-vignette {
  z-index: 30;
}


/* ----------------------------------------
   RESPONSIVE
   ---------------------------------------- */
@media (max-width: 800px) {
  .cosmo-layout {
    flex-direction: column;
    padding: 3rem 1rem 1rem;
  }

  .cosmo-orrery-wrap {
    flex: 0 0 50vh;
  }

  .cosmo-sidebar {
    flex: 1;
    max-width: 100%;
  }
}