:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --fg: #ededed;
  --mute: #8a8a8e;
  --line: #1d1d20;
  --pad: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 28px var(--pad) 8px;
}

h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}

.meta, .intro { margin: 0; color: var(--mute); }

main { padding: 0 var(--pad) 48px; }

.intro { padding: 0 0 28px; }

.grid {
  columns: 3 300px;
  column-gap: 16px;
}

figure {
  margin: 0 0 20px;
  break-inside: avoid;
}

figure button {
  all: unset;
  display: block;
  position: relative;
  width: 100%;
  cursor: zoom-in;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #151517;
  transition: opacity .2s ease;
}

figure button:hover img { opacity: .82; }

figure button:focus-visible,
.lb-btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

figcaption {
  padding: 8px 2px 0;
  color: var(--mute);
  font-size: 13px;
}

.play {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(11, 11, 12, .72);
  pointer-events: none;
}

.play::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 11px;
  border-left: 13px solid var(--fg);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

footer {
  padding: 8px var(--pad) 40px;
  color: var(--mute);
  font-size: 13px;
}

/* viewer */
dialog {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--fg);
}

dialog::backdrop { background: #000; }

.lb-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  height: 100%;
}

.lb-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 56px 24px 24px;
}

.lb-media img,
.lb-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  outline: none;
}

body:has(dialog[open]) { overflow: hidden; }

.lb-info {
  padding: 56px 28px 28px;
  overflow: auto;
  border-left: 1px solid var(--line);
}

.lb-info h2 { margin: 4px 0 12px; font-size: 19px; font-weight: 600; }
.lb-info p { margin: 0 0 12px; }

.tag, .count {
  color: var(--mute);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lb-btn {
  all: unset;
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: var(--fg);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}

.lb-btn:hover { background: rgba(255, 255, 255, .14); }
.lb-close { top: 12px; right: 12px; z-index: 2; }
.lb-prev, .lb-next { top: 50%; margin-top: -22px; }
.lb-prev { left: 12px; }
.lb-next { right: 332px; }

@media (max-width: 800px) {
  .lb-wrap { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lb-info { border-left: 0; border-top: 1px solid var(--line); padding: 20px; max-height: 38vh; }
  .lb-media { padding: 56px 12px 12px; }
  .lb-next { right: 12px; }
}

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