/* ==========================================================================
   Happy Travellers — gallery, filters and lightbox
   --------------------------------------------------------------------------
   Kept in its own file rather than added to style.css: this is the only page
   that uses any of it, and every other page already pays for style.css on
   first load. Tokens, buttons and section rhythm all come from style.css —
   nothing here redefines the design system.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Hero trust line
   -------------------------------------------------------------------------- */
.ht-microcopy {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.6rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.ht-microcopy svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: #86d18d;
}

/* --------------------------------------------------------------------------
   2. Filters
   -------------------------------------------------------------------------- */
.ht-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 2.4rem 0 0;
  padding: 0;
  list-style: none;
}

.ht-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.ht-filter:hover {
  border-color: rgba(46, 59, 93, 0.3);
  color: var(--ink);
}

.ht-filter__count {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-mute);
}

/* aria-pressed is the state, so the styling hangs off it rather than off a
   class kept in sync by hand. */
.ht-filter[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.ht-filter[aria-pressed="true"] .ht-filter__count {
  color: rgba(255, 255, 255, 0.72);
}

/* --------------------------------------------------------------------------
   3. Masonry gallery
   --------------------------------------------------------------------------
   CSS multi-column gives true masonry with no JavaScript measuring and no
   layout thrash when a filter changes. Photographs keep their own
   proportions, which is the whole reason for a masonry layout here.
   -------------------------------------------------------------------------- */
.ht-gallery {
  margin-top: 2.6rem;
  columns: 3;
  column-gap: 1.4rem;
}

.ht-card {
  break-inside: avoid;
  margin: 0 0 1.4rem;
  padding: 0;
  border: 0;
  width: 100%;
  display: block;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: zoom-in;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.ht-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.ht-card:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.ht-card__img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--cream-deep);
}

/* These three are spans, not block elements: the card is a <button>, whose
   content model allows phrasing content only. So they have to be told to
   behave as blocks — left inline, the place and date run together on one
   line and the last line is clipped by the card's overflow. */
.ht-card__meta {
  display: block;
  padding: 1rem 1.15rem 1.15rem;
}

.ht-card__place {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.ht-card__sub {
  display: block;
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  color: var(--ink-mute);
}

/* Hidden by a filter. Using hidden rather than a class keeps the state in one
   place and keeps the card out of the accessibility tree too. */
.ht-card[hidden] {
  display: none;
}

.ht-empty {
  margin-top: 2rem;
  color: var(--ink-mute);
}

/* --------------------------------------------------------------------------
   4. Lightbox
   -------------------------------------------------------------------------- */
.ht-lightbox {
  position: fixed;
  inset: 0;
  /* Above every fixed thing the site already has: floaters 150, drawer 190,
     header 200, reading-progress bar 300. A modal that the sticky header
     punches through is not a modal. */
  z-index: 400;
  display: flex;
  flex-direction: column;
  background: rgba(13, 20, 36, 0.975);
  opacity: 0;
  visibility: hidden;
  /* visibility is stepped, not eased: it waits out the fade on the way out,
     and flips immediately on the way in. Easing it in as well left the
     overlay still `hidden` on the frame the dialog opened, and a browser
     will not move focus into something invisible — so the close button
     never received focus and keyboard users stayed on the page behind. */
  transition: opacity 0.28s var(--ease), visibility 0s linear 0.28s;
}

.ht-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s var(--ease), visibility 0s linear 0s;
}

.ht-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem clamp(0.85rem, 3vw, 1.6rem);
  flex: 0 0 auto;
}

.ht-lightbox__stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 0;
  padding: 0 clamp(0.5rem, 2vw, 1.6rem);
}

.ht-lightbox__figure {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.ht-lightbox__img {
  display: block;
  max-width: min(100%, 1400px);
  max-height: 68vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
}

.ht-lightbox__cap {
  text-align: center;
  color: #fff;
  padding: 0 0.5rem;
}

.ht-lightbox__place {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  font-weight: 600;
  line-height: 1.25;
}

.ht-lightbox__sub {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.74);
}

.ht-lightbox__foot {
  flex: 0 0 auto;
  padding: 0.9rem 1rem 1.4rem;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

/* Controls — 48px so they clear WCAG 2.2 target size on touch with room to
   spare, and they sit on a solid tint so they never vanish into a pale sky. */
.ht-ctrl {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: 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.1);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.ht-ctrl:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.5);
}

.ht-ctrl:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.ht-ctrl svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Background must not scroll behind the lightbox. Fixing the body would lose
   the scroll position, so overflow is enough here. */
body.ht-locked {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   5. Trust panel
   -------------------------------------------------------------------------- */
.ht-trust {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.ht-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.ht-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--line-light);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.ht-link:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.34);
}

.ht-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   6. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .ht-trust {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .ht-gallery {
    columns: 2;
  }
}

/* On a phone the two 48px arrows either side of the photograph were taking a
   quarter of the screen: a 1280px-wide group photo was rendering into 247px
   on a 375px viewport. Below this width they wrap underneath the caption
   instead, and the photograph gets the full screen. */
@media (max-width: 700px) {
  .ht-lightbox__stage {
    flex-wrap: wrap;
    align-content: center;
    gap: 1rem 1.25rem;
  }

  .ht-lightbox__figure {
    flex: 0 0 100%;
    order: 1;
  }

  .ht-ctrl {
    order: 2;
  }
}

@media (max-width: 620px) {
  .ht-lightbox__img {
    max-height: 58vh;
  }
}

@media (max-width: 560px) {
  .ht-gallery {
    columns: 1;
    column-gap: 0;
  }

  .ht-filter {
    padding: 0.55rem 0.95rem;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ht-card,
  .ht-lightbox {
    transition: none;
  }

  .ht-card:hover {
    transform: none;
  }
}
