/* ------------------------------------------------------------------
   SWAG
   Two states. Without the tube (no WebGL, no JS, or forced colours)
   #shell is the page and the video keeps its native controls. With the
   tube, #shell steps back to being the accessible layer and the canvas
   carries the picture.
   ------------------------------------------------------------------ */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  color: #fcfcfc;
  font: 400 16px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-text-size-adjust: 100%;
}

/* The source on the videos page. Full size and on-screen so the browser
   never throttles decoding; the tube covers it when it is running, and it
   is the fallback player when it is not. */
#clip {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 0;
}

html[data-screen="contact"]:not(.gl) #clip { display: none; }

#tube {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
  touch-action: manipulation;
}

/* ---------------- fallback / no-script presentation ---------------- */

#shell {
  position: relative;
  z-index: 2;
  min-height: 100%;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 7vh, 5rem);
  padding: 6vmin;
  text-align: center;
  background: #111;
}

/* The videos page keeps its own player visible underneath. Scoped to that
   page: the contact page also has a #clip, and a form does not want to be
   a transparent strip along the bottom of a video. */
html:not(.gl)[data-screen="videos"] body:has(#clip) #shell {
  background: none;
  justify-content: flex-end;
  gap: clamp(.6rem, 2vh, 1.4rem);
  padding-bottom: 8vh;
  pointer-events: none;
}

html:not(.gl)[data-screen="videos"] body:has(#clip) #shell > * { pointer-events: auto; }

#shell .pagetitle {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 2rem);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #f9e33d;
  text-shadow: 2px 2px 0 #000;
}

#mark { margin: 0; line-height: 0; }

#mark img {
  width: min(62vw, 72vh);
  height: auto;
  display: block;
}

/* The gallery. Under the tube this is the accessible layer, clipped away
   with the rest of #shell; without it, it is the whole page — a real grid
   of thumbnails linking to the full-size files. */
#gallery { width: min(70rem, 100%); text-align: left; }

#gallery h2 {
  margin: 1.6rem 0 .6rem;
  font-size: .82rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #f2c21b;
}

#gallery ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: .5rem;
}

#gallery a {
  display: block;
  border: 2px solid #4a473f;
  background: #14120c;
  line-height: 0;
}

#gallery a:hover, #gallery a:focus-visible { border-color: #f2c21b; outline: none; }
#gallery a[aria-current="true"] { border-color: #f2c21b; }

#gallery img { width: 100%; height: 11rem; object-fit: cover; display: block; }

/* The contact form. Only ever seen when the tube is not running — under the
   tube this is still the form you are typing into, clipped away with the
   rest of #shell while the glass draws a picture of it. */
#form {
  width: min(46rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

#form .field { margin: 0; display: flex; flex-direction: column; gap: .35rem; }

#form label {
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #f2c21b;
}

#form input,
#form textarea {
  font: inherit;
  font-size: 1rem;
  color: #14120c;
  background: #e6e3db;
  border: 2px solid #89857c;
  border-top-color: #4a473f;
  border-left-color: #4a473f;
  padding: .7em .8em;
  min-height: 44px;
  width: 100%;
  resize: vertical;
}

#form input:focus-visible,
#form textarea:focus-visible { outline: 3px solid #f2c21b; outline-offset: 2px; }

#form .actions { margin: 0; display: flex; flex-wrap: wrap; gap: .8rem; }

#form button {
  flex: 1 1 14rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #14120c;
  background: #c9c5bc;
  border: 2px solid #89857c;
  border-top-color: #f1eee6;
  border-left-color: #f1eee6;
  padding: .9em 1em;
  min-height: 44px;
  cursor: pointer;
}

#form button:hover,
#form button:focus-visible { background: #f2c21b; }

#form #f-send { background: #f2c21b; }
#form #f-send:hover, #form #f-send:focus-visible { background: #fff07e; }

#f-status:empty { display: none; }

/* The page's own playlist. Only ever seen when the tube is not running —
   under the tube it is the accessible layer and is clipped away with the
   rest of #shell. */
#tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  max-width: 62rem;
}

#tracks button {
  font: inherit;
  font-size: clamp(.75rem, 1.5vw, 1rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fcfcfc;
  background: rgba(0, 0, 0, .72);
  border: 1px solid rgba(249, 227, 61, .45);
  padding: .7em 1em;
  min-height: 44px;
  cursor: pointer;
}

#tracks button[aria-pressed="true"] {
  color: #0a0806;
  background: #f9e33d;
  border-color: #f9e33d;
  font-weight: 700;
}

#tracks button:hover,
#tracks button:focus-visible { color: #0a0806; background: #f2c21b; }

#shell .sub { font-size: clamp(.8rem, 2vw, 1.1rem); color: #d2c49b; }

#shell .note { margin: 0; max-width: 34rem; color: #d2c49b; }

#nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(.9rem, 3vh, 2rem);
}

#nav a {
  color: #fcfcfc;
  text-decoration: none;
  text-transform: uppercase;
  font-size: clamp(.9rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: .18em;
  padding: .5em .8em;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

#nav a:hover,
#nav a:focus-visible {
  color: #000;
  background: #f2c21b;
  text-shadow: none;
  outline: 3px solid #000;
}

#fsbtn {
  position: absolute;
  left: 4vmin;
  bottom: 4vmin;
  font: inherit;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f2c21b;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(242, 194, 27, .45);
  padding: .5em .8em;
  cursor: pointer;
}

#fsbtn:hover, #fsbtn:focus-visible { color: #000; background: #f2c21b; }

/* The music controls. Only ever seen when the tube is not running — under
   it they are the accessible layer, clipped away with the rest of #shell. */
#music { width: min(46rem, 100%); text-align: left; }
#music .actions { margin: .4rem 0 0; display: flex; flex-wrap: wrap; gap: .6rem; }

#music button {
  font: inherit;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f2c21b;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(242, 194, 27, .45);
  padding: .6em .9em;
  min-height: 44px;
  cursor: pointer;
}

#music button:hover,
#music button:focus-visible { color: #000; background: #f2c21b; }
#music #m-now:empty { display: none; }

/* The credit, under the form it belongs to. Only ever seen when the tube is
   not running — the glass draws its own. */
.credit {
  margin: 1.4rem 0 0;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #9c9c9c;
}

#fxbtn {
  position: absolute;
  right: 4vmin;
  bottom: 4vmin;
  font: inherit;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #f2c21b;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(242, 194, 27, .45);
  padding: .5em .8em;
  cursor: pointer;
}

#fxbtn:hover, #fxbtn:focus-visible { color: #000; background: #f2c21b; }

/* -------------------- tube running: shell steps back -------------------- */

html.gl #tube { display: block; }

html.gl #shell {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  background: none;
  gap: 0;
}

/* Focus still has to be perceivable. The tube draws the gold selection plate
   for sighted keyboard users; this keeps a real ring for anyone whose UA
   ignores the canvas. */
html.gl #nav a:focus-visible,
html.gl #music button:focus-visible,
html.gl #gallery a:focus-visible,
html.gl #tracks button:focus-visible,
html.gl #form button:focus-visible,
html.gl #fsbtn:focus-visible,
html.gl #fxbtn:focus-visible { outline: 2px solid #f2c21b; }

/* -------------------- respect the user's own palette -------------------- */

@media (forced-colors: active) {
  html.gl #tube { display: none; }

  html.gl #shell {
    position: relative;
    width: auto;
    height: auto;
    min-height: 100%;
    margin: 0;
    padding: 6vmin;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    gap: clamp(2rem, 7vh, 5rem);
    background: Canvas;
  }

  #nav a { forced-color-adjust: auto; text-shadow: none; }
}
