/* rgb.photography */

:root {
  --bg: #111112;
  --fg: #ecebe8;
  --muted: #9b9a96;
  --tile: #1c1c1e;
  --focus: #7aa2ff;
  --red: #ff5a52;
  --green: #3fcf6e;
  --blue: #4c8dff;
  --gap: 6px; /* GAP in app.js */
  --pad: clamp(8px, 2vw, 28px);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f4f1;
    --fg: #1c1b19;
    --muted: #6d6b66;
    --tile: #e4e2dd;
    --focus: #2355d8;
    --red: #e0342c;
    --green: #1e9e4a;
    --blue: #2463eb;
  }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  max-width: 1920px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) var(--pad) clamp(14px, 2.5vw, 28px);
}

.wordmark {
  margin: 0;
  font-size: clamp(1.4rem, 1rem + 1.6vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.wordmark .r { color: var(--red); }
.wordmark .g { color: var(--green); }
.wordmark .b { color: var(--blue); }

.byline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* the grid: justified rows, app.js sizes each tile so every photo keeps its shape and each row fills the width */

main {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

.tile {
  position: relative;
  display: block;
  flex: none;
  overflow: hidden;
  border-radius: 2px;
  background: var(--color, var(--tile));
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}

.tile.loaded img { opacity: 1; }

.tile .label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 12px 10px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.5);
  background: linear-gradient(transparent, rgb(0 0 0 / 0.55));
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .tile:hover img { transform: scale(1.02); }
  .tile:hover .label { opacity: 1; }
}

.tile:focus-visible .label { opacity: 1; }

.tile:focus-visible {
  outline-offset: 3px;
}

.status {
  color: var(--muted);
  text-align: center;
}

.status:empty { display: none; }

/* footer */

.site-footer {
  max-width: 1920px;
  margin: 0 auto;
  padding: 36px var(--pad) 48px;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p { margin: 0; }

/* the viewer, always dark so the photo is what you see */

.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0b0c;
  color: #ecebe8;
  overscroll-behavior: contain;
}

.viewer::backdrop { background: #0b0b0c; }

.viewer[open] {
  display: grid;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.viewer figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
  margin: 0;
}

.stage {
  display: grid;
  /* a fixed-size cell, so the photo's max-height: 100% has a height to be a percentage of */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-height: 0;
  padding: clamp(8px, 3vw, 40px) clamp(8px, 7vw, 96px) 12px;
}

.stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer figcaption {
  max-width: 68ch;
  max-height: 32dvh;
  overflow-y: auto;
  margin: 0 auto;
  padding: 4px 20px 22px;
  text-align: center;
}

.viewer h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
}

.viewer figcaption p {
  margin: 0 0 6px;
  color: #c9c8c4;
  font-size: 0.925rem;
}

.viewer .meta {
  color: #8f8e8a;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.viewer p:empty { display: none; }

.viewer button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.06);
  color: #ecebe8;
  cursor: pointer;
  transition: background 0.2s ease;
}

.viewer button:hover { background: rgb(255 255 255 / 0.16); }

.viewer button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer .close { top: 12px; right: 12px; }
.viewer .nav { top: calc(50% - 24px - 8dvh); }
.viewer .previous { left: 12px; }
.viewer .next { right: 12px; }

/* phones: swipe to move, the arrow buttons would sit on the photo */
@media (max-width: 640px) {
  .viewer .nav { display: none; }
  .stage { padding: 56px 0 8px; }
  .viewer figcaption { padding: 4px 16px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
