/* ============================================================
   G2 — ASSEMBLED / SCROLL
   The name, the titles and the photographs are one dust field.
   ============================================================ */

:root {
  --bg: #08080a;
  --ink: #f2efe8;
  --dim: rgba(242, 239, 232, 0.46);
  --line: rgba(242, 239, 232, 0.13);
  --accent: #e8a05a;
  --pad: clamp(1.1rem, 3.2vw, 3rem);
  --ease: cubic-bezier(0.22, 0.71, 0.18, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-y: scroll;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.32;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  z-index: 70;
  background: rgba(242, 239, 232, 0.09);
  pointer-events: none;
}

.progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* the whole field ------------------------------------------------------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

body.is-ready #stage { opacity: 1; }

.plate {
  position: fixed;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  object-fit: cover;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55);
  background: #0c0c10;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, #000 46%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, #000 0%, #000 46%, transparent 100%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 0% 0%;
  mask-size: 0% 0%;
}

.glow {
  position: fixed;
  z-index: 0;
  opacity: 0;
  filter: blur(58px) saturate(1.12) brightness(0.55);
  transition: opacity 1.4s var(--ease);
  pointer-events: none;
}

/* interface ------------------------------------------------------------- */

.ui {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease) 0.35s;
}

body.is-ready .ui { opacity: 1; }

.kicker {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  color: var(--dim);
}

.nav {
  position: absolute;
  left: var(--pad);
  bottom: var(--pad);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  pointer-events: auto;
}

.nav__btn {
  appearance: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.nav__btn:hover,
.nav__btn:focus-visible {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.nav__btn:active { transform: scale(0.94); }

.nav__btn:focus-visible {
  outline: 1px solid rgba(242, 239, 232, 0.6);
  outline-offset: 4px;
}

.nav__count { color: var(--dim); }
.nav__count b { color: var(--ink); font-weight: 500; }

.hint {
  margin-left: 0.9rem;
  color: rgba(242, 239, 232, 0.3);
  letter-spacing: 0.1em;
  white-space: nowrap;
  transition: opacity 0.6s var(--ease);
}

.hint.is-gone { opacity: 0; }

.plate-meta {
  position: fixed;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.end {
  position: fixed;
  left: 50%;
  bottom: var(--pad);
  transform: translateX(-50%);
  color: rgba(242, 239, 232, 0.28);
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.8s var(--ease);
}

.scroll-space {
  width: 1px;
  pointer-events: none;
}

/* the static version is a real page ------------------------------------- */

.fallback {
  display: none;
  position: relative;
  padding: 0 var(--pad);
}

.static .fallback { display: block; }

.static #stage,
.static .plate,
.static .glow,
.static .ui,
.static .progress,
.static .scroll-space,
.static .sr-only {
  display: none;
}

.fallback__head {
  min-height: 78svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(1rem, 2.5vh, 1.7rem);
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

.fallback__head .kicker { position: static; }

.fallback__name {
  margin: 0;
  font-weight: 400;
  font-size: clamp(3.6rem, 11vw, 9.5rem);
  line-height: 0.86;
  letter-spacing: -0.035em;
}

.fallback__name em { font-style: italic; }

.fallback__lede {
  margin: 0;
  font-style: italic;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  color: rgba(242, 239, 232, 0.72);
}

.gallery {
  border-top: 1px solid var(--line);
  padding: clamp(2.5rem, 7vh, 5rem) 0;
}

.gallery__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: clamp(1.6rem, 4vh, 2.8rem);
}

.gallery__head h2 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(1.9rem, 4.2vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.8rem, 1.6vw, 1.4rem);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  text-align: left;
}

.tile__img {
  display: block;
  position: relative;
  overflow: hidden;
  background: #15151a;
  aspect-ratio: var(--ar, 1.5);
}

.tile__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.9);
  transform: scale(1.01);
  transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
}

.tile:hover .tile__img img,
.tile:focus-visible .tile__img img {
  transform: scale(1.055);
  filter: saturate(1.05) brightness(1);
}

.tile:focus-visible { outline: 1px solid rgba(242, 239, 232, 0.6); outline-offset: 4px; }

.tile__cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  color: rgba(242, 239, 232, 0.5);
}

.tile__cap b {
  font-weight: 400;
  color: rgba(242, 239, 232, 0.86);
  letter-spacing: 0.02em;
}

.tile__cap span { color: var(--dim); }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 0 2.2rem;
  border-top: 1px solid var(--line);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.7rem;
  padding: 2rem;
  text-align: center;
}

/* responsive ------------------------------------------------------------ */

@media (max-width: 620px), (hover: none) and (pointer: coarse) {
  /* A full-bleed mix-blend-mode layer makes iOS Safari composite the whole
     page in software every frame while the canvas is redrawing. The dust is
     texture enough on a phone. */
  .grain { display: none; }
  /* A 58px blur over two full-bleed fixed layers is the other thing iOS Safari
     will not composite cheaply. Brightness alone is just a multiply. */
  .glow { filter: brightness(0.58) saturate(1.08); }
}

@media (max-width: 900px) {
  .kicker { top: 1rem; left: 1rem; }
  .nav { left: 1rem; bottom: 1rem; }
  .hint { display: none; }
  .plate-meta { font-size: 0.52rem; }
  .end { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .fallback__head { min-height: 64svh; }
}

@media (max-width: 560px) {
  .nav { gap: 0.55rem; }
  .nav__btn { width: 42px; height: 42px; }
  .gallery__head { gap: 0.4rem; }
  .foot { font-size: 0.56rem; }
}

/* a real static page for anyone who cannot take the motion -------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #stage,
  .plate,
  .glow,
  .ui,
  .progress,
  .scroll-space,
  .sr-only {
    display: none;
  }
  .fallback { display: block; }
  * { transition-duration: 0.01ms !important; }
}
