/* The home page with the museum behind it (static/js/museum.js, mode "bg").
   Without WebGL, or with the background switched off, none of this applies:
   every rule is gated on html.bg3d, which the script adds only once it runs. */
#museum-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; display: block; opacity: 0; transition: opacity .6s ease; }
/* The scene only shows once the page has its panels (html.bg3d): text never sits straight on bright scenery while it loads. */
html.bg3d #museum-bg { opacity: 1; }
html.bg3d { background: #120a14; }
html.bg3d body { background: transparent; }

#museum-bg-scrim {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgb(14 8 16 / .62), rgb(14 8 16 / .36) 34%, rgb(14 8 16 / .42) 64%, rgb(14 8 16 / .80));
}

/* The page stays a page: its sections become panels in front of the scenery. They use the theme's own surface colour, mostly opaque, so text keeps its contrast in the light theme as well as the dark one. */
html.bg3d .site-head, html.bg3d .site-foot {
  background: color-mix(in srgb, var(--canvas-background) 84%, transparent);
  border: 1px solid var(--border-subtle); border-radius: 12px;
}
html.bg3d .site-head { margin-top: .75rem; }
html.bg3d .site-foot { margin-bottom: .75rem; }
html.bg3d #tools, html.bg3d .elsewhere {
  background: color-mix(in srgb, var(--canvas-background) 82%, transparent);
  border: 1px solid var(--border-subtle); border-radius: 14px; padding: 1.4rem 1.5rem 1.2rem;
}
/* Keep the opening readable above the optional scene. */
html.bg3d .hero {
  max-width: none; margin-top: 1.5rem; padding: 1.8rem 1.5rem 1.4rem;
  border: 1px solid var(--border-subtle); border-radius: 14px;
  background: color-mix(in srgb, var(--canvas-background) 88%, transparent);
}
html.bg3d #tools, html.bg3d .elsewhere { margin-top: 2rem; }
/* the release card is a panel of its own, opaque so its text keeps full contrast over the scenery */
html.bg3d .release-card { margin-top: 2rem; box-shadow: 0 12px 34px rgb(0 0 0 / .3); }
html.bg3d .section-head { margin-top: 0; }
@media (max-width: 820px) {
  html.bg3d .hero { padding: 1.1rem 1.1rem .9rem; background: color-mix(in srgb, var(--canvas-background) 86%, transparent); }
  html.bg3d #tools, html.bg3d .elsewhere { padding: 1rem 1.1rem; }
}

.bg-line {
  width: min(1100px, calc(100% - 2.5rem)); margin: 0 auto; padding: .65rem 0;
  min-height: 2.7rem;
}
/* With the scenery on, the line is a panel like the rest, so its text keeps its contrast over a bright sky */
html.bg3d .bg-line {
  width: min(1100px - 3rem, calc(100% - 3rem)); margin: .6rem auto 0; padding: .55rem 1rem; min-height: 0; border-radius: 12px;
  background: color-mix(in srgb, var(--canvas-background) 88%, transparent); border: 1px solid var(--border-subtle); color: var(--text-primary);
}
.bg-toggle {
  display: inline-flex; align-items: center; gap: .45rem; margin-left: .35rem;
  font: inherit; color: var(--accent-interactive); background: none;
  border: 1px solid currentColor; border-radius: 999px; padding: .2rem .65rem;
  cursor: pointer;
}
.bg-toggle::before {
  content: ''; width: 1.65rem; height: .9rem; border-radius: 999px;
  background: color-mix(in srgb, currentColor 25%, transparent);
  box-shadow: inset 0 0 0 1px currentColor;
}
.bg-toggle[aria-checked="true"]::before {
  background: var(--accent-interactive);
  box-shadow: inset 0 0 0 1px var(--accent-interactive);
}
.bg-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* in the light theme the panels are nearly opaque, so the text is easy to read */
html.bg3d[data-theme="light"] .site-head, html.bg3d[data-theme="light"] .site-foot,
html.bg3d[data-theme="light"] #tools, html.bg3d[data-theme="light"] .elsewhere {
  background: color-mix(in srgb, var(--canvas-background) 93%, transparent);
}
html.bg3d[data-theme="light"] .hero {
  background: color-mix(in srgb, var(--canvas-background) 94%, transparent);
}

/* going in: the page fades out as the camera moves through the door */
html.museum-diving main, html.museum-diving .site-head, html.museum-diving .site-foot { opacity: 0; pointer-events: none; transition: opacity .5s ease; }
html.museum-diving body { cursor: progress; }

/* Display options stay readable and reachable in every state of the scenery: loading, ready, off, failed. */
.home-display { position: relative; z-index: 1; }
html[data-background-requested="on"] .home-display, html.bg3d .home-display {
  padding: .65rem 1rem; border-radius: 12px; color: var(--text-primary);
  background: color-mix(in srgb, var(--canvas-background) 92%, transparent); border: 1px solid var(--border-subtle);
}
html[data-background-requested="on"] .home-display summary, html.bg3d .home-display summary { color: var(--text-primary); font-weight: 600; }
html[data-background-requested="on"] .home-display .bg-line, html.bg3d .home-display .bg-line { background: none; border: 0; width: auto; margin: .6rem 0 0; padding: 0; color: var(--text-primary); }
@media (prefers-reduced-motion: reduce) { #museum-bg { transition: none; } }
