/* Đổi màu chủ đạo ở khối :root bên dưới. */

:root {
  --bg: #f7f6f3;
  --surface: #fffcf8;
  --ink: #141414;
  --muted: #5e5e58;
  --line: #e4e1da;
  --soft: #efece6;
  --shadow: 0 16px 40px rgba(20, 20, 20, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body { padding-bottom: 168px; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 68px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

main {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto 64px;
}

.intro { padding: 56px 0 8px; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-size: 52px;
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.lede {
  margin: 14px 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 17px;
}

.contact-bar {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin-top: 22px;
}

.contact-bar .tray-links { width: 100%; }

.controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: 36px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 8px 0;
  color: var(--muted);
  font-size: 15px;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.search {
  position: relative;
  flex: 0 1 280px;
  margin-bottom: 6px;
}

.search svg {
  position: absolute;
  left: 0;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 8px 0 8px 26px;
}

.search input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

.count {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.empty {
  margin: 28px 0 0;
  padding: 36px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.group { margin-top: 32px; }

.group h2 {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.group h2 span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 450;
  letter-spacing: 0;
  text-transform: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.grid.featured {
  grid-template-columns: 1fr;
}

.grid.featured .card {
  display: grid;
  grid-template-columns: minmax(260px, 0.86fr) 1.14fr;
  min-height: 440px;
}

.grid.featured .tile {
  aspect-ratio: auto;
  height: 100%;
}

.grid.featured .card-body {
  justify-content: flex-end;
  padding: 40px 44px 36px;
}

.grid.featured .card h3 {
  font-size: 48px;
  -webkit-line-clamp: 3;
}

.grid.featured .tile-word {
  max-width: 12ch;
  font-size: 40px;
}

.grid.featured .price {
  font-size: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
}

.card.is-on { border-color: var(--ink); }

.tile {
  position: relative;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 42%),
    var(--soft);
  display: grid;
  place-items: center;
}

.tile svg {
  width: min(280px, 72%);
  height: auto;
  color: var(--ink);
}

.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile.has-photo .tile-cat,
.tile.has-photo .tile-code {
  z-index: 1;
  right: auto;
  width: fit-content;
  padding: 3px 6px;
  background: rgba(255, 252, 248, 0.86);
  color: var(--ink);
}

.tile-word {
  max-width: 16ch;
  padding: 0 20px;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.tile-cat,
.tile-code {
  position: absolute;
  left: 16px;
  right: 16px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile-cat { top: 16px; }
.tile-code { bottom: 16px; }

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 18px 16px;
}

.sku {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card h3 {
  margin: 10px 0 0;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.measure {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.spec {
  margin: 6px 0 0;
  color: var(--muted);
}

.price {
  margin: 18px 0 0;
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

.qty-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.qty {
  width: 68px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 10px;
}

.select {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 8px 12px;
  font-size: 14px;
}

.card.is-on .select {
  background: var(--ink);
  color: #fff;
}

.card.is-on .select input { accent-color: #fff; }

.staff {
  margin-top: 56px;
  color: var(--muted);
  font-size: 13px;
}

.staff summary {
  width: fit-content;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.staff-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-top: 12px;
}

.rate {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rate input {
  width: 88px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.staff p { margin: 0; }

.count[hidden],
.empty[hidden],
.tray[hidden] {
  display: none;
}

.tray {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: min(460px, calc(100% - 32px));
  min-width: 0;
  padding: 14px;
  background: var(--ink);
  color: #f7f7f5;
  box-shadow: var(--shadow);
}

.tray-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.tray-links {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.contact-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.contact-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.contact-wa {
  background: #1f8f4e;
  color: #fff;
}

.contact-msg {
  background: #fffcf8;
  color: var(--ink);
}

.contact-bar .contact-msg { border: 1px solid var(--ink); }

.contact-btn.is-off {
  opacity: 0.45;
}

.tray span {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.tray strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .top { padding: 0 16px; }
  main { width: min(1120px, calc(100% - 24px)); }
  .intro { padding-top: 20px; }
  .intro h1 { font-size: 32px; }
  .lede { font-size: 15px; }
  .contact-bar { max-width: none; margin-top: 16px; }
  .controls { flex-direction: column; align-items: stretch; margin-top: 16px; }
  .group { margin-top: 16px; }
  .search { flex-basis: auto; }
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .grid.featured { grid-template-columns: 1fr; }
  .grid.featured .card {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .grid.featured .tile {
    aspect-ratio: 4 / 3;
    height: auto;
    max-height: none;
  }
  .grid.featured .card-body { padding: 16px; }
  .grid.featured .card h3 { font-size: 28px; }
  .card { overflow: hidden; }
  .card-body { padding: 10px 10px 12px; }
  .sku { display: none; }
  .card h3 { font-size: 15px; margin-top: 4px; }
  .measure { font-size: 14px; }
  .spec { font-size: 13px; }
  .price { font-size: 16px; margin-top: 8px; }
  .card-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }
  .qty-field { justify-content: space-between; font-size: 12px; gap: 6px; }
  .qty { width: 64px; padding: 8px 6px; }
  .select {
    margin-left: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: center;
    padding: 10px 8px;
    font-size: 13px;
    gap: 6px;
  }
  .qty,
  .search input,
  .rate input { font-size: 16px; }
  body { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
  .contact-btn { padding: 11px 8px; font-size: 13px; }
  .tile-cat, .tile-code { font-size: 10px; left: 8px; }
  .tile svg { width: 58%; }
  .tray {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: none;
    min-width: 0;
  }
}
