/* Home page only. Header, footer, buttons and colours are in chrome.css (loaded first, on every page when the new home is on). */
* { box-sizing: border-box; }
body { margin: 0; font: 400 14px/20px var(--font); color: var(--on-surface); background: var(--page); }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, p { margin: 0; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:root { --hero-search: 52px; }
.xh-hero { position: relative; z-index: 1; background: var(--surface-dim); touch-action: pan-y; user-select: none; }
.xh-hero-media { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.xh-hero-media > * { position: absolute; opacity: 0; transition: opacity .6s; }
.xh-hero-media > .is-active { opacity: 1; }
.xh-hero.is-swiping .xh-hero-media > * { transition: none; }
.xh-hero-banner, .xh-hero-banner img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xh-hero-chart { left: -1%; top: 10px; width: 102%; height: calc(100% - 22px); }
.xh-hero-chart path { stroke: var(--c); stroke-width: 4; vector-effect: non-scaling-stroke; transition: stroke .6s, fill-opacity .6s; }
.xh-hero-chart.is-ghost { opacity: .7; }
.xh-hero-chart.is-ghost2 { opacity: .4; }
.xh-hero-chart:is(.is-ghost, .is-ghost2) path { fill-opacity: 0; stroke: color-mix(in srgb, var(--on-surface-var) 40%, transparent); }
.xh-hero-chart.is-active path { animation: xh-reveal 1.6s ease-out; }
@keyframes xh-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.xh-hero-inner { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: max(200px, 23vw); max-width: 576px; margin: 0 auto; padding: 40px 16px 0; } /* 23vw ≈ the 1920×440 banner ratio */
.xh-hero-title { margin: 0 40px 32px; font-size: 28px; line-height: 36px; font-weight: 400; color: var(--on-surface-var); }
.xh-hero-title mark { display: table; padding: 0 5px; margin-left: -5px; font-weight: 700; color: var(--title-color); background: linear-gradient(var(--highlight), var(--highlight)) no-repeat; animation: xh-sweep .2s linear .3s backwards; }
@keyframes xh-sweep { from { background-size: 0 100%; opacity: 0; transform: translateX(-20px); } }
.xh-search { display: flex; align-items: center; height: var(--hero-search); margin-bottom: calc(var(--hero-search) / -2); padding: 0 6px 0 20px; background: var(--surface); border: 1px solid var(--outline-var); border-radius: calc(var(--hero-search) / 2); box-shadow: 0 1px 3px rgba(32,33,36,.2); }
.xh-search:focus-within { box-shadow: 0 1px 6px rgba(32,33,36,.28); border-color: transparent; }
.xh-search-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--c); transition: background .4s; }
.xh-search input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 0; outline: 0; font-size: 16px; background: none; user-select: text; }
.xh-search input::placeholder { color: var(--on-surface); overflow: hidden; text-overflow: ellipsis; }
.xh-search input::-webkit-search-cancel-button { display: none; }
.xh-search .xh-btn { padding: 0 16px; }
.xh-hero + .xh-why { padding-top: calc(var(--hero-search) / 2 + 20px); }
.xh-hero-foot { position: absolute; top: 12px; right: 16px; display: flex; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); font-size: 12px; color: var(--outline); }
.xh-hero-foot:focus-within { width: auto; height: auto; padding: 6px 12px; clip-path: none; background: var(--surface); border-radius: 16px; }
.xh-hero-foot > span { display: none; }
.xh-dots { display: flex; align-items: center; gap: 8px; }
.xh-dots button:not(.xh-pause) { position: relative; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: var(--c); transition: width .25s ease; }
.xh-dots button.is-active { width: 48px; background: var(--outline-var); }
.xh-dots button i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--c); }
.xh-dots button.is-active i { animation: xh-progress var(--interval) linear forwards; }
.xh-hero:is(.is-paused, :has(.xh-search:focus-within)) .xh-dots i { animation-play-state: paused; }
@keyframes xh-progress { to { width: 100%; } }
.xh-pause { display: grid; margin-left: 16px; padding: 0; border: 0; background: none; color: var(--outline); }
@media (min-width: 1024px) {
    :root { --hero-search: 66px; }
    .xh-hero { height: 440px; }
    .xh-hero-chart { top: 40px; height: 400px; }
    .xh-hero-inner { height: 100%; min-height: 0; max-width: 1010px; padding: 0 24px; }
    .xh-hero-title { position: absolute; top: 112px; width: 280px; margin: 0; font-size: 36px; line-height: 44px; font-weight: 500; }
    .xh-search { width: 544px; max-width: calc(100% - 366px); margin-left: 366px; padding: 0 12px 0 26px; }
    .xh-hero.is-untitled .xh-search { width: auto; max-width: none; margin-left: 0; }
    .xh-search input { padding: 0 16px; font-size: 24px; }
    .xh-search .xh-btn { padding: 0 24px; }
}

/* Why trending */
.xh-why { background: var(--surface-band); padding: 20px 0; }
.xh-why-panel { max-width: 1030px; margin: 0 auto; padding: 0 24px; }
.xh-why-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.xh-why-head h2 { padding-left: 16px; font-size: 16px; line-height: 24px; font-weight: 500; color: var(--on-surface-var); }
.xh-news { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.xh-news-card { display: flex; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--outline-var); border-radius: 24px 8px; }
.xh-news-card:hover { box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.xh-news-card > img, .xh-news-card > .xh-thumb-ph { width: 64px; height: 64px; flex: none; border-radius: 16px 4px; object-fit: cover; }
.xh-news-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 20px; }
.xh-news-card small { display: block; margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--on-surface-var); }

/* Sections */
.xh-section { max-width: 1072px; margin: 0 auto; padding: 48px 24px 0; }
.xh-section:last-of-type { padding-bottom: 35px; }
.xh-section-title { position: relative; text-align: center; font-size: 32px; line-height: 40px; font-weight: 500; color: var(--on-surface-var); }
/* Decorative blob: two rounded squares, one turned 45deg, read as a soft 8-lobed badge */
.xh-section-title::before, .xh-section-title::after { content: ""; position: absolute; z-index: -1; left: 50%; top: -20px; width: 56px; height: 56px; margin-left: -28px; background: var(--secondary); border-radius: 18px; }
.xh-section-title::after { transform: rotate(45deg); }
.xh-section-sub { max-width: 1024px; margin: 0 auto; padding: 16px 24px 24px; text-align: center; font-size: 16px; line-height: 24px; font-weight: 500; color: var(--on-surface-var); }
.xh-center { display: flex; justify-content: center; margin: 16px 0 24px; }

/* Cards */
.xh-card { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--outline-var); border-radius: 32px; color: var(--on-surface); transition: box-shadow .2s; }
.xh-card:hover { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15); }
.xh-card-media { position: relative; display: block; overflow: hidden; }
.xh-card-media img, .xh-thumb-ph { width: 100%; height: 100%; object-fit: cover; }
/* Product shot: whole product visible in any frame shape. White in dark mode too, to blend with white-background photos */
.xh-card-media img.is-contain { object-fit: contain; padding: 12px; background: var(--white-color); }
.xh-thumb-ph { display: grid; place-items: center; background: var(--ph); color: rgba(0,0,0,.45); }
.xh-card-lg .xh-thumb-ph .material-symbols-outlined { font-size: 72px; }
.xh-card-title { display: block; }

.xh-card-lg { flex: 0 0 448px; height: 514px; scroll-snap-align: start; }
.xh-card-lg .xh-card-media { height: 256px; flex: none; }
.xh-card-body { display: flex; flex-direction: column; flex: 1; padding: 24px; }
.xh-card-lg .xh-card-title { font-size: 24px; line-height: 32px; margin-bottom: 8px; }
.xh-card-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 20px; }
.xh-card-link { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-left: 8px; font-size: 14px; font-weight: 500; color: var(--primary); }
.xh-card-link .material-symbols-outlined { font-size: 20px; }

.xh-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 1024px; margin: 0 auto; }
.xh-card-sm { min-height: 234px; }
.xh-card-sm .xh-card-media { height: 136px; flex: none; }
.xh-card-sm .xh-thumb-ph .material-symbols-outlined { font-size: 56px; }
.xh-card-sm .xh-card-title { padding: 16px 16px 8px; font-size: 16px; line-height: 24px; font-weight: 500; }
.xh-grid + .xh-grid { margin-top: 24px; }
.xh-price { display: block; margin-bottom: 8px; font-size: 18px; line-height: 24px; font-weight: 500; }
.xh-price del { margin-right: 4px; font-size: .8em; font-weight: 400; color: var(--on-surface-var); }
.xh-price ins { text-decoration: none; color: light-dark(var(--red-color), color-mix(in srgb, var(--red-color) 40%, var(--white-color))); }
.xh-card-sm .xh-price { padding: 0 16px 16px; margin: 0; font-size: 15px; }
.xh-play { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 48px !important; color: var(--surface); font-variation-settings: "FILL" 1; filter: drop-shadow(0 1px 4px rgb(0 0 0 / .4)); transition: transform .2s; }
/* ▶ stays above the hover preview and grows over the picture: that area plays the video, the text opens the page */
[data-yt] .xh-card-media:hover .xh-play { transform: translate(-50%, -50%) scale(1.2); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    :not([data-autoplay]) > [data-yt] .xh-play { display: none; }
}
.xh-card-sm .xh-thumb-ph:has(+ .xh-play) .material-symbols-outlined { display: none; }
/* Hover preview: clicks pass through to the card; fades in once loaded to hide YouTube's black first frame */
.xh-card-preview { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; opacity: 0; transition: opacity .3s .3s; }
.xh-card-preview.is-ready { opacity: 1; }
/* ponytail: 16:9 only, YouTube Shorts show letterboxed */
.xh-video { padding: 0; border: 0; width: min(960px, 92vw, 150vh); aspect-ratio: 16 / 9; background: var(--black-color); overflow: visible; }
.xh-video::backdrop { background: rgb(0 0 0 / .8); }
.xh-video iframe { display: block; width: 100%; height: 100%; border: 0; }
.xh-video-close { position: absolute; right: 0; bottom: 100%; padding: 8px 0; border: 0; background: none; color: var(--white-color); font-size: 32px !important; cursor: pointer; }

/* Carousel */
.xh-carousel { position: relative; }
.xh-carousel-track { display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 88%, transparent); }
.xh-carousel-track::-webkit-scrollbar { display: none; }
.xh-carousel-btn { position: absolute; z-index: 2; top: 229px; display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--surface-band); color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15); }
.xh-carousel-btn.is-next { right: -4px; }
.xh-carousel-btn.is-prev { left: -28px; }
.xh-carousel-btn[hidden] { display: none; }

/* Single / page */
.xh-article { max-width: 760px; margin: 0 auto; padding: 48px 24px 96px; font: 400 16px/1.7 Roboto, Arial, sans-serif; }
.xh-article h1 { margin-bottom: 24px; font: 500 32px/40px var(--font); }
.xh-article img { border-radius: 24px; height: auto; }
.xh-content figure.wp-block-table { margin: 24px 0; overflow-x: auto; }
.xh-content table { width: 100%; margin: 24px 0; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.xh-content figure.wp-block-table table { margin: 0; }
.xh-content :is(th, td) { padding: 10px 14px; border: 1px solid var(--outline-var); text-align: left; vertical-align: top; }
.xh-content th, .xh-content thead td { background: var(--surface-band); font-weight: 500; }
.xh-content tbody tr:nth-child(even) { background: var(--surface-dim); }
/* Captions under images/tables/videos: centered like in the editor (core only centers them via its optional theme.css) */
.xh-content .wp-element-caption { margin-top: 8px; color: var(--on-surface-var); font-size: 14px; text-align: center; }
/* Product photos: one big frame (fixed shape, so switching photos doesn't jump the page) + clickable thumbnails */
.xh-gallery-main { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--white-color); }
.xh-gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.xh-gallery-thumbs button { width: 72px; height: 72px; padding: 0; border: 2px solid var(--outline-var); border-radius: 12px; overflow: hidden; background: var(--white-color); }
.xh-gallery-thumbs button[aria-pressed="true"] { border-color: var(--primary); }
.xh-gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
/* grid, not flex-wrap: call + Zalo stay on one row; on phones they split the width and long text wraps inside the button */
.xh-buy { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 12px; margin: 24px 0 32px; }
.xh-buy .xh-price { grid-column: 1 / -1; margin: 0; font: 500 28px/36px var(--font); }
.xh-buy .xh-btn { align-self: stretch; min-height: 40px; height: auto; padding: 8px 20px; white-space: normal; text-align: center; }
@media (max-width: 719px) { .xh-buy { grid-template-columns: 1fr 1fr; } .xh-buy .xh-btn { padding: 8px 12px; } }
@media (min-width: 720px) {
    .xh-pd-left, .xh-pd-right { max-width: 1200px; }
    .xh-pd-left:has(.xh-gallery), .xh-pd-right:has(.xh-gallery) {
        display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto auto 1fr; column-gap: 48px; align-items: start;
        grid-template-areas: "g t" "g b" "g c";
    }
    .xh-pd-right:has(.xh-gallery) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "t g" "b g" "c g"; }
    .xh-product h1 { grid-area: t; }
    .xh-product .xh-gallery { grid-area: g; }
    /* only the two-column layouts: in "stack" a sticky photo would slide over the description */
    .xh-pd-left .xh-gallery, .xh-pd-right .xh-gallery { position: sticky; top: calc(var(--header-h, 64px) + 24px); }
    .xh-product .xh-buy { grid-area: b; }
    .xh-product .xh-content { grid-area: c; }
    .xh-pd-left .xh-buy, .xh-pd-right .xh-buy { margin-top: 0; }
}
.xh-results { padding-top: 40px; }
.xh-results-form { display: flex; align-items: center; max-width: 720px; height: 56px; margin: 0 auto; padding: 0 8px 0 20px; background: var(--surface); border: 1px solid var(--outline-var); border-radius: 28px; }
.xh-results-form:focus-within { box-shadow: 0 1px 6px rgba(32,33,36,.28); border-color: transparent; }
.xh-results-form > .material-symbols-outlined { color: var(--on-surface-var); }
.xh-results-form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 0; outline: 0; font-size: 18px; background: none; color: var(--on-surface); }
.xh-results-form button .material-symbols-outlined { display: none; }
.xh-results-title { max-width: 1024px; margin: 20px auto 0; font-size: 16px; line-height: 24px; font-weight: 400; color: var(--on-surface-var); }
.xh-results-head { max-width: 1024px; margin: 32px auto 16px; padding-bottom: 8px; border-bottom: 1px solid var(--outline-var); font-size: 22px; line-height: 28px; font-weight: 500; }
.xh-section-title + .xh-results-grid, .xh-section-title + .xh-results-list { margin-top: 40px; }
.xh-results-list { max-width: 1024px; margin: 0 auto; }
.xh-row { display: flex; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--outline-var); color: var(--on-surface); }
.xh-row-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.xh-row-title { font-size: 18px; line-height: 26px; font-weight: 500; }
.xh-row:hover .xh-row-title { color: var(--primary); text-decoration: underline; }
.xh-row-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 20px; color: var(--on-surface-var); }
.xh-row-date { font-size: 13px; color: var(--on-surface-var); }
.xh-row-media { flex: none; width: 160px; height: 96px; overflow: hidden; border-radius: 12px; }
.xh-row-media img { width: 100%; height: 100%; object-fit: cover; }
.xh-results .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.xh-results .page-numbers { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border-radius: 20px; font-size: 14px; font-weight: 500; color: var(--on-surface-var); }
.xh-results a.page-numbers:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.xh-results .page-numbers.current { background: var(--primary); color: var(--on-primary); }

/* Responsive — breakpoints and sizes measured on the reference at 900/650/412px */
@media (max-width: 1023px) {
    .xh-news { grid-template-columns: repeat(2, 1fr); }
    .xh-section { padding-top: 20px; }
    .xh-section-title { font-size: 24px; line-height: 32px; }
    .xh-carousel, .xh-grid { margin: 0 -24px; }
    .xh-carousel-track { padding: 0 24px; scroll-padding: 0 24px; mask-image: none; }
    .xh-carousel-btn { display: none; }
    .xh-card-lg { flex: 0 0 326px; height: 448px; }
    .xh-card-lg .xh-card-media { height: 208px; }
    .xh-card-lg .xh-card-title { font-size: 20px; line-height: 28px; }
    .xh-grid { display: flex; justify-content: safe center; gap: 10px; max-width: none; padding: 0 24px; overflow-x: auto; scrollbar-width: none; }
    .xh-card-sm { flex: 0 0 158px; min-height: 168px; }
    .xh-card-sm .xh-card-media { height: 88px; }
    .xh-card-sm .xh-card-title { padding: 4px 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .xh-card-sm .xh-thumb-ph .material-symbols-outlined { font-size: 40px; }
    /* Results wrap into 2 columns instead of scrolling sideways: visitors compare many products here */
    .xh-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0; padding: 0; }
    .xh-results-grid .xh-card-sm .xh-card-media { height: 136px; }
    .xh-results .xh-row-media { width: 96px; height: 72px; }

}
@media (max-width: 719px) {
    .xh-news { grid-template-columns: 1fr; }
    .xh-why-panel { padding: 0 24px; }
    .xh-why { padding-top: 16px; }
    .xh-why-head h2 { font-size: 14px; line-height: 20px; }
    .xh-section-sub + .xh-grid + .xh-center { display: none; }
    .xh-center + .xh-grid, .xh-grid + .xh-grid { margin-top: 18px; }
    /* phones: the button shows only the magnifier (the one on the left goes), leaving the text box more room */
    .xh-results-form { padding-left: 8px; }
    .xh-results-form > .material-symbols-outlined, .xh-results-form button span { display: none; }
    .xh-results-form button { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
    .xh-results-form button .material-symbols-outlined { display: block; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .xh-hero-chart.is-active path, .xh-hero-title mark { animation: none; }
    .xh-hero-banner[data-no-still] { display: none; }
}
