/*
 * Styles for the generated gift landing pages (/gifts/...). Loaded after /site.css.
 * The gift card matches the list page in the app (apps/web/src/styles.css). The ten tones are
 * the same colours as TONES in apps/web/src/gift-art.tsx; keep the two in step.
 * No inline styles are used on these pages, because the site's CSP does not allow them.
 */
.gifts-page {
  padding: 1.5rem 0 4rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Breadcrumbs */
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.crumbs li + li::before {
  content: "›";
  margin-right: 0.5rem;
}

.crumbs a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--primary);
}

/* Page head */
.gifts-head h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tagline {
  max-width: 44rem;
}

.byline {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.disclosure {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  max-width: 44rem;
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid #fbbf24;
  background: rgba(255, 249, 232, 0.92);
  color: #3f3c52;
  font-size: 0.9rem;
}

.disclosure-icon {
  flex: none;
  font-size: 1.15rem;
  line-height: 1.3;
}

.intro {
  max-width: 44rem;
  margin: 1.75rem 0 2rem;
  font-size: 1.05rem;
}

.intro p {
  margin: 0 0 1rem;
}

.section-title {
  margin: 3rem 0 1rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
}

/* Gift cards: the same look as the app's list page */
.items {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  padding: 1.25rem;
  border: 1px solid #fff;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 1px 2px rgba(20, 18, 31, 0.04),
    0 12px 36px -16px rgba(var(--glow), 0.22);
  outline: 1px solid rgba(0, 0, 0, 0.04);
  scroll-margin-top: 6rem;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.item:hover {
  transform: translateY(-2px);
  box-shadow:
    0 2px 4px rgba(20, 18, 31, 0.05),
    0 24px 48px -18px rgba(var(--glow), 0.4);
}

.item-body {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.item-lead {
  display: flex;
  flex: 1;
  align-items: flex-start;
  align-self: center;
  gap: 1rem;
  min-width: 0;
}

.item-main {
  display: grid;
  flex: 1;
  gap: 0.5rem;
  min-width: 0;
}

.item-placeholder {
  display: grid;
  flex: none;
  place-items: center;
  width: 6rem;
  height: 6rem;
  border-radius: 0.75rem;
  outline: 1px solid rgba(0, 0, 0, 0.04);
}

.item-placeholder {
  position: relative;
  overflow: hidden;
}

/* The product picture covers the icon tile; if it fails to load, the tile still shows. */
.item-placeholder.has-image {
  background-image: none;
  background-color: #fff;
}

.item-placeholder.has-image > svg {
  opacity: 0.18;
}

.item-image {
  position: absolute;
  inset: 0;
  display: block;
}

.item-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.25rem;
}

.stock-chip {
  width: fit-content;
  margin: 0;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.stock-sold-out {
  background: #ffe4e6;
  color: #9f1239;
}

.stock-low-stock {
  background: #fff1d6;
  color: #92400e;
}

.stock-unknown {
  background: var(--primary-soft);
  color: var(--muted);
}

.item-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item-title a {
  color: var(--ink);
  text-decoration: none;
}

.item-title a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.item-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.item-side {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  align-self: flex-start;
  gap: 0.75rem;
  min-height: 6rem;
}

.price-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  outline: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.price-none {
  background: var(--primary-soft);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-sm {
  min-height: 2.2rem;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* House card in the ad slot, ready for an ad network later. Space is reserved to avoid layout shift. */
.ad-card {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  min-height: 8rem;
  border-style: dashed;
}

.ad-label {
  width: fit-content;
  margin: 0;
  padding: 0.1rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot {
  min-width: 0;
  overflow: hidden;
}

.footer .ad-choices {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.footer .ad-choices:hover {
  color: var(--primary);
}

.ad-house {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  color: var(--muted);
  font-size: 0.95rem;
}

.ad-house p {
  margin: 0;
}

.ad-house-title {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

/*
 * Ad states, set by /gifts-ads.js on the card (data-ad-state):
 *   none / house  our own promo, labelled "From GiftListHuddle"
 *   loading       our promo stays visible; the ad container is on the page but invisible so Google
 *                 can render into it. Every state keeps the card at the same height (17rem)
 *   ad            the ad, labelled "Sponsored"
 */
.ad-card {
  position: relative;
}

/* On a page that loads ads: the same height in every state, so a card never grows or shrinks when an ad arrives or fails. */
[data-adsense-slot] .ad-card,
[data-ad-unit] .ad-card {
  min-height: 17rem;
}

.ad-label-sponsored,
.ad-gpt {
  display: none;
}

/*
 * Full width, no height, invisible: an AdSense in-feed unit sizes itself from the width of its
 * container, so a 1px box left it nothing to work with. Once the ad arrives the container
 * keeps this width and simply gains its height.
 */
.ad-card[data-ad-state="loading"] .ad-gpt {
  display: block;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.ad-card[data-ad-state="ad"] .ad-gpt {
  display: block;
}

.ad-card[data-ad-state="ad"] .ad-house,
.ad-card[data-ad-state="ad"] .ad-label-house {
  display: none;
}

.ad-card[data-ad-state="ad"] .ad-label-sponsored {
  display: block;
}

/* The /gifts/ hub: hero, jump chips and guide cards */
.hub-hero {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.hub-hero .eyebrow,
.guide-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.hub-highlight {
  color: var(--primary);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .hub-highlight {
    background-image: linear-gradient(120deg, #5b3df5, #d946ef);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.hub-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.hub-stats li {
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-size: 0.9rem;
}

.hub-stats strong {
  color: var(--ink);
}

.hub-art {
  justify-self: center;
  width: 100%;
  max-width: 17rem;
  height: auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip:focus-visible,
.guide-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  scroll-margin-top: 6rem;
}

.section-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.8rem;
  background: var(--primary-soft);
  font-size: 1.3rem;
  line-height: 1;
}

.section-count {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: normal;
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.9rem;
  row-gap: 0.3rem;
  align-items: center;
  height: 100%;
  padding: 1rem 1.1rem;
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.guide-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 2px rgba(20, 18, 31, 0.04),
    0 18px 40px -16px rgba(var(--glow), 0.4);
}

.guide-card:hover .guide-title {
  color: var(--primary);
}

.guide-tile {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 1rem;
  font-size: 1.6rem;
  line-height: 1;
}

.guide-text {
  display: block;
}

.guide-title {
  display: block;
  font-weight: 700;
  line-height: 1.25;
}

.guide-tagline {
  display: -webkit-box;
  margin-top: 0.2rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.guide-count {
  grid-column: 2;
  justify-self: start;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (min-width: 52rem) {
  .hub-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 2rem;
  }

  .hub-art {
    max-width: 26rem;
  }
}

/* A guide page: hero with its own emoji badge, stats, rank badges */
.guide-hero {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.guide-hero > .disclosure {
  grid-column: 1 / -1;
}

.guide-hero .eyebrow a {
  color: inherit;
  text-decoration: none;
}

.guide-hero .eyebrow a:hover {
  text-decoration: underline;
}

.guide-stats {
  margin-top: 1rem;
}

.guide-hero .byline {
  margin-top: 0.7rem;
}

.guide-jump {
  margin-top: 1.25rem;
}

/* Small screens keep the page short: the emoji in the group chip carries the personality there. */
.guide-badge {
  position: relative;
  display: none;
  place-items: center;
  justify-self: start;
  width: 100%;
  max-width: 8rem;
  aspect-ratio: 1;
  border-radius: 2rem;
  box-shadow:
    0 1px 2px rgba(20, 18, 31, 0.05),
    0 24px 48px -20px rgba(var(--glow), 0.45);
}

.guide-badge-emoji {
  font-size: 4.2rem;
  line-height: 1;
  filter: drop-shadow(0 8px 10px rgba(20, 18, 31, 0.16));
}

.spark {
  position: absolute;
  line-height: 1;
}

.spark-1 {
  top: -0.6rem;
  right: 0.5rem;
  font-size: 1.6rem;
  transform: rotate(12deg);
}

.spark-2 {
  bottom: 0.7rem;
  left: -0.7rem;
  font-size: 1.3rem;
}

.spark-3 {
  top: 1.4rem;
  left: -0.5rem;
  font-size: 1rem;
}

.item-rank {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(20, 18, 31, 0.2);
}

.intro p:first-child {
  color: var(--ink);
  font-size: 1.15rem;
}

@media (min-width: 52rem) {
  .guide-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
  }

  .guide-badge {
    display: grid;
    justify-self: center;
    width: 14rem;
    max-width: none;
    border-radius: 2.6rem;
  }

  .guide-badge-emoji {
    font-size: 7rem;
  }

  .spark-1 {
    top: -0.9rem;
    right: 1rem;
    font-size: 2.2rem;
  }

  .spark-2 {
    bottom: 1.4rem;
    left: -1.1rem;
    font-size: 1.8rem;
  }

  .spark-3 {
    top: 2.2rem;
    left: -0.8rem;
    font-size: 1.3rem;
  }
}

/* Call to action */
.band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3rem;
  padding: 2rem;
  border-radius: 1.5rem;
  background-image: linear-gradient(135deg, #5b3df5, #d946ef);
  color: #fff;
}

.band h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.band p {
  max-width: 34rem;
  margin: 0.4rem 0 0;
  opacity: 0.92;
}

.band .btn {
  background: #fff;
  color: var(--primary);
}

.faq .panel > summary {
  border-radius: 1.25rem;
}

@media (max-width: 640px) {
  .item {
    padding: 1rem;
  }

  .item-body {
    flex-direction: column;
  }

  .item-lead {
    align-self: stretch;
  }

  .item-placeholder {
    width: 4rem;
    height: 4rem;
  }

  .item-side {
    flex-direction: row-reverse;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    align-self: stretch;
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .item,
  .guide-card,
  .chip {
    transition: none;
  }

  .item:hover,
  .guide-card:hover {
    transform: none;
  }
}

/* Gift tones */
.tone-0 {
  background-image: linear-gradient(145deg, #efeaff, #ddd3ff);
  color: #5b3df5;
}

.tone-1 {
  background-image: linear-gradient(145deg, #ffe4f1, #ffcfe5);
  color: #c0267a;
}

.tone-2 {
  background-image: linear-gradient(145deg, #fff1d6, #ffe0a3);
  color: #c26a04;
}

.tone-3 {
  background-image: linear-gradient(145deg, #dcfce7, #bbf3cf);
  color: #15803d;
}

.tone-4 {
  background-image: linear-gradient(145deg, #e0f2fe, #bde5fb);
  color: #0369a1;
}

.tone-5 {
  background-image: linear-gradient(145deg, #ffe4e6, #fecdd3);
  color: #d61c46;
}

.tone-6 {
  background-image: linear-gradient(145deg, #ccfbf1, #98f0e0);
  color: #0f766e;
}

.tone-7 {
  background-image: linear-gradient(145deg, #e0e7ff, #c7d2fe);
  color: #4338ca;
}

.tone-8 {
  background-image: linear-gradient(145deg, #ffedd5, #ffd5a8);
  color: #c2410c;
}

.tone-9 {
  background-image: linear-gradient(145deg, #fae8ff, #f3cffd);
  color: #a21caf;
}

.consent-banner {
  position: fixed;
  inset: auto 0 0;
  z-index: 20;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
}

.consent-banner[hidden] {
  display: none;
}

.consent-banner p {
  max-width: 60rem;
  margin: 0;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 40rem) {
  .consent-banner {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 1rem 1.5rem;
  }
}
