/* รวมช่าง — ruamchang.com */
:root {
    --ink: #1d2127;
    --ink-2: #4a515c;
    --ink-3: #7b8390;
    --bg: #f3f1ec;
    --card: #ffffff;
    --line: #e2ded5;
    --accent: #f2b705;      /* เหลืองเซฟตี้ */
    --accent-2: #d99f00;
    --sale: #d7263d;
    --ok: #1f7a4d;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(29, 33, 39, .06), 0 4px 14px rgba(29, 33, 39, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    font-size: 16px;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
code { background: #e9e5dc; padding: .1em .35em; border-radius: 4px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }

/* ---------- header ---------- */
.top {
    background: var(--ink);
    border-bottom: 4px solid var(--accent);
    position: sticky; top: 0; z-index: 10;
}
.top-in { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; flex-shrink: 0; }
.logo-mark {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--accent); color: var(--ink);
    display: grid; place-items: center;
}
.logo-text { font-weight: 700; font-size: 1.3rem; letter-spacing: .01em; }
.search { flex: 1; display: flex; max-width: 620px; margin-left: auto; }
.search input {
    flex: 1; min-width: 0; height: 40px; padding: 0 14px;
    border: 0; border-radius: 8px 0 0 8px; font: inherit; font-size: .95rem;
}
.search button {
    height: 40px; padding: 0 18px; border: 0; border-radius: 0 8px 8px 0;
    background: var(--accent); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.search button:hover { background: var(--accent-2); }

/* ---------- hero + categories ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 700; }
.hero p { color: var(--ink-2); max-width: 640px; margin: 10px 0 0; }

.cats {
    display: grid; gap: 14px; margin: 24px 0 8px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.cat-group { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.cat-group h2 {
    font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
    margin-bottom: 8px; padding-bottom: 8px; border-bottom: 2px solid var(--accent);
}
.cat-group ul { list-style: none; margin: 0; padding: 0; }
.cat-group li a {
    display: flex; justify-content: space-between; gap: 8px;
    padding: 6px 0; text-decoration: none; font-weight: 500;
}
.cat-group li a:hover { color: var(--accent-2); }
.cat-group small { color: var(--ink-3); font-weight: 400; }

/* ---------- blocks ---------- */
.block { margin-top: 32px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.block-head h2 { font-size: 1.25rem; }
.block-head a { color: var(--ink-2); font-size: .9rem; text-decoration: none; }
.empty { color: var(--ink-2); background: var(--card); padding: 24px; border-radius: var(--radius); text-align: center; }
.empty.small { padding: 16px; font-size: .9rem; }

/* ---------- product grid ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.card {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    text-decoration: none; box-shadow: var(--shadow);
    display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(29, 33, 39, .12); }
.card-img { position: relative; aspect-ratio: 1; background: #f7f6f2; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-title {
    font-size: .88rem; font-weight: 500; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.7em; margin-bottom: 4px;
}
.price { color: var(--sale); font-weight: 700; font-size: 1.05rem; }
.was { color: var(--ink-3); text-decoration: line-through; font-size: .8rem; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--ink-3); font-size: .78rem; margin-top: auto; padding-top: 4px; }
.meta.big { font-size: .9rem; margin: 8px 0 0; }
.star { color: #b07d00; font-weight: 600; }
.badge-off {
    position: absolute; top: 8px; left: 8px;
    background: var(--sale); color: #fff; font-size: .75rem; font-weight: 700;
    padding: 2px 7px; border-radius: 4px;
}
.badge-off.static { position: static; display: inline-block; }
.tag-official, .tag-pref {
    align-self: flex-start; font-size: .68rem; font-weight: 700; letter-spacing: .03em;
    padding: 1px 6px; border-radius: 3px; background: var(--ink); color: var(--accent);
}
.tag-pref { background: #fff4d1; color: #7a5800; }

/* ---------- list pages ---------- */
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 1.6rem; }
.count { color: var(--ink-3); }

.filters {
    display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
    background: var(--card); padding: 12px 14px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 16px; font-size: .9rem;
}
.filters label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.filters select, .filters input[type=number] {
    font: inherit; height: 36px; padding: 0 8px; border: 1px solid var(--line);
    border-radius: 6px; background: #fff; color: var(--ink);
}
.filters input[type=number] { width: 96px; }
.filters .check { cursor: pointer; }
.btn-ghost {
    font: inherit; height: 36px; padding: 0 16px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--ink); background: transparent; font-weight: 600;
}
.btn-ghost:hover { background: var(--ink); color: #fff; }

.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 24px; }
.pager a, .pager .dis {
    padding: 8px 16px; border-radius: 6px; background: var(--card); text-decoration: none;
    box-shadow: var(--shadow); font-weight: 500;
}
.pager .dis { opacity: .4; }
.pager a:hover { background: var(--accent); }
.pager .cur { color: var(--ink-2); font-size: .9rem; }

/* ---------- product page ---------- */
.pd {
    display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.pd-main { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f7f6f2; border-radius: 8px; }
.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pd-thumbs button {
    width: 64px; height: 64px; padding: 0; border: 2px solid var(--line); border-radius: 6px;
    background: #f7f6f2; cursor: pointer; overflow: hidden;
}
.pd-thumbs button:hover, .pd-thumbs button:focus { border-color: var(--accent); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pd-info h1 { font-size: 1.35rem; font-weight: 600; }
.pd-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 16px 0 6px; }
.pd-price .price { font-size: 1.9rem; }
.pd-price .was { font-size: 1rem; }
.hint { font-size: .9rem; color: var(--ok); margin: 4px 0; }
.shop { margin: 14px 0 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--ink-2); }
.btn-buy {
    display: block; text-align: center; text-decoration: none;
    background: var(--accent); color: var(--ink); font-weight: 700; font-size: 1.05rem;
    padding: 14px 20px; border-radius: 8px; box-shadow: 0 3px 0 var(--accent-2);
}
.btn-buy:hover { background: #ffc61a; }
.btn-buy:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-2); }
.fine { font-size: .78rem; color: var(--ink-3); margin-top: 10px; }

.chart {
    margin: 0; background: var(--card); border-radius: var(--radius); padding: 16px 16px 10px;
    box-shadow: var(--shadow); color: var(--sale);
}
.chart svg { width: 100%; height: 140px; display: block; }
.chart figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--ink-3); margin-top: 6px; }

.desc { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.desc summary { padding: 14px 18px; cursor: pointer; font-weight: 600; }
.desc-body { padding: 0 18px 18px; color: var(--ink-2); font-size: .92rem; white-space: normal; overflow-wrap: anywhere; }

.prose { background: var(--card); border-radius: var(--radius); padding: 24px; max-width: 760px; box-shadow: var(--shadow); }
.prose h1 { margin-bottom: 12px; }
.prose h2 { font-size: 1.15rem; margin: 20px 0 6px; }

/* ---------- footer ---------- */
.foot { background: var(--ink); color: #b9bec6; font-size: .85rem; padding: 28px 0; }
.foot a { color: var(--accent); }
.foot p { margin: 0 0 8px; max-width: 820px; }
.foot strong { color: #fff; }
.foot .copy { color: #6f7682; margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
    .top-in { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
    .search { max-width: none; width: 100%; flex-basis: 100%; }
    .pd { grid-template-columns: 1fr; padding: 14px; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .filters { font-size: .85rem; }
    .chart figcaption span:nth-child(2) { display: none; }
}
