/* Gallery (v4): a bright library of finished videos, same tokens as fresh.css. */
.gallery-page { background: var(--bg); }
.gal { max-width: 1440px; margin: 0 auto; padding: calc(var(--bar) + 56px) var(--gutter) 0; }
.gal-head { max-width: 760px; }
.gal-head h1 { margin-top: 10px; font-size: clamp(40px, 5vw, 64px); }
.gal-head p { margin-top: 14px; font-size: 17.5px; color: var(--ink-2); max-width: 60ch; }
.gal-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 30px 0 22px; }
.gal-filters button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r1); background: #fff; color: var(--ink-2); font: 600 13.5px/1 var(--font); cursor: pointer; }
.gal-filters button:hover { border-color: var(--ink-2); color: var(--ink); }
.gal-filters button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.gal-filters .n { opacity: .6; font-weight: 500; font-family: var(--mono); }

.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-auto-flow: dense; gap: 16px; }
.gcard { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit; font: inherit; box-shadow: var(--e1); transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.gcard:hover, .gcard:focus-visible { box-shadow: var(--e2); transform: translateY(-2px); }
.gcard.wide { grid-column: span 2; }
.gcard.tall { grid-row: span 2; }
.gthumb { position: relative; background: #111; overflow: hidden; flex: 1; min-height: 0; }
.gcard .gthumb { aspect-ratio: 16 / 9; }
.gcard.tall .gthumb { aspect-ratio: auto; height: 100%; }
.gcard.sq .gthumb { aspect-ratio: 1; }
.gthumb img, .gthumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gthumb video { opacity: 0; transition: opacity .25s; }
.gthumb video.on { opacity: 1; }
.gplay { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .94); font: 700 13px/1 var(--font); color: var(--ink); box-shadow: var(--e2); opacity: 0; transform: translateY(4px); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.gplay b { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.gplay svg { width: 11px; height: 11px; margin-left: 2px; }
.gcard:hover .gplay, .gcard:focus-visible .gplay { opacity: 1; transform: none; }
.gmeta { padding: 12px 14px 14px; }
.gmeta .row1 { display: flex; align-items: center; gap: 8px; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .03em; color: var(--dim); }
.gmeta .row1 .grow { flex: 1; }
.gmeta b { display: block; margin-top: 8px; font-size: 18px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; color: var(--ink); }
.gmeta p { margin-top: 6px; font-size: 13.5px; color: var(--dim); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-story { --c: var(--s1); } .cat-ad { --c: var(--s4); } .cat-launch { --c: var(--s3); } .cat-explainer { --c: var(--s2); } .cat-local { --c: var(--s6); }
.dotc { width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--accent)); flex: none; }
.gal-empty { grid-column: 1 / -1; padding: 60px 20px; text-align: center; color: var(--dim); border: 1px dashed var(--line-2); border-radius: var(--r2); }
.gal-loading { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: center; padding: 60px; }
.gal-loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); animation: gdot 1s infinite alternate; }
.gal-loading span:nth-child(2) { animation-delay: .2s; } .gal-loading span:nth-child(3) { animation-delay: .4s; }
@keyframes gdot { to { background: var(--accent); } }

.gal-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 56px 0 0; padding: 28px 30px; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); }
.gal-cta h2 { font-size: clamp(30px, 3.4vw, 44px); }
.gal-cta p { margin-top: 8px; color: var(--ink-2); }
.gallery-page .foot { margin: 56px 0 0; padding: 22px 0 28px; }

/* The lightbox: watch with sound */
.lb { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(22, 22, 28, .55); }
.lb[hidden] { display: none; }
.lb-in { position: relative; width: min(1180px, 100%); max-height: calc(100svh - 48px); display: grid; grid-template-columns: minmax(0, 1fr) 320px; overflow: hidden; background: #fff; border-radius: var(--r3); box-shadow: var(--e3); }
.lb-in.portrait { width: min(860px, 100%); grid-template-columns: minmax(0, 360px) minmax(0, 1fr); }
.lb-player { background: #111; display: grid; place-items: center; min-height: 0; }
.lb-player video { display: block; width: 100%; max-height: calc(100svh - 48px); background: #111; }
.lb-meta { display: flex; flex-direction: column; gap: 12px; padding: 24px 22px; overflow: auto; }
.lb-cat { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); text-transform: uppercase; letter-spacing: .03em; font: 500 11px/1 var(--mono); }
.lb-meta h2 { font-size: 30px; }
.lb-meta p { color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.lb-prompt { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--surface); }
.lb-prompt .mono { color: var(--dim); text-transform: uppercase; letter-spacing: .03em; font: 500 10.5px/1 var(--mono); }
.lb-prompt p { margin-top: 6px; font: 400 13px/1.55 var(--mono); color: var(--ink); }
.lb-meta .btn { align-self: flex-start; margin-top: auto; }
.lb-x { position: absolute; z-index: 2; right: 10px; top: 10px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--e2); }
.lb-x svg { width: 18px; height: 18px; }

@media (max-width: 860px) {
  .gal { padding: calc(var(--bar) + 32px) 16px 0; }
  .gal-head h1 { font-size: 38px; }
  .gal-head p { font-size: 16px; }
  .gal-filters { flex-wrap: nowrap; overflow-x: auto; margin: 22px -16px 18px; padding: 0 16px 4px; scrollbar-width: none; }
  .gal-filters::-webkit-scrollbar { display: none; }
  .gal-filters button { flex: none; }
  .gal-grid { grid-template-columns: 1fr; }
  .gcard.wide { grid-column: auto; } .gcard.tall { grid-row: auto; }
  .gcard.tall .gthumb { aspect-ratio: 9 / 16; height: auto; max-height: 80svh; }
  .gal-cta { flex-direction: column; align-items: flex-start; }
  .lb { padding: 0; }
  .lb-in, .lb-in.portrait { grid-template-columns: 1fr; max-height: 100svh; height: 100svh; border-radius: 0; overflow: auto; }
  .lb-player video { max-height: 70svh; }
}
@media (prefers-reduced-motion: reduce) { .gal-loading span { animation: none; } }
