/* HK deals cards — headline-hk
   Dark is default (html[data-theme=dark]); light via the theme toggle.
   html is 62.5% (1rem = 10px). Uses existing theme tokens and --ghost-accent-color.
   No JS libraries. Amazon cards never show a price, discount or rating.
   Product photos use object-fit: contain on a light tile. The homepage strip
   is a horizontal carousel on narrow screens; /tag/deals/ and in-post grids are not. */

.hk-deals,
.hk-deals-strip,
.hk-deals-page,
.hk-deals-grid {
    --hk-deal-bg: var(--color-white);
    --hk-deal-bd: var(--color-light-gray);
    --hk-deal-text: var(--color-darker-gray);
    --hk-deal-why: #3a4150;
    --hk-deal-muted: var(--color-secondary-text);
    --hk-deal-ph: var(--color-lighter-gray);
    --hk-deal-tile: #e8ebf0;
    --hk-deal-accent: var(--ghost-accent-color, #2563eb);
    --hk-deal-limited: #ff5a36;
    --hk-deal-ok: #16a34a;
    font-family: var(--font-sans, Inter, system-ui, sans-serif);
}

html[data-theme="dark"] .hk-deals,
html[data-theme="dark"] .hk-deals-strip,
html[data-theme="dark"] .hk-deals-page,
html[data-theme="dark"] .hk-deals-grid,
html[data-theme="dark"] .hk-deal {
    --hk-deal-bg: #171a20;
    --hk-deal-bd: #262a32;
    --hk-deal-text: #e6e8eb;
    --hk-deal-why: #c8cdd4;
    --hk-deal-muted: #9aa3ad;
    --hk-deal-ph: #1e232b;
    --hk-deal-tile: #e8ebf0;
    --hk-deal-ok: #4ade80;
}

/* ----- Homepage strip ----- */
.hk-deals-strip {
    margin: clamp(40px, 6vw, 72px) 0 4px;
    padding-top: clamp(28px, 4vw, 40px);
    border-top: 1px solid var(--hk-deal-bd, var(--color-light-gray));
}

.hk-deals-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin: 0 0 8px;
}

.hk-deals-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    margin: 0 0 10px;
}

.hk-deals-strip-title,
.hk-deals-page-title,
.gh-topic-grid .hk-deals-page-title {
    margin: 0;
    font-family: var(--font-sans, Inter, system-ui, sans-serif);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--hk-deal-text, var(--color-darker-gray));
}

.hk-deals-strip-head .hk-deals-strip-title {
    flex: 1 1 auto;
    min-width: 0;
}

.hk-deals-strip-links {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 14px;
    margin-left: 16px;
}

.hk-deals-strip-links a,
.hk-deals-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--hk-deal-muted, var(--color-secondary-text));
    text-decoration: none;
    white-space: nowrap;
}

.hk-deals-strip-links a[hidden] {
    display: none !important;
}

.hk-deals-more svg,
.hk-deals-strip-links a svg {
    display: block;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    margin: 0;
}

.hk-deals-strip-links a:hover,
.hk-deals-more:hover {
    color: var(--hk-deal-text, var(--color-darker-gray));
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hk-deals-strip-links a:focus-visible,
.hk-deals-more:focus-visible,
.hk-deals-note a:focus-visible {
    outline: 2px solid var(--hk-deal-accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.hk-deals-note,
.gh-content .hk-deals-note {
    margin: 0 0 14px;
    font-size: 1.25rem;
    line-height: 1.4;
    color: var(--hk-deal-muted, var(--color-secondary-text));
}

.hk-deals-note a {
    color: inherit;
    text-underline-offset: 2px;
}

.hk-deals-strip.is-empty,
.hk-deals-page.is-empty,
.hk-deals-grid-wrap.is-empty {
    display: none;
}

/* ----- Filter chips (categories) ----- */
.hk-deals-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.hk-deals-chip {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 7px 12px;
    border: 1px solid var(--color-mid-gray, #ccc);
    border-radius: 999px;
    background: var(--color-lighter-gray, #f6f6f6);
    color: var(--hk-deal-text, var(--color-darker-gray));
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.hk-deals-chip:hover,
.hk-deals-chip:focus-visible {
    border-color: var(--hk-deal-text, var(--color-darker-gray));
}

.hk-deals-chip:focus-visible {
    outline: 2px solid var(--hk-deal-accent);
    outline-offset: 2px;
}

.hk-deals-chip.is-active {
    border-color: var(--hk-deal-accent);
    background: var(--hk-deal-accent);
    color: #fff;
}

.hk-deals-empty,
.gh-content .hk-deals-empty {
    display: none;
    margin: 8px 0 24px;
    font-size: 1.5rem;
    color: var(--hk-deal-muted);
}

.hk-deals-empty.is-visible {
    display: block;
}

/* ----- Grid ----- */
.hk-deals-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.hk-deals-grid--home {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gh-content .hk-deals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 2.4em;
    max-width: none;
}

/* ----- Card ----- */
.hk-deal {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    border: 1px solid var(--hk-deal-bd, var(--color-light-gray));
    border-radius: 12px;
    background: var(--hk-deal-bg, var(--color-white));
    color: var(--hk-deal-text, var(--color-darker-gray));
    overflow: hidden;
    box-shadow: none;
}

.hk-deal-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--hk-deal-ph, var(--color-lighter-gray));
    overflow: hidden;
}

.hk-deal-img {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 40px 16px 14px;
    background: var(--hk-deal-tile, #e8ebf0);
}

.hk-deal-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 36px 16px 16px;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(37, 99, 235, 0.16), transparent 55%),
        var(--hk-deal-ph, var(--color-lighter-gray));
    color: var(--hk-deal-muted);
    font-size: clamp(1.6rem, 2vw, 2.2rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.15;
    text-align: center;
    text-transform: uppercase;
}

.hk-deal-flags {
    position: absolute;
    z-index: 1;
    top: 8px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: calc(100% - 108px);
}

.hk-deal-cat,
.hk-deal-limited,
.hk-deal-expiring,
.hk-deal-store,
.hk-deal-off {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.hk-deal-cat {
    background: rgba(15, 17, 21, 0.84);
    color: #fff;
}

.hk-deal-limited {
    background: var(--hk-deal-limited);
    color: #fff;
}

.hk-deal-store {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 8px;
    background: #fff;
    color: #15171a;
    border: 1px solid rgba(15, 17, 21, 0.12);
    box-shadow: 0 1px 2px rgba(15, 17, 21, 0.12);
}

.hk-deal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 6px;
    padding: 12px 14px 14px;
    min-width: 0;
}

.hk-deal-title,
.gh-content .hk-deal-title,
.gh-content .hk-deal h3 {
    margin: 0;
    font-family: var(--font-sans, Inter, system-ui, sans-serif);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.3;
    color: var(--hk-deal-text, var(--color-darker-gray));
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.hk-deal-why,
.gh-content .hk-deal-why,
.gh-content .hk-deal p.hk-deal-why {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--hk-deal-why, var(--hk-deal-muted));
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.hk-deal-price {
    display: none;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 10px;
    margin: 2px 0 0;
    font-variant-numeric: tabular-nums;
}

.hk-deal--priced .hk-deal-price {
    display: flex;
}

.hk-deal-now {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--hk-deal-text);
}

.hk-deal-was,
.gh-content .hk-deal s.hk-deal-was {
    font-size: 1.4rem;
    color: var(--hk-deal-muted);
    text-decoration: line-through;
}

.hk-deal-off {
    background: var(--hk-deal-accent);
    color: #fff;
}

.hk-deal-meta,
.hk-deal-credit,
.hk-deal-ends,
.gh-content .hk-deal-meta,
.gh-content .hk-deal-credit,
.gh-content .hk-deal-ends,
.gh-content .hk-deal p.hk-deal-meta,
.gh-content .hk-deal p.hk-deal-credit,
.gh-content .hk-deal p.hk-deal-ends {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.35;
    color: var(--hk-deal-muted);
}

.hk-deal-ends {
    display: none;
}

.hk-deal--priced .hk-deal-ends:not(:empty) {
    display: block;
}

.hk-deal-expiring {
    margin-left: 6px;
    background: #b45309;
    color: #fff;
}

html[data-theme="dark"] .hk-deal-expiring {
    background: #fbbf24;
    color: #15171a;
}

.hk-deal-cta,
.gh-content .hk-deal-cta,
.gh-content a.hk-deal-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin: auto 0 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--hk-deal-accent);
    color: #fff !important;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
}

.hk-deal-cta:hover,
.gh-content a.hk-deal-cta:hover {
    filter: brightness(0.92);
    color: #fff !important;
}

.hk-deal-cta:focus-visible,
.gh-content a.hk-deal-cta:focus-visible {
    outline: 2px solid var(--hk-deal-accent);
    outline-offset: 2px;
}

.hk-deal-cta:active {
    filter: brightness(0.85);
}

/* Past round-ups on the Deals tag page */
.hk-deals-archive {
    margin-top: clamp(40px, 6vw, 72px);
}

.hk-deals-archive-title {
    margin: 0 0 24px;
    font-family: var(--font-sans, Inter, system-ui, sans-serif);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    color: var(--color-darker-gray);
}

/* Example-only ribbon for the static preview, never used in production cards */
.hk-deal-example {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px 8px;
    background: #111827;
    color: #fbbf24;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 1099px) {
    .hk-deals-grid,
    .hk-deals-grid--home {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gh-content .hk-deals-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .hk-deals-page .hk-deals-grid,
    .gh-content .hk-deals-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        overflow: visible;
    }

    /* Homepage strip only: peek the next card. Tag page and in-post grids stay stacked. */
    .hk-deals-strip .hk-deals-grid--home {
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 12px;
        margin: 0;
        padding: 2px 0 6px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 2px;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .hk-deals-strip .hk-deals-grid--home::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .hk-deals-strip .hk-deals-grid--home > .hk-deal {
        flex: 0 0 80%;
        width: 80%;
        max-width: none;
        scroll-snap-align: start;
    }

    .hk-deals-strip-title,
    .hk-deals-page-title,
    .hk-deals-archive-title {
        font-size: 2rem;
    }

    .hk-deals-chip {
        padding: 10px 14px;
    }
}

@media (max-width: 640px) {
    .hk-deals-strip-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .hk-deals-strip-links {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hk-deal-cta {
        filter: none;
        transition: none;
    }

    .hk-deals-strip .hk-deals-grid--home {
        scroll-behavior: auto;
    }
}

/* Inlined deals JSON feed: never show raw JSON */
#hk-deals-data, #hk-deals-source, pre.hk-deals-data, script.hk-deals-data { display: none !important; }
