/* QHPH visual stability layer.
   First paint should feel like the same QHPH home, not a temporary app.
   Static chrome mirrors the real layout while dynamic areas reserve geometry. */

:root {
  --qhph-skeleton-a: #171c1b;
  --qhph-skeleton-b: #252d2a;
  --qhph-skeleton-c: #1c2321;
  --qhph-skeleton-scan-duration: 1.55s;
}

html.qhph-page-loading {
  scroll-behavior: auto !important;
  overflow: hidden !important;
  scrollbar-gutter: stable;
}
html.qhph-page-loading body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Real app is built behind the loader, then crossfades into the exact same frame. */
.app-shell.qhph-shell-awaiting-reveal {
  opacity: 0;
  transition: opacity .28s ease;
}
.app-shell.qhph-shell-awaiting-reveal.is-visible { opacity: 1; }

/* premium-ui.css raises every hero child into a relative stacking context.
   The city landmark is decorative absolute art and must never consume layout height. */
.home-v2 .v3-hero > .city-identity-landmarks {
  position: absolute;
  z-index: 1;
}

.qhph-page-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 2%, rgba(34,214,209,.08), transparent 29%),
    radial-gradient(circle at 7% 30%, rgba(201,112,74,.055), transparent 25%),
    var(--bg, #0B0E0E);
  color: var(--ink, #F4EBDD);
  opacity: 1;
  visibility: visible;
  transition: opacity .28s ease, visibility .28s ease;
}
.qhph-page-loader.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.qhph-page-loader-shell {
  position: relative;
  min-height: 100dvh;
  padding-bottom: calc(94px + env(safe-area-inset-bottom));
}

/* Header mirrors .home-v2 .v3-topbar: brand at the real left edge, city at right. */
.qhph-loader-topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(to bottom,rgba(11,14,14,.96),rgba(11,14,14,.82),transparent);
  border-bottom: 0;
}
.qhph-loader-brand {
  display: grid;
  gap: 2px;
}
.qhph-loader-brand strong {
  font: 950 18px/1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  letter-spacing: .12em;
}
.qhph-loader-brand small {
  font: 700 9px/1.2 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  opacity: .48;
}
.qhph-loader-city { width: 118px; height: 34px; }

.qhph-loader-main {
  height: calc(100dvh - 66px - 82px - env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.qhph-loader-block {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding: 17px 18px;
}
.qhph-loader-hero {
  order: 1;
  padding-top: 32px;
  padding-bottom: 8px;
  display: grid;
  gap: 11px;
  isolation: isolate;
}
.qhph-loader-hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  pointer-events: none;
  inset: -34% -38% -30%;
  background:
    radial-gradient(ellipse 58% 64% at 47% 39%, rgba(16,38,50,.64) 0%, rgba(11,30,40,.46) 31%, rgba(9,23,30,.24) 55%, rgba(7,18,22,.08) 74%, transparent 92%),
    radial-gradient(ellipse 30% 32% at 84% 14%, rgba(34,214,209,.08) 0%, transparent 78%),
    radial-gradient(ellipse 29% 28% at 10% 56%, rgba(201,112,74,.05) 0%, transparent 82%);
  filter: blur(8px);
}
/* Same cathedral silhouette used by the live Santo Domingo identity layer. */
.qhph-loader-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  right: -28px;
  top: 6px;
  width: 230px;
  height: 176px;
  opacity: .18;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 160'%3E%3Cg fill='none' stroke='%23e9d8bc' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M46 136V66h34V36h40v30h34v70'/%3E%3Cpath d='M28 136h144'/%3E%3Cpath d='M62 136v-34M138 136v-34'/%3E%3Cpath d='M82 136V98c0-24 36-24 36 0v38'/%3E%3Cpath d='M72 82h56M80 72h40'/%3E%3Cpath d='M100 36V12M88 22h24'/%3E%3C/g%3E%3C/svg%3E");
}
.qhph-loader-row,
.qhph-loader-section-heading,
.qhph-loader-chip-row,
.qhph-loader-wallet-title-row {
  display: flex;
  align-items: center;
}
.qhph-page-skeleton-shape,
.qhph-skeleton-media,
.qhph-skeleton-line {
  background: linear-gradient(100deg,
    var(--qhph-skeleton-a) 0%,
    var(--qhph-skeleton-a) 39%,
    var(--qhph-skeleton-c) 45%,
    var(--qhph-skeleton-b) 50%,
    var(--qhph-skeleton-c) 55%,
    var(--qhph-skeleton-a) 61%,
    var(--qhph-skeleton-a) 100%);
  background-size: 220% 100%;
  background-position: 115% 0;
  animation: qhph-skeleton-scan var(--qhph-skeleton-scan-duration) linear infinite;
}

/* Start each group at a different point in the same scan cycle. Negative delays
   avoid a static first frame while keeping the motion calm and coordinated. */
.qhph-loader-hero .qhph-page-skeleton-shape { animation-delay: -.12s; }
.qhph-loader-time-tabs .qhph-page-skeleton-shape { animation-delay: -.30s; }
.qhph-loader-context .qhph-page-skeleton-shape { animation-delay: -.46s; }
.qhph-loader-planner-block .qhph-page-skeleton-shape { animation-delay: -.64s; }
.qhph-loader-moods .qhph-page-skeleton-shape { animation-delay: -.82s; }
.qhph-skeleton-card:nth-child(3n + 2) .qhph-skeleton-media,
.qhph-skeleton-card:nth-child(3n + 2) .qhph-skeleton-line { animation-delay: -.28s; }
.qhph-skeleton-card:nth-child(3n) .qhph-skeleton-media,
.qhph-skeleton-card:nth-child(3n) .qhph-skeleton-line { animation-delay: -.56s; }

.qhph-page-skeleton-shape { display: block; border-radius: 999px; }
.qhph-loader-eyebrow { width: 214px; height: 8px; }
.qhph-loader-title {
  width: min(78vw, 520px);
  height: 52px;
  border-radius: 15px;
}
.qhph-loader-subtitle { width: min(62vw, 280px); height: 11px; opacity: .74; }
.qhph-loader-search {
  width: 100%;
  max-width: 920px;
  height: 54px;
  margin-top: 8px;
  border-radius: 999px;
}
.qhph-loader-chip-row { gap: 8px; overflow: hidden; }
.qhph-loader-time-tabs { margin-top: 2px; }
.qhph-loader-time-chip { flex: 0 0 74px; height: 34px; }

/* The context row occupies the same place as the weather-aware pill. */
.qhph-loader-context {
  width: min(100%, 390px);
  min-height: 42px;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 1px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  background: rgba(15,27,31,.44);
}
.qhph-loader-context-copy { width: 26px; height: 26px; flex: 0 0 26px; }
.qhph-loader-context-action { width: 190px; height: 9px; }

/* Reuse the former planner placeholder as the city identity strip seen above the moods. */
.qhph-loader-planner-block {
  order: 2;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  align-items: center;
  gap: 11px;
  max-width: 620px;
  min-height: 62px;
  margin: 3px auto 0;
  padding: 11px 12px;
  border: 1px solid rgba(233,216,188,.11);
  border-radius: 16px;
  background: linear-gradient(115deg, rgba(201,112,74,.055), rgba(34,214,209,.035));
}
.qhph-loader-planner-block::before { display: none; }
.qhph-loader-planner-icon { width: 38px; height: 38px; border-radius: 12px; z-index: 1; }
.qhph-loader-planner-copy { display: grid; gap: 7px; z-index: 1; }
.qhph-loader-planner-title { width: min(56vw, 230px); height: 11px; }
.qhph-loader-planner-sub { width: min(72vw, 390px); height: 8px; opacity: .72; }
.qhph-loader-planner-arrow { display: none; }

.qhph-loader-mood-section {
  order: 3;
  padding-top: 11px;
  padding-bottom: 8px;
}
.qhph-loader-mood-section::before {
  content: "";
  display: block;
  width: 150px;
  height: 7px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
}
.qhph-loader-moods { gap: 8px; }
.qhph-loader-mood { flex: 0 0 88px; height: 32px; }

/* These sections live below the first real viewport. Do not show fake cards above the fold. */
.qhph-loader-radar,
.qhph-loader-wallet,
.qhph-loader-nearby,
.qhph-loader-explore { display: none; }

/* Kept for the hardening fallback and feed-level skeletons. */
.qhph-loader-section,
.qhph-loader-wallet { gap: 14px; }
.qhph-loader-section-heading { justify-content: space-between; gap: 16px; }
.qhph-loader-heading-stack { display: grid; gap: 8px; }
.qhph-loader-kicker { width: 86px; height: 7px; }
.qhph-loader-heading { width: 152px; height: 20px; border-radius: 8px; }
.qhph-loader-heading-wide { width: 190px; height: 20px; border-radius: 8px; }
.qhph-loader-count { width: 50px; height: 8px; }
.qhph-loader-cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(216px, 72vw);
  gap: 12px;
  overflow: hidden;
}
.qhph-loader-card {
  min-height: 264px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 22px;
  background: #121615;
}
.qhph-loader-card-media { width: 100%; height: 174px; border-radius: 0; }
.qhph-loader-card-copy { display: grid; gap: 9px; padding: 14px; }
.qhph-loader-card-kicker { width: 40%; height: 7px; }
.qhph-loader-card-title { width: 76%; height: 15px; border-radius: 7px; }
.qhph-loader-card-meta { width: 56%; height: 9px; }
.qhph-loader-wallet-title-row { justify-content: space-between; }
.qhph-loader-wallet-title { width: 112px; height: 22px; border-radius: 8px; }
.qhph-loader-wallet-mark { width: 28px; height: 28px; }
.qhph-loader-wallet-chips { gap: 8px; }
.qhph-loader-wallet-chip { flex: 0 0 98px; height: 34px; }
.qhph-loader-wallet .qhph-loader-cards { grid-auto-columns: minmax(180px, 62vw); }
.qhph-loader-wallet .qhph-loader-card { min-height: 205px; }
.qhph-loader-wallet .qhph-loader-card-media { height: 112px; }
.qhph-loader-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.qhph-loader-category { height: 66px; border-radius: 18px; }

/* Mobile loader nav is the real bottom-nav geometry. */
.qhph-loader-bottom-nav {
  position: fixed;
  z-index: 2;
  left: 12px;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  height: 68px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px;
  background: rgba(13,17,16,.96);
  backdrop-filter: blur(14px);
}
.qhph-loader-nav-item {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  opacity: .52;
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.qhph-loader-nav-item.is-active {
  opacity: .96;
  color: var(--accent, #e8784d);
}
.qhph-loader-nav-item b { font-size: 18px; line-height: 1; font-weight: 700; }
.qhph-loader-nav-item small { font-size: 8px; line-height: 1; font-weight: 750; }

/* Feed/media stability after first reveal. */
.qhph-feed-skeleton { display: contents; }
.qhph-skeleton-card {
  min-height: 280px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 24px;
  background: #121615;
  scroll-snap-align: start;
}
.qhph-skeleton-media { width: 100%; height: 190px; }
.qhph-skeleton-copy { padding: 15px; display: grid; gap: 9px; }
.qhph-skeleton-line { height: 11px; border-radius: 999px; }
.qhph-skeleton-line:first-child { width: 72%; height: 16px; }
.qhph-skeleton-line:last-child { width: 48%; }
.qhph-loading-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.v3-card > img,
.activity-image,
.movie-summary img,
.saved-row img,
.wallet-card-visual img,
.detail-sheet img,
.surprise-image,
.offer-card-image {
  background-color: var(--surface-2, #1D2320);
}

img.qhph-media-pending {
  background-image: linear-gradient(100deg,
    var(--qhph-skeleton-a) 0%,
    var(--qhph-skeleton-a) 39%,
    var(--qhph-skeleton-c) 45%,
    var(--qhph-skeleton-b) 50%,
    var(--qhph-skeleton-c) 55%,
    var(--qhph-skeleton-a) 61%,
    var(--qhph-skeleton-a) 100%);
  background-size: 220% 100%;
  background-position: 115% 0;
  animation: qhph-skeleton-scan var(--qhph-skeleton-scan-duration) linear infinite;
  transition: filter .18s ease, opacity .18s ease;
  filter: saturate(.7) brightness(.84);
}
img.qhph-media-ready {
  animation: none;
  background-image: none;
  filter: none;
}
img.qhph-media-failed {
  animation: none;
  background-image: linear-gradient(135deg, var(--surface-2, #1D2320), var(--bg, #0B0E0E));
  filter: grayscale(1) brightness(.8);
}

.wallet-card-visual {
  display: block;
  width: 100%;
  height: 104px;
  overflow: hidden;
  border-radius: 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg,var(--surface-2,#1D2320),var(--surface,#151918));
}
.wallet-card-visual img { display: block; width: 100%; height: 100%; object-fit: cover; }
.surprise-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

@keyframes qhph-skeleton-scan {
  0% { background-position: 115% 0; }
  100% { background-position: -115% 0; }
}

@media (min-width: 760px) {
  .qhph-loader-topbar {
    min-height: 78px;
    padding: 14px 18px 12px;
  }
  .qhph-loader-brand small { display: none; }
  .qhph-loader-main { height: calc(100dvh - 78px - 28px); }
  .qhph-loader-hero { padding-top: 54px; }
  .qhph-loader-title { height: 68px; width: min(66vw, 570px); }
  .qhph-loader-search { height: 56px; }
  .qhph-loader-planner-block { margin-left: max(18px, calc((100% - 1080px) / 2 + 18px)); margin-right: auto; }
  .qhph-loader-cards { grid-auto-columns: minmax(230px, 31%); }
  .qhph-loader-wallet .qhph-loader-cards { grid-auto-columns:minmax(210px,28%); }
  .qhph-loader-category-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .qhph-skeleton-card { min-height:300px; }
}

/* Real desktop QHPH uses the same content frame and vertical nav rail. */
@media (min-width: 1200px) {
  .qhph-loader-main { height: calc(100dvh - 78px); }
  .qhph-loader-block {
    max-width: 1360px;
    padding-inline: 54px;
  }
  .qhph-loader-hero {
    padding-top: clamp(40px, 5vw, 78px);
  }
  .qhph-loader-search {
    max-width: 940px;
    min-height: 58px;
  }
  .qhph-loader-context {
    margin-bottom: 48px;
  }
  .qhph-loader-planner-block {
    margin-left: max(54px, calc((100% - 1360px) / 2 + 54px));
    margin-right: auto;
  }
  .qhph-loader-city {
    width: 136px;
    height: 37px;
  }
  .qhph-loader-bottom-nav {
    top: 50%;
    bottom: auto;
    left: max(22px, calc((100vw - 1520px) / 2));
    right: auto;
    transform: translateY(-50%);
    width: 96px;
    height: auto;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 11px 8px;
    border-radius: 26px;
    box-shadow: 0 18px 48px rgba(0,0,0,.28);
  }
  .qhph-loader-nav-item {
    min-height: 68px;
    justify-content: center;
    align-content: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 18px;
  }
  .qhph-loader-nav-item.is-active {
    background: var(--accent-soft, rgba(232,120,77,.14));
  }
  .qhph-loader-nav-item b { font-size: 22px; }
  .qhph-loader-nav-item small { font-size: 10px; }
  .qhph-loader-hero::after {
    right: 10px;
    top: -2px;
    width: 315px;
    height: 240px;
    opacity: .22;
  }
}

@media (max-width: 560px) {
  .qhph-loader-title { height: 48px; }
  .qhph-loader-eyebrow { width: 178px; }
  .qhph-loader-context { width: min(100%, 350px); }
  .qhph-loader-planner-block { margin-inline: 18px; width: calc(100% - 36px); }
}

@media (prefers-reduced-motion: reduce) {
  .qhph-page-loader,
  .app-shell.qhph-shell-awaiting-reveal { transition: none !important; }
  .qhph-page-skeleton-shape,
  .qhph-skeleton-media,
  .qhph-skeleton-line,
  img.qhph-media-pending {
    animation: none !important;
    background-position: 50% 0;
    transition: none !important;
  }
}

/* Screenshot-verified 1920px first-viewport parity.
   Keep dynamic content abstract, but reserve every visible block before reveal. */
@media (min-width: 1200px) {
  .qhph-loader-search { margin-top: 23px; }
  .qhph-loader-context { margin-bottom: 34px; }

  /* The identity strip must keep its real 620px measure; the generic desktop
     loader frame must not stretch it across the full content canvas. */
  .qhph-loader-planner-block {
    width: 620px;
    max-width: 620px;
    padding-inline: 12px;
  }

  /* Intent chips are followed by a scroll cue, the home mood rail and the two
     planning entry cards in the real first viewport. Reserve those shapes so
     reveal only replaces paint, not geometry. */
  .qhph-loader-mood-section {
    overflow: visible;
    padding-bottom: 250px;
  }
  .qhph-loader-moods {
    position: relative;
    overflow: visible;
  }
  .qhph-loader-moods::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 67px;
    width: 34px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255,255,255,.16);
  }
  .qhph-loader-moods::after {
    content: "";
    position: absolute;
    left: 0;
    top: 110px;
    width: 94px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255,255,255,.055);
    box-shadow:
      104px 0 0 rgba(255,255,255,.055),
      208px 0 0 rgba(255,255,255,.055),
      312px 0 0 rgba(255,255,255,.055),
      416px 0 0 rgba(255,255,255,.055),
      520px 0 0 rgba(255,255,255,.055),
      624px 0 0 rgba(255,255,255,.055);
  }
  .qhph-loader-mood-section::after {
    content: "";
    display: block;
    height: 86px;
    margin-top: 156px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 20px;
    background:
      radial-gradient(circle at 29px 43px, rgba(232,120,77,.34) 0 15px, transparent 16px),
      linear-gradient(rgba(255,255,255,.10),rgba(255,255,255,.10)) 62px 28px / 150px 10px no-repeat,
      linear-gradient(rgba(255,255,255,.055),rgba(255,255,255,.055)) 62px 49px / 220px 8px no-repeat,
      linear-gradient(135deg, rgba(232,120,77,.065), rgba(255,255,255,.025));
    box-shadow:
      0 100px 0 rgba(18,22,21,.96),
      0 100px 0 1px rgba(255,255,255,.065);
  }
}
