/* ==========================================================================
   LNMC event gallery
   Loaded only on pages that render [lnmc_gallery].
   Depends on the design tokens declared in the child theme style.css.
   ========================================================================== */

.lnmc-gallery {
  --lnmc-gallery-gap: clamp(10px, 1.6vw, 18px);
  --lnmc-gallery-radius: 14px;
  padding: clamp(56px, 8vw, 104px) 0;
  background:
    radial-gradient(
      1200px 420px at 50% -10%,
      rgba(255, 179, 0, 0.1),
      transparent 70%
    ),
    var(--lnmc-neutral-50, #fafafa);
  color: var(--lnmc-neutral-900, #2e2e2e);
}

.lnmc-gallery__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* ---- Header ------------------------------------------------------------- */

.lnmc-gallery__header {
  max-width: 68ch;
  margin: 0 auto clamp(24px, 4vw, 40px);
  text-align: center;
}

.lnmc-gallery__eyebrow {
  margin: 0 0 0.6em;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lnmc-gold-dark, #ff8f00);
}

.lnmc-gallery__title {
  margin: 0 0 0.4em;
  font-size: clamp(1.75rem, 4.2vw, 2.75rem);
  line-height: 1.15;
  color: var(--lnmc-green, #1b5e20);
  text-wrap: balance;
}

.lnmc-gallery__lede {
  margin: 0 auto;
  max-width: 60ch;
  font-size: clamp(1rem, 1.6vw, 1.075rem);
  line-height: 1.65;
  color: var(--lnmc-neutral-700, #4a4a4a);
}

.lnmc-gallery__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 0.6rem;
  margin: 1.1em 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--lnmc-neutral-700, #4a4a4a);
}

.lnmc-gallery__dot {
  opacity: 0.4;
}

.lnmc-gallery__meta-org,
.lnmc-gallery__meta-org:hover,
.lnmc-gallery__meta-org:focus {
  color: var(--lnmc-green, #1b5e20);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* ---- Grid --------------------------------------------------------------- */

.lnmc-gallery .lnmc-gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-flow: dense;
  gap: var(--lnmc-gallery-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lnmc-gallery .lnmc-gallery__item {
  position: relative;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The child theme caps prose list items at 65ch inside #main-content, and
   style.css loads after this file. Gallery tiles and hero facts are layout
   boxes rather than prose, so re-open the width for them — otherwise every
   tile is clamped to ~452px and the two-column feature tiles never fill. */
#main-content .lnmc-gallery .lnmc-gallery__item,
#main-content .lnmc-gallery-page .lnmc-gallery-hero__fact {
  max-width: none;
}

.lnmc-gallery .lnmc-gallery__figure {
  position: relative;
  margin: 0;
  height: 100%;
  border-radius: var(--lnmc-gallery-radius);
  overflow: hidden;
  background: var(--lnmc-neutral-200, #e8e8e0);
  box-shadow: 0 1px 2px rgba(14, 61, 18, 0.06);
  transition:
    box-shadow 300ms var(--lnmc-ease, ease),
    transform 300ms var(--lnmc-ease, ease);
}

.lnmc-gallery .lnmc-gallery__link {
  display: block;
  position: relative;
  /* `aspect-ratio` sizes the tile when the row height is auto; `height: 100%`
     lets it fill the row when a neighbouring feature tile is taller, otherwise
     the shorter tile leaves a strip of bare background. */
  aspect-ratio: 1 / 1;
  width: 100%;
  height: 100%;
  text-decoration: none;
  border-radius: inherit;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.lnmc-gallery .lnmc-gallery__img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  /* Bias the crop upward so faces are not cut off on group photos. */
  object-position: 50% 32%;
  transition: transform 600ms var(--lnmc-ease, ease);
  border-radius: 0;
}

.lnmc-gallery__item--wide .lnmc-gallery__link {
  aspect-ratio: 16 / 9;
}

@media (min-width: 560px) {
  .lnmc-gallery .lnmc-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lnmc-gallery__item--wide {
    grid-column: span 2;
  }
}

@media (min-width: 900px) {
  .lnmc-gallery .lnmc-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lnmc-gallery__item--wide {
    grid-column: span 2;
  }
}

/* ---- Tile interactions -------------------------------------------------- */

.lnmc-gallery__figure:hover,
.lnmc-gallery__figure:focus-within {
  box-shadow: 0 18px 40px rgba(27, 94, 32, 0.18);
  transform: translateY(-2px);
}

.lnmc-gallery__figure:hover .lnmc-gallery__img,
.lnmc-gallery__figure:focus-within .lnmc-gallery__img {
  transform: scale(1.035);
}

/* Expand affordance — always present so keyboard users can tell the tile
   opens something, but only painted on hover/focus. */
.lnmc-gallery__expand {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(14, 61, 18, 0.62);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 220ms ease;
}

.lnmc-gallery__expand::before,
.lnmc-gallery__expand::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  background: #fff;
  border-radius: 1px;
}

.lnmc-gallery__expand::before {
  width: 13px;
  height: 2px;
  transform: translate(-50%, -50%);
}

.lnmc-gallery__expand::after {
  width: 2px;
  height: 13px;
  transform: translate(-50%, -50%);
}

.lnmc-gallery__figure:hover .lnmc-gallery__expand,
.lnmc-gallery__figure:focus-within .lnmc-gallery__expand {
  opacity: 1;
}

/* Caption overlay — pointer devices only. Touch users read the caption in
   the viewer, where it has room to breathe. */
.lnmc-gallery .lnmc-gallery__caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 42px 14px 12px;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #fff;
  text-align: left;
  background: linear-gradient(
    to top,
    rgba(8, 24, 10, 0.86),
    rgba(8, 24, 10, 0)
  );
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 240ms ease,
    transform 240ms ease;
  pointer-events: none;
}

.lnmc-gallery__figure:hover .lnmc-gallery__caption,
.lnmc-gallery__figure:focus-within .lnmc-gallery__caption {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .lnmc-gallery .lnmc-gallery__caption {
    display: none;
  }
}

.lnmc-gallery .lnmc-gallery__link:focus-visible {
  outline: 3px solid var(--lnmc-gold, #ffb300);
  outline-offset: -3px;
}

.lnmc-gallery__count {
  margin: clamp(20px, 3vw, 28px) 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--lnmc-neutral-400, #9e9e9e);
}

.lnmc-gallery__empty {
  padding: 24px;
  border: 1px dashed var(--lnmc-neutral-200, #e8e8e0);
  border-radius: 10px;
  text-align: center;
}

/* ---- Viewer ------------------------------------------------------------- */

.lnmc-lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(8, 18, 10, 0.94);
  color: #fff;
  overflow: hidden;
}

.lnmc-lightbox::backdrop {
  background: rgba(8, 18, 10, 0.94);
}

.lnmc-lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lnmc-lightbox__figure {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  max-width: min(94vw, 1240px);
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
}

.lnmc-lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(94vw, 1240px);
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  border-radius: 8px;
}

.lnmc-lightbox__caption {
  max-width: 62ch;
  margin: 0;
  padding: 0 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  color: rgba(255, 255, 255, 0.86);
}

.lnmc-lightbox__button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.lnmc-lightbox__button:hover {
  background: rgba(255, 179, 0, 0.28);
  border-color: rgba(255, 179, 0, 0.75);
}

.lnmc-lightbox__button:focus-visible {
  outline: 3px solid var(--lnmc-gold, #ffb300);
  outline-offset: 2px;
}

.lnmc-lightbox__close {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}

.lnmc-lightbox__prev {
  top: 50%;
  left: max(10px, env(safe-area-inset-left));
  transform: translateY(-50%);
}

.lnmc-lightbox__next {
  top: 50%;
  right: max(10px, env(safe-area-inset-right));
  transform: translateY(-50%);
}

.lnmc-lightbox__counter {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
}

.lnmc-lightbox.is-loading .lnmc-lightbox__img {
  opacity: 0.35;
}

@media (max-width: 720px) {
  .lnmc-lightbox__prev,
  .lnmc-lightbox__next {
    top: auto;
    bottom: max(54px, calc(env(safe-area-inset-bottom) + 54px));
    transform: none;
  }

  .lnmc-lightbox__prev {
    left: calc(50% - 62px);
  }

  .lnmc-lightbox__next {
    right: calc(50% - 62px);
  }

  .lnmc-lightbox__img {
    max-height: calc(100dvh - 190px);
  }
}

body.lnmc-lightbox-open {
  overflow: hidden;
}

/* ---- Motion & contrast preferences -------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .lnmc-gallery__figure,
  .lnmc-gallery__img,
  .lnmc-gallery__expand,
  .lnmc-gallery__caption,
  .lnmc-lightbox__button {
    transition: none;
  }

  .lnmc-gallery__figure:hover,
  .lnmc-gallery__figure:focus-within {
    transform: none;
  }

  .lnmc-gallery__figure:hover .lnmc-gallery__img,
  .lnmc-gallery__figure:focus-within .lnmc-gallery__img {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  .lnmc-gallery__figure {
    outline: 2px solid var(--lnmc-green, #1b5e20);
    outline-offset: -2px;
  }

  .lnmc-gallery .lnmc-gallery__caption {
    background: #08180a;
    opacity: 1;
  }
}

@media print {
  .lnmc-gallery__expand,
  .lnmc-lightbox {
    display: none;
  }

  .lnmc-gallery .lnmc-gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Gallery page furniture — hero, context note and closing call to action.
   Only relevant on the /gallery/ page, which always renders a gallery.
   ========================================================================== */

.lnmc-gallery-page {
  --lnmc-gallery-page-wrap: 1200px;
}

.lnmc-gallery-hero {
  padding: clamp(64px, 10vw, 128px) 0 clamp(32px, 5vw, 56px);
  background:
    radial-gradient(
      900px 380px at 15% 0%,
      rgba(255, 179, 0, 0.16),
      transparent 65%
    ),
    linear-gradient(160deg, #0e3d12 0%, #1b5e20 62%, #2e7d32 100%);
  color: #fff;
}

.lnmc-gallery-hero__inner,
.lnmc-gallery-note__inner,
.lnmc-gallery-cta__inner {
  max-width: var(--lnmc-gallery-page-wrap);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

.lnmc-gallery-hero__eyebrow {
  margin: 0 0 0.75em;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lnmc-gold-light, #ffe082);
}

.lnmc-gallery-hero__title {
  margin: 0 0 0.35em;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.05;
  color: #fff;
  text-wrap: balance;
}

.lnmc-gallery-hero__lede {
  max-width: 62ch;
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
}

.lnmc-gallery-hero__facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  margin: clamp(28px, 4vw, 44px) 0 0;
  padding: 0;
  list-style: none;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
}

.lnmc-gallery-hero__fact {
  margin: 0;
  padding: 16px 18px;
  list-style: none;
  background: rgba(255, 255, 255, 0.07);
}

.lnmc-gallery-hero__fact strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--lnmc-gold-light, #ffe082);
}

.lnmc-gallery-hero__fact span {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.78);
}

@media (min-width: 640px) {
  .lnmc-gallery-hero__facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---- Context note ------------------------------------------------------- */

.lnmc-gallery-note {
  padding: clamp(48px, 7vw, 88px) 0;
  background: var(--lnmc-neutral-100, #f5f5f0);
}

.lnmc-gallery-note__inner {
  max-width: 74ch;
}

.lnmc-gallery-note h2 {
  margin: 0 0 0.6em;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  color: var(--lnmc-green, #1b5e20);
}

.lnmc-gallery-note p {
  margin: 0 0 1em;
  font-size: 1.0125rem;
  line-height: 1.72;
  color: var(--lnmc-neutral-700, #4a4a4a);
}

.lnmc-gallery-note__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 1.6em 0 0;
  padding: 0;
  list-style: none;
}

.lnmc-gallery-note__links li {
  margin: 0;
  list-style: none;
}

.lnmc-gallery-note__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(27, 94, 32, 0.28);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--lnmc-green, #1b5e20);
  text-decoration: none;
  background: #fff;
  transition:
    border-color 200ms ease,
    background 200ms ease,
    color 200ms ease;
}

.lnmc-gallery-note__links a:hover,
.lnmc-gallery-note__links a:focus-visible {
  border-color: var(--lnmc-green, #1b5e20);
  background: var(--lnmc-green, #1b5e20);
  color: #fff;
}

.lnmc-gallery-note__links a:focus-visible {
  outline: 3px solid var(--lnmc-gold, #ffb300);
  outline-offset: 2px;
}

/* ---- Closing call to action --------------------------------------------- */

.lnmc-gallery-cta {
  padding: clamp(52px, 8vw, 96px) 0;
  background: #fff;
}

.lnmc-gallery-cta__inner {
  max-width: 66ch;
  text-align: center;
}

.lnmc-gallery-cta h2 {
  margin: 0 0 0.5em;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  color: var(--lnmc-green, #1b5e20);
  text-wrap: balance;
}

.lnmc-gallery-cta p {
  margin: 0 auto 1.6em;
  max-width: 54ch;
  font-size: 1.0125rem;
  line-height: 1.7;
  color: var(--lnmc-neutral-700, #4a4a4a);
}

.lnmc-gallery-cta__button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 30px;
  border-radius: 999px;
  font-weight: 600;
  color: #1b3d05;
  text-decoration: none;
  background: linear-gradient(135deg, #ffb300, #ff8f00);
  box-shadow: 0 10px 24px rgba(255, 143, 0, 0.28);
  transition:
    transform 200ms var(--lnmc-ease, ease),
    box-shadow 200ms var(--lnmc-ease, ease);
}

.lnmc-gallery-cta__button:hover,
.lnmc-gallery-cta__button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 143, 0, 0.34);
  color: #1b3d05;
}

.lnmc-gallery-cta__button:focus-visible {
  outline: 3px solid #1b5e20;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .lnmc-gallery-note__links a,
  .lnmc-gallery-cta__button {
    transition: none;
  }

  .lnmc-gallery-cta__button:hover,
  .lnmc-gallery-cta__button:focus-visible {
    transform: none;
  }
}
