/* ============================================================
   HOME PAGE: everything below the hero
   Loaded only on "/" (pageStyles in lib/pages.js), after components.css and
   before preferences.css. Classes are prefixed hm-.
   The hero, its stats strip, the cookie bar and the toast keep their styles
   in animations.css / components.css.
   ============================================================ */

/* White-on-photo tiles need the gold focus ring */
.sx--dark :focus-visible,
.hm-conservation :focus-visible,
.hm-tile:focus-visible,
.hm-country:focus-visible,
.hm-bento-item:focus-visible { outline-color: var(--accent); }

.hm-conservation .sx-eyebrow { color: var(--accent); }

/* ─── 1. Experience tiles ───────────────────────────────────── */
.hm-tiles {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.hm-tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--primary-light);
  isolation: isolate;
}
.hm-tile > img { position: absolute; inset: 0; transition: transform 0.6s var(--ease-out); }
.hm-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(8,18,8,0.82) 0%, rgba(8,18,8,0.2) 52%, rgba(8,18,8,0) 100%);
}
.hm-tile-icon {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.16);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.95rem;
}
.hm-tile-body {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #fff;
}
.hm-tile-body strong { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.hm-tile-body small { font-size: 0.8rem; opacity: 0.82; }

/* ─── 2. Featured safaris ───────────────────────────────────── */
.hm-filter { margin-top: 0; margin-bottom: 8px; max-width: 100%; }
@media (max-width: 640px) {
  /* one swipeable row instead of a wrapped pill */
  .hm-filter { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hm-filter::-webkit-scrollbar { display: none; }
  .hm-filter .filter-tab { flex: none; }
}
.sx--alt .tours-grid { margin-top: 28px; }

/* ─── 4. Destinations ───────────────────────────────────────── */
.hm-countries {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-auto-rows: 250px;
  gap: 16px;
}
.hm-country {
  position: relative;
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--dark-mid);
  isolation: isolate;
}
.hm-country--lead { grid-row: span 2; }
.hm-country:nth-child(4) { grid-column: span 2; }
.hm-country > img { position: absolute; inset: 0; transition: transform 0.7s var(--ease-out); }
.hm-country::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(6,14,6,0.88) 0%, rgba(6,14,6,0.3) 55%, rgba(6,14,6,0.05) 100%);
}
.hm-country-body {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #fff;
}
.hm-country-body small {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.hm-country-body strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.hm-country--lead .hm-country-body strong { font-size: clamp(1.9rem, 3vw, 2.6rem); }
.hm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.hm-chips span {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.1);
  font-size: 0.74rem;
  font-weight: 600;
}
.hm-country-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0.9;
}
.hm-country-meta i { font-size: 0.75rem; transition: transform var(--dur-base) var(--ease-out); }

/* ─── 5. Photo bento ────────────────────────────────────────── */
.hm-bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: clamp(150px, 15vw, 214px);
  grid-auto-flow: dense;
  gap: 14px;
}
.hm-bento-item {
  position: relative;
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--primary-light);
}
.hm-bento-item > img { position: absolute; inset: 0; transition: transform 0.7s var(--ease-out); }
.hm-bento-item--feature { grid-column: span 2; grid-row: span 2; }
.hm-bento-item--tall    { grid-row: span 2; }
.hm-bento-item--wide    { grid-column: span 2; }
.hm-bento-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 36px 16px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to top, rgba(8,18,8,0.7), rgba(8,18,8,0));
}
.hm-bento-cta {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hm-bento-cta strong { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--accent); }
.hm-bento-cta span { font-size: 0.88rem; line-height: 1.4; opacity: 0.9; }
.hm-bento-cta i {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  font-size: 0.8rem;
  transition: transform var(--dur-base) var(--ease-out);
}

/* ─── 6. How it works ───────────────────────────────────────── */
.hm-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.hm-step {
  position: relative;
  padding: 34px 30px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.hm-step-num {
  position: absolute;
  top: 8px;
  right: 22px;
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--primary-light);
  pointer-events: none;
}
.hm-step-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 1.15rem;
  box-shadow: var(--shadow-green);
}
.hm-step h3 { position: relative; margin: 0 0 8px; font-size: 1.2rem; color: var(--dark); }
.hm-step p { position: relative; margin: 0; font-size: 0.96rem; line-height: var(--leading-ui); color: var(--text-muted); }

/* ─── 7. Reviews ────────────────────────────────────────────── */
.hm-reviews {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hm-reviews-intro h2 { color: var(--dark); font-size: clamp(1.75rem, 3.1vw, 2.5rem); }
.hm-rating { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.hm-rating-score { font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; color: var(--dark); }
.hm-rating-detail { display: flex; flex-direction: column; gap: 2px; }
.hm-rating-detail .stars { color: var(--accent); font-size: 1.05rem; letter-spacing: 0.1em; }
.hm-rating-detail small { font-size: 0.82rem; color: var(--text-muted); }

/* the track clips overflow, so the card's shadow has to fit inside its padding */
.hm-reviews .testimonial-card { padding: 4px 4px 28px; }
.hm-reviews .testimonial-card-inner {
  max-width: none;
  padding: 36px 40px;
  border: 1px solid var(--border-light);
  box-shadow: 0 12px 28px -10px rgba(15,31,15,0.16);
}
.hm-reviews .testimonial-text { font-size: 1.1rem; }
.hm-reviews .testimonial-nav { justify-content: flex-start; margin-top: 0; padding-left: 4px; }
.hm-reviews .test-arrow { border-color: var(--border); color: var(--dark); background: var(--surface); }
.hm-reviews .test-arrow:hover { background: var(--accent); border-color: var(--accent); color: var(--dark); }
.hm-reviews .test-dot { background: var(--border); }
.hm-reviews .test-dot.active { background: var(--primary); }
.hm-reviews .test-pause { border-color: var(--border); color: var(--text-muted); }
.hm-reviews .test-pause:hover { background: var(--primary-light); }

/* ─── 8. Conservation ───────────────────────────────────────── */
.hm-conservation {
  padding: clamp(64px, 8vw, 96px) 0;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(200,146,42,0.14) 0%, rgba(200,146,42,0) 55%),
    linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
}
.hm-conservation-grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hm-conservation h2 { color: #fff; font-size: clamp(1.75rem, 3.1vw, 2.5rem); }
.hm-conservation p { margin: 16px 0 0; max-width: 54ch; font-size: 1.05rem; line-height: var(--leading-read); color: rgba(255,255,255,0.84); }
.hm-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 32px 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.2);
}
.hm-stats > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  padding: 0 18px;
  border-left: 1px solid rgba(255,255,255,0.16);
}
.hm-stats > div:first-child { padding-left: 0; border-left: 0; }
.hm-stats dd { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--accent); }
.hm-stats dt { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.75); }
.hm-conservation-photo {
  position: relative;
  aspect-ratio: 5 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  background: var(--primary-dark);
}
.hm-conservation-photo > img { position: absolute; inset: 0; }

/* ─── 9. Blog ───────────────────────────────────────────────── */
.hm-posts {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 24px;
}
.hm-post {
  position: relative;
  display: flex;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out);
}
.hm-post--lead { grid-row: span 2; flex-direction: column; }
.hm-post-img { position: relative; flex: none; background: var(--primary-light); overflow: hidden; }
.hm-post-img > img { position: absolute; inset: 0; transition: transform 0.6s var(--ease-out); }
.hm-post--lead .hm-post-img { aspect-ratio: 16 / 10; }
.hm-post:not(.hm-post--lead) .hm-post-img { width: 38%; min-height: 150px; }
.hm-post-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px; }
.hm-post-meta { display: flex; align-items: center; gap: 12px; font-size: 0.78rem; color: var(--text-muted); }
.hm-post-cat {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  font-weight: 700;
  color: var(--primary);
}
.hm-post h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; letter-spacing: -0.015em; color: var(--dark); }
.hm-post--lead h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
/* the title's link covers the whole card */
.hm-post h3 a::after { content: ''; position: absolute; inset: 0; }
.hm-post p {
  margin: 0;
  font-size: 0.95rem;
  line-height: var(--leading-ui);
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hm-post--lead p { -webkit-line-clamp: 4; }
.hm-post time { margin-top: auto; font-size: 0.8rem; color: var(--text-muted); }

/* ─── 10. Social feed: keeps social.css-in-components; just the frame ─── */
#social .social-grid { margin-top: 0; }

/* ─── Hover (hover-capable devices only) ────────────────────── */
@media (hover: hover) {
  .hm-tile:hover > img,
  .hm-country:hover > img,
  .hm-bento-item:hover > img,
  .hm-post:hover .hm-post-img > img { transform: scale(1.06); }
  .sx-link:hover i,
  .hm-country:hover .hm-country-meta i,
  .hm-bento-cta:hover i { transform: translateX(4px); }
  .hm-post:hover { box-shadow: var(--shadow-md); }
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .hm-tiles { grid-template-columns: repeat(3, 1fr); }
  .hm-tile { aspect-ratio: 4 / 5; }
  .hm-steps { gap: 16px; }
  .hm-step { padding: 28px 22px; }
}
@media (max-width: 1024px) {
  .hm-countries { grid-template-columns: 1fr 1fr; grid-auto-rows: 230px; }
  .hm-country--lead { grid-column: span 2; grid-row: span 2; }
  .hm-country:nth-child(4) { grid-column: span 2; }
  .hm-reviews { grid-template-columns: minmax(0, 1fr); }
  .hm-conservation-grid { grid-template-columns: minmax(0, 1fr); }
  .hm-conservation-photo { max-width: 640px; }
}
@media (max-width: 860px) {
  .hm-steps { grid-template-columns: minmax(0, 1fr); }
  .hm-posts { grid-template-columns: minmax(0, 1fr); }
  .hm-post--lead { grid-row: auto; }
}
@media (max-width: 760px) {
  .hm-bento { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; gap: 10px; }
}
@media (max-width: 640px) {
  /* experience tiles become a swipeable rail */
  .hm-tiles {
    display: flex;
    gap: 12px;
    margin: 0 -24px;
    padding: 0 24px 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 24px;
    scrollbar-width: none;
  }
  .hm-tiles::-webkit-scrollbar { display: none; }
  .hm-tiles > li { flex: 0 0 62%; scroll-snap-align: start; }
  .hm-tile { aspect-ratio: 4 / 5; }

  .hm-countries { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 210px; }
  .hm-country--lead { grid-column: auto; grid-row: span 2; }
  .hm-country:nth-child(4) { grid-column: auto; }

  .hm-reviews .testimonial-card-inner { padding: 28px 22px; }
  .hm-stats > div { padding: 0 10px; }
  .hm-post:not(.hm-post--lead) { flex-direction: column; }
  .hm-post:not(.hm-post--lead) .hm-post-img { width: 100%; aspect-ratio: 16 / 9; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-tile > img, .hm-country > img, .hm-bento-item > img, .hm-post-img > img,
  .hm-country-meta i, .hm-bento-cta i { transition: none; }
}
