/* ==========================================================================
   DUNESCAPE JOURNEYS — HOMEPAGE
   1. Hero          2. Service strip      3. Featured tours
   4. Why choose us 5. Horizontal gallery 6. Qatar at a glance
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HERO — 55/45 split, image bleeds to the right viewport edge
   -------------------------------------------------------------------------- */

/* The hero is choreographed by home.js. Hide it until that timeline has
   primed its start states, otherwise it can paint at final position first.
   main.js guarantees .is-primed lands even if home.js fails to load. */
.js-anim .hero:not(.is-primed) { visibility: hidden; }

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 55fr 45fr;
  align-items: stretch;
  background: var(--pearl);
  overflow: hidden;
  isolation: isolate;
}

/* Aligns hero copy to the container gutter while the image bleeds off-edge */
.hero__content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-md);
  padding-block: calc(72px + var(--space-xl)) var(--space-xl);
  padding-right: var(--space-xl);
  padding-left: max(var(--pad-x), calc((100vw - var(--container)) / 2 + var(--pad-x)));
}

.hero__title {
  font-size: var(--fs-display);
  line-height: 0.96;
  letter-spacing: -0.032em;
  max-width: 15ch;
}

.hero__title em {
  font-style: italic;
  color: var(--gold-deep);
}

.hero__lead {
  max-width: 46ch;
  font-size: var(--fs-lead);
  line-height: 1.62;
  color: var(--ink-soft);
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-2xs);
}

/* Credential row under the CTAs */
.hero__proof {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}

.hero__proof-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero__proof-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--deep);
}

.hero__proof-num span { color: var(--gold-deep); }

.hero__proof-label {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --- Visual --- */
.hero__visual {
  position: relative;
  overflow: hidden;
  background: var(--sand-dim);
  clip-path: inset(100% 0 0 0);
}

.hero__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

.hero__visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, rgba(26, 21, 16, 0.06) 0%, rgba(26, 21, 16, 0.42) 100%);
  pointer-events: none;
}

/* Rotated edge label riding the right side of the image */
.hero__edge {
  position: absolute;
  right: 22px;
  bottom: 130px;
  z-index: 4;
  writing-mode: vertical-rl;
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-inv-soft);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hero__edge::before {
  content: "";
  width: 1px;
  height: 60px;
  background: var(--gold);
  opacity: 0.7;
}

/* Floating card breaking the 55/45 seam */
.hero__badge {
  position: absolute;
  z-index: 5;
  left: 55%;
  bottom: 90px;
  transform: translateX(-50%);
  width: min(280px, 30vw);
  padding: var(--space-sm) var(--space-md);
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  border-left: 2px solid var(--gold);
}

.hero__badge-quote {
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--deep);
}

.hero__badge-by {
  margin-top: 0.6rem;
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Scroll cue */
.hero__scroll {
  position: absolute;
  z-index: 5;
  left: max(var(--pad-x), calc((100vw - var(--container)) / 2 + var(--pad-x)));
  bottom: 36px;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.hero__scroll-line {
  width: 52px;
  height: 1px;
  background: var(--deep-12);
  overflow: hidden;
  position: relative;
}

.hero__scroll-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform-origin: left center;
  animation: scrollCue 2.4s var(--ease-inout) infinite;
}

@keyframes scrollCue {
  0%   { transform: scaleX(0); transform-origin: left center; }
  45%  { transform: scaleX(1); transform-origin: left center; }
  55%  { transform: scaleX(1); transform-origin: right center; }
  100% { transform: scaleX(0); transform-origin: right center; }
}

/* --- Hero responsive: image stacks ABOVE text under 768px --- */
@media (max-width: 1200px) {
  .hero__content { padding-right: var(--space-lg); }
  .hero__badge { width: 250px; bottom: 60px; }
}

@media (max-width: 991px) {
  .hero { grid-template-columns: 58fr 42fr; }
  .hero__badge, .hero__edge { display: none; }
  .hero__content { padding-block: calc(64px + var(--space-lg)) var(--space-lg); }
  .hero__proof { gap: var(--space-sm); }
}

@media (max-width: 767px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh auto;
    min-height: 0;
  }

  .hero__visual {
    order: -1;               /* image above text on mobile */
    clip-path: none;
    margin-top: 64px;
  }

  .hero__content {
    padding: var(--space-lg) var(--pad-x) var(--space-xl);
  }

  .hero__title { max-width: none; }
  .hero__scroll { display: none; }
}

/* --------------------------------------------------------------------------
   2. SERVICE STRIP — 5 columns divided by hairlines
   -------------------------------------------------------------------------- */

.services {
  background: var(--pearl);
  border-top: 1px solid var(--rule);
  position: relative;
  z-index: 2;
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.service {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md) calc(var(--space-lg) - 0.5rem);
  border-right: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
  transition: color var(--dur) var(--ease-out);
}

.service:last-child { border-right: 0; }

/* Warm wash rises from the bottom on hover */
.service::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--deep);
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: transform 0.55s var(--ease-expo);
}

.service:hover::before { transform: scaleY(1); }
.service:not(:hover)::before { transform-origin: top center; }

.service__icon {
  width: 34px;
  height: 34px;
  color: var(--gold-deep);
  transition: color var(--dur) var(--ease-out), transform 0.55s var(--ease-expo);
}

.service__icon svg { width: 100%; height: 100%; stroke-width: 1.25; }

.service__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--deep);
  transition: color var(--dur) var(--ease-out);
}

.service__desc {
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-faint);
  transition: color var(--dur) var(--ease-out);
}

.service__num {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-md);
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  opacity: 0.5;
  transition: color var(--dur) var(--ease-out);
}

.service:hover .service__icon { color: var(--gold); transform: translateY(-3px); }
.service:hover .service__title { color: var(--sand); }
.service:hover .service__desc { color: var(--ink-inv-soft); }
.service:hover .service__num { color: var(--gold); opacity: 1; }

@media (max-width: 991px) {
  .services__grid { grid-template-columns: repeat(2, 1fr); }
  .service { border-bottom: 1px solid var(--rule); padding: var(--space-md) var(--space-sm); }
  .service:nth-child(2n) { border-right: 0; }
  .service:last-child { grid-column: 1 / -1; border-bottom: 0; }
}

@media (max-width: 560px) {
  .services__grid { grid-template-columns: 1fr; }
  .service { border-right: 0; }
  .service:last-child { border-bottom: 0; }
}

/* --------------------------------------------------------------------------
   3. FEATURED TOURS — 4 × 3:4 cards, alternating vertical offset
   -------------------------------------------------------------------------- */

.featured { background: var(--sand); }

.featured__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
  align-items: start;
}

/* Editorial rhythm — every other card drops down */
@media (min-width: 992px) {
  .featured__grid > *:nth-child(even) { margin-top: 56px; }
}

.tour-card {
  position: relative;
  display: block;
  background: transparent;
}

.tour-card .frame {
  clip-path: inset(0 0 0 0);
  will-change: clip-path;
}

.tour-card__body {
  padding-top: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tour-card__title {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: var(--deep);
  transition: color var(--dur) var(--ease-out);
}

.tour-card:hover .tour-card__title { color: var(--gold-deep); }
.tour-card:hover .frame img { transform: scale(1.05); }

.tour-card__desc {
  font-size: var(--fs-sm);
  line-height: 1.62;
  color: var(--ink-soft);
}

.tour-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
}

.tour-card__dur {
  font-family: var(--font-label);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.tour-card__go {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--deep-12);
  border-radius: 50%;
  color: var(--deep);
  flex: none;
  transition: background-color var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
}

.tour-card__go svg { width: 15px; height: 15px; }

.tour-card:hover .tour-card__go {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--deep);
  transform: rotate(-45deg);
}

@media (max-width: 991px) {
  .featured__grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-md) var(--gutter); }
}

@media (max-width: 600px) {
  .featured__grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   4. WHY CHOOSE US — pearl cards on deep dark
   -------------------------------------------------------------------------- */

.why {
  position: relative;
  background: var(--deep);
  color: var(--ink-inv);
  overflow: hidden;
}

.why .bloom {
  width: 640px;
  height: 640px;
  top: -220px;
  right: -140px;
  opacity: 0.3;
}

.why__grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
}

.why-card {
  position: relative;
  background: var(--pearl);
  padding: var(--space-md) calc(var(--space-md) - 0.25rem) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 300px;
  transition: transform var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out);
  will-change: transform;
}

.why-card::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--ease-expo);
}

.why-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.4);
}

.why-card:hover::after { transform: scaleX(1); }

.why-card__num {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.18em;
  color: var(--gold-deep);
}

.why-card__icon {
  width: 30px;
  height: 30px;
  margin: var(--space-xs) 0 var(--space-2xs);
  color: var(--terracotta);
}

.why-card__icon svg { width: 100%; height: 100%; stroke-width: 1.25; }

.why-card__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--deep);
}

.why-card__text {
  font-size: var(--fs-sm);
  line-height: 1.68;
  color: var(--ink-soft);
  margin-top: auto;
}

@media (max-width: 991px) {
  .why__grid { grid-template-columns: repeat(2, 1fr); }
  .why-card { min-height: 0; padding-bottom: var(--space-md); }
}

@media (max-width: 600px) {
  .why__grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   5. GALLERY — pinned horizontal scroll
   -------------------------------------------------------------------------- */

.gallery {
  position: relative;
  background: var(--sand);
  padding-block: var(--section-y) 0;
  overflow: hidden;
}

/* Pinned layout: lock to exactly one viewport so nothing clips while held */
@media (min-width: 768px) {
  .gallery {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: 0;
  }
}

.gallery__head {
  max-width: var(--container);
  margin-inline: auto;
  width: 100%;
  padding-inline: var(--pad-x);
  margin-bottom: var(--space-lg);
}

.gallery__viewport { overflow: hidden; }

.gallery__track {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-inline: max(var(--pad-x), calc((100vw - var(--container)) / 2 + var(--pad-x)));
  padding-bottom: var(--section-y);
  width: max-content;
  will-change: transform;
}

@media (min-width: 768px) {
  .gallery__track { padding-bottom: var(--space-md); }
}

.gallery__item {
  position: relative;
  flex: none;
  width: clamp(260px, 27vw, 420px);
  overflow: hidden;
  background: var(--sand-dim);
  cursor: pointer;
}

/* Sized in vh so the pinned section always fits the viewport. Mixed heights
   and alignments make the strip read like a contact sheet, not a carousel. */
@media (min-width: 768px) {
  .gallery__item { width: auto; height: 54vh; }
  .gallery__item--tall  { aspect-ratio: 3 / 4; height: 54vh; align-self: flex-start; }
  .gallery__item--wide  { aspect-ratio: 4 / 3; height: 42vh; }
  .gallery__item--short { aspect-ratio: 1 / 1; height: 38vh; align-self: flex-end; }
}

@media (max-width: 767px) {
  .gallery__item--tall  { aspect-ratio: 3 / 4; }
  .gallery__item--wide  { aspect-ratio: 4 / 3; }
  .gallery__item--short { aspect-ratio: 1 / 1; }
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 1s var(--ease-expo);
  will-change: transform;
}

.gallery__item:hover img { transform: scale(1.09); }

.gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 21, 16, 0) 45%, rgba(26, 21, 16, 0.78) 100%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
  pointer-events: none;
}

.gallery__item:hover::after { opacity: 1; }

.gallery__caption {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  width: 100%;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  color: var(--ink-inv);
  transform: translateY(14px);
  opacity: 0;
  transition: transform 0.5s var(--ease-expo), opacity var(--dur) var(--ease-out);
  pointer-events: none;
}

.gallery__item:hover .gallery__caption { transform: translateY(0); opacity: 1; }

.gallery__caption h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--ink-inv);
  letter-spacing: -0.02em;
}

.gallery__caption p {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 0.35rem;
}

/* Progress bar for the pinned scroll */
.gallery__progress {
  align-self: flex-start;
  margin-left: max(var(--pad-x), calc((100vw - var(--container)) / 2 + var(--pad-x)));
  margin-top: var(--space-md);
  width: 180px;
  height: 2px;
  background: var(--deep-12);
  overflow: hidden;
  flex: none;
}

.gallery__progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
}

/* Mobile: native horizontal scroll with snap instead of a pinned section */
@media (max-width: 767px) {
  .gallery__viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .gallery__viewport::-webkit-scrollbar { display: none; }

  .gallery__track {
    gap: var(--space-sm);
    padding-inline: var(--pad-x);
    padding-bottom: var(--section-y);
    transform: none !important;
  }

  .gallery__item {
    width: 76vw;
    scroll-snap-align: center;
    align-self: auto !important;
  }

  .gallery__item--wide { width: 84vw; }
  .gallery__progress { display: none; }
  .gallery__caption { opacity: 1; transform: none; }
  .gallery__item::after { opacity: 1; }
}

/* --------------------------------------------------------------------------
   6. QATAR AT A GLANCE — facts grid + stylised map panel
   -------------------------------------------------------------------------- */

.glance { background: var(--pearl); }

.glance__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}

.glance__facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: var(--space-md);
  border-top: 1px solid var(--rule);
}

.fact {
  padding: var(--space-md) var(--space-md) var(--space-md) 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fact:nth-child(odd) { border-right: 1px solid var(--rule); }
.fact:nth-child(even) { padding-left: var(--space-md); }

.fact__label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.fact__label svg { width: 14px; height: 14px; stroke-width: 1.5; }

.fact__value {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  line-height: 1.24;
  letter-spacing: -0.02em;
  color: var(--deep);
}

.fact__note {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  line-height: 1.5;
}

/* --- Map panel --- */
.map-panel {
  position: relative;
  background: var(--deep);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: var(--space-lg);
}

/* Faint coordinate grid */
.map-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(212, 197, 169, 0.07) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(212, 197, 169, 0.07) 0 1px, transparent 1px 56px);
  pointer-events: none;
}

.map-panel .bloom {
  width: 420px;
  height: 420px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.32;
}

.map-panel__svg {
  position: relative;
  z-index: 2;
  width: min(62%, 260px);
  height: auto;
  overflow: visible;
}

.map-panel__shape {
  fill: rgba(201, 169, 98, 0.09);
  stroke: var(--gold);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
  stroke-linejoin: round;
}

.map-panel__pin { fill: var(--gold); }

.map-panel__ring {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1;
  animation: mapPulse 3s var(--ease-out) infinite;
}

.map-panel__ring:nth-of-type(2) { animation-delay: 1s; }

@keyframes mapPulse {
  0%   { r: 6;  opacity: 0.9; }
  100% { r: 30; opacity: 0; }
}

.map-panel__label {
  position: absolute;
  z-index: 3;
  left: var(--space-md);
  bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.map-panel__label .k {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.map-panel__label .v {
  font-family: var(--font-label);
  font-size: var(--fs-xs);
  color: var(--ink-inv-faint);
  letter-spacing: 0.06em;
}

.map-panel__corner {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 3;
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-inv-faint);
}

@media (max-width: 991px) {
  .glance__inner { grid-template-columns: 1fr; gap: var(--space-lg); }
  .map-panel { aspect-ratio: 3 / 2; }
}

@media (max-width: 560px) {
  .glance__facts { grid-template-columns: 1fr; }
  .fact:nth-child(odd) { border-right: 0; }
  .fact:nth-child(even) { padding-left: 0; }
  .map-panel { aspect-ratio: 1 / 1; }
}

/* The closing CTA band lives in layout.css — it is shared by every page. */
