/* CRT effect on the page background and the section photos, plus the page-wide power-on / page switch.
   Loaded after style.css. The effect itself and all its tunable values live in crt.js. */

/* The background picture now lives in #bg-layer (below), so the whole page, background included,
   can be animated as one piece. The body itself is plain black. */
body[class] { background-image: none; background-color: #000; }

/* Background layer: fixed, full screen, behind everything.
   Holds the plain photo (the fallback if WebGL fails) and the shader canvas on top of it. */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
#bg-fallback {
  position: absolute;
  inset: 0;
  background: url("images/legend.jpg") center / cover no-repeat;   /* default; crt.js sets the page's own from data-bg */
}
/* Each page's own photo, for when the script never runs (same photos as the page rules in style.css) */
.page-home #bg-fallback, .page-contact #bg-fallback { background-image: url("images/nightsky.jpg"); }
.page-about #bg-fallback { background-image: url("images/prawnlake.jpg"); }
.page-lessons #bg-fallback, .page-mixing #bg-fallback { background-image: url("images/mixingdesk.jpg"); }

/* Canvases stay hidden until the shader has drawn. If WebGL fails they never show,
   and the plain photo underneath is what the visitor sees. Clicks pass straight through. */
.crt-canvas { display: none; pointer-events: none; }
.crt-canvas.crt-ready { display: block; }

.crt-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
header, main, footer { position: relative; z-index: 1; }

/* Sub-menu bar: many items wrap onto several centred lines, close together, never scroll sideways */
.subnav-bar ul { flex-wrap: wrap; justify-content: center; gap: .15rem 1rem; }
.subnav-bar li { max-width: 100%; }

/* INOP items that are real links: keep the greyed look of the word (hover colour comes from the site's link style) */
.inop-link { opacity: .6; }

/* Performance sub-menu only: Guitarist stands alone on the first line, with a faint gold divider
   below it; the six band tabs wrap underneath as before. */
.subnav-bar[aria-label="Performance"] li:first-child {
  flex: 0 0 100%;
  text-align: center;
}
.subnav-bar[aria-label="Performance"] li:first-child a {
  font-size: 1.15em;
}
/* Cream instead of gold, like the cream email link on the Contact page; hover and focus stay red */
.subnav-bar[aria-label="Performance"] li:first-child a:not(:hover):not(:active):not(:focus-visible) {
  background-image: none;
  color: #efe6cf;
  -webkit-text-fill-color: #efe6cf;
}
.subnav-bar[aria-label="Performance"] li:first-child::after {
  content: "";
  display: block;
  width: 60%;
  height: 1px;
  margin: .45rem auto .3rem;
  background: rgba(201, 166, 77, .4);
}

/* Power-on: the page is hidden until the script starts the effect.
   Failsafe: if the script never runs, the page appears by itself after 3 s. */
html.crt-hold #page,
html.crt-hold #bg-layer { visibility: hidden; animation: crt-reveal 0s 3s forwards; }
@keyframes crt-reveal { to { visibility: visible; } }
/* Section photo: wrapper is exactly the photo's size; the canvas covers the photo 1:1 */
.photo-crt {
  position: relative;
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1.5rem;
  border-radius: 12px;
  overflow: hidden;
}
.photo-crt .about-photo { max-width: none; margin: 0; }
.photo-crt .crt-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
