/* townsville.dev — placeholder. Code-particles drift and coalesce into a slowly
   tumbling 3D logo, which then takes the occasional static "bzzzt" glitch.
   Palette matches townsville.nl. */

@font-face { font-family: "Delicious"; src: url("../fonts/Delicious-Roman.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Delicious"; src: url("../fonts/Delicious-Italic.otf") format("opentype"); font-style: italic; font-display: swap; }

:root { --red: #e52320; --red-hi: #f2473c; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #060607; overflow: hidden; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* Crisp logo that fades in once the particles have settled into shape, so the mark
   itself reads clearly instead of staying a soft cloud of characters. Tumbles slowly
   in 3D: three nested layers, each spinning one axis at its own (co-prime-ish) speed,
   so the combined motion doesn't visibly repeat. */
#logoPerspective { position: fixed; z-index: 1; pointer-events: none; perspective: 1400px; }
#rotY, #rotX, #rotZ, #logoSlab { position: absolute; inset: 0; transform-style: preserve-3d; }
/* Full 360° tumbling looked great from the front but degenerated into an ugly flat
   smear near edge-on (the stacked layers have no side walls/shading, so viewed from
   the side they're just a sliver). A bounded sway keeps it well short of edge-on —
   worst case ~42° combined — while still reading as "slowly turning in 3D". */
#rotY { animation: spinY 17s ease-in-out infinite; }
#rotX { animation: spinX 13s ease-in-out infinite; }
#rotZ { animation: spinZ 23s ease-in-out infinite; }
@keyframes spinY { 0%, 100% { transform: rotateY(-22deg); } 50% { transform: rotateY(22deg); } }
@keyframes spinX { 0%, 100% { transform: rotateX(-14deg); } 50% { transform: rotateX(14deg); } }
@keyframes spinZ { 0%, 100% { transform: rotateZ(-6deg); } 50% { transform: rotateZ(6deg); } }

/* Gives the flat cutout real thickness: a stack of copies spaced along Z, so the
   logo reads as a solid plate — not a sheet of paper — especially edge-on mid-tumble.
   Depth in px is set per layer from JS (--z), since it scales with the logo's
   on-screen size and can't be a static class. */
.slabLayer {
  --tint: brightness(0) saturate(100%) invert(26%) sepia(74%) saturate(3000%) hue-rotate(-5deg) brightness(1.05);
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 1.8s ease;
  filter: var(--tint);
  transform: translateZ(calc(var(--z, 0) * 1px));
}
#logoSlab.show .slabLayer { opacity: .8; }

/* Brief "bzzzt" static burst on the settled logo — sliced, colour-split, jittered.
   Triggered on a random interval from JS so it reads as an interference glitch,
   not a smooth loop. Runs on every layer at once, so the whole slab buzzes together. */
#logoSlab.glitch .slabLayer { animation: logoGlitch .38s steps(1, end); }
@keyframes logoGlitch {
  0%   { clip-path: inset(0 0 0 0); filter: var(--tint); }
  8%   { clip-path: inset(8% 0 71% 0); filter: var(--tint) drop-shadow(6px 0 0 rgba(43,224,224,.65)) drop-shadow(-6px 0 0 rgba(255,255,255,.5)); }
  16%  { clip-path: inset(62% 0 4% 0); filter: var(--tint) drop-shadow(-8px 0 0 rgba(43,224,224,.6)) drop-shadow(5px 0 0 rgba(255,255,255,.45)); opacity: .5; }
  24%  { clip-path: inset(30% 0 48% 0); filter: var(--tint) drop-shadow(7px 0 0 rgba(43,224,224,.6)); }
  33%  { clip-path: inset(0 0 0 0); filter: var(--tint); opacity: .8; }
  46%  { clip-path: inset(45% 0 20% 0); filter: var(--tint) drop-shadow(-6px 0 0 rgba(43,224,224,.55)) drop-shadow(6px 0 0 rgba(255,255,255,.4)); }
  58%  { clip-path: inset(5% 0 68% 0); filter: var(--tint) drop-shadow(5px 0 0 rgba(43,224,224,.5)); opacity: .55; }
  70%  { clip-path: inset(0 0 0 0); filter: var(--tint); opacity: .8; }
  100% { clip-path: inset(0 0 0 0); filter: var(--tint); opacity: .8; }
}

.overlay {
  position: fixed; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 7vh;
  pointer-events: none;
  font-family: "Delicious", system-ui, sans-serif;
  color: #fff;
  text-align: center;
  opacity: 0;
  animation: rise 1.4s ease forwards 1.6s;
}
@keyframes rise { to { opacity: 1; } }
.overlay h1 { margin: 0; font-weight: 400; font-size: clamp(1.8rem, 5vw, 3rem); letter-spacing: .06em; }
.overlay h1 b { color: var(--red-hi); font-weight: 700; }
.overlay p { margin: .6rem 0 0; font-style: italic; opacity: .72; font-size: 1.05rem; max-width: 36ch; line-height: 1.5; }
.overlay a {
  color: var(--red-hi);
  font-style: normal;
  font-weight: 700;
  text-decoration: none;
  pointer-events: auto;
  border-bottom: 1px solid rgba(242,71,60,.45);
}
.overlay a:hover { border-bottom-color: var(--red-hi); }
