/* Homepage surfaces and reusable store tiles; business rules live in the existing API. */
.home-discovery { padding-block: 20px 36px; }
.discovery-section, .home-browse .comparison-column {
  container-type: inline-size; color: var(--cb-heading);
}
/* Initialization scripts may sit between sections; only visible sections add a gap. */
.discovery-section:not([hidden]) ~ .discovery-section { margin-top: var(--cb-section-gap); }
.discovery-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.discovery-heading h2 { display: flex; align-items: center; gap: 10px; color: var(--cb-heading); font-size: clamp(22px, 2vw, 28px); line-height: 1.3; letter-spacing: -.7px; font-weight: 700; }
.discovery-heading p { color: var(--cb-secondary-text); font-size: 15px; line-height: 1.5; margin-top: 6px; }
.section-icon, .notable-heading-icon, .list-symbol { display: inline-flex; flex: 0 0 24px; color: var(--cb-primary); }
.section-icon svg, .notable-heading-icon svg, .list-symbol svg { width: 24px; height: 24px; }
.notable-heading-copy, .notable-title-row, .list-title { min-width: 0; }
.notable-title-row { display: flex; gap: 10px; align-items: center; }
.list-title { display: flex; align-items: flex-start; gap: 10px; }
.list-symbol { margin-top: 6px; }
.heading-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-top: -4px; }
.see-all { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0; color: var(--cb-primary); font-size: 14px; background: transparent; white-space: nowrap; flex-shrink: 0; }
.see-all:hover { text-decoration: underline; text-underline-offset: 4px; }
.notable-controls { display: flex; gap: 8px; }
.strip-arrow, .notable-arrow { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--cb-border); border-radius: 50%; background: white; color: var(--cb-primary); font-size: 20px; }
.strip-arrow:hover:not(:disabled), .notable-arrow:hover:not(:disabled) { background: var(--cb-hover); }
.strip-arrow:disabled, .notable-arrow:disabled { opacity: .4; cursor: default; }
/* Width comes from each section, so short saved rows never stretch their tiles. */
.store-tiles {
  --tile-gap: 12px; --tile-width: calc((100cqi - 6px - var(--tile-gap) * .75) / 1.75);
  display: flex; align-items: stretch; gap: var(--tile-gap); width: 100%; min-width: 0;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding: 4px 3px 8px; scroll-padding-inline: 3px;
}
.store-tiles::-webkit-scrollbar { display: none; }
.store-tiles > :is(.discovery-status, .list-empty) { flex: 1; }
.saved-strip.is-expanded { display: grid; grid-template-columns: repeat(auto-fill, var(--tile-width)); overflow: visible; }
.notable-card { flex: 0 0 var(--tile-width); position: relative; min-width: 0; scroll-snap-align: start; }
.notable-store-link { display: block; border-radius: 12px; }
.store-artwork { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--store-artwork-background, #fff); }
.store-artwork--neutral { box-shadow: inset 0 0 0 1px var(--cb-border); }
.store-artwork img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; padding: 18px 22px; }
.store-artwork--full img { padding: 0; }
.store-artwork--fallback { background: #f5f7fa; }
.store-artwork-name { font: 700 clamp(18px, 2cqi, 26px)/1.3 'Manrope',sans-serif; text-align: center; padding: 20px; overflow-wrap: anywhere; }
.notable-rate { margin-top: 8px; color: var(--cb-primary); font: 600 clamp(20px, 2cqi, 24px)/1.25 'Manrope',sans-serif; letter-spacing: -.6px; overflow-wrap: anywhere; }
.notable-rate strong { font-weight: inherit; }
.notable-provider { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: var(--cb-secondary-text); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.notable-provider .portal-logo { width: 14px; height: 14px; flex: 0 0 14px; object-fit: contain; }
.notable-provider > span { min-width: 0; overflow-wrap: anywhere; }
.notable-comparison { display: flex; align-items: flex-start; gap: 4px; margin-top: 6px; color: var(--cb-positive); font-size: 13px; font-weight: 500; line-height: 1.4; }
.notable-comparison-visible { display: flex; align-items: baseline; gap: 4px; }
.notable-comparison svg { flex: 0 0 14px; width: 14px; height: 14px; margin-top: 2px; }
.notable-comparison-visible > span { min-width: 0; overflow-wrap: anywhere; }
.tile-previous { color: var(--cb-secondary-text); font-size: 12px; line-height: 1.4; margin-top: 6px; }
.favorite-toggle { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; color: var(--cb-heading); isolation: isolate; }
.favorite-toggle::before { content: ''; position: absolute; width: 32px; height: 32px; background: #fffffff2; border-radius: 50%; z-index: -1; }
.favorite-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.favorite-toggle[aria-pressed="true"] { color: var(--cb-primary); }
.favorite-toggle[aria-pressed="true"] svg { fill: currentColor; }
.discovery-status { padding: 20px 0; color: var(--cb-secondary-text); font-size: 14px; }
.discovery-status button { color: var(--cb-primary); background: transparent; text-decoration: underline; }
.discovery-pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 20px; color: var(--cb-secondary-text); font-size: 13px; }
.home-browse { margin-top: var(--cb-section-gap); scroll-margin-top: var(--cb-section-gap); }
.home-browse .browse-toolbar { margin-bottom: var(--cb-section-gap); align-items: flex-start; gap: 12px; }
.category-menu { min-width: 0; max-width: 65%; }
.category-menu summary { cursor: pointer; font-size: 14px; color: var(--cb-secondary-text); padding: 9px 12px; border: 1px solid var(--cb-border); border-radius: 10px; background: white; width: fit-content; }
.category-menu summary:hover { background: var(--cb-hover); }
.category-menu .category-filters { padding-top: 10px; }
.home-browse .comparison-columns { grid-template-columns: minmax(0, 1fr); gap: var(--cb-section-gap); }
.home-browse .store-list { border: 0; border-radius: 0; overflow: visible; }
.home-browse .list-pagination { border: 0; padding: 20px 0 0; font-size: 13px; }
.home-browse .page-action { font-size: 13px; color: var(--cb-primary); }
.home-browse .page-action:disabled { color: var(--cb-secondary-text); }
body[data-page="home"] :is(a, button, summary, [tabindex]):focus-visible { outline: 3px solid var(--cb-primary); outline-offset: 2px; }
@container (min-width: 450px) { .store-tiles { --tile-gap: 16px; --tile-width: calc((100cqi - 30px) / 2.25); } }
@container (min-width: 600px) { .store-tiles { --tile-width: calc((100cqi - 38px) / 3); } }
@container (min-width: 860px) { .store-tiles { --tile-width: calc((100cqi - 54px) / 4); } }
@container (min-width: 1100px) { .store-tiles { --tile-width: calc((100cqi - 70px) / 5); } }
@media (max-width: 767px) {
  .discovery-heading { flex-wrap: wrap; gap: 8px; }
  .discovery-heading h2 { font-size: 22px; }
  .discovery-heading p { font-size: 14px; }
  .heading-actions { margin-left: auto; gap: 4px; }
  .strip-arrow, .notable-arrow { width: 36px; }
  .see-all { font-size: 13px; gap: 4px; }
  .notable-controls { gap: 4px; }
  .store-artwork img { padding: 14px 18px; }
  .store-artwork--full img { padding: 0; }
  .category-menu { max-width: 47%; }
  .category-menu summary { padding: 10px; font-size: 13px; }
  .home-browse .reward-filters button { font-size: 12px; padding-inline: 8px; }
  .home-browse .list-pagination { gap: 10px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-discovery *, .home-discovery *::before { transition: none !important; scroll-behavior: auto !important; }
}

/* Reserve the actual artwork and text height before the API replaces initial content. */
.store-tiles { min-height: calc(var(--tile-width) * 9 / 16 + 77px); }
#notable-cards { min-height: calc(var(--tile-width) * 9 / 16 + 102px); }
#increases-list { min-height: calc(var(--tile-width) * 9 / 16 + 122px); }

/* Determine returning-visitor space during parsing, before the rest of the page paints. */
#favorites { position: relative; }
#saved-status { position: absolute; bottom: 20px; left: var(--cb-section-padding); right: var(--cb-section-padding); }
