/* ============================================================
   service-grids.css — 10 thẻ dịch vụ.
   Mỗi thẻ = tiêu đề + lưới ảnh vuông (1–4 ảnh) + thanh tương tác.

   Nền vàng: #services-content::before dùng CHUNG rule với trang Sản phẩm
   trong css/style.css (gold-bg.svg, fixed 100lvh + phủ trắng) nên nền hai
   trang giống hệt nhau, không bị phóng to và không giật khi cuộn.

   Lưới ảnh là hình vuông chia trên khung 6×6 ô → mọi bố cục lấp đủ 36 ô.
   ============================================================ */

.svc-section {
  padding: 10px 0 28px;
}

.svc-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ── Thẻ ── */
.svc-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(120, 78, 20, 0.5);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  backdrop-filter: blur(10px) saturate(1.05);
  display: flex;
  flex-direction: column;
}

/* ── Tiêu đề ── */
.svc-head {
  padding: 13px 16px 11px;
}

.svc-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: #3d2b12;
}

.svc-sub {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 400;
  color: #94805a;
  line-height: 1.35;
}

/* ── Lưới ảnh vuông 6×6 ── */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  aspect-ratio: 1 / 1;
  gap: 2px;
  background: rgba(212, 162, 77, 0.22);
}

.svc-tile {
  position: relative;
  overflow: hidden;
  background: #f3ecdd;
  cursor: pointer;
}

.svc-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%; /* smart-crop ghi đè bằng trọng tâm thật */
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.45s ease;
}

.svc-tile img.is-loaded {
  opacity: 1;
}

.svc-tile:hover img {
  transform: scale(1.03);
}

/* Badge "+N" kiểu Facebook */
.svc-more {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ── Thanh tương tác dưới thẻ ── */
.svc-bar {
  display: flex;
  align-items: stretch;
  border-top: 1px solid rgba(184, 120, 45, 0.16);
}

.svc-act {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 6px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #7b6440;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.svc-act + .svc-act {
  border-left: 1px solid rgba(184, 120, 45, 0.12);
}

.svc-act svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: currentColor;
  transition: transform 0.18s ease;
}

.svc-act:hover {
  background: rgba(212, 162, 77, 0.12);
  color: #5c4a1e;
}

.svc-act:active svg {
  transform: scale(0.86);
}

/* Đã thích */
.svc-act.is-on {
  color: #e0245e;
}

.svc-act.is-on:hover {
  background: rgba(224, 36, 94, 0.09);
  color: #c51e51;
}

.svc-count {
  font-variant-numeric: tabular-nums;
}

/* ── Thẻ mở được trang riêng ── */
.svc-card.is-link {
  cursor: pointer;
}

.svc-card.is-link:hover {
  box-shadow: 0 22px 46px -22px rgba(120, 78, 20, 0.62);
}

.svc-card.is-link:focus-visible {
  outline: 2px solid #d4a24d;
  outline-offset: 2px;
}

/* ── Nút "Quay lại" nổi trên trang chi tiết dịch vụ ──
   #service-detail-content không có sẵn nút back nào, mà nội dung nạp vào là
   trang HTML rời có style riêng — nên để nút nổi thay vì chèn vào layout. */
.svc-back {
  position: fixed;
  left: 12px;
  /* Né navbar sticky ở trên (--topcover do index.html đo và ghi) */
  top: calc(var(--topcover, 60px) + 10px);
  z-index: 1040;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 11px;
  border: 1px solid rgba(184, 120, 45, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #5c4a1e;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(120, 78, 20, 0.5);
  transition: background 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.svc-back.is-on {
  display: inline-flex;
}

.svc-back svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.svc-back:hover {
  background: #fff;
}

.svc-back:active {
  transform: scale(0.96);
}

@media (max-width: 575.98px) {
  .svc-back {
    left: 9px;
    padding: 7px 12px 7px 9px;
    font-size: 12.5px;
  }
  .svc-back svg { width: 16px; height: 16px; }
}

/* ══ 10 kiểu chia hình vuông — mỗi kiểu lấp đủ 36 ô ══════ */

/* 1 ảnh */
.g-s-full > :nth-child(1) { grid-area: 1 / 1 / 7 / 7; }

/* 2 ảnh — chia đôi dọc */
.g-s-2col > :nth-child(1) { grid-area: 1 / 1 / 7 / 4; }
.g-s-2col > :nth-child(2) { grid-area: 1 / 4 / 7 / 7; }

/* 2 ảnh — chia đôi ngang */
.g-s-2row > :nth-child(1) { grid-area: 1 / 1 / 4 / 7; }
.g-s-2row > :nth-child(2) { grid-area: 4 / 1 / 7 / 7; }

/* 2 ảnh — chia lệch 2:1 */
.g-s-2asym > :nth-child(1) { grid-area: 1 / 1 / 7 / 5; }
.g-s-2asym > :nth-child(2) { grid-area: 1 / 5 / 7 / 7; }

/* 3 ảnh — 1 lớn trái + 2 nhỏ phải */
.g-s-3left > :nth-child(1) { grid-area: 1 / 1 / 7 / 5; }
.g-s-3left > :nth-child(2) { grid-area: 1 / 5 / 4 / 7; }
.g-s-3left > :nth-child(3) { grid-area: 4 / 5 / 7 / 7; }

/* 3 ảnh — 1 lớn phải + 2 nhỏ trái */
.g-s-3right > :nth-child(1) { grid-area: 1 / 3 / 7 / 7; }
.g-s-3right > :nth-child(2) { grid-area: 1 / 1 / 4 / 3; }
.g-s-3right > :nth-child(3) { grid-area: 4 / 1 / 7 / 3; }

/* 3 ảnh — 1 lớn trên + 2 nhỏ dưới */
.g-s-3top > :nth-child(1) { grid-area: 1 / 1 / 5 / 7; }
.g-s-3top > :nth-child(2) { grid-area: 5 / 1 / 7 / 4; }
.g-s-3top > :nth-child(3) { grid-area: 5 / 4 / 7 / 7; }

/* 3 ảnh — 2 nhỏ trên + 1 lớn dưới */
.g-s-3bottom > :nth-child(1) { grid-area: 3 / 1 / 7 / 7; }
.g-s-3bottom > :nth-child(2) { grid-area: 1 / 1 / 3 / 4; }
.g-s-3bottom > :nth-child(3) { grid-area: 1 / 4 / 3 / 7; }

/* 4 ảnh — 2×2 */
.g-s-4quad > :nth-child(1) { grid-area: 1 / 1 / 4 / 4; }
.g-s-4quad > :nth-child(2) { grid-area: 1 / 4 / 4 / 7; }
.g-s-4quad > :nth-child(3) { grid-area: 4 / 1 / 7 / 4; }
.g-s-4quad > :nth-child(4) { grid-area: 4 / 4 / 7 / 7; }

/* 4 ảnh — 1 lớn trên + 3 nhỏ dưới */
.g-s-4hero > :nth-child(1) { grid-area: 1 / 1 / 5 / 7; }
.g-s-4hero > :nth-child(2) { grid-area: 5 / 1 / 7 / 3; }
.g-s-4hero > :nth-child(3) { grid-area: 5 / 3 / 7 / 5; }
.g-s-4hero > :nth-child(4) { grid-area: 5 / 5 / 7 / 7; }

/* ── Tablet trở lên: 2 thẻ mỗi hàng ── */
@media (min-width: 768px) {
  .svc-wrap {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    padding: 0 14px;
  }
}

@media (min-width: 1200px) {
  .svc-wrap { gap: 22px; }
}

/* ── Mobile ── */
@media (max-width: 575.98px) {
  .svc-section { padding: 8px 0 22px; }
  .svc-wrap { padding: 0 8px; gap: 13px; }
  .svc-card { border-radius: 15px; }
  .svc-head { padding: 11px 13px 9px; }
  .svc-title { font-size: 14px; }
  .svc-sub { font-size: 11.5px; }
  .svc-more { font-size: 20px; }
  .svc-act { font-size: 12.5px; gap: 6px; padding: 10px 4px; }
  .svc-act svg { width: 17px; height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .svc-tile img { transition: opacity 0.2s ease; }
  .svc-tile:hover img { transform: none; }
  .svc-act svg { transition: none; }
}
