/* Gallery page. Loaded after home.css (contact card) and pages.css (page hero). */

/* Hero: a fanned stack of three photos */
.g-hero__count { margin-top: 1.5rem; font: 600 var(--text-sm) var(--font-display); letter-spacing: 0.04em; color: var(--ink-2); }
.g-hero__count strong { font-size: var(--text-xl); color: var(--ink); letter-spacing: -0.03em; }
.g-hero__count span { margin-inline: 0.5rem; color: var(--line-strong); }
.g-stack { position: relative; aspect-ratio: 5 / 4; max-width: 520px; width: 100%; justify-self: end; }
.g-stack__img {
  position: absolute;
  width: 68%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--mist);
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform var(--duration) var(--ease-out);
}
.g-stack__img--1 { left: 0; top: 14%; z-index: 3; transform: rotate(-5deg); }
.g-stack__img--2 { right: 0; top: 0; z-index: 2; transform: rotate(6deg); box-shadow: 6px 6px 0 var(--amber); }
.g-stack__img--3 { right: 8%; bottom: 0; z-index: 1; transform: rotate(-2deg); box-shadow: 6px 6px 0 var(--teal); }
.g-stack:hover .g-stack__img--1 { transform: rotate(-8deg) translate(-6px, -4px); }
.g-stack:hover .g-stack__img--2 { transform: rotate(9deg) translate(6px, -6px); }
@media (max-width: 1039px) { .g-stack { justify-self: start; max-width: 440px; } }
@media (max-width: 520px) { .g-stack { display: none; } }

/* Filters (shown once JavaScript runs) */
.g-filters[hidden] { display: none; }
.g-filters {
  position: sticky;
  top: 76px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3rem);
  padding: 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(10px);
  width: fit-content;
  max-width: 100%;
}
@media (max-width: 900px) {
  /* One scrollable row, so the sticky bar stays short on phones and tablets */
  .g-filters { top: 68px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding: 0.4rem; }
  .g-filters::-webkit-scrollbar { display: none; }
  .g-filter { flex-shrink: 0; padding: 0.45rem 0.8rem; }
}
.g-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border: 2px solid transparent;
  border-radius: 999px;
  background: none;
  font: 700 var(--text-sm) var(--font-body);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}
.g-filter::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c); transform: rotate(45deg); }
.g-filter span { font-size: var(--text-xs); color: var(--ink-3); }
.g-filter:hover { border-color: var(--line-strong); color: var(--ink); }
.g-filter[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.g-filter[aria-pressed="true"]::before { background: var(--amber); }
.g-filter[aria-pressed="true"] span { color: var(--on-navy-2); }

/* Albums */
.albums { display: grid; gap: clamp(3.5rem, 2.5rem + 3vw, 5.5rem); }
.album { scroll-margin-top: 150px; }
.album[hidden] { display: none; }
.album__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.35rem 1.5rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--ink);
}
.album__head > * { grid-column: 1; min-width: 0; }
.album__tag {
  justify-self: start;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--c);
  color: var(--cf, var(--ink));
  font: 700 var(--text-xs) var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.album__head h2 { margin-top: 0.5rem; font-size: var(--text-xl); letter-spacing: -0.03em; }
.album__place { color: var(--ink-2); font-weight: 600; }
.album__meta { grid-column: 2; grid-row: 1 / span 3; align-self: end; font-size: var(--text-sm); font-weight: 600; color: var(--ink-3); white-space: nowrap; }
@media (max-width: 640px) {
  .album__head { grid-template-columns: 1fr; }
  .album__meta { grid-column: 1; grid-row: auto; white-space: normal; }
}

/* Justified rows: each photo grows in proportion to its aspect ratio, so a row shares one height
   and nothing is cropped. The ::after filler stops a short last row from stretching. */
.album__grid { --row: 230px; display: flex; flex-wrap: wrap; gap: 10px; }
.album__grid::after { content: ""; flex-grow: 1000; }
@media (max-width: 760px) { .album__grid { --row: 150px; gap: 8px; } }
@media (max-width: 420px) { .album__grid { --row: 110px; gap: 6px; } }
.album__grid li { flex: var(--r) 1 calc(var(--r) * var(--row)); max-width: 100%; }
.album__grid a {
  display: block;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--mist-2);
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.album__grid img { display: block; width: 100%; height: auto; transition: transform var(--duration) var(--ease-out); }
.album__grid a:hover { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--c); }
.album__grid a:hover img { transform: scale(1.04); }
.album__grid a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.g-source { margin-top: clamp(3rem, 2rem + 3vw, 4.5rem); font-size: var(--text-sm); color: var(--ink-3); }
.g-main + .lightbox + .contact { padding-top: 0; }

/* Lightbox */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: clamp(3.5rem, 2rem + 4vw, 5rem) clamp(0.75rem, 0.5rem + 4vw, 6rem) 1.25rem;
  border: 0;
  background: rgb(21 34 60 / 0.96);
  color: var(--on-navy);
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgb(21 34 60 / 0.6); }
.lightbox__figure { display: grid; gap: 0.9rem; justify-items: center; max-width: 100%; max-height: 100%; margin: 0; }
.lightbox__img {
  max-width: 100%;
  max-height: calc(100dvh - 11rem);
  width: auto;
  height: auto;
  border-radius: var(--radius);
  border: 2px solid rgb(255 255 255 / 0.2);
  background: rgb(255 255 255 / 0.04);
  touch-action: pan-y;
}
.lightbox__caption { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.4rem 1.1rem; font-size: var(--text-sm); text-align: center; }
.lightbox__count { color: var(--on-navy-2); font-variant-numeric: tabular-nums; }
.lightbox__original { color: var(--amber); font-weight: 700; }
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border: 2px solid rgb(255 255 255 / 0.3);
  border-radius: 50%;
  background: rgb(21 34 60 / 0.6);
  color: var(--white);
  cursor: pointer;
  transition: background-color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast) var(--ease-out);
}
.lightbox__btn svg { width: 24px; height: 24px; }
.lightbox__btn:hover { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.lightbox__btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.lightbox__btn--close { top: 1rem; right: 1rem; }
.lightbox__btn[hidden] { display: none; }
.lightbox__btn--prev { left: 1rem; top: 50%; translate: 0 -50%; }
.lightbox__btn--prev svg { rotate: 90deg; }
.lightbox__btn--next { right: 1rem; top: 50%; translate: 0 -50%; }
.lightbox__btn--next svg { rotate: -90deg; }
@media (max-width: 640px) {
  .lightbox__btn--prev, .lightbox__btn--next { top: auto; bottom: 1rem; translate: none; }
  .lightbox { padding-bottom: 5.5rem; }
  .lightbox__img { max-height: calc(100dvh - 13rem); }
}
@media (prefers-reduced-motion: reduce) {
  .g-stack__img, .album__grid img, .album__grid a, .g-filter, .lightbox__btn { transition: none; }
}

/* No albums yet (WordPress) */
.g-empty { padding: 2rem; border: 2px dashed var(--line-strong); border-radius: var(--radius); text-align: center; color: var(--ink-2); }
