/*
 * Khô Mắm An — homepage redesign layer ("Gian bếp miền Tây").
 * Loaded after child-theme.css; only refines shared tokens, so it can be
 * removed to roll back. Principles: one focal point per screen, warm and
 * calm, price + action next to every product, 44px touch targets.
 */

:root {
  --space-section: clamp(48px, 7vw, 88px);
  --radius-card: 20px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ink: #2f1b14;           /* body-on-cream, 12.9:1 */
  --ink-soft: #5e4a41;      /* secondary text, 7.4:1 on --bg-page */
}

/* ---------- Rhythm & section headings ---------- */
.section {
  padding-top: var(--space-section);
  padding-bottom: var(--space-section);
}

.section-head {
  margin-bottom: clamp(20px, 3vw, 32px);
}

.section-title {
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.15;
  text-wrap: balance;
}

.section-link {
  min-height: 44px;
  color: var(--maroon);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.section-link:hover {
  text-decoration-thickness: 2px;
}

/* ---------- Hero: photo as a rounded plate, two clear paths ---------- */
.hero__grid {
  min-height: clamp(460px, 44vw, 540px);
}

.hero__copy {
  padding: clamp(40px, 6vw, 72px) 0;
}

.hero__title {
  letter-spacing: -.02em;
}

.hero__desc {
  font-size: 17px;
  line-height: 1.6;
  color: #f5e3d2;
  max-width: 46ch;
}

.btn-cta {
  min-height: 52px;
  font-size: 16px;
  letter-spacing: 0;
  transition: transform .25s var(--ease-out), background-color .2s;
}

.btn-cta:hover {
  transform: translateY(-2px);
  background: var(--gold-hover);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 26px;
  border: 1.5px solid rgba(251, 238, 222, .6);
  border-radius: 12px;
  color: var(--text-lighter);
  font-weight: 700;
  font-size: 16px;
  transition: background-color .2s, border-color .2s;
}

.btn-ghost:hover {
  background: rgba(251, 238, 222, .12);
  border-color: var(--text-lighter);
}

.hero__story-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.hero__usps {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(251, 238, 222, .18);
}

.hero__usp {
  font-size: 14px;
  color: #f5e3d2;
}

/* ---------- Categories: one calm row ---------- */
.section--categories {
  padding-top: clamp(28px, 4vw, 44px);
  padding-bottom: clamp(8px, 2vw, 16px);
}

.category-card {
  min-height: 44px;
  transition: transform .25s var(--ease-out);
}

.category-card:hover {
  transform: translateY(-3px);
}

.category-card__name {
  font-weight: 700;
  color: var(--ink);
}

.category-card__cta {
  color: var(--ink-soft);
}

/* ---------- Product cards: vertical, price and action in reach ---------- */
.product-grid--home {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 28px);
}

.product-card {
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 39, 28, .05);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(60, 39, 28, .12);
}

.product-card__media {
  overflow: hidden;
  background: var(--bg-alt);
}

.product-card__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  padding: 0;
  transition: transform .6s var(--ease-out);
}

.product-card:hover .product-card__img {
  transform: scale(1.04);
}

.product-card__body {
  padding: 16px 16px 18px;
  gap: 8px;
}

.product-card__name {
  font-size: 16px;
  line-height: 1.35;
  min-height: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__name a {
  color: var(--ink);
}

.product-card__name a:hover {
  color: var(--maroon);
}

.product-card__price-row {
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}

.product-card__from {
  font-size: 13px;
  color: var(--ink-soft);
}

.product-card .price {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.product-card .price del {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.product-card .price ins {
  text-decoration: none;
}

.btn-add {
  min-height: 46px;
  margin-top: 8px;
  font-size: 15px;
  border-radius: 12px;
  transition: background-color .2s, transform .2s var(--ease-out);
}

.btn-add:hover {
  background: var(--maroon-darker);
}

.btn-add:active {
  transform: scale(.98);
}

.btn-add ~ .btn-add {
  display: none;
}

/* ---------- Trust strip (replaces the big stat counters) ---------- */
.stats-section {
  background: var(--maroon-darker);
  color: var(--text-lighter);
  padding: clamp(36px, 5vw, 56px) 0;
}

.stats-section .section-title {
  color: var(--text-lighter);
  font-size: clamp(22px, 2.6vw, 28px);
  margin-bottom: 24px;
}

.stats-section .stat-item__value {
  color: var(--gold-light);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 800;
}

.stats-section .stat-item__label {
  color: #f0d9c4;
  font-size: 14px;
  line-height: 1.45;
}

.stats-section .stat-item__icon {
  color: var(--gold-light);
}

/* ---------- Reviews, story, FAQ: breathing room and readable text ---------- */
.review-card,
.faq-item__a {
  color: var(--ink-soft);
}

.home-story__title {
  text-wrap: balance;
  letter-spacing: -.015em;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .hero__grid {
    min-height: 0;
  }

  .product-grid--home {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  /* Bottom nav already carries account + cart: drop the duplicates up top */
  .has-bottom-nav .header-actions {
    display: none;
  }

  .product-card__body {
    padding: 12px 12px 14px;
  }

  .product-card .price {
    font-size: 18px;
  }

  .btn-add {
    font-size: 14px;
    padding: 10px 8px;
  }
}

@media (max-width: 380px) {
  .product-card__name {
    font-size: 15px;
  }
}

/* Phones: the base theme squeezes copy + circular photo into two columns.
   Stack instead: banner photo, headline, both purchase paths, trust points. */
@media (max-width: 640px) {
  .hero__grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .hero__visual {
    order: -1;
    padding: 16px 0 0;
    grid-column: auto;
    grid-row: auto;
  }

  .hero__visual .hero__photo-img,
  .hero__photo {
    aspect-ratio: 16 / 10;
    border: 0;
    border-radius: 20px;
    object-position: center;
    box-shadow: 0 16px 36px rgba(20, 4, 8, .4);
  }

  .hero__badge {
    top: 28px;
    right: 12px;
    width: 76px;
    height: 76px;
    padding: 6px;
  }

  .hero__badge-num {
    font-size: 16px;
  }

  .hero__badge-label {
    font-size: 7px;
    max-width: 58px;
  }

  .hero__copy {
    display: block;
    padding: 20px 0 28px;
  }

  .hero__copy [data-hero-slide],
  .hero__actions,
  .hero__usps {
    grid-column: auto;
    grid-row: auto;
  }

  .hero__title {
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.08;
    letter-spacing: -.02em;
  }

  .hero__title-script {
    font-size: clamp(30px, 9vw, 38px);
    margin-bottom: 6px;
  }

  .hero__desc {
    font-size: 16px;
    line-height: 1.55;
    margin: 12px 0 0;
  }

  .hero__actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
  }

  .hero__actions .btn-cta,
  .hero__actions .btn-ghost {
    flex: 1 1 100%;
    width: 100%;
    min-height: 52px;
    justify-content: center;
    font-size: 16px;
    white-space: nowrap;
  }

  .hero__story-link {
    display: inline-flex;
    font-size: 15px;
  }

  .hero__usps {
    margin-top: 22px;
    padding-top: 18px;
    gap: 12px 14px;
  }

  .hero__usp {
    font-size: 13px;
    line-height: 1.35;
    align-items: center;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-card,
  .product-card__img,
  .category-card,
  .btn-cta,
  .btn-add {
    transition: none;
  }

  .product-card:hover,
  .product-card:hover .product-card__img,
  .category-card:hover,
  .btn-cta:hover {
    transform: none;
  }
}

/* All four homepage picks are "best sellers": a badge on every card is noise */
.product-grid--home .badge--best {
  display: none;
}

/* Narrow phones: keep "Chọn quy cách" / "Thêm vào giỏ" on one line */
@media (max-width: 420px) {
  .product-card .btn-add {
    white-space: nowrap;
    gap: 0;
    font-size: 13.5px;
  }

  .product-card .btn-add svg {
    display: none;
  }
}

/* ---------- Contrast pass (WCAG AA) for small gold labels ---------- */
.home-story__eyebrow {
  color: var(--gold-light);
  font-size: 12px;
}

.home-promo__eyebrow,
.home-promo__label,
.news-card__cat {
  color: #7d5410;
  font-size: 12px;
}

.home-promo__price del,
.home-promo__price del .amount {
  color: var(--text-muted);
}

/* ---------- Product detail: variation pills ---------- */
.variation-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.variation-pill {
  min-width: 84px;
  min-height: 46px;
  padding: 0 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}

.variation-pill:hover {
  border-color: var(--maroon);
}

.variation-pill:focus-visible {
  outline: 2px solid var(--maroon);
  outline-offset: 2px;
}

.variation-pill.is-active {
  border-color: var(--maroon);
  background: var(--maroon);
  color: #fff;
}

.detail-actions-variable .variations select.is-enhanced {
  display: none !important;
}

.detail-actions-variable .variations td.value:has(.is-enhanced) .reset_variations {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .variation-pill {
    transition: none;
  }
}

/* ---------- Article body: tables ---------- */
.article-main table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 24px 0;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.article-main table thead th {
  background: var(--maroon);
  color: #fff;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.article-main table th,
.article-main table td {
  min-width: 140px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.article-main table tbody th {
  background: var(--bg-alt);
  color: var(--ink);
}

.article-main table tbody tr:nth-child(even) td {
  background: var(--bg-alt);
}

.article-main table tbody tr:last-child td,
.article-main table tbody tr:last-child th {
  border-bottom: 0;
}

/* ---------- Article: previous / next navigation ---------- */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.post-navigation {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.post-navigation .nav-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.post-navigation .nav-previous:only-child {
  grid-column: 1 / -1;
}

.post-navigation .nav-next:only-child {
  grid-column: 2;
}

.post-navigation a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  min-height: 44px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .2s, box-shadow .3s var(--ease-out), transform .3s var(--ease-out);
}

.post-navigation .nav-next a {
  text-align: right;
}

.post-navigation a:hover {
  border-color: var(--maroon);
  box-shadow: 0 10px 24px rgba(60, 39, 28, .1);
  transform: translateY(-2px);
}

.post-navigation .nav-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.post-navigation .nav-previous .nav-subtitle::before {
  content: "← ";
}

.post-navigation .nav-next .nav-subtitle::after {
  content: " →";
}

.post-navigation .nav-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: none;
  color: var(--maroon);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 600px) {
  .post-navigation .nav-links {
    grid-template-columns: 1fr;
  }

  .post-navigation .nav-next:only-child {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-navigation a {
    transition: none;
  }

  .post-navigation a:hover {
    transform: none;
  }
}

/* ---------- Article body: images keep their real proportions ---------- */
.article-main > p > img,
.article-main figure:not(.article-cover) img,
.article-main .wp-block-image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto !important;     /* HTML height attr must not stretch/squash */
  max-height: 640px;           /* tall portrait photos stay reasonable */
  margin: 28px auto 8px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(60, 39, 28, .1);
}

.article-main figure:not(.article-cover) {
  margin: 28px 0;
}

.article-main figure:not(.article-cover) img {
  margin: 0 auto;
}

.article-main figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
}

.article-main .wp-block-embed iframe,
.article-main iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 14px;
}
