/* ==========================================================================
   LIMM — Clinical Editorial
   photo.css · gallery header, sticky year nav, justified year grids, lightbox
   Depends on tokens.css + layout.css. Adds nothing to them.
   ========================================================================== */

/* Page-scoped override of the token in tokens.css: this page stacks a second
   sticky bar (the 63px year nav) under the compacted masthead, so an anchor
   jump has to clear both or the year numeral lands behind the chips. */
:root { scroll-padding-top: calc(var(--nav-h-compact) + 84px); }

/* ---- Page header --------------------------------------------------------- */
.gal-head { padding-bottom: clamp(40px, 4.5vw, 72px); }

.gal-head__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--navy);
}
.gal-head__meta b { color: var(--accent-ink); font-weight: 500; }
.gal-head__meta span:last-child { color: var(--muted); }

.gal-head__title {
  grid-column: 1 / 8;
  font-size: var(--text-hero);
  font-weight: 300;
  margin-block: clamp(40px, 4.5vw, 76px) 0;
}
.gal-head__sub {
  grid-column: 9 / 13;
  align-self: end;
  padding-bottom: 0.9rem;
  font-size: var(--text-lead);
  line-height: 1.45;
  color: var(--navy);
  text-wrap: pretty;
}
.gal-head__sub b {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 60;
  font-weight: 500;
  font-size: 1.25em;
  color: var(--ink);
}
@media (max-width: 1023px) {
  .gal-head__title { grid-column: 1 / 7; }
  .gal-head__sub   { grid-column: 1 / 6; align-self: start; padding-bottom: 0; margin-top: 28px; }
}
@media (max-width: 640px) {
  .gal-head__meta  { flex-direction: column; gap: 6px; }
  .gal-head__title { grid-column: 1 / 5; }
  .gal-head__sub   { grid-column: 1 / 5; }
}

/* ---- Sticky year sub-navigation ------------------------------------------
   Same component as the Members group nav; duplicated here because that rule
   set lives in members.css, which this page does not load.                   */
.ynav {
  position: sticky;
  top: var(--nav-h-compact);
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-block: 1px solid var(--rule);
}
.ynav__inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-block: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ynav__inner::-webkit-scrollbar { display: none; }
.ynav__label { flex: 0 0 auto; color: var(--muted); margin-right: 8px; }
.ynav__chips { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.ynav__chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 8px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.ynav__chip i { font-style: normal; color: var(--muted); transition: color var(--dur) var(--ease); }
.ynav__chip:hover { color: var(--ink); border-color: var(--ink); }
.ynav__chip:active { background: var(--paper-2); }
.ynav__chip.is-active {
  color: var(--ink);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.ynav__chip.is-active i { color: var(--accent-ink); }

/* ---- Year group ---------------------------------------------------------- */
.ygroup { padding-block: clamp(48px, 5vw, 88px) 0; }
.ygroup:last-of-type { padding-bottom: clamp(56px, 6vw, 96px); }

.ygroup__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: var(--gutter);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: clamp(24px, 2.6vw, 40px);
}
.ygroup__year {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 144;
  font-weight: 300;
  font-size: clamp(3rem, 0.7rem + 6.4vw, 6.5rem);
  line-height: 0.86;
  letter-spacing: -0.04em;
  font-feature-settings: "tnum";
}
.ygroup__count { color: var(--muted); padding-bottom: 0.6em; white-space: nowrap; }
.ygroup__count b { color: var(--accent-ink); font-weight: 500; }

/* ---- Justified rows ------------------------------------------------------
   Row widths and heights are computed in photo.js from the real pixel
   dimensions in photos.json, so nothing is ever cropped by the layout.      */
.jgrid { display: block; }
.jrow { display: flex; align-items: flex-start; }
.jrow:last-child { margin-bottom: 0 !important; }

.pf { margin: 0; min-width: 0; flex: 0 0 auto; }

.pf__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
}
.pf__media { display: flex; gap: 8px; overflow: hidden; }
.pf__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--paper-2);
  transition: transform 600ms var(--ease), opacity var(--dur) var(--ease);
}
.pf__btn:hover .pf__media img { transform: scale(1.025); }
.pf__media > span { display: block; overflow: hidden; flex: 0 0 auto; }

.pf__cap {
  position: relative;
  padding-top: 14px;
  margin-top: 26px;
  border-top: 1px solid var(--rule-soft);
}
/* The accent marker grows across the caption rule on hover — the site's link
   language, applied to a photograph. */
.pf__cap::before {
  content: "";
  position: absolute; top: -1px; left: 0;
  width: 8px; height: 2px;
  background: var(--accent);
  transition: width var(--dur) var(--ease);
}
.pf__btn:hover .pf__cap::before,
.pf__btn:focus-visible .pf__cap::before { width: 100%; }

.pf__title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  text-wrap: pretty;
}
.pf__meta {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pf__meta em { font-style: normal; color: var(--accent-ink); }

.gal__error { padding-block: 40px; color: var(--muted); }

/* ---- Footer callout ------------------------------------------------------ */
.gal-note {
  border-top: 1px solid var(--rule);
  padding-block: clamp(28px, 3vw, 44px) clamp(48px, 5vw, 80px);
}
.gal-note p {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: var(--muted);
  max-width: 72ch;
  text-transform: none;
  letter-spacing: 0.04em;
  line-height: 1.6;
}
.gal-note p::before {
  content: "";
  flex: 0 0 auto;
  width: 40px; height: 1px;
  margin-top: 0.62em;
  background: var(--accent);
}

/* ---- Lightbox ------------------------------------------------------------ */
.lb {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  /* The ground is painted on the dialog as well as the backdrop: the masthead
     runs a backdrop-filter, and a filtered surface can still ghost through a
     ::backdrop alone. Both layers are in the top layer, so nothing bleeds. */
  background: rgba(11, 31, 51, 0.94);
  color: var(--paper);
  overflow: hidden;
}
.lb::backdrop { background: rgba(11, 31, 51, 0.94); }

.lb__panel {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: clamp(14px, 2vw, 26px) clamp(16px, 3vw, 40px) clamp(16px, 2vw, 28px);
}

.lb__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: color-mix(in srgb, var(--paper) 66%, transparent);
}
.lb__top b { color: var(--accent); font-weight: 500; }

.lb__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.lb__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: rgba(246, 245, 241, 0.06);
}

.lb__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(16px, 3vw, 48px);
  padding-top: 14px;
  border-top: 1px solid rgba(246, 245, 241, 0.24);
}
.lb__cap { min-width: 0; }
.lb__cap b {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: 1.4;
  text-wrap: pretty;
}
.lb__cap span {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 62%, transparent);
}
.lb__cap span em { font-style: normal; color: var(--accent); }

.lb__controls { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.lb__count { color: color-mix(in srgb, var(--paper) 66%, transparent); min-width: 6ch; text-align: center; }
.lb__count b { color: var(--paper); font-weight: 500; }

.lb__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(246, 245, 241, 0.32);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.lb__btn:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.lb__btn:active { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.lb__btn:disabled { opacity: 0.35; cursor: default; background: none; border-color: rgba(246, 245, 241, 0.2); color: var(--paper); }
.lb__btn svg { display: block; }
.lb :focus-visible { outline-color: var(--accent); }

@media (max-width: 640px) {
  .lb__foot { flex-direction: column; align-items: stretch; gap: 14px; }
  .lb__controls { justify-content: space-between; }
  .lb__btn span { display: none; }
}
