/* Homepage/offers only. Uses the existing theme tokens and compiled components. */
.tf-discovery-page {
    --tf-discovery-accent: 142 48% 32%;
    --tf-discovery-glow: 130 34% 69%;
}
.dark .tf-discovery-page {
    --tf-discovery-accent: 139 46% 66%;
    --tf-discovery-glow: 134 27% 43%;
}
.tf-discovery-hero {
    padding: 2.75rem 0 2.75rem;
    border-bottom: 1px solid hsl(var(--border));
    background: radial-gradient(ellipse at 50% 0%, hsl(var(--tf-discovery-glow) / .25), transparent 74%), hsl(var(--background));
}
.dark .tf-discovery-hero {
    background: radial-gradient(ellipse at 50% 0%, hsl(var(--tf-discovery-glow) / .3), transparent 76%), hsl(var(--background));
}
.tf-discovery-hero-content { max-width: 64rem; margin: 0 auto; text-align: center; }
.tf-discovery-eyebrow {
    display: inline-flex; align-items: center; gap: .5rem; max-width: 100%;
    padding: .4rem .8rem; border: 1px solid hsl(var(--tf-discovery-accent) / .25);
    border-radius: 9999px; background: hsl(var(--background) / .5);
    font-size: .75rem; font-weight: 500; line-height: 1.5;
}
.tf-discovery-eyebrow svg { flex: none; color: hsl(var(--tf-discovery-accent)); }
.tf-discovery-title {
    max-width: 54rem; margin: 1.25rem auto 0; font-size: clamp(1.9rem, 4.1vw, 3.25rem);
    line-height: 1.13; font-weight: 750; letter-spacing: -.04em; text-wrap: balance;
    overflow-wrap: anywhere;
}
.tf-hero-phrase { white-space: nowrap; }
.tf-discovery-description {
    max-width: 46rem; margin: 1rem auto 0; color: hsl(var(--muted-foreground));
    font-size: 1.125rem; line-height: 1.65;
}
.tf-discovery-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 1.4rem; }
.tf-discovery-action { min-height: 44px; padding: .7rem 1.6rem; }
.tf-discovery-action.border { background: hsl(var(--background)); }
.tf-discovery-action.border:hover { background: hsl(var(--accent)); }
.tf-discovery-search {
    display: flex; align-items: center; gap: .85rem; width: 100%; max-width: 54rem;
    min-height: 60px; margin: 1.75rem auto 0; padding: .3rem .35rem .3rem 1.2rem;
    border: 1.5px solid hsl(var(--foreground) / .4); border-radius: 9999px;
    background: hsl(var(--background) / .9); box-shadow: 0 4px 20px hsl(var(--foreground) / .04);
    text-align: left; transition: border-color 160ms ease, box-shadow 160ms ease;
}
.tf-discovery-search:focus-within { border-color: hsl(var(--tf-discovery-accent)); box-shadow: 0 0 0 3px hsl(var(--tf-discovery-accent) / .13); }
.tf-discovery-search > svg { flex: none; color: hsl(var(--muted-foreground)); }
.tf-discovery-search input {
    flex: 1 1 auto; min-width: 0; width: 100%; height: 44px; padding: 0;
    border: 0; outline: none; box-shadow: none; background: transparent;
    color: hsl(var(--foreground)); font: inherit; font-size: 1rem;
}
.tf-discovery-search input::placeholder { color: hsl(var(--muted-foreground)); opacity: 1; }
.tf-discovery-search input:focus { outline: none; box-shadow: none; }
.tf-discovery-search-submit {
    display: grid; place-items: center; flex: none; width: 48px; height: 48px;
    border-radius: 50%; background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
    transition: opacity 160ms ease; cursor: pointer;
}
.tf-discovery-search-submit:hover { opacity: .85; }
.tf-discovery-search-submit:focus-visible, .tf-discovery-search-shortcut:focus-visible, .tf-offer-share:focus-visible, .tf-discovery-chip:focus-visible,
.tf-discovery-text-link:focus-visible, .tf-offer-tile:focus-visible, .tf-ranking-site:focus-visible {
    outline: 2px solid hsl(var(--ring)); outline-offset: 3px;
}
.tf-discovery-topics { display: flex; align-items: center; gap: .75rem; max-width: 58rem; margin: 1.1rem auto 0; min-width: 0; }
.tf-discovery-topics-label { flex: none; font-size: .8rem; font-weight: 600; color: hsl(var(--muted-foreground)); }
.tf-discovery-topic-scroll {
    min-width: 0; overflow-x: auto; padding: .35rem .2rem; scrollbar-width: none;
    -ms-overflow-style: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.tf-discovery-topic-scroll::-webkit-scrollbar, .tf-offer-track::-webkit-scrollbar { display: none; }
.tf-discovery-topic-scroll:focus-visible, .tf-offer-track:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; border-radius: .5rem; }
.tf-discovery-topic-track { display: flex; align-items: center; justify-content: center; width: max-content; min-width: 100%; gap: .5rem; }
.tf-discovery-chip {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; flex: none;
    min-height: 36px; padding: .4rem .85rem; border: 1px solid hsl(var(--border)); border-radius: 9999px;
    background: hsl(var(--background) / .65); color: hsl(var(--muted-foreground));
    font-size: .8rem; font-weight: 500; line-height: 1.4; white-space: nowrap;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.tf-discovery-chip:hover { border-color: hsl(var(--tf-discovery-accent) / .6); color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.tf-discovery-chip.is-active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); }
.tf-discovery-chip-count { font-size: .7rem; opacity: .75; font-variant-numeric: tabular-nums; }
.tf-discovery-availability { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1rem; font-size: .8rem; color: hsl(var(--muted-foreground)); }
.tf-discovery-availability > span { width: 6px; height: 6px; flex: none; border-radius: 50%; background: hsl(var(--tf-discovery-accent)); }
.tf-offer-types { margin: 1.1rem auto 0; max-width: 58rem; }
.tf-offers-hero .tf-discovery-search { margin-top: 1.4rem; }

/* Reserve the desktop search slot; the mobile replacement is out of flow so
   toggling it cannot move the hero or trigger a visibility feedback loop. */
.tf-homepage [data-tf-header-search],
.tf-offerspage [data-tf-header-search] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.tf-homepage[data-tf-header-search-visible="true"] [data-tf-header-search],
.tf-offerspage[data-tf-header-search-visible="true"] [data-tf-header-search] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.tf-homepage .tf-site-mobile-search,
.tf-offerspage .tf-site-mobile-search {
    position: fixed;
    top: var(--tf-home-header-edge, 4rem);
    left: 0;
    right: 0;
}

.tf-offer-strip { padding: 2.25rem 0 2rem; }
.tf-discovery-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.tf-discovery-section-copy { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.tf-discovery-section-icon { display: grid; place-items: center; flex: none; width: 50px; height: 50px; border-radius: 8px; background: hsl(var(--tf-discovery-accent) / .12); color: hsl(var(--tf-discovery-accent)); }
.tf-discovery-section-heading h2 { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.3; }
.tf-discovery-section-heading p { margin-top: .3rem; font-size: .875rem; line-height: 1.5; color: hsl(var(--muted-foreground)); }
.tf-discovery-text-link { display: inline-flex; align-items: center; gap: .5rem; flex: none; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tf-discovery-text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tf-offer-track { display: flex; align-items: stretch; gap: 1rem; list-style: none; margin: 0; padding: .3rem .2rem; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tf-offer-slide { flex: 0 0 calc((100% - 3rem) / 4); min-width: 0; scroll-snap-align: start; }
.tf-offer-tile { display: flex; align-items: center; gap: .9rem; height: 100%; min-height: 110px; padding: 1rem; transition: border-color 160ms ease, box-shadow 160ms ease; }
.tf-offer-tile:hover { border-color: hsl(var(--tf-discovery-accent) / .6); box-shadow: 0 4px 14px hsl(var(--foreground) / .06); }
.tf-offer-tile:focus-visible { outline-offset: -3px; }
.tf-offer-tile-copy { display: block; flex: 1; min-width: 0; }
.tf-offer-tile-copy > strong { display: block; font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-offer-tile-deal { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: .3rem; min-height: 2.9em; font-size: .8rem; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.tf-offer-tile-logo { display: grid; place-items: center; flex: none; align-self: stretch; }
.tf-offer-track.tf-carousel-ready { scroll-snap-type: none; scroll-behavior: auto; }

.tf-home-rankings { padding: 3rem 0 4rem; border-top: 1px solid hsl(var(--border)); background: hsl(var(--muted) / .18); }
.tf-ranking-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.tf-ranking-card { padding: 1.4rem; min-width: 0; }
.tf-ranking-card h3 { display: flex; align-items: center; gap: .65rem; margin-bottom: 1rem; font-size: 1.05rem; font-weight: 600; }
.tf-ranking-card h3 svg { color: hsl(var(--tf-discovery-accent)); }
.tf-ranking-list { list-style: none; margin: 0; padding: 0; }
.tf-ranking-row { display: grid; grid-template-columns: 1rem minmax(0, 1fr) max-content 2.25rem; align-items: center; gap: .75rem; min-height: 74px; padding: .8rem 0; border-top: 1px solid hsl(var(--border)); }
.tf-ranking-row:first-child { border-top: 0; }
.tf-ranking-position { font-size: .8rem; font-weight: 600; color: hsl(var(--tf-discovery-accent)); }
.tf-ranking-site { display: flex; align-items: center; gap: .75rem; min-width: 0; border-radius: .3rem; }
.tf-ranking-site img { width: 40px; height: 40px; flex: none; object-fit: contain; border-radius: .45rem; background: hsl(var(--muted) / .4); }
.tf-ranking-site > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 500; }
.tf-ranking-site:hover > span { text-decoration: underline; text-underline-offset: 3px; }
.tf-ranking-count { font-size: .75rem; font-variant-numeric: tabular-nums; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.tf-ranking-visit { width: 36px; height: 36px; color: hsl(var(--muted-foreground)); }
.tf-ranking-empty { padding: 1.5rem 0; }

.tf-offerspage .tf-offer-card { min-width: 0; transition: box-shadow 180ms ease, border-color 180ms ease; }
.tf-offerspage .tf-offer-card:hover { border-color: hsl(var(--foreground) / .24); box-shadow: 0 4px 14px hsl(var(--foreground) / .06); }
.tf-offer-card-heading { min-width: 0; flex: 1; }
.tf-offer-card-heading h2 { font-size: 1rem; line-height: 1.45; }
.tf-offer-card-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.tf-offer-card-badge { display: inline-flex; align-items: center; padding: .3rem .55rem; border-radius: 9999px; background: hsl(var(--muted) / .6); color: hsl(var(--muted-foreground)); font-size: .7rem; line-height: 1.35; }
.tf-offer-card-badge.tf-offer-card-featured { background: hsl(var(--tf-discovery-accent) / .12); color: hsl(var(--tf-discovery-accent)); }
.tf-offer-card-footer { margin-top: auto; gap: .75rem; }
.tf-offer-card-footer > a { flex: none; }

@media (max-width: 1023px) and (min-width: 768px) {
    .tf-offer-slide { flex-basis: calc((100% - 2rem) / 3); }
    .tf-ranking-card { padding: 1rem; }
    .tf-ranking-row { gap: .5rem; }
}
@media (max-width: 767px) {
    .tf-discovery-hero { padding: 2.4rem 0 2rem; }
    .tf-discovery-title { margin-top: 1rem; font-size: clamp(1.8rem, 5.8vw, 2.4rem); line-height: 1.18; }
    .tf-discovery-eyebrow { font-size: .68rem; padding: .4rem .65rem; gap: .4rem; }
    .tf-discovery-description { font-size: .9375rem; line-height: 1.65; max-width: 35rem; }
    .tf-discovery-actions { gap: .6rem; margin-top: 1.2rem; }
    .tf-discovery-action { padding: .65rem 1.05rem; font-size: .8125rem; }
    .tf-discovery-search { min-height: 56px; margin-top: 1.5rem; padding-left: .9rem; gap: .55rem; }
    .tf-discovery-search > svg { width: 18px; height: 18px; }
    .tf-discovery-search input { font-size: 16px; }
    .tf-discovery-search input::placeholder { font-size: .8125rem; }
    .tf-discovery-search-submit { width: 44px; height: 44px; }
    .tf-discovery-topics { gap: .5rem; margin-top: .9rem; }
    .tf-discovery-topics-label { font-size: .75rem; }
    .tf-discovery-chip { min-height: 38px; font-size: .75rem; }
    .tf-offer-strip { padding: 1.6rem 0; }
    .tf-discovery-section-heading { flex-wrap: wrap; gap: .75rem; }
    .tf-discovery-section-heading p { font-size: .8rem; }
    .tf-discovery-section-icon { width: 36px; height: 36px; border-radius: .6rem; }
    .tf-discovery-text-link { margin-left: auto; }
    .tf-offer-slide { flex-basis: min(82vw, 300px); }
    .tf-offer-tile { min-height: 108px; }
    .tf-home-rankings { padding: 2.5rem 0; }
    .tf-ranking-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .tf-ranking-card { padding: 1rem; }
    .tf-ranking-row { grid-template-columns: .8rem minmax(0, 1fr) max-content 2.75rem; gap: .55rem; }
    .tf-ranking-site { gap: .6rem; }
    .tf-ranking-visit { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .tf-discovery-page [data-tf-header-search], .tf-discovery-page .tf-search-shell,
    .tf-discovery-search, .tf-discovery-search-submit, .tf-discovery-chip, .tf-offer-tile,
    .tf-offerspage .tf-offer-card { transition: none; animation: none; }
    .tf-offer-track { scroll-behavior: auto; }
}

/* Keep the original navbar's container, gap, font sizes and md breakpoint.
   Only the homepage search visibility is managed above. */
.tf-discovery-search-shortcut {
    display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
    flex: none; min-height: 44px; padding: 0 .75rem; border-radius: 9999px;
    color: hsl(var(--muted-foreground)); cursor: pointer;
}
.tf-discovery-search-shortcut kbd {
    display: grid; place-items: center; min-width: 1.55rem; height: 1.65rem;
    padding: 0 .35rem; border: 1px solid hsl(var(--border)); border-radius: .3rem;
    background: hsl(var(--muted) / .55); font: inherit; font-size: .7rem; line-height: 1;
}
.tf-discovery-search-shortcut:hover kbd { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.tf-drag-scroll { cursor: grab; }
.tf-drag-scroll a { cursor: inherit; }
.tf-drag-scroll.tf-is-dragging, .tf-drag-scroll.tf-is-dragging * {
    cursor: grabbing; user-select: none; -webkit-user-select: none;
}
.tf-offer-share {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 44px; height: 44px; border-radius: .45rem; color: hsl(var(--muted-foreground));
}
.tf-offer-share[hidden] { display: none; }
.tf-offer-share:hover { color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.tf-offer-share[aria-disabled="true"] { opacity: .6; cursor: wait; }
.tf-offer-share-feedback {
    position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 70;
    max-width: min(34rem, calc(100vw - 2rem)); padding: .8rem 1rem;
    border: 1px solid hsl(var(--border)); border-radius: .5rem; background: hsl(var(--card));
    color: hsl(var(--card-foreground)); box-shadow: 0 6px 24px hsl(var(--foreground) / .12);
    font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere;
}
.tf-offer-share-feedback:empty { opacity: 0; border: 0; padding: 0; pointer-events: none; }
@media (max-width: 767px) {
    .tf-discovery-search-shortcut { padding-inline: .4rem; }
    .tf-discovery-search-shortcut kbd { min-width: 1.4rem; font-size: .65rem; }
}
