/* Media: image layers and their CSS fallbacks.
   Every .media box is fully styled without its image; the photo fades in on top
   once it has loaded (main.js adds .is-loaded) and a missing file never shows. */
.media { background-color: var(--bg-raise); }
.frame { position: relative; }
.media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  color: transparent; /* hide alt text if a file is missing and JS is off */
  filter: saturate(1.1) contrast(1.05) brightness(.88);
}
.js .media img { opacity: 0; }
.js .media.is-loaded img { opacity: 1; }
.media.is-missing img { display: none; }
.media::after { content: ""; position: absolute; inset: 0; pointer-events: none; }

/* Shared fallback textures */
.hero, .frame, .contact-media {
  --tex-grid: linear-gradient(rgba(0, 240, 255, .07) 1px, transparent 1px) 0 0 / 32px 32px,
              linear-gradient(90deg, rgba(0, 240, 255, .07) 1px, transparent 1px) 0 0 / 32px 32px;
}

/* Hero: night-sky gradient + perspective floor, covered by hero.jpg when present. */
.hero {
  background:
    radial-gradient(55% 45% at 78% 30%, rgba(255, 43, 214, .26), transparent 70%),
    radial-gradient(45% 40% at 18% 55%, rgba(0, 240, 255, .14), transparent 70%),
    linear-gradient(to bottom, transparent 51.5%, rgba(255, 43, 214, .5) 52%, transparent 52.6%),
    linear-gradient(to bottom, #050813 0%, #0A0E26 38%, #1A0B2E 52%, #070A18 53%, var(--bg) 100%);
}
.hero-media { z-index: -1; background: none; }
.hero-floor { z-index: -2; perspective: 380px; perspective-origin: 50% 0; overflow: hidden; -webkit-mask-image: linear-gradient(to top, #000 15%, transparent); mask-image: linear-gradient(to top, #000 15%, transparent); }
.hero-floor::before {
  content: "";
  position: absolute;
  inset: 0 -60% -60%;
  transform-origin: 50% 0;
  transform: rotateX(68deg);
  background:
    linear-gradient(rgba(0, 240, 255, .4) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(255, 43, 214, .32) 1px, transparent 1px) 0 0 / 64px 64px;
}
.hero-media img { object-position: 70% 50%; }
.hero-media::after {
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(6, 9, 19, .6) 28%, rgba(6, 9, 19, .08) 58%, rgba(6, 9, 19, .55) 100%),
    linear-gradient(90deg, rgba(6, 9, 19, .7), transparent 65%),
    linear-gradient(120deg, rgba(0, 240, 255, .08), transparent 45%, rgba(255, 43, 214, .1));
}
.hero::after { /* soft hand-off into the page */
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 6rem;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to top, var(--bg), transparent);
}

/* Framed panels (about, directions) */
.frame {
  --hud-inset: -7px;
  --hud-len: 14px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(0, 240, 255, .32) 22% calc(22% + 1px), transparent calc(22% + 1px)),
    linear-gradient(rgba(0, 240, 255, .2) 0 0) 50% 50% / 1px 18% no-repeat,
    linear-gradient(rgba(0, 240, 255, .2) 0 0) 50% 50% / 18% 1px no-repeat,
    var(--tex-grid),
    radial-gradient(80% 60% at 25% 15%, rgba(255, 43, 214, .32), transparent 70%),
    radial-gradient(70% 60% at 85% 95%, rgba(0, 240, 255, .26), transparent 70%),
    linear-gradient(160deg, #0E1433, #070A1A);
}
.frame::after {
  background:
    repeating-linear-gradient(to bottom, rgba(6, 9, 19, .22) 0 1px, transparent 1px 3px),
    linear-gradient(to top, rgba(6, 9, 19, .55), transparent 45%),
    linear-gradient(135deg, rgba(0, 240, 255, .1), transparent 50%, rgba(255, 43, 214, .12));
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, .08), inset 0 0 60px rgba(6, 9, 19, .6);
}
.about-media { aspect-ratio: 4 / 3; }
.about-media img { object-position: 70% 40%; }
.directions-media { aspect-ratio: 16 / 10; }
@media (min-width: 1024px) { .directions-media { aspect-ratio: auto; min-height: 26rem; } }

/* Contact backdrop */
.contact-media {
  background:
    var(--tex-grid),
    radial-gradient(55% 60% at 85% 85%, rgba(255, 43, 214, .22), transparent 70%),
    radial-gradient(45% 50% at 10% 20%, rgba(0, 240, 255, .12), transparent 70%),
    var(--bg);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%);
  mask-image: linear-gradient(to bottom, transparent, #000 18%);
}
.contact-media::after {
  background:
    linear-gradient(to bottom, var(--bg), rgba(6, 9, 19, .5) 30%, rgba(6, 9, 19, .65) 75%, var(--bg)),
    linear-gradient(90deg, rgba(6, 9, 19, .65), transparent 70%);
}

@media (forced-colors: active) {
  .media img { filter: none; }
}
