/* Grandpa Griggles, wild option. */
@font-face { font-family: "Unbounded"; src: url("assets/fonts/unbounded-latin.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("assets/fonts/instrument-serif-latin.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("assets/fonts/instrument-serif-italic-latin.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --black: #050505;
  --white: #f6f4ee;
  --acid: #c8ff3d;
  --m: clamp(1rem, 0.5rem + 1.6vw, 2rem);
  --display: "Unbounded", "Arial Black", sans-serif;
  --text: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--acid) var(--black); }
body {
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--text);
  font-size: clamp(1.25rem, 1.1rem + 0.55vw, 1.6rem);
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--acid); color: var(--black); }
:focus-visible { outline: 3px solid var(--acid); outline-offset: 3px; }
.skip { position: absolute; left: var(--m); top: -5rem; z-index: 30; background: var(--acid); color: var(--black); padding: 0.6rem 1rem; font-family: var(--display); font-size: 0.8rem; }
.skip:focus { top: 0.5rem; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; background: var(--black); }
/* Without WebGL or script the first drawing tiles the ground instead. */
html:not(.gl) body { background: var(--black) url("assets/img/tex-michael.webp") center / 22rem; }
html:not(.gl) #gl { display: none; }
html:not(.gl) body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(5, 5, 5, 0.72); }


/* Text always sits on its own black bars, so it reads on any pattern. */
.bar { background: var(--black); color: var(--white); padding: 0.12em 0.45em 0.18em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ---------- Top ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.75rem var(--m); pointer-events: none; }
.top > * { pointer-events: auto; }
.top__mark { font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; text-decoration: none; background: var(--black); padding: 0.55rem 0.8rem; }
.top__end, .lang { display: flex; align-items: center; gap: 0.35rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.5rem; padding: 0 0.85rem;
  font-family: var(--display); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.01em; line-height: 1;
  background: var(--black); color: var(--white); text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease);
}
.chip:hover { background: var(--white); color: var(--black); }
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"] { background: var(--acid); color: var(--black); }
.chip--solid { background: var(--white); color: var(--black); }
.chip--solid:hover { background: var(--acid); }
.chip__dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: currentColor; opacity: 0.45; }
#sound[aria-pressed="true"] .chip__dot { opacity: 1; }

/* ---------- Intro ---------- */
.intro { min-height: 100svh; padding: 6rem var(--m) 3rem; display: flex; flex-direction: column; justify-content: flex-end; gap: 1.25rem; }
.intro h1 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.6rem, 13.6vw, 15.5rem);
  line-height: 0.84; letter-spacing: -0.055em; text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.intro h1 span { display: block; width: fit-content; background: var(--black); padding: 0.06em 0.12em 0.04em 0.08em; }
.intro h1 span + span { margin-left: auto; }
.intro__line { max-width: 34ch; font-size: 1.25em; line-height: 1.32; }
.intro__hint { max-width: 40ch; font-style: italic; }
.intro__line .bar, .intro__hint .bar { line-height: 1.5; }

/* ---------- Works ---------- */
.work { --open: 1; height: 240svh; }
.work__stage {
  position: sticky; top: 0; height: 100svh; min-height: 34rem;
  padding: 4.5rem var(--m) 2rem;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: center;
  overflow: hidden;
}
.work__art {
  grid-column: 2; justify-self: center;
  height: min(calc(100svh - 7.5rem), 56vw);
  aspect-ratio: 3 / 4;
  /* the iris: the drawing opens out of the centre of its own pattern */
  clip-path: circle(calc(var(--open) * 86%) at 50% 50%);
  transform: scale(calc(1.12 - 0.12 * var(--open))) rotate(calc((1 - var(--open)) * -14deg));
  will-change: clip-path, transform;
}
.work__art img { width: 100%; height: 100%; object-fit: contain; }
.work--round .work__art, .work--square .work__art { aspect-ratio: 1; height: min(calc(100svh - 9rem), 46vw); }
.work--round .work__art { clip-path: circle(calc(var(--open) * 50%) at 50% 50%); }
.work__text {
  grid-column: 1; grid-row: 1;
  display: grid; gap: 1.1rem; justify-items: start; align-content: center;
  opacity: clamp(0, calc(var(--open) * 3 - 1.6), 1);
  transform: translateY(calc((1 - var(--open)) * 3rem));
}
.work--flip .work__art { grid-column: 1; }
.work--flip .work__text { grid-column: 2; }
.work h2 {
  font-family: var(--display); font-weight: 900;
  font-size: clamp(2.4rem, 6.2vw, 6.5rem);
  line-height: 1.02; letter-spacing: -0.05em; text-transform: uppercase;
}
.work h2 .bar { padding: 0.02em 0.14em 0.06em; }
.work__text p { max-width: 30ch; }
.work__text .bar { line-height: 1.52; }
.formats { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.formats a {
  display: inline-flex; align-items: baseline; gap: 0.7em;
  font-family: var(--display); font-weight: 500; font-size: 0.8rem; line-height: 1;
  padding: 0.95rem 1rem;
  background: var(--white); color: var(--black); text-decoration: none;
  transition: background-color 160ms ease, transform 160ms var(--ease);
}
.formats a b { font-weight: 800; }
.formats a:hover { background: var(--acid); transform: translateY(-2px); }
.formats a:active { transform: scale(0.96); }

/* ---------- Outro ---------- */
.outro { background: var(--black); padding: clamp(5rem, 12vw, 11rem) var(--m) 2rem; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3rem var(--m); }
.outro h2 { grid-column: 1 / span 5; font-family: var(--display); font-weight: 900; font-size: clamp(2rem, 4.4vw, 4.4rem); line-height: 0.92; letter-spacing: -0.05em; text-transform: uppercase; text-wrap: balance; }
.facts { grid-column: 7 / span 6; display: grid; gap: 1.1rem; counter-reset: fact; }
.facts li { max-width: 40ch; padding-left: 1.6em; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: 0.42em; width: 0.6em; height: 0.6em; background: var(--acid); transform: rotate(45deg); }
.outro__mail {
  grid-column: 1 / -1; margin-top: 3rem;
  font-family: var(--display); font-weight: 900;
  font-size: calc((100vw - 2 * var(--m)) / 19.9);
  line-height: 1; letter-spacing: -0.05em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  transition: color 160ms ease;
}
.outro__mail:hover { color: var(--acid); }
.outro__links { grid-column: 1 / span 7; display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; font-family: var(--display); font-size: 0.78rem; font-weight: 500; }
.outro__links a { display: inline-block; padding: 0.5rem 0; text-underline-offset: 0.3em; }
.outro__links a:hover { color: var(--acid); }
.outro__legal { grid-column: 8 / -1; justify-self: end; text-align: right; font-size: 1rem; color: #b9b6ad; align-self: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
  .work__art { transform: none; clip-path: none; }
  .work--round .work__art { clip-path: circle(50% at 50% 50%); }
  .work__text { opacity: 1; transform: none; }
  .work { height: auto; }
  .work__stage { position: relative; }
}

@media (max-width: 899px) {
  .top__mark { font-size: 0.9rem; padding: 0.55rem 0.6rem; }
  .chip { padding: 0 0.6rem; min-height: 2.75rem; }
  .chip--solid { display: none; }
  .intro { padding-top: 5rem; }
  .work__stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; gap: 1rem; padding-top: 4.25rem; padding-bottom: 1.25rem; }
  .work__art, .work--flip .work__art { grid-column: 1; grid-row: 1; height: min(calc(100svh - 21rem), 112vw); }
  .work--round .work__art, .work--square .work__art { height: min(calc(100svh - 17rem), 86vw); }
  .work__text, .work--flip .work__text { grid-column: 1; grid-row: 2; gap: 0.7rem; }
  .work h2 { font-size: clamp(1.9rem, 9.4vw, 3.4rem); }
  .work__text p { font-size: 1.1rem; }
  .formats a { padding: 0.9rem 0.8rem; font-size: 0.72rem; }
  .outro h2, .facts, .outro__links, .outro__legal { grid-column: 1 / -1; }
  .outro__legal { justify-self: start; text-align: left; }
  .outro__mail { font-size: calc((100vw - 2 * var(--m)) / 16.4); margin-top: 1rem; white-space: normal; }
  .outro__mail span { display: block; }
}
