/* ==========================================================================
   Đồ Đồng — HuyHoangT&T
   Design system + layout dùng chung. Không framework, không jQuery.
   Bảng màu giữ nguyên nhận diện cũ (#3b0203 / #660c0d / #edc983).
   ========================================================================== */

/* --- Token ---------------------------------------------------------------- */
:root {
  /* Thương hiệu — lấy từ site cũ, giữ nguyên để không lệch nhận diện */
  --c-maroon-900: #3b0203;
  --c-maroon-700: #660c0d;
  --c-maroon-500: #8a1516;
  --c-gold-300:   #edc983;
  --c-gold-500:   #c9a227;
  --c-bronze:     #99694d;
  --c-red:        #990000;

  /* Trung tính */
  --c-ink:        #1a1614;
  --c-body:       #45403d;
  --c-muted:      #6d6e71;
  --c-line:       #e4e0dc;
  --c-surface:    #ffffff;
  --c-surface-2:  #faf8f6;
  --c-surface-3:  #f3f1ee;

  /* Ngữ nghĩa */
  --c-bg:         var(--c-surface-2);
  --c-text:       var(--c-body);
  --c-heading:    var(--c-ink);
  --c-accent:     var(--c-maroon-700);
  --c-accent-ink: #ffffff;

  /* Chữ — thang tỉ lệ 1.2, co giãn theo màn hình */
  --f-sans: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --t-xs:   clamp(.75rem, .72rem + .12vw, .8125rem);
  --t-sm:   clamp(.8125rem, .79rem + .14vw, .875rem);
  --t-base: clamp(.9375rem, .91rem + .16vw, 1rem);
  --t-md:   clamp(1.0625rem, 1.02rem + .22vw, 1.1875rem);
  --t-lg:   clamp(1.25rem, 1.16rem + .42vw, 1.5rem);
  --t-xl:   clamp(1.5rem, 1.34rem + .78vw, 2rem);
  --t-2xl:  clamp(1.875rem, 1.6rem + 1.3vw, 2.75rem);

  /* Nhịp giãn cách — thang 4px */
  --s-1: .25rem;  --s-2: .5rem;   --s-3: .75rem;  --s-4: 1rem;
  --s-5: 1.5rem;  --s-6: 2rem;    --s-7: 3rem;    --s-8: 4rem;
  --s-9: 6rem;

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --shadow-1: 0 1px 2px rgba(26,22,20,.06), 0 1px 3px rgba(26,22,20,.05);
  --shadow-2: 0 4px 12px rgba(26,22,20,.08), 0 2px 4px rgba(26,22,20,.04);
  --shadow-3: 0 12px 32px rgba(26,22,20,.12), 0 4px 8px rgba(26,22,20,.05);

  --wrap: 1280px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--f-sans);
  font-size: var(--t-base);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s-3);
  font-weight: 700;
  line-height: 1.22;
  color: var(--c-heading);
  letter-spacing: -.011em;
  text-wrap: balance;
}
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
h4 { font-size: var(--t-md); }

p { margin: 0 0 var(--s-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--c-accent); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--c-maroon-500); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--c-gold-500);
  outline-offset: 2px;
  border-radius: 3px;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25rem; }
li + li { margin-top: var(--s-1); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

table { border-collapse: collapse; width: 100%; }

/* --- Bố cục --------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s-4); }
@media (min-width: 768px) { .wrap { padding-inline: var(--s-5); } }

.stack > * + * { margin-top: var(--s-4); }
.section { padding-block: var(--s-7); }
@media (min-width: 992px) { .section { padding-block: var(--s-8); } }

.grid { display: grid; gap: var(--s-4); }
@media (min-width: 576px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 380px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .grid-4 { gap: var(--s-3); } .grid-4 .card--product .card__title { font-size: var(--t-sm); } }
@media (min-width: 992px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.visually-hidden, .screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 999;
  background: var(--c-maroon-700); color: #fff;
  padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: var(--s-4); color: #fff; }

/* --- Tiêu đề mục ---------------------------------------------------------- */
.section-head { text-align: center; margin-bottom: var(--s-6); }
.section-head h2 { margin-bottom: var(--s-2); }
.section-head .eyebrow {
  display: inline-block; font-size: var(--t-xs); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--c-bronze); margin-bottom: var(--s-2);
}
.section-head .lede { color: var(--c-muted); max-width: 60ch; margin-inline: auto; }
.section-head::after {
  content: ""; display: block; width: 56px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--c-gold-500), transparent);
  margin: var(--s-4) auto 0;
}

/* --- Nút ------------------------------------------------------------------ */
.btn {
  --btn-bg: var(--c-maroon-700);
  --btn-ink: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: .7em 1.5em;
  background: var(--btn-bg); color: var(--btn-ink);
  border: 1px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: var(--t-sm); line-height: 1.2;
  text-align: center;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.btn:hover { color: var(--btn-ink); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); }
.btn--gold  { --btn-bg: var(--c-gold-500); --btn-ink: var(--c-maroon-900); }
.btn--ghost { --btn-bg: transparent; --btn-ink: var(--c-maroon-700); border-color: currentColor; }
.btn--ghost:hover { background: var(--c-maroon-700); --btn-ink: #fff; }
.btn--block { display: flex; width: 100%; }
.btn--lg { padding: .85em 2em; font-size: var(--t-base); }

/* --- Thẻ sản phẩm --------------------------------------------------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); border-color: #d9d2cb; }

.card__media { position: relative; aspect-ratio: 1 / 1; background: var(--c-surface-3); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
.card:hover .card__media img { transform: scale(1.04); }

.card__body { padding: var(--s-3) var(--s-4) var(--s-4); display: flex; flex-direction: column; flex: 1; gap: var(--s-2); }
.card__title {
  margin: 0; font-size: var(--t-sm); font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden;
}
.card__title a { color: var(--c-heading); }
.card__title a:hover { color: var(--c-accent); }
.card__price { margin-top: auto; font-weight: 700; color: var(--c-red); font-size: var(--t-sm); }
.card__price--ask { color: var(--c-bronze); font-weight: 600; }

.badge {
  position: absolute; top: var(--s-2); left: var(--s-2); z-index: 2;
  background: var(--c-red); color: #fff;
  font-size: var(--t-xs); font-weight: 700;
  padding: .25em .6em; border-radius: 999px;
}

/* --- Breadcrumb ----------------------------------------------------------- */
.breadcrumb { padding-block: var(--s-3); font-size: var(--t-xs); color: var(--c-muted); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) 0; }
.breadcrumb li { margin: 0; display: flex; align-items: center; }
.breadcrumb li + li::before { content: "›"; margin-inline: .5em; color: var(--c-line); }
.breadcrumb a { color: var(--c-muted); }
.breadcrumb a:hover { color: var(--c-accent); }
.breadcrumb [aria-current] { color: var(--c-ink); font-weight: 500; }

/* --- Phân trang ----------------------------------------------------------- */
.pagination { display: flex; justify-content: center; margin-top: var(--s-6); }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding-inline: .6em; margin: 0 3px;
  border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  background: var(--c-surface); color: var(--c-body);
  font-size: var(--t-sm); font-weight: 500;
  transition: all .18s var(--ease);
}
.pagination .page-numbers:hover { border-color: var(--c-accent); color: var(--c-accent); }
.pagination .page-numbers.current { background: var(--c-maroon-700); border-color: var(--c-maroon-700); color: #fff; }
.pagination .dots { border-color: transparent; background: none; }

/* --- Nội dung bài viết ---------------------------------------------------- */
.prose { max-width: 75ch; }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { font-size: var(--t-xl); margin-top: var(--s-6); }
.prose h3 { font-size: var(--t-lg); margin-top: var(--s-5); }
.prose img { border-radius: var(--radius); margin-inline: auto; }
.prose figure { margin: var(--s-5) 0; }
.prose figcaption { font-size: var(--t-xs); color: var(--c-muted); text-align: center; margin-top: var(--s-2); }
.prose blockquote {
  margin: var(--s-5) 0; padding: var(--s-3) var(--s-5);
  border-left: 3px solid var(--c-gold-500);
  background: var(--c-surface-3); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic; color: var(--c-ink);
}
.prose table { margin: var(--s-5) 0; font-size: var(--t-sm); }
.prose :is(th, td) { padding: var(--s-2) var(--s-3); border: 1px solid var(--c-line); text-align: left; }
.prose th { background: var(--c-surface-3); font-weight: 600; color: var(--c-ink); }
.prose tr:nth-child(even) td { background: var(--c-surface-2); }

/* Bảng rộng phải cuộn được trong khung của nó, không đẩy ngang cả trang */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- Trạng thái rỗng ------------------------------------------------------ */
.empty { text-align: center; padding: var(--s-8) var(--s-4); color: var(--c-muted); }
.empty h2 { color: var(--c-ink); }

/* Thẻ bài viết: ảnh 16:9, nhãn chuyên mục, trích dẫn */
.card__media--wide { aspect-ratio: 16 / 9; }
.card--post .card__body { gap: var(--s-2); }
.card__meta { margin: 0; font-size: var(--t-xs); color: var(--c-muted); }
.card__meta a { color: var(--c-bronze); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.card__title--post { font-size: var(--t-md); font-weight: 700; line-height: 1.35; -webkit-line-clamp: 2; line-clamp: 2; }
.card__excerpt { margin: 0; font-size: var(--t-sm); color: var(--c-body); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden; }
.card__more { margin-top: auto; padding-top: var(--s-2); font-size: var(--t-sm); font-weight: 600; color: var(--c-maroon-700); }
.card--post:hover .card__more { text-decoration: underline; text-underline-offset: .2em; }

/* Chip danh mục con — dùng ở danh mục sản phẩm lẫn chuyên mục bài viết */
.subcat-list { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; }
.subcat {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .5em 1.1em;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: 999px; font-size: var(--t-sm); color: var(--c-body);
  transition: all .18s var(--ease);
}
.subcat:hover { border-color: var(--c-maroon-700); background: var(--c-maroon-700); color: #fff; }
.subcat em { font-style: normal; font-size: var(--t-xs); opacity: .65; }


/* Tên sản phẩm trên thẻ: một dòng, cắt bằng "…" (tên đầy đủ ở tooltip và trang sản phẩm) */
.card--product .card__title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; line-clamp: unset; }

/* Ô lưới không được nở theo nội dung (tên sản phẩm nowrap từng làm lưới tràn 360px) */
.grid > *, ul.products > li, .card, .cat-grid > *, .home-cats__grid > * { min-width: 0; }
.card__title, .card__body { min-width: 0; }

/* Chữ nhỏ nhất 12,8px; link dài trong nội dung cũ không được tràn khung; nút text đủ vùng chạm */
:root { --t-xs: clamp(.8rem, .78rem + .1vw, .8125rem); }
.prose a, .cat-desc a, .comment-text a { overflow-wrap: anywhere; word-break: break-word; }
.showroom-card__actions a, .footer__list a, .footer__policies a, .side-list__items a, .blog-col__list a { padding-block: .45em; }
.card__title a { display: block; padding-block: .15em; }
