/* Public footers become narrow, independently scrollable information rails. */
:root[data-mode] .cosmic-theatre.is-home { --home-rail-width: 78px; }
:root[data-mode] .cosmic-theatre.is-home .site-stage { padding-left: var(--home-rail-width); }
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer {
  position: fixed;
  z-index: 30;
  isolation: isolate;
  top: var(--theatre-header-clearance);
  bottom: 0;
  left: 0;
  display: block;
  width: var(--home-rail-width);
  max-width: none;
  height: auto;
  margin: 0;
  padding: 18px 5px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-right: 1px solid var(--cosmic-canvas-line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--theatre-veil) 94%, transparent), color-mix(in srgb, var(--theatre-veil) 76%, transparent));
  pointer-events: auto;
}
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .theatre-podium { display: none; }
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer-brand {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font: 12px/1.3 var(--sans);
}
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer-meta {
  display: flex;
  flex-flow: row nowrap;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .home-footer-info,
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer-record {
  display: flex;
  flex: 1 1 0;
  flex-flow: column nowrap;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  min-width: 0;
}
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer nav,
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer-record {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  text-align: left;
}
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer :is(nav a, .site-footer-record > a, .planet-texture-credit) {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: 1.35;
  letter-spacing: 0;
}
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .planet-texture-credit { display: block; margin: 0; }
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .planet-texture-credit a { display: inline; min-height: 0; }
:root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer-record-divider { display: none; }

/* The information rail is available on every screen without reserving space. */
:root[data-mode] .cosmic-theatre.has-home-rail-toggle { --home-rail-width: 0px; }
:root[data-mode] .cosmic-theatre.has-home-rail-toggle .site-footer {
  width: 78px;
  transform: translateX(-100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform .25s ease, visibility 0s linear .25s;
}
:root[data-mode] .cosmic-theatre.has-home-rail-toggle.home-rail-open .site-footer {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform .25s ease;
}
:root[data-mode] .cosmic-theatre.has-home-rail-toggle > .home-rail-toggle {
  position: fixed;
  z-index: 31;
  top: 50%;
  left: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--theatre-light) 30%, transparent);
  border-radius: 50%;
  color: var(--cosmic-canvas-ink);
  background: color-mix(in srgb, var(--theatre-veil) 92%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--theatre-light) 20%, transparent);
  font: 20px/1 var(--sans);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: left .25s ease, transform .25s ease, border-color .2s ease, background-color .2s ease;
}
:root[data-mode] .cosmic-theatre.has-home-rail-toggle > .home-rail-toggle > span { transform: translateX(10px); transition: transform .25s ease; }
:root[data-mode] .cosmic-theatre.has-home-rail-toggle.home-rail-open > .home-rail-toggle { left: 78px; transform: translate(0, -50%); }
:root[data-mode] .cosmic-theatre.has-home-rail-toggle.home-rail-open > .home-rail-toggle > span { transform: none; }
:root[data-mode] .cosmic-theatre.has-home-rail-toggle > .home-rail-toggle:hover {
  border-color: var(--theatre-light);
  background: color-mix(in srgb, var(--theatre-light) 12%, var(--theatre-veil));
}
.home-rail-toggle:focus-visible { outline: 2px solid var(--theatre-light); outline-offset: 2px; }

/* A single timed curtain carries the original galaxy across the page. */
.scroll-passage {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  touch-action: none;
}
.scroll-passage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--passage-base);
  background-image: var(--passage-art);
  background-size: 175% 155%, 155% 145%, 155% 145%, 160% 160%, 100% 100%;
  background-repeat: no-repeat;
  transform: translateX(-100%);
  animation: deck-passage-cover .38s ease-in-out both, galaxy-passage .44s ease-in-out both;
  will-change: transform, background-position;
}
@keyframes deck-passage-cover { to { transform: translateX(0); } }

@media (max-width: 900px) {
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer { padding-top: 14px; }
}
@media (max-width: 600px) {
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer :is(nav a, .site-footer-record > a, .planet-texture-credit) {
    font-size: 13px;
    text-orientation: mixed;
  }
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer-brand { font-size: 13px; text-orientation: mixed; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-passage::before { animation-duration: .01ms !important; }
  .has-home-rail-toggle :is(.site-footer, .home-rail-toggle, .home-rail-toggle > span) { transition-duration: .01ms !important; }
}
@media print {
  .scroll-passage, .home-rail-toggle { display: none !important; }
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-stage { padding-left: 0; }
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer { position: static; width: 100%; height: auto; display: block; overflow: visible; }
  :root[data-mode] .cosmic-theatre.has-home-rail-toggle .site-footer { width: 100%; transform: none; visibility: visible; }
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer :is(.site-footer-brand, .site-footer-meta, .home-footer-info, nav, .site-footer-record) { display: block; writing-mode: horizontal-tb; }
  :root[data-mode] .cosmic-theatre:is(.is-home, .has-home-rail-toggle) .site-footer :is(nav a, .site-footer-record > a, .planet-texture-credit) { display: inline; writing-mode: horizontal-tb; text-orientation: mixed; }
}
