/* ============================================================
   Jacob Ambrose — Photography
   Stripped-back editorial. Helvetica Neue. Image-first.
   ============================================================ */

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #9a9a9a;
  --line: rgba(0, 0, 0, 0.12);
  --gap: 6px;
  --pad: 6px;                 /* outer page margin — keep tiny, near full-bleed */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --track: 0.18em;
  --cell: 4 / 5;             /* gallery thumbnail aspect ratio */
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #0a0a0a; --fg: #f4f4f4; --muted: #6f6f6f; --line: rgba(255,255,255,0.14); }
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-y: scroll;            /* stable width — prevents justified-row overflow */
}
body { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

.brand {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav { display: flex; gap: 18px; align-items: center; }

.nav a {
  font-size: 10.5px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s var(--ease);
}
.nav a:hover, .nav a.is-active { color: var(--fg); }

/* ---------- Ticker banner ---------- */
.ticker {
  background: #000;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  padding: 6px 0;
}

.ticker__track {
  display: inline-flex;
  align-items: center;
  will-change: transform;
  animation: ticker-scroll 34s linear infinite;
}
.ticker--rev .ticker__track { animation-direction: reverse; }
.ticker:hover .ticker__track { animation-play-state: paused; }

.ticker__group { display: inline-flex; align-items: center; }

.ticker .item {
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  padding: 0 0.7em;
  line-height: 1;
}
.ticker a.item { transition: color 0.25s var(--ease); }
.ticker a.item:hover { color: rgba(255, 255, 255, 0.55); }
.ticker .sep {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.5);
  padding: 0;
  transform: translateY(-0.04em);
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
}

/* Reverse the ticker in dark mode: light tape, dark text */
@media (prefers-color-scheme: dark) {
  .ticker { background: #f4f4f4; color: #0a0a0a; }
  .ticker a.item:hover { color: rgba(0, 0, 0, 0.5); }
  .ticker .sep { color: rgba(0, 0, 0, 0.5); }
}

/* ---------- Home (jagged / offset) ---------- */
/* Home page fills the viewport exactly — no scrolling */
html.no-scroll { overflow: hidden; height: 100%; }
body[data-page="home"] {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body[data-page="home"] .splash { flex: 1 1 auto; }
body[data-page="home"] .site-footer { padding: 18px var(--pad); }

.splash {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Three ticker tapes sitting BEHIND the collection images.
   Top + bottom scroll opposite (.ticker--rev) to the middle one. */
.splash .ticker {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  z-index: 0;
  padding: 8px 0;
}
.ticker--top    { top: 25%; }
.ticker--bg     { top: 50%; }
.ticker--bottom { top: 75%; }
/* The two extra tapes are mobile-only. Middle tape: TORONTO on desktop,
   @jayckub_ on mobile (.only-desktop / .only-mobile toggle). */
.ticker--top, .ticker--bottom { display: none; }
.only-mobile { display: none; }
.splash .ticker .item {
  font-size: clamp(8px, 1.2vw, 14px);
  letter-spacing: 0.24em;
  padding: 0;
}
.ticker .gapsep { display: inline-block; width: 2.6em; }

.collections {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 210px));
  justify-content: center;
  align-items: start;
  gap: clamp(18px, 4vw, 52px);
  padding: 5vh var(--pad);
}

/* Offsets create the staggered editorial layout */
.collections .collection:nth-child(3n+1) { margin-top: 0; }
.collections .collection:nth-child(3n+2) { margin-top: 12vh; }
.collections .collection:nth-child(3n+3) { margin-top: 5vh; }

.collection { display: block; }

.collection .frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #f2f2f2;
}
@media (prefers-color-scheme: dark) { .collection .frame { background: #141414; } }

.collection .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease), filter 0.8s var(--ease);
}
.collection:hover .frame img { transform: scale(1.05); }

/* White overlay + centered "Enter" on hover */
.collection .frame::after {
  content: "Enter";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.collection:hover .frame::after { opacity: 1; }

.collection .cap {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 1px 0;
  font-size: 10px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--fg);
}
.collection .cap .name {
  position: relative;
  z-index: 1;
  transition: letter-spacing 0.45s var(--ease), color 0.25s var(--ease) 0.2s;
}
/* Line grows wider, then fills vertically into a red rectangle behind the name */
.collection .cap .name::before {
  content: "";
  position: absolute;
  left: -4px;
  bottom: -1px;
  width: 0;
  height: 1px;
  background: #e30613;
  z-index: -1;
  transition: width 0.3s var(--ease), height 0.3s var(--ease) 0.18s;
}
.collection:hover .cap .name { letter-spacing: 0.32em; color: #fff; }
.collection:hover .cap .name::before { width: calc(100% + 8px); height: calc(100% + 3px); }
.collection .cap .count { color: var(--muted); }

.collection.is-empty .frame {
  display: flex; align-items: center; justify-content: center;
}
.collection.is-empty .frame span {
  color: var(--muted); font-size: 10px; letter-spacing: var(--track); text-transform: uppercase;
}

/* ---------- Gallery (uniform, flush top & sides) ---------- */
.gallery-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px var(--pad) 14px;
}
.gallery-head h2 {
  font-size: 11px; font-weight: 500; letter-spacing: var(--track);
  text-transform: uppercase; margin: 0;
}
.gallery-head .meta {
  font-size: 10px; letter-spacing: var(--track); text-transform: uppercase; color: var(--muted);
}

.grid { padding: 0 var(--pad) var(--pad); }
.grid .row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
.grid .row:last-child { margin-bottom: 0; }

.grid figure {
  margin: 0;
  flex: 0 0 auto;
  overflow: hidden;
  cursor: zoom-in;
  background: #f2f2f2;
}
.grid figure.full { width: 100%; max-height: 82vh; }
@media (prefers-color-scheme: dark) { .grid figure { background: #141414; } }

.grid figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.grid figure img.loaded { opacity: 1; }

.empty-note {
  padding: 40px var(--pad) 120px; color: var(--muted); font-size: 12px; letter-spacing: 0.04em;
}
.empty-note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; user-select: none; }

.lightbox__btn {
  position: absolute; top: 0; height: 100%; width: 28%;
  background: none; border: none; cursor: pointer; color: var(--fg); opacity: 0; padding: 0;
}
.lightbox__prev { left: 0; }
.lightbox__next { right: 0; }

.lightbox__close {
  position: absolute; top: 14px; right: var(--pad);
  font-size: 13px; letter-spacing: var(--track); text-transform: uppercase;
  color: var(--fg); background: none; border: none; cursor: pointer; opacity: 0.6;
}
.lightbox__close:hover { opacity: 1; }

.lightbox__counter {
  position: absolute; bottom: 16px; left: 0; width: 100%;
  text-align: center; font-size: 10px; letter-spacing: var(--track); color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 12px 22px;
  align-items: baseline; justify-content: space-between;
  padding: 60px var(--pad) 36px;
}
.site-footer .links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a, .site-footer .copy {
  font-size: 10px; letter-spacing: var(--track); text-transform: uppercase;
  color: var(--muted); transition: color 0.25s var(--ease);
}
.site-footer a:hover { color: var(--fg); }

/* ---------- Home: 4+ sections ---------- */
.collections[data-count="4"] {
  grid-template-columns: repeat(4, minmax(0, clamp(120px, 15.5vw, 176px)));
  gap: clamp(14px, 3vw, 40px);
}
.collections[data-count="4"] .collection:nth-child(1) { margin-top: 0; }
.collections[data-count="4"] .collection:nth-child(2) { margin-top: 10vh; }
.collections[data-count="4"] .collection:nth-child(3) { margin-top: 3vh; }
.collections[data-count="4"] .collection:nth-child(4) { margin-top: 12vh; }

/* ---------- Gallery: per-gig headings ---------- */
.grid .gig__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 26px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.grid .gig__head:first-child { margin-top: 2px; padding-top: 0; border-top: 0; }
.grid .gig__title {
  font-size: 10.5px; letter-spacing: var(--track); text-transform: uppercase;
}
.grid .gig__count {
  font-size: 9.5px; letter-spacing: var(--track); text-transform: uppercase; color: var(--muted);
}

/* ---------- Video strip (horizontal, staggered, hover / in-view play) ---------- */
/* The video page fills the viewport so the strip can sit vertically centered. */
body.is-video-page { min-height: 100dvh; display: flex; flex-direction: column; }
body.is-video-page .grid.video-grid { flex: 1 1 auto; min-height: 0; }

.grid.video-grid {
  --stagger: 5vh;                 /* zig-zag amplitude (JS sets each tile's --sy) */
  display: flex;
  align-items: center;            /* vertically center the strip */
  gap: clamp(18px, 3vw, 44px);
  /* --vcomp (set by JS) offsets header/footer height asymmetry so the strip's
     center of mass lands on the true viewport center */
  padding: max(2vh, calc(3vh + var(--vcomp, 0px))) var(--pad) 3vh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.grid.video-grid::-webkit-scrollbar { height: 6px; }
.grid.video-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.video-grid .vtile {
  position: relative;                     /* anchor for the absolute caption */
  flex: 0 0 auto;
  width: clamp(188px, 21vw, 250px);
  scroll-snap-align: center;
  display: block;
  transform: translateY(calc(var(--sy, 0) * var(--stagger)));   /* mean-zero zig-zag */
}
/* Compact footer on the video page so the strip centers on the true viewport */
body.is-video-page .site-footer { padding: 15px var(--pad); }

.vtile__frame {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #eee;
}
@media (prefers-color-scheme: dark) { .vtile__frame { background: #141414; } }
.vtile__frame video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  z-index: 0; background: #000;
}
.vtile__poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  z-index: 1;
  transition: opacity 0.45s var(--ease);
}
.vtile.active .vtile__poster { opacity: 0; }

/* play affordance: bare triangle, no circle */
.vtile__play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 0; height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
  opacity: 0.95;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.vtile.playing .vtile__play,
.vtile.counting .vtile__play { opacity: 0; }   /* hide the triangle while the countdown ring shows */

/* countdown ring: appears 5s after un-hover, depletes over the final 5s */
.vtile__count {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 48px; height: 48px;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.vtile.counting .vtile__count { opacity: 1; }
.vtile__count svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.vtile__count .ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 2.4; }
.vtile__count .ring-fg {
  fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 0;
}
.vtile.counting .vtile__count .ring-fg { animation: ring-deplete 5s linear forwards; }
@keyframes ring-deplete { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 100; } }
.vtile__num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; letter-spacing: 0;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

/* caption: hidden until hover, then a red bar sweeps in with the text
   typewriter-revealing on top of it (always white-on-red, never clipped) */
.vtile__cap {
  position: absolute;                     /* below the frame, out of centering flow */
  top: 100%; left: 1px; right: 1px;
  padding: 11px 0 0;
  font-size: 10px; letter-spacing: var(--track); text-transform: uppercase;
  white-space: nowrap;
}
.vtile__cap .name {
  position: relative;
  display: inline-block;
  color: #fff;                              /* white text, sits over the red bar */
  clip-path: inset(0 100% 0 0);             /* fully hidden when not hovering */
}
.vtile__cap .name::before {                 /* the red bar behind the text */
  content: ""; position: absolute;
  left: -4px; right: -4px; top: -1px; bottom: -1px;
  background: #e30613; z-index: -1;
  transform: scaleX(0); transform-origin: left center;
  transition: transform 0.28s var(--ease);
}
.vtile:hover .vtile__cap .name,
.vtile.playing .vtile__cap .name {
  clip-path: inset(0 0 0 0);                /* reveal left→right */
  transition: clip-path 0.5s steps(20, end);
}
.vtile:hover .vtile__cap .name::before,
.vtile.playing .vtile__cap .name::before { transform: scaleX(1); }

/* Video in the lightbox */
.lightbox video { max-width: 94vw; max-height: 90vh; background: #000; outline: none; }
.lightbox.is-video { background: #0a0a0a; }
.lightbox.is-video .lightbox__close { color: #fff; opacity: 0.75; }
.lightbox.is-video .lightbox__close:hover { opacity: 1; }
.lightbox.is-video .lightbox__counter { color: rgba(255, 255, 255, 0.6); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  body { font-size: 13px; }
  /* Mobile header: no nav, centered title */
  .site-header { padding: 14px var(--pad); justify-content: center; }
  .nav { display: none; }
  .brand { font-size: 10px; letter-spacing: 0.2em; }

  /* No ticker tapes on mobile */
  .splash .ticker { display: none; }

  /* Keep the gallery title no larger/bolder than the site title (brand) */
  .gallery-head h2 { font-size: 9px; }
  .gallery-head .meta { font-size: 9px; }

  /* Balanced zig-zag, locked to one screen. Covers sized by viewport
     HEIGHT (vh) so the three always fit — never clipped on short phones. */
  body[data-page="home"] .splash { align-items: stretch; }
  /* Two-column staggered grid → much larger covers, still one locked screen. */
  .collections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: clamp(12px, 4.5vw, 24px);
    row-gap: 2vh;
    align-content: center;
    height: 100%;
    padding: 2vh var(--pad);
  }
  .collections .collection { margin: 0; width: auto; align-self: start; }
  .collection .frame { width: 100%; height: auto; aspect-ratio: 3 / 4; }
  .collection .cap { width: 100%; padding-top: 6px; }
  /* offset the right column for a masonry-style stagger */
  .collections .collection:nth-child(2n) { transform: translateY(4vh); }
  body[data-page="home"] .site-footer { padding: 12px var(--pad); }

  .lightbox img { max-width: 100vw; max-height: 86vh; }
  .lightbox video { max-width: 100vw; max-height: 86vh; }
  .lightbox__close { font-size: 11px; }

  /* Covers are width-driven in the grid; cancel desktop height + stagger margins,
     and override the desktop 4-column template (higher specificity) with 2 columns */
  .collections[data-count="4"] {
    grid-template-columns: 1fr 1fr;
    column-gap: clamp(12px, 4.5vw, 24px);
    row-gap: 2vh;
  }
  .collections[data-count="4"] .collection .frame { height: auto; }
  .collections[data-count="4"] .collection:nth-child(n) { margin-top: 0; }

  /* Swipeable, vertically-centered video strip on phones */
  .grid.video-grid {
    --stagger: 3.2vh; gap: 16px;
    padding: max(2vh, calc(3vh + var(--vcomp, 0px))) var(--pad) 3vh;
  }
  .video-grid .vtile { width: 62vw; }
}
