/* ============================================================
   Homepage motion & layout-variation enhancements
   Scoped to the homepage only — loaded via $extraHead in home.php
   ============================================================ */

/* ── Hero: slow background pan/zoom ──────────────────────────────
   main.css has a leftover `.home-hero{background-size:cover !important;
   background-position:center center !important}` rule — !important always
   beats an animation on the same property, so the photo lives on its own
   layer here instead of fighting it. ──────────────────────────────── */
.home-hero__photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  animation: heroKenBurns 26s ease-in-out infinite alternate;
}
@keyframes heroKenBurns {
  0%   { transform: scale(1); }
  100% { transform: scale(1.12); }
}

/* ── Hero finder: single search box over departure ports + ports of call ── */
.hero-finder--single {
  max-width: 480px;
  margin-top: 8px;
}
.finder-box {
  position: relative;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 10px;
  padding: 12px 16px;
}
.finder-box label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(255,255,255,.8);
  margin-bottom: 4px;
}
.finder-search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-body);
  padding: 2px 0;
  outline: none;
}
.finder-search-input::placeholder {
  color: rgba(255,255,255,.55);
}
.finder-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  max-height: 280px;
  z-index: 20;
}
.finder-search-results a {
  display: block;
  padding: 10px 14px;
  color: var(--color-text);
  font-size: .9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--color-bg-light);
}
.finder-search-results a:last-child { border-bottom: none; }
.finder-search-results a:hover {
  background: var(--color-bg-light);
}

/* ── Card image zoom-on-hover ─────────────────────────────────── */
.feature-photo-card__img,
.port-card__photo,
.dest-card {
  transition: transform .5s ease, background-size .5s ease;
}
.feature-photo-card:hover .feature-photo-card__img,
.port-card--overlay:hover .port-card__photo {
  transform: scale(1.08);
}
.post-card__img img {
  transition: transform .5s ease;
}
.post-card:hover .post-card__img img {
  transform: scale(1.06);
}

/* ── Cruise Planning Tools: proper card grid instead of a thin pill bar ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 22px 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.tool-card__icon {
  font-size: 1.9rem;
  line-height: 1;
  margin-bottom: 4px;
}
.tool-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
}
.tool-card p {
  font-size: .85rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.45;
}
@media (max-width: 900px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Departure ports: photo-overlay cards, matching the destinations
   section instead of the older plain photo-over-text-block style.
   Back in a static grid (not the scroll row — too cramped) with room
   for the title to not wrap awkwardly. ──────────────────────────── */
.port-card--overlay {
  position: relative;
  height: 200px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background: #0f1f3d;
  border-radius: 10px;
  border: none;
}

/* ── Mosaic layout: one big card, a couple of wide ones, rest square.
   First 8 ports show by default (fills two full rows with no gaps);
   the rest reveal via "Show More". ─────────────────────────────── */
.port-cards-grid--mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 190px;
  grid-auto-flow: dense;
  gap: 16px;
}
.port-cards-grid--mosaic .port-card--overlay {
  height: 100%;
}
.port-cards-grid--mosaic .port-card:nth-child(1) {
  grid-column: span 2;
  grid-row: span 2;
}
.port-cards-grid--mosaic .port-card:nth-child(4),
.port-cards-grid--mosaic .port-card:nth-child(9) {
  grid-column: span 2;
}
.port-cards-grid--mosaic .port-card--extra {
  display: none;
}
.port-cards-grid--mosaic.is-expanded .port-card--extra {
  display: block;
}
.load-more-row {
  text-align: center;
  margin-top: 28px;
}
.port-card__photo {
  position: absolute;
  inset: 0;
  background-color: #0f1f3d;
  background-size: cover;
  background-position: center;
}
.port-card__overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.15) 75%, transparent 100%);
}
.port-card__overlay h3 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.25;
}
.port-card__loc {
  color: rgba(255,255,255,.8);
  font-size: .8rem;
}

/* ── Scroll-reveal ────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ── Destinations: feature the first (most popular) card, and make
   the trailing row (Eastern Canada + Hawaii) a 2/3 + 1/3 split instead
   of one full-width card sitting alone. ─────────────────────────── */
.destinations-grid--featured {
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: repeat(3, 180px);
}
.destinations-grid--featured .dest-card:first-child {
  grid-row: span 2;
  height: 100%;
}
.destinations-grid--featured .dest-card--canada {
  grid-column: span 2;
}
.dest-card--hawaii {
  background-image: url('/assets/img/hawaii-region.jpg');
}

/* main.css carries two conflicting definitions of .dest-card /
   .dest-card__overlay (one flex-based, one absolute-positioned) —
   pin both down explicitly so the gradient band stays a tight,
   content-sized strip instead of swallowing half the photo. ────── */
.dest-card {
  position: relative;
  overflow: hidden;
  display: block;
}
.dest-card__overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
}

/* ── Trust bar: count-up target numbers start blank-safe ───────── */
.trust-item__num[data-count-to] {
  font-variant-numeric: tabular-nums;
}

/* ── Blog: feature the latest post (wider + taller image) beside
   the next two as smaller cards, instead of three equal cards. ──── */
.post-grid--mosaic {
  grid-template-columns: repeat(4, 1fr);
}
.post-grid--mosaic .post-card:first-child {
  grid-column: span 2;
}
.post-grid--mosaic .post-card:first-child .post-card__img {
  height: 280px;
}

/* ── Respect reduced-motion preference ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .home-hero__photo { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .feature-photo-card__img, .port-card__photo, .dest-card, .post-card__img img {
    transition: none;
  }
}

/* ── Mobile: mosaic/featured-destination layouts simplify ──────── */
@media (max-width: 768px) {
  .hero-finder--single {
    max-width: none;
  }
  .post-grid--mosaic {
    grid-template-columns: 1fr;
  }
  .post-grid--mosaic .post-card:first-child {
    grid-column: span 1;
  }
  .post-grid--mosaic .post-card:first-child .post-card__img {
    height: 180px;
  }
  .destinations-grid--featured {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .destinations-grid--featured .dest-card:first-child {
    grid-column: span 2;
    grid-row: auto;
    height: 180px;
  }
  .port-cards-grid--mosaic {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 160px;
  }
  .port-cards-grid--mosaic .port-card:nth-child(1) {
    grid-column: span 2;
    grid-row: span 1;
  }
  .port-cards-grid--mosaic .port-card:nth-child(4),
  .port-cards-grid--mosaic .port-card:nth-child(9) {
    grid-column: span 2;
  }
}
