/* The photo gallery (gallery.html). Markup from scripts/build-gallery-page.mjs,
   behaviour from assets/gallery.js.

   Same visual language as the departures page (assets/departures.css):
   Poppins at regular weight for reading text, navy #0F1F63 at weight 600 for
   names and links, Avenir capitals for titles, white cards with a 1px slate
   border and a 12px radius.

   The photos sit in a justified grid: each item's flex-grow and flex-basis
   are its width / height (--r), so every photo in a row ends up the same
   height and none is cropped. The row heights (--h) are also in the
   builder, which works out each photo's `sizes` from them. */

.tc-gal {
  --gal-navy: #0f1f63;
  --gal-ink: #334155;
  --gal-muted: #64748b;
  --gal-line: #e2e8f0;
  --gal-tint: #f8fafc;
  --gal-sea: #0e7490;
  --gal-wa: #25d366;
  --gal-wa-hover: #1da851;
  color: var(--gal-ink);
  font-weight: 400;
}

.tc-gal__wrap {
  max-width: 80rem;
  margin: 0 auto;
  padding: 8.5rem 1rem 5rem;
}

@media (min-width: 768px) {
  .tc-gal__wrap {
    padding: 9.5rem 2rem 6rem;
  }
}

.tc-gal p,
.tc-gal h1,
.tc-gal h2,
.tc-gal h3,
.tc-gal figure {
  margin: 0;
}

.tc-gal b {
  font-weight: 600;
}

.tc-gal__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tc-gal [hidden] {
  display: none !important;
}

.tc-gal a:focus-visible,
.tc-gal button:focus-visible {
  outline: 2px solid var(--gal-navy);
  outline-offset: 2px;
}

.tc-gal__icon {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
}

.tc-gal__arrow {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  transition: transform 0.15s ease;
}

/* --- Page head ----------------------------------------------------------- */

.tc-gal__head {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 0.25rem;
  text-align: center;
}

.tc-gal__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem !important;
  color: var(--gal-sea);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tc-gal__title {
  color: var(--gal-navy);
  font-family: avenir, Poppins, sans-serif;
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  text-wrap: balance;
}

.tc-gal__lead {
  margin-top: 0.75rem !important;
  color: var(--gal-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.tc-gal__facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

.tc-gal__facts li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tc-gal__facts .tc-gal__icon {
  color: var(--gal-navy);
}

.tc-gal__facts a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-underline-offset: 3px;
}

.tc-gal__facts a:hover {
  color: var(--gal-navy);
  text-decoration-color: currentColor;
}

/* --- Filters ------------------------------------------------------------- */

.tc-gal__filters {
  display: flex;
  gap: 0.5rem;
  margin: 2.5rem -1rem 1.25rem;
  padding: 0.25rem 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tc-gal__filters::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .tc-gal__filters {
    flex-wrap: wrap;
    justify-content: center;
    margin: 3rem 0 1.75rem;
    padding: 0.25rem 0;
    overflow: visible;
  }
}

.tc-gal__chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.6rem 0.4rem 1rem;
  border: 1px solid var(--gal-line);
  border-radius: 9999px;
  background: #fff;
  color: var(--gal-ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.tc-gal__chip:hover {
  border-color: #94a3b8;
}

.tc-gal__chipn {
  min-width: 1.6rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: var(--gal-tint);
  color: var(--gal-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.tc-gal__chip[aria-pressed="true"] {
  border-color: var(--gal-navy);
  background: var(--gal-navy);
  color: #fff;
}

.tc-gal__chip[aria-pressed="true"] .tc-gal__chipn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* --- The grid ------------------------------------------------------------ */

.tc-gal__grid {
  --h: 150px;
  --gap: 0.375rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

/* With the filters showing, they give the space above the grid. */
.tc-gal__filters:not([hidden]) + .tc-gal__grid {
  margin-top: 0;
}

/* Keeps the last row at its natural height instead of stretching it.
   assets/gallery.js then sets each photo's width so that every row fills the
   width exactly at close to --h (.is-justified). */
.tc-gal__grid::after {
  content: "";
  flex: 10000 1 0;
}

@media (min-width: 768px) {
  .tc-gal__grid {
    --h: 220px;
    --gap: 0.625rem;
  }
}

@media (min-width: 1100px) {
  .tc-gal__grid {
    --h: 260px;
  }
}

.tc-gal__item {
  position: relative;
  flex: var(--r) 1 calc(var(--r) * var(--h));
  min-width: 0;
  animation: tc-gal-in 0.35s ease both;
}

.tc-gal__grid.is-justified .tc-gal__item {
  flex: none;
}

@keyframes tc-gal-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.tc-gal__link {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 0.5rem;
  background: #e2e8f0;
  aspect-ratio: var(--r);
}

.tc-gal .tc-gal__link:focus-visible {
  outline-offset: 3px;
}

.tc-gal__link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--z, 1));
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tc-gal__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 31, 99, 0.45), rgba(15, 31, 99, 0) 45%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tc-gal__expand {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.55rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--gal-navy);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@media (hover: hover) {
  .tc-gal__link:hover img {
    transform: scale(calc(var(--z, 1) * 1.04));
  }

  .tc-gal__link:hover .tc-gal__shade,
  .tc-gal__link:hover .tc-gal__expand {
    opacity: 1;
    transform: none;
  }
}

/* --- About these photos -------------------------------------------------- */

.tc-gal__about {
  display: grid;
  gap: 2rem;
  max-width: 72rem;
  margin: 4rem auto 0;
}

@media (min-width: 900px) {
  .tc-gal__about {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 3.5rem;
    margin-top: 5.5rem;
  }
}

.tc-gal__h2 {
  margin-bottom: 1rem !important;
  color: var(--gal-navy);
  font-family: avenir, Poppins, sans-serif;
  font-size: clamp(1.4rem, 1.15rem + 1vw, 1.875rem);
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
}

.tc-gal__abouttext p {
  font-size: 0.975rem;
  line-height: 1.75;
}

.tc-gal__abouttext p + p {
  margin-top: 0.9rem;
}

.tc-gal__h3 {
  margin-bottom: 0.85rem !important;
  color: var(--gal-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tc-gal__places ul {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tc-gal__place {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 2.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--gal-line);
  border-radius: 0.75rem;
  background: #fff;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 31, 99, 0.06);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.tc-gal__place:hover {
  border-color: #cbd5e1;
  box-shadow: 0 14px 32px -14px rgba(15, 31, 99, 0.3);
}

.tc-gal__placeicon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--gal-tint);
  color: var(--gal-navy);
}

.tc-gal__placetext {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.tc-gal__placename {
  color: var(--gal-navy);
  font-size: 0.95rem;
  font-weight: 600;
}

.tc-gal__placenote {
  color: var(--gal-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.tc-gal__place .tc-gal__arrow {
  color: var(--gal-navy);
}

.tc-gal__place:hover .tc-gal__arrow,
.tc-gal__btn:hover .tc-gal__arrow {
  transform: translateX(3px);
}

/* --- Call to action ------------------------------------------------------ */

.tc-gal__cta {
  display: grid;
  gap: 1.25rem;
  max-width: 72rem;
  margin: 4rem auto 0;
  padding: 1.75rem 1.5rem;
  border-radius: 0.75rem;
  background: var(--gal-navy) linear-gradient(120deg, #0f1f63 0%, #16328a 60%, #0e5f86 100%);
  color: #e2e8f0;
}

@media (min-width: 768px) {
  .tc-gal__cta {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    margin-top: 5rem;
    padding: 2.25rem 2.5rem;
  }
}

.tc-gal__ctatitle {
  color: #fff;
  font-family: avenir, Poppins, sans-serif;
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.65rem);
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
}

.tc-gal__ctatext p {
  margin-top: 0.4rem !important;
  font-size: 0.975rem;
  line-height: 1.6;
}

.tc-gal__ctaactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tc-gal__btn,
.tc-gal .tc-gal__wa {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.15rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.tc-gal__btn {
  background: #fff;
  color: var(--gal-navy);
  font-weight: 600;
}

.tc-gal__btn:hover {
  background: #e2e8f0;
}

.tc-gal .tc-gal__wa {
  background: var(--gal-wa);
  color: #fff;
}

.tc-gal .tc-gal__wa:hover {
  background: var(--gal-wa-hover);
}

.tc-gal__cta a:focus-visible {
  outline-color: #fff;
}

.tc-gal__waicon {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

/* --- Full-size viewer ---------------------------------------------------- */

.tc-gal__viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(8, 15, 45, 0.96);
  color: #fff;
  overscroll-behavior: contain;
}

.tc-gal__viewer::backdrop {
  background: rgba(8, 15, 45, 0.6);
}

.tc-gal__viewer[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tc-gal-fade 0.2s ease;
}

@keyframes tc-gal-fade {
  from {
    opacity: 0;
  }
}

.tc-gal__vfig {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: calc(100vw - 2rem);
  padding: 3.5rem 0 1rem;
}

@media (min-width: 768px) {
  .tc-gal__vfig {
    max-width: calc(100vw - 9rem);
    padding: 3.5rem 0 1.5rem;
  }
}

/* Clips the zoomed-in photos (--z) as the grid does. */
.tc-gal__vframe {
  display: block;
  overflow: hidden;
  max-width: 100%;
  border-radius: 0.375rem;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
}

.tc-gal__vimg {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  transform: scale(var(--z, 1));
  transition: opacity 0.2s ease;
}

.tc-gal__vimg.is-loading {
  opacity: 0.35;
}

.tc-gal__vcap {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  max-width: 48rem;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.5;
}

.tc-gal__vcount {
  flex: none;
  color: #94a3b8;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.tc-gal__vbtn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.tc-gal__vbtn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.tc-gal__vbtn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.tc-gal__navicon {
  width: 1.4rem;
  height: 1.4rem;
}

.tc-gal__vbtn--close {
  top: 0.75rem;
  right: 0.75rem;
}

.tc-gal__vbtn--prev,
.tc-gal__vbtn--next {
  top: 50%;
  transform: translateY(-50%);
}

.tc-gal__vbtn--prev {
  left: 1rem;
}

.tc-gal__vbtn--next {
  right: 1rem;
}

/* On phones the arrows move under the photo, beside the caption, so they
   never cover it; swiping works too. */
@media (max-width: 767px) {
  .tc-gal__vbtn--prev,
  .tc-gal__vbtn--next {
    top: auto;
    bottom: 1rem;
    transform: none;
  }

  .tc-gal__vfig {
    padding-bottom: 4.5rem;
  }

  .tc-gal__vimg {
    max-height: calc(100dvh - 12rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tc-gal__item,
  .tc-gal__viewer[open] {
    animation: none;
  }

  .tc-gal__link img,
  .tc-gal__arrow {
    transition: none;
  }
}
