/* Photographs — Jerry Brito
   A gallery: museum-wall white, black ink, and one red dot. */

:root {
  --wall: #EFEFEC;
  --ink: #111111;
  --graphite: #6C6C68;
  --hair: rgba(17, 17, 17, .14);
  --dot: #D42A1F;

  --room: #0A0A0A;
  --room-ink: #EDEDEA;
  --room-muted: #8A8A86;

  --bg: var(--wall);
  --fg: var(--ink);
  --muted: var(--graphite);

  --sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 64px);
  color-scheme: light;
}

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

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  padding-inline: var(--gutter);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--dot); outline-offset: 3px; }

/* ---------- header ---------- */

.head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px 40px;
  padding-block: calc(env(safe-area-inset-top, 0px) + clamp(36px, 6vw, 88px)) clamp(28px, 4vw, 48px);
}

.ident { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.name {
  margin: 0;
  font-weight: 500;
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  letter-spacing: -.025em;
  line-height: 1;
}

.dot,
.label-dot {
  display: inline-block;
  width: .3em;
  height: .3em;
  border-radius: 50%;
  background: var(--dot);
  margin-left: .12em;
  vertical-align: .62em;
}

.sub {
  margin: 0;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.blurb {
  margin: 0;
  max-width: 38ch;
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.45;
}

.count {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.count .num {
  display: block;
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(3.2rem, 8vw, 7rem);
  letter-spacing: -.05em;
  line-height: .85;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.controls {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 36px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}

.controls[hidden] { display: none; }

.ctl { display: flex; align-items: center; gap: 4px; margin-left: -8px; }

.controls button {
  border: 0;
  background: none;
  padding: 6px 8px;
  font-size: .92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  transition: color .15s;
}

.controls button:hover { color: var(--fg); }

/* the selected option wears the red dot */
.ctl button[aria-pressed="true"] { color: var(--fg); }
.ctl button[aria-pressed="true"]::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
}

.play-all { margin-left: auto; color: var(--fg) !important; }
.play-all::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}

/* ---------- the stream ---------- */

.stream { padding-bottom: 40px; }

/* Until the script arranges the photographs, keep the unordered list out of sight. */
html.js .stream:not(.is-ready) { visibility: hidden; }

/* Without JavaScript: a simple ragged hang. */
html:not(.js) .stream { display: flex; flex-wrap: wrap; gap: 16px; }
html:not(.js) .ph { height: 220px; width: calc(220px * var(--ar)); max-width: 100%; }

.ph {
  position: relative;
  display: block;
  flex: none;
  overflow: hidden;
  background: rgb(var(--g) var(--g) var(--g));
  cursor: zoom-in;
}

.ph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* wall: justified rows, set by app.js */
.row {
  display: flex;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.stream .ph img { transition: opacity .25s ease; }
.stream .ph:hover img { opacity: .9; }

.stream .ph::after {
  content: "No. " attr(data-no);
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 5px 8px;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .06em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s ease, transform .2s ease;
}

.stream .ph:hover::after,
.stream .ph:focus-visible::after { opacity: 1; transform: none; }

/* ---------- back to top ---------- */

.topper {
  position: fixed;
  z-index: 40;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 14px 9px 16px;
  background: rgba(239, 239, 236, .86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--hair);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity .25s ease, transform .25s ease;
}

.topper.is-shown {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.topper .dot { font-size: 1.1rem; }

.topper-up {
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .15s;
}

.topper:hover .topper-up,
.topper:focus-visible .topper-up { color: var(--ink); }

/* ---------- footer ---------- */

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding-block: 28px calc(env(safe-area-inset-bottom, 0px) + 36px);
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot p { margin: 0; }
.foot a:hover { color: var(--fg); }

/* ---------- the viewing room ---------- */

.room {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--room);
  color: var(--room-ink);
  color-scheme: dark;
}

.room[hidden] { display: none; }

.room-frame {
  position: absolute;
  margin: 0;
  top: calc(env(safe-area-inset-top, 0px) + 4vh);
  bottom: 118px;
  left: var(--gutter);
  right: var(--gutter);
  cursor: pointer;
}

.room-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .9s ease;
}

.room-img.is-on { opacity: 1; }

.label {
  position: absolute;
  left: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 30px);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: baseline;
}

.label p { margin: 0; grid-column: 2; }
.label-dot { grid-row: 1; grid-column: 1; width: 8px; height: 8px; margin: 0; vertical-align: 0; }
.label-no { font-weight: 500; font-size: 1.05rem; letter-spacing: -.01em; }
.label-date { font-weight: 300; font-size: .95rem; margin-top: 2px !important; }
.label-cam {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--room-muted);
  margin-top: 6px !important;
}

.room-bar {
  position: absolute;
  right: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 30px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.room-pos {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--room-muted);
  margin-right: 12px;
  font-variant-numeric: tabular-nums;
}

.room-btn {
  border: 1px solid rgba(237, 237, 234, .22);
  background: none;
  color: var(--room-ink);
  min-width: 44px;
  height: 36px;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}

.room-btn:hover,
.room-btn:focus-visible { background: var(--room-ink); color: var(--room); border-color: var(--room-ink); }
.room-play.is-playing { border-color: var(--dot); }

.room-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--dot);
}

.room-progress.is-running {
  width: 100%;
  transition: width var(--slide, 6s) linear;
}

body.room-open { overflow: hidden; }

@media (max-width: 640px) {
  .head { grid-template-columns: minmax(0, 1fr); }
  .count { grid-column: 1; grid-row: auto; text-align: left; order: -1; }
  .controls { grid-row: auto; }
  .play-all { margin-left: 0; }
  .room-frame { bottom: 170px; }
  .room-bar { left: var(--gutter); right: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); }
  .label { bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }
  .room-pos { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .room-img, .ph img, .ph::after, .topper { transition: none !important; }
}
