@font-face {
  font-family: "Gothic";
  src: url("fonts/URWGothic-Book.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Gothic";
  src: url("fonts/URWGothic-Demi.otf") format("opentype");
  font-weight: 600;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  --tx: 0;      /* sticker lean, -1..1, written by app.js */
  --ty: 0;
  --lx: 50vw;   /* light position, viewport px */
  --ly: 50vh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Gothic", "URW Gothic", "ITC Avant Garde Gothic", "Century Gothic", "Avenir", sans-serif;
  color: #0a0a0a;
  background: #121213;
}

/* ---------- wallpaper: the undercroft, nearly monochrome ---------- */

/* fills whatever the photo itself doesn't cover */
.wall-blur {
  position: fixed; inset: -40px;
  background: url("img/skatepark.webp") 60% 70% / cover no-repeat;
  filter: grayscale(.85) brightness(.42) blur(22px);
}
/* the photo, sized and placed by app.js to show as much as possible */
.wall {
  position: fixed;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: url("img/skatepark.webp") center / 100% 100% no-repeat;
  filter: grayscale(.8) contrast(1.05) brightness(.74);
}
/* only a light vignette, so most of the wall stays visible */
.stage::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(140% 120% at 50% 50%, transparent 55%, rgba(6, 6, 8, .5) 100%);
}

/* scanlines, snow and a rolling bar, only visible while the wall's signal fails */
.tv {
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(transparent 0%, rgba(255, 255, 255, .07) 45%, rgba(255, 255, 255, .12) 50%, rgba(255, 255, 255, .07) 55%, transparent 100%) 0 var(--roll, 0%) / 100% 34% no-repeat,
    repeating-linear-gradient(rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='s'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.4 -.25'/></filter><rect width='100%' height='100%' filter='url(%23s)'/></svg>");
  mix-blend-mode: overlay;
}

/* the light you're holding also falls on the wall */
.torch {
  position: fixed;
  left: 0; top: 0;
  width: 90vmax; height: 90vmax;
  margin: -45vmax 0 0 -45vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 250, 240, .16), rgba(255, 250, 240, .05) 45%, transparent 100%);
  mix-blend-mode: soft-light;
  transform: translate(var(--lx), var(--ly));
  pointer-events: none;
  will-change: transform;
}

/* film grain over everything, very quiet */
body::after {
  content: "";
  position: fixed; inset: -50%;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

.stage { position: fixed; inset: 0; }

/* ---------- the sticker ---------- */

/* size and position come from app.js (layout); these are fallbacks */
.tilt {
  position: absolute;
  left: 40vw; top: 52vh;
  width: 50vw;
  aspect-ratio: 2.05;
  transform-style: preserve-3d;
  will-change: transform;
  transform:
    perspective(1100px)
    rotateY(calc(var(--tx) * 6deg))
    rotateX(calc(var(--ty) * -5deg));
}

@media (max-aspect-ratio: 9/10) {
  .tilt {
    aspect-ratio: 1 / 1.6;
    transform:
      perspective(1100px)
      rotateY(calc(var(--tx) * 5deg))
      rotateX(calc(var(--ty) * -4.1deg));
  }
}

.ticket, .shadow, .shadow-shape { position: absolute; inset: 0; }

.ticket {
  container-type: size;
  overflow: hidden;
  background: #c9ccd3;             /* until the first frame paints */
}

#holo, .lines { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.lines { overflow: visible; }
.lines path { fill: none; stroke: rgba(8, 8, 10, .7); vector-effect: non-scaling-stroke; }
.lines .border { stroke-width: 1.25; }
.lines .perf { stroke-width: 1.25; stroke-dasharray: 7 6; }

/* contact shadow: thrown away from the light */
.shadow {
  transform: translate3d(
    calc((50vw - var(--lx)) * .03 + var(--tx) * -4px),
    calc((50vh - var(--ly)) * .02 + 12px),
    -40px) scale(.97);
  filter: blur(16px);
  opacity: .45;
}
.shadow-shape { background: #000; }

/* ---------- type (painted by WebGL; this is the fallback/layout) ---------- */

.body {
  position: absolute;
  left: 17%; right: 0; top: 0; bottom: 0;
  padding: 8.5cqh 7.5cqw 9cqh 6.5cqw;
  display: flex; flex-direction: column; justify-content: center;
}

.quote {
  font-weight: 400;
  font-size: 5.05cqw;
  line-height: 1.06;
  letter-spacing: -.005em;
  text-wrap: balance;
  text-shadow: -.035em 0 rgba(255, 0, 110, .26), .035em 0 rgba(0, 170, 255, .26);
}

.pay {
  position: absolute;
  right: 7.5cqw; bottom: 7.5cqh;
  font-size: 3.6cqw;
  line-height: 1;
  text-shadow: -.035em 0 rgba(255, 0, 110, .26), .035em 0 rgba(0, 170, 255, .26);
  padding: .3em 0;
}

.gl-text .quote, .gl-text .pay { color: transparent; text-shadow: none; }

@media (max-aspect-ratio: 9/10) {
  .body { left: 0; top: 16%; padding: 6cqh 9cqw 12cqh 9cqw; }
  .quote { font-size: 9.6cqw; line-height: 1.08; }
  .pay { font-size: 7cqw; right: 9cqw; bottom: 5.5cqh; }
}

/* ---------- the switch: fx | music ---------- */

.switch {
  position: fixed;
  right: calc(env(safe-area-inset-right) + 22px);
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0; background: none;
  font: inherit;
  cursor: pointer;
  color: #fff;
  -webkit-user-select: none; user-select: none;
}
.sw-label {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  opacity: .38;
  transition: opacity .4s;
}
.switch[aria-checked="false"] .sw-fx,
.switch[aria-checked="true"] .sw-music { opacity: .92; }

.sw-track {
  position: relative;
  width: 50px; height: 26px;
  border-radius: 13px;
  background: rgba(20, 20, 22, .55);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .4s;
}
.sw-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(160deg, #f4f5f7, #a9adb5);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform .42s cubic-bezier(.3, 1.5, .5, 1), background .4s;
}
/* on: the thumb turns to foil */
.switch[aria-checked="true"] .sw-thumb {
  transform: translateX(24px);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .85), transparent 45%),
    conic-gradient(from 200deg, #cfe9ff, #f6d0f2, #d6f7da, #fff2c4, #d9d3ff, #cfe9ff);
}
.switch[aria-checked="true"] .sw-track { background: rgba(60, 60, 66, .55); }
.switch:hover .sw-track, .switch:focus-visible .sw-track { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .5); }
.switch:focus-visible { outline: none; }
.switch:active .sw-thumb { width: 23px; }
.switch[aria-checked="true"]:active .sw-thumb { transform: translateX(21px); }

/* ---------- no WebGL: a quiet CSS foil ---------- */
.no-gl .ticket {
  background:
    radial-gradient(60% 80% at 30% 30%, #f4d3f0aa, transparent 70%),
    radial-gradient(60% 80% at 75% 65%, #cdeaffaa, transparent 70%),
    radial-gradient(50% 60% at 55% 20%, #d8f8dcaa, transparent 70%),
    linear-gradient(115deg, #c9ccd3, #e5e7ec, #b9bcc4);
  background-size: 200% 200%;
  animation: foil 9s ease-in-out infinite alternate;
}
.no-gl #holo { display: none; }
@keyframes foil { to { background-position: 100% 100%; } }

@media (prefers-reduced-motion: reduce) {
  body::after, .no-gl .ticket { animation: none; }
}
