/* =========================================================================
   Gallery (/gallery/) — styles used by this page only. Classes: .gallery-*
   Solid navbar (no hero photo), text page title with the filter chips beside
   it, dense photo grid with "Show all", the three buildings, shared lightbox (tuned below), shared footer.
   Behaviour: assets/js/gallery.js.
   ========================================================================= */

@keyframes gallery-fade-up { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   Page title
   ========================================================================= */
.gallery-head { padding: 132px 24px 0; }
/* Title on the left and the photo filters on the right, over one hairline (layout B, 17 Nov 2026, FX-100). The
   filters drop under the title when the row is too narrow for both. */
.gallery-head__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-hairline);
}
.gallery-head__titles { min-width: 0; }
.gallery-head__item {
  max-width: var(--container-wide);
  margin: 0 auto;
  animation: gallery-fade-up 800ms var(--ease-out-soft) both;
}
.gallery-head__item:nth-child(2) { animation-delay: 110ms; }
.gallery-head__item.gallery-head__item--lede { animation-delay: 220ms; }

.gallery-head__title {
  margin-top: 10px;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: var(--tracking-display);
}
.gallery-head__lede {
  margin-top: 16px;
  max-width: var(--measure-narrow); /* 56ch of the lede's own font size */
  font-size: var(--text-size-body);
  line-height: 1.7;
  color: var(--text-body);
}

/* =========================================================================
   Filter chips
   ========================================================================= */
/* The three buildings: a short definition list below the photos, under its own hairline and heading
   (17 Nov 2026, FX-100; it sat between the title and the filter chips). */
.gallery-buildings { padding: 0 24px 96px; }
.gallery-buildings__inner { max-width: var(--container-wide); margin: 0 auto; padding-top: 40px; border-top: 1px solid var(--border-hairline); }
.gallery-buildings__title { margin-bottom: 22px; font-size: clamp(26px, 3vw, 36px); line-height: 1.1; }
.gallery-buildings__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px 40px;
}
.gallery-buildings__name { margin-bottom: 6px; }
.gallery-buildings__text {
  max-width: 46ch;
  color: var(--text-body);
  font-size: var(--text-small);
  line-height: 1.7;
}

.gallery-chips__group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  animation: gallery-fade-up 700ms var(--ease-out-soft) both;
}
/* The chips only work with JavaScript; keep their space so nothing shifts when it starts. */
html:not(.eb-js) .gallery-chips__group { visibility: hidden; }

.gallery-chip {
  padding: 9px 14px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: normal;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition:
    background 160ms var(--ease-out-soft),
    color 160ms var(--ease-out-soft),
    border-color 160ms var(--ease-out-soft);
}
.gallery-chip[aria-pressed="true"] {
  background: var(--action-primary);
  border-color: var(--action-primary);
  color: var(--white);
}
/* Hover shades only where there is a mouse: on touch screens a tapped chip kept its hover shade (EB-103, 13 Nov 2026). */
@media (hover: hover) {
  .gallery-chip[aria-pressed="false"]:hover {
    background: var(--stucco-200);
    border-color: var(--border-strong);
    color: var(--text-heading);
  }
  .gallery-chip[aria-pressed="true"]:hover {
    background: var(--action-primary-hover);
    border-color: var(--action-primary-hover);
  }
}
.gallery-chip:active { transform: scale(.97); }

/* =========================================================================
   Photo grid
   Spans follow each tile's position among the tiles shown (i % 9):
   0 → 2×2 (--big), 4 → 2×1 (--wide), 6 → 1×2 (--tall). gallery.js
   recomputes them on every filter change. The holes "dense" leaves at
   3 columns are as designed.
   ========================================================================= */
.gallery-photos { padding: 24px 24px 64px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 188px;
  grid-auto-flow: dense;
  gap: 12px;
  max-width: var(--container-wide);
  margin: 0 auto;
}
.gallery-tile {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--stucco-300);
  cursor: zoom-in;
  /* reveal (gallery.js): 22px rise + .985 scale, 620ms, staggered */
  --reveal-y: 22px;
  --reveal-scale: .985;
  --reveal-fade: 620ms;
  --reveal-move: 620ms;
}
.gallery-tile--big { grid-column: span 2; grid-row: span 2; }
.gallery-tile--wide { grid-column: span 2; }
.gallery-tile--tall { grid-row: span 2; }
.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--crop, 50% 50%);
  filter: sepia(.10) saturate(1.04);
  transition:
    transform 640ms var(--ease-out-soft),
    filter 320ms var(--ease-out-soft);
}
@media (hover: hover) {
  .gallery-tile:hover img { transform: scale(1.045); }
}
.gallery-tile:focus-visible { outline: 3px solid var(--pool-500); outline-offset: 3px; }
/* Without JavaScript the lightbox can't open, so the tiles don't promise a zoom. EB-089. */
@media (scripting: none) {
  .gallery-tile { cursor: auto; }
}

/* "Show all N photos" */
.gallery-more {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding-top: 56px;
  text-align: center;
}
.gallery-more[data-reveal] {
  --reveal-y: 30px;
  --reveal-scale: 1;
  --reveal-fade: 700ms;
  --reveal-move: 700ms;
}
.gallery-more__btn {
  padding: 13px 26px;
  border: 1px solid var(--pool-600);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--pool-600);
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: normal;
  letter-spacing: .14em;
  text-transform: uppercase;
  transition:
    background 160ms var(--ease-out-soft),
    color 160ms var(--ease-out-soft),
    border-color 160ms var(--ease-out-soft);
}
@media (hover: hover) { /* mouse only (EB-103, 13 Nov 2026) */
  .gallery-more__btn:hover {
    background: var(--pool-600);
    border-color: var(--pool-600);
    color: var(--white);
  }
}
.gallery-more__btn:active { transform: scale(.98); }

/* =========================================================================
   Lightbox (shared component, tuned to the Gallery design)
   ========================================================================= */
body[data-page="gallery"] .eb-lightbox__img { animation: eb-box-in 380ms var(--ease-out-soft) both; }
/* The strip starts at the left edge, even when it fits. */
body[data-page="gallery"] .eb-lightbox__thumbs > :first-child { margin-left: 0; }
body[data-page="gallery"] .eb-lightbox__thumbs > :last-child { margin-right: 0; }
/* The Gallery design gives the viewer's arrows and close button no hover
   state (only the Rooms viewer brightens them), so hover keeps each rest
   colour: .14 here, .2 on touch screens, .22 at ≤1100px, and the 65% ink
   disc in upright windows (end of file). */
body[data-page="gallery"] .eb-lightbox__nav:hover,
body[data-page="gallery"] .eb-lightbox__close:hover { background: rgba(251,247,239,.14); }
@media (hover: none) {
  body[data-page="gallery"] .eb-lightbox__nav:hover { background: rgba(251,247,239,.2); }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1100px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 164px; }
}
@media (max-width: 820px) {
  .gallery-head { padding: 120px 20px 0; }
  .gallery-buildings { padding: 0 20px 72px; }
  .gallery-head__bar { padding-bottom: 14px; }
}
@media (max-width: 760px) {
  .gallery-chip { min-height: 40px; font-size: var(--text-label); }
}
@media (max-width: 680px) {
  .gallery-head { padding: 112px 18px 0; }
  /* Title, then the filters on their own full-width row. */
  .gallery-head__bar { display: block; }
  .gallery-buildings { padding: 0 18px 64px; }
  .gallery-head__title { font-size: clamp(36px, 10vw, 52px); }
  /* The row scrolls sideways here, and a scroll box clips what pokes out of it: 2px of room above (taken back with
     the margin) keeps the top of each chip's 44px touch area, which was cut to 42.5px (EB-101, 13 Nov 2026). */
  .gallery-chips__group {
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 12px; /* 14px under the title, less the 2px of room above */
    padding-top: 2px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .gallery-chips__group::-webkit-scrollbar { display: none; }
  .gallery-chip { flex: none; padding: 7px 11px; white-space: nowrap; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 132px; gap: 8px; }
}
@media (max-width: 430px) {
  .gallery-head { padding: 106px 16px 0; }
  .gallery-buildings { padding: 0 16px 56px; }
  .gallery-head__lede { font-size: 15px; }
  .gallery-grid { grid-auto-rows: 118px; gap: 6px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .gallery-head { padding: 96px 24px 0; }
  .gallery-buildings { padding: 0 24px 56px; }
}
/* "The sign" has too few photos for phones; the chip is hidden there. */
@media (max-width: 760px), (orientation: landscape) and (max-height: 500px) {
  .gallery-chip--sign { display: none; }
}

/* Upright phones */
@media (max-width: 760px) and (orientation: portrait) {
  .gallery-head { padding: 96px 18px 0; }
  .gallery-buildings { padding: 0 18px 56px; }
  .gallery-buildings__inner { padding-top: 32px; }
  /* All four filters on one row (Oliver, 19 Nov 2026; "Grounds" wrapped to a second row on a 393px iPhone): tighter
     padding, gaps and letter spacing, still 13px: one row from 360px wide. A narrower screen still wraps, rather than scroll. */
  .gallery-chips__group { flex-wrap: wrap; justify-content: center; gap: 6px; overflow: visible; }
  .gallery-chip { padding: 0 8px; letter-spacing: .03em; }
  .gallery-photos { padding: 20px 16px 40px; }
  .gallery-more { padding-top: 32px; }
  .gallery-more__btn { min-height: 48px; }
  body[data-page="gallery"] .eb-lightbox { --lb-pad: 64px 12px 150px; --lb-close-inset: 20px; --lb-thumb-w: 96px; --lb-thumb-h: 66px; }
  body[data-page="gallery"] .eb-lightbox__counter { bottom: 112px; }
  body[data-page="gallery"] .eb-lightbox__nav:hover { background: rgba(251,247,239,.22); }
  /* "The sign" (5 photos; reachable here only by resizing after picking it):
     one full-width 4:5 photo per row, no spans. */
  .gallery-grid[data-filter="The sign"] { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .gallery-grid[data-filter="The sign"] > .gallery-tile { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 4 / 5; }
}

/* Phones on their side */
@media (orientation: landscape) and (max-height: 500px) {
  .gallery-head { padding: 84px 28px 0; }
  .gallery-buildings { padding: 0 28px 56px; }
  .gallery-buildings__inner { padding-top: 32px; }
  .gallery-chips__group { justify-content: center; }
  .gallery-chip { min-height: 40px; }
  .gallery-photos { padding: 20px 28px 40px; }
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 140px; gap: 8px; }
  .gallery-more { padding-top: 28px; }
  body[data-page="gallery"] .eb-lightbox { --lb-pad: 16px 84px 96px; --lb-close-inset: 20px; --lb-thumb-w: 72px; --lb-thumb-h: 50px; }
  body[data-page="gallery"] .eb-lightbox__counter { display: block; bottom: 68px; }
  /* "The sign": two 4:3 photos per row, no spans. */
  .gallery-grid[data-filter="The sign"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; }
  .gallery-grid[data-filter="The sign"] > .gallery-tile { grid-column: auto; grid-row: auto; aspect-ratio: 4 / 3; }
}

/* =========================================================================
   Reduced motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .gallery-head__item,
  .gallery-chips__group,
  body[data-page="gallery"] .eb-lightbox__img { animation: none; }
  .gallery-tile img { transition: none; }
  .gallery-tile:hover img { transform: none; }
  .gallery-chip:active,
  .gallery-more__btn:active { transform: none; }
}

/* Touch screens: 44×44px minimum hit area for the filter chips (40px tall on phones),
   as components.css does for buttons and text links. Nothing moves. */
@media (pointer: coarse) {
  .gallery-chip { position: relative; }
  .gallery-chip::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
}

/* Upright windows: the arrows sit over the photo on a 65% ink disc (components.css, gap C11). Hover keeps that rest
   colour, as everywhere in this viewer. It matters on phones, where a tapped arrow stays in :hover. Last in the file
   so it wins over the hover rules above. */
@media (orientation: portrait) {
  body[data-page="gallery"] .eb-lightbox__nav:hover { background: rgba(36,28,23,.65); }
}
