/* Shopee affiliate theme — mobile-first (design at 375px, grow to desktop)
   พื้นขาว ตัวหนังสือดำหนา ต่อเนื่องกับ post.jpg; สีเด่นสีเดียว = ปุ่ม "ดูที่ Shopee" */

:root {
    --ink: #111;
    --paper: #fff;
    --muted: #5a5a5a;
    --line: #e4e4e2;
    --soft: #f4f4f2;
    --accent: #d93a18;
    --accent-dark: #b92f12;
    --font-head: 'Kanit', 'Noto Sans Thai', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans Thai', 'Noto Sans Thai', system-ui, sans-serif;
    --wrap: 1120px;
    --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; font-weight: 600; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.section { margin-top: 32px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip-link:focus { top: 8px; }

/* header */
.site-header { border-bottom: 2px solid var(--ink); }
.site-header__row { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 16px; }
.brand { display: block; flex: none; padding-block: 8px; text-decoration: none; }
.brand img { display: block; width: auto; height: 36px; }
.site-nav { display: flex; gap: 20px; }
.site-nav a { font-weight: 600; text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current] { border-bottom-color: var(--ink); }

/* intro blocks */
.intro { padding-top: 24px; }
.lede { margin: 6px 0 0; color: var(--muted); }
.link-strong { font-weight: 600; text-underline-offset: 3px; }

/* filter chips */
.filters { margin-top: 16px; display: grid; gap: 10px; }
.filters__row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.filters__label { flex: none; font-size: 0.8rem; font-weight: 600; color: var(--muted); width: 2.4rem; }
.chips { list-style: none; margin: 0; padding: 2px 0 6px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    display: block; white-space: nowrap; text-decoration: none; font-size: 0.9rem; font-weight: 600;
    padding: 6px 12px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper);
}
.chip:hover { background: var(--soft); }
.chip.is-active { background: var(--ink); color: var(--paper); }

/* product grid + card */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; margin-top: 14px; }
.card__link { display: block; text-decoration: none; }
.card__media { aspect-ratio: 4 / 5; background: var(--soft); overflow: hidden; border-radius: 4px; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding-top: 8px; display: grid; gap: 2px; }
.card__cat { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.card__title {
    font-size: 0.95rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__link:hover .card__title { text-decoration: underline; text-underline-offset: 3px; }
.card__price { font-size: 0.85rem; color: var(--muted); }

.more { margin: 24px 0 0; text-align: center; }
.empty { margin: 16px 0; color: var(--muted); }

/* pagination (markup from pagination plugin) */
.pagination { list-style: none; margin: 28px 0 0; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.pagination a, .pagination span {
    display: block; min-width: 40px; padding: 6px 10px; text-align: center; text-decoration: none;
    border: 1.5px solid var(--ink); border-radius: 4px; font-weight: 600;
}
.pagination span { border-color: var(--line); color: var(--muted); }
.pagination span.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* search */
.searchbox { display: flex; gap: 8px; margin-top: 14px; max-width: 560px; }
.searchbox input {
    flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper); color: var(--ink);
}
.searchbox button {
    font: inherit; font-weight: 600; padding: 10px 16px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--paper); cursor: pointer;
}

/* button (the one accent colour) */
.btn {
    display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 24px;
    font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; text-decoration: none;
    border-radius: 6px; border: 0; cursor: pointer;
}
.btn--shopee { background: var(--accent); color: #fff; }
.btn--shopee:hover { background: var(--accent-dark); }
.btn--shopee:focus-visible { outline-color: var(--ink); }

/* product page */
.product { padding-top: 14px; }
.crumbs { font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { text-underline-offset: 3px; }
.product__layout { margin-top: 12px; display: grid; gap: 18px; }
.product__media img { width: 100%; border-radius: 4px; background: var(--soft); }
.shots { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.shots--1 { grid-template-columns: 1fr; }
.shots--3 img:first-child { grid-column: 1 / -1; }
.product__cat { font-size: 0.85rem; font-weight: 600; color: var(--muted); text-underline-offset: 3px; }
.product__info h1 { margin-top: 2px; font-size: 1.6rem; }
.product__title { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.product__intro { margin-top: 14px; }
.product__price { margin: 16px 0 0; font-family: var(--font-head); font-weight: 700; font-size: 1.6rem; line-height: 1.2; }
.product__price span { font-family: var(--font-body); font-weight: 400; font-size: 0.9rem; color: var(--muted); }
.product__hint { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.product__cta { margin-top: 18px; }
.affiliate-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); }
.product__body { margin-top: 24px; }
.related { padding-bottom: 8px; }

/* sticky buy bar (mobile only) */
.buy-bar { position: fixed; inset: auto 0 0 0; z-index: 50; background: var(--paper); border-top: 2px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
.buy-bar__inner { display: flex; align-items: center; gap: 14px; padding-block: 10px; }
.buy-bar__price { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.buy-bar .btn { flex: 1; }
.tpl-product main { padding-bottom: 88px; }

/* generic pages */
.page { padding-top: 24px; }
.prose { max-width: 40rem; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6em; }
.page .prose { margin-top: 12px; }

/* footer */
.site-footer { margin-top: 48px; padding: 20px 0 28px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.site-footer p { margin: 0 0 6px; }
.tpl-product .site-footer { padding-bottom: 96px; }

/* tablet */
@media (min-width: 720px) {
    :root { --gutter: 24px; }
    h1 { font-size: 2.1rem; }
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 18px; }
    .filters__row { gap: 14px; }
    .filters__label { width: 3rem; }
    .chips { flex-wrap: wrap; overflow: visible; }
}

/* desktop */
@media (min-width: 900px) {
    .product__layout { grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 40px; align-items: start; }
    .product__media { position: sticky; top: 16px; }
    .product__info h1 { font-size: 2rem; }
    .product__cta { display: inline-flex; min-width: 280px; }
    .buy-bar { display: none; }
    .tpl-product main, .tpl-product .site-footer { padding-bottom: 0; }
    .tpl-product .site-footer { padding-bottom: 28px; }
}

@media (min-width: 1000px) {
    .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
