/* ==================================================
   DeadEye Stare: photos page (photos.html)
   Builds on home.css (tokens, header, buttons, footer)
   ================================================== */

/* ---------- banner: two photos (Ed, then Dave at the right edge) on black, their edges fading softly into the black and into each other ---------- */
.p-hero {
  --h: clamp(300px, 40vw, 580px);   /* banner height; photo widths and the overlap scale with it */
  --extra: max(0px, (100vw - 1440px) / 2);   /* on screens wider than the layout, Dave grows to fill the space so both photos sit further left */
  position: relative;
  margin: 0;
  height: calc(var(--h) * 0.88);   /* trims the faded bottom of the photos so the gallery sits higher */
  overflow: hidden;
  background: #000;
}

.p-hero__photo {
  position: absolute;
  top: 0;
  right: calc(var(--h) * 1.03 + var(--extra));   /* Ed's right edge overlaps Dave's faded left edge */
  height: var(--h);
  aspect-ratio: 1290 / 1040;
  /* fade left, right and bottom edges to transparent so the black shows through */
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 24%, #000 80%, transparent 100%),
    linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, #000 24%, #000 80%, transparent 100%),
    linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
  mask-composite: intersect;
}

.p-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dave: second photo, flush with the right edge, long fade on the left so it melts into Ed's photo */
.p-hero__photo--dave {
  right: 0;
  z-index: 1;
  width: calc(var(--h) * 1.33 + var(--extra));
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 42%, #000 88%, transparent 100%),
    linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
  mask-image:
    linear-gradient(to right, transparent 0%, #000 42%, #000 88%, transparent 100%),
    linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
}
.p-hero__photo--dave .p-hero__img { object-position: 50% 0%; }

/* blend the black banner into the page color below it */
.p-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 80px;
  background: linear-gradient(to bottom, rgba(20, 18, 17, 0), var(--charcoal));
  pointer-events: none;
}

.p-hero__content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(20px, 4vw, 48px);
}

.p-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.75rem, 9vw, 6rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.p-hero__sub {
  margin: 8px 0 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 500;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

/* credit sits inside the unfaded part of the photo */
.p-hero .photo-credit { z-index: 3; right: calc(var(--h) * 1.35 + var(--extra)); }   /* bottom of the banner, under Ed (the photo it credits) */

/* phones: photo full width with softer side fades, title below it */
@media (max-width: 640px) {
  .p-hero { height: auto; }
  .p-hero::after { content: none; }
  .p-hero__photo {
    position: relative;
    right: auto;
    width: 100%;
    height: auto;
    -webkit-mask-image:
      linear-gradient(to right, transparent 0%, #000 10%, #000 90%, transparent 100%),
      linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
    mask-image:
      linear-gradient(to right, transparent 0%, #000 10%, #000 90%, transparent 100%),
      linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
  }
  .p-hero .photo-credit { top: 0; bottom: auto; right: 40%; }   /* phones: title overlaps the photo bottom, so the credit sits at the top of Ed's photo */
  /* Ed on the left 72%, Dave over the right side with a wide fade between them */
  .p-hero__photo:not(.p-hero__photo--dave) { width: 72%; }
  .p-hero__photo--dave {
    position: absolute;
    top: 0;
    right: 0;
    width: 46%;
    height: calc(72vw * 1040 / 1290);
    aspect-ratio: auto;
    -webkit-mask-image:
      linear-gradient(to right, transparent 0%, #000 50%, #000 100%),
      linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
    mask-image:
      linear-gradient(to right, transparent 0%, #000 50%, #000 100%),
      linear-gradient(to bottom, #000 0%, #000 70%, transparent 100%);
  }
  .p-hero__content { position: static; margin-top: -24px; padding-top: 0; padding-bottom: 8px; }
  .p-hero__title, .p-hero__sub { text-shadow: none; }
}

/* ---------- gallery: justified rows, every photo keeps its shape, order reads left to right ---------- */
.gallery-section { padding: clamp(32px, 5vw, 64px) 0 clamp(56px, 8vw, 96px); }
.gallery-section .wrap { max-width: 1400px; }

.gallery__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--red);
}
.gallery__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1;
  text-transform: uppercase;
}
.gallery__count {
  margin: 0;
  color: var(--amber);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gallery {
  --row: 260px;               /* target row height */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* keeps the last row from stretching huge */
.gallery::after { content: ""; flex-grow: 999; }

.gallery > li {
  --r: 1.5;                   /* set per photo by photos.js from its real shape */
  flex: var(--r) 1 calc(var(--r) * var(--row));
  min-width: 0;
}

.gallery a {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  background: var(--charcoal-2);
  aspect-ratio: var(--r);
}
.gallery a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.3s ease;
}
.gallery a::after {
  content: "\f00e";            /* fa-search-plus */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 17, 0.45);
  color: var(--paper);
  font-family: FontAwesome;
  font-size: 1.8rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}
@media (hover: hover) {
  .gallery a:hover img { transform: scale(1.04); }
  .gallery a:hover::after { opacity: 1; }
}
.gallery a:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.gallery a:focus-visible::after { opacity: 1; }

@media (max-width: 900px) { .gallery { --row: 190px; gap: 6px; } }
@media (max-width: 520px) { .gallery { --row: 130px; gap: 4px; } }

/* ---------- call to action ---------- */
.gallery__more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 48px;
  padding: 24px;
  border: 1px solid var(--charcoal-3);
  border-left: 4px solid var(--amber);
}
.gallery__more p { flex: 1 1 260px; margin: 0; font-size: 1.05rem; }
@media (max-width: 480px) { .gallery__more .btn { flex: 1 1 100%; } }

/* ---------- photo viewer ---------- */
.viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 9, 8, 0.97);
  color: var(--paper);
  overflow: hidden;
}
.viewer::backdrop { background: rgba(10, 9, 8, 0.9); }
.viewer[open] { display: grid; grid-template-rows: auto 1fr; }

.viewer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 20px;
}
.viewer__count {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.viewer__close,
.viewer__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--charcoal-3);
  border-radius: 50%;
  background: rgba(20, 18, 17, 0.75);
  color: var(--paper);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.viewer__close:hover, .viewer__close:focus-visible,
.viewer__nav:hover, .viewer__nav:focus-visible { background: var(--amber); border-color: var(--amber); color: var(--charcoal); }
.viewer__close:focus-visible, .viewer__nav:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }

.viewer__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 0;
  padding: 0 84px 20px;
  touch-action: pan-y;        /* horizontal swipes go to our handler */
}
.viewer__img {
  max-width: 100%;
  max-height: calc(100dvh - 140px);
  object-fit: contain;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-drag: none;
}
.viewer__img.is-loading { opacity: 0.25; }

.viewer__caption {
  margin-top: 12px;
  max-width: 70ch;
  color: var(--paper-muted);
  font-size: 0.9375rem;
  text-align: center;
}
.viewer__caption:empty { display: none; }

.viewer__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.viewer__nav--prev { left: 16px; }
.viewer__nav--next { right: 16px; }

/* phones: photo uses the full width, arrows sit at the bottom within thumb reach */
@media (max-width: 640px) {
  .viewer__stage { padding: 0 0 84px; }
  .viewer__img { max-height: calc(100dvh - 190px); box-shadow: none; }
  .viewer__caption { padding: 0 16px; }
  .viewer__nav { top: auto; bottom: 16px; transform: none; }
  .viewer__nav--prev { left: calc(50% - 64px); }
  .viewer__nav--next { right: calc(50% - 64px); }
}

/* lock page scroll behind the viewer */
html.viewer-open { overflow: hidden; }

/* ---------- current page in nav ---------- */
.site-nav a[aria-current="page"] { color: var(--amber); border-bottom-color: var(--amber); }
