/* =============================================================
   BLOG — 4RAU BARBER CUTCLUB
   v2.0: SEO display · Cross-device · Smart UX · A11y
   ============================================================= */

/* ── 1. Design tokens ───────────────────────────────────────── */
:root {
  --reading-width:  72ch;
  --media-width:    960px;
  --toc-offset:     80px;           /* sticky nav clearance */

  --blog-accent:       var(--cp-primary, #435846);
  --blog-accent-dark:  var(--cp-primary-mid, #536E58);
  --blog-accent-light: #f0f4f0;
  --blog-text:         #1a1a2e;
  --blog-muted:        #6c757d;
  --blog-border:       #e4e7ec;
  --blog-radius:       12px;
  --blog-shadow-sm:    0 2px 8px rgba(0,0,0,.06);
  --blog-shadow-md:    0 8px 24px rgba(0,0,0,.09);
  --blog-shadow-lg:    0 16px 40px rgba(0,0,0,.12);
  --blog-ease:         cubic-bezier(.4, 0, .2, 1);
  --blog-dur:          .2s;
}

/* ── 2. Blog index / category hero ─────────────────────────── */
/* aspect-ratio thay fixed height → loại bỏ CLS hoàn toàn; width:100% explicit cho full-bleed */
.blog-index-hero {
  width: 100%;
  aspect-ratio: 16 / 5;
  min-height: 200px;
  max-height: 380px;
  background-size: cover;
  background-position: center center;
  position: relative;
}
.blog-index-hero--fallback {
  aspect-ratio: 16 / 4;
  min-height: 140px;
}
.blog-index-hero__overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.58); z-index: 1;
}
.blog-index-hero__content { z-index: 2; }

.blog-category-banner {
  background-size: cover; background-position: center;
  animation: fadeInBanner .9s var(--blog-ease) both;
}
@keyframes fadeInBanner {
  from { opacity: 0; transform: scale(1.025); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── 3. Blog list cards ─────────────────────────────────────── */
.blog-card {
  transition: transform var(--blog-dur) var(--blog-ease),
              box-shadow var(--blog-dur) var(--blog-ease);
  height: 100%;
  will-change: transform;
}
.blog-card:hover,
.blog-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--blog-shadow-md);
}
.blog-title-hover:hover { color: var(--blog-accent) !important; }

/* Thumbnail */
.thumbnail-wrapper {
  width: clamp(100px, 14vw, 130px);
  aspect-ratio: 4 / 3;
  flex-shrink: 0; border-radius: 8px; overflow: hidden;
}
.thumbnail-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .32s var(--blog-ease);
}
.thumbnail-wrapper:hover .thumbnail-img,
.thumbnail-wrapper:focus-within .thumbnail-img { transform: scale(1.07); }

.blog-highlight-item { display: flex; gap: 16px; align-items: stretch; }

/* Text clamping */
.text-truncate-2,
.card-title.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.text-truncate-2 { font-size: .95rem; font-weight: 500; line-height: 1.45; }
.card-title.truncate-2 {
  font-size: 1.05rem; font-weight: 700; color: var(--blog-text);
  margin-bottom: .4rem; text-decoration: none;
}
.card-title { font-size: 1.1rem; line-height: 1.5; margin-bottom: .5rem; }
.card-text.truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .9rem; color: #555;
}

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Labels / badges */
.badge.bg-secondary { font-size: .72rem; padding: 3px 10px; border-radius: 10px; display: inline-block; margin-bottom: 4px; }
.category-label {
  font-size: .72rem; font-weight: 600; color: #fff;
  background: #6c757d; display: inline-block;
  padding: 2px 9px; border-radius: 12px; margin-bottom: 8px;
}

/* Images in list/card */
/* background giữ chỗ khi ảnh chưa load → tránh alt-text lệch trái */
.blog-main-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #e9ecef; }
.blog-recommend-img { object-fit: cover; }
.post-img { width: 100%; object-fit: cover; height: 100%; border-radius: .5rem 0 0 .5rem; }

/* Related post images */
.fixed-ratio-img { height: 200px; object-fit: cover; width: 100%; }
.two-line-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis; height: 3em; line-height: 1.5em;
}

/* Dropdown */
.custom-dropdown .list-group { z-index: 1000; left: 0; right: 0; }
#dropdownToggle { cursor: pointer; }
.blog-list-section { padding-top: 60px; }

/* Tags */
.badge[rel="tag"]:hover { background: #e9ecef !important; color: #343a40 !important; }

/* ── 4. Reading progress bar ────────────────────────────────── */
#read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--blog-accent) 0%, #ff6a3d 100%);
  z-index: 10000;
  transition: width .08s linear;       /* smooth real-time fill */
  box-shadow: 0 0 6px rgba(215,53,42,.45);
}

/* ── 5. Page banner (detail page) ──────────────────────────── */
.page-banner {
  position: relative;
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}
.banner-hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  z-index: 0;
}
.banner-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.68); z-index: 1; }
.page-banner .container,
.page-banner .page-banner-content { position: relative; z-index: 2; }
.page-banner .blog-detail-breadcrumb { margin-bottom: 0; }
.page-banner .blog-detail-breadcrumb .breadcrumb-item,
.page-banner .blog-detail-breadcrumb .breadcrumb-item.active,
.page-banner .blog-detail-breadcrumb .breadcrumb-item a {
  color: rgba(255,255,255,.9) !important;
}
.page-banner .blog-detail-breadcrumb .breadcrumb-item a { text-decoration: none; }
.page-banner .blog-detail-breadcrumb .breadcrumb-item a:hover { color: #fff !important; text-decoration: underline; }
.page-banner .blog-detail-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.5) !important; }

/* ── 6. Blog meta bar ───────────────────────────────────────── */
.blog-meta-bar {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.blog-meta-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 13px; background: #f4f5f7;
  border: 1px solid var(--blog-border); border-radius: 999px;
  font-size: 12.5px; color: #555; line-height: 1; white-space: nowrap;
}
.blog-meta-item svg { flex-shrink: 0; opacity: .6; }
/* Reading time: subtle accent */
.blog-meta-item--time { background: var(--blog-accent-light); border-color: #fcd9d4; color: var(--blog-accent); }

/* ── 7. Reading width layout ────────────────────────────────── */
.blog-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0;
}
.blog-content > * {
  width: 100%;
  max-width: min(var(--reading-width), 100%);
  margin-left: auto !important;
  margin-right: auto !important;
  clear: both;
  float: none !important;
}
/* Media elements are allowed to be wider */
.blog-content > img,
.blog-content > figure,
.blog-content > .responsive-media {
  max-width: min(var(--reading-width), 100%);
  margin-left: auto; margin-right: auto;
}

/* ── 8. Typography — headings ───────────────────────────────── */
/* clamp() handles all breakpoints in one rule — no mobile override needed */
.blog-content :is(h2,h3,h4,h5) {
  font-weight: 800;
  text-wrap: balance;
  text-align: center !important;
  margin-left: auto; margin-right: auto;
}
.blog-content h2 { font-size: clamp(20px, 4.5vw, 32px); margin: 1.2em auto .45em; line-height: 1.25; }
.blog-content h3 { font-size: clamp(18px, 3.4vw, 26px); margin: 1em auto .4em;   line-height: 1.3; }
.blog-content h4 { font-size: clamp(16px, 2.8vw, 22px); margin: .9em auto .35em; line-height: 1.35; }
.blog-content h5 { font-size: clamp(15px, 2.2vw, 18px); margin: .8em auto .3em;  line-height: 1.4; }

/* ── 9. Typography — body text ──────────────────────────────── */
/* line-height 1.72 tối ưu cho tiếng Việt có dấu (khuyến nghị W3C) */
.blog-content p {
  font-size: 17px; line-height: 1.72;
  margin-top: 0; margin-bottom: .9em;
  color: var(--blog-text);
}
/* Đoạn mở bài nổi bật hơn */
.blog-content > p:first-of-type { font-size: 18px; line-height: 1.75; color: #111; }

.blog-lead {
  max-width: min(var(--reading-width), 100%);
  margin-left: auto; margin-right: auto;
}
.blog-lead p { font-size: 17px; line-height: 1.65; color: #333; }

/* Links within text */
.blog-content :where(p,li) a {
  color: var(--blog-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(215,53,42,.35);
  transition: color .15s ease, text-decoration-color .15s ease;
}
.blog-content :where(p,li) a:hover {
  color: var(--blog-accent-dark);
  text-decoration-color: var(--blog-accent-dark);
}
.blog-content :where(p,li) a:focus-visible {
  outline: 2px solid var(--blog-accent); outline-offset: 2px; border-radius: 2px;
}

/* Overflow guard + hyphenation */
.blog-content *:where(p,ul,ol,blockquote,table,pre,code,figcaption) {
  max-width: min(var(--reading-width), 100%);
  margin-inline: auto !important;
  overflow-wrap: anywhere; word-break: break-word; hyphens: auto;
}
.blog-content center { display: contents; }

/* ── 10. Blockquote ─────────────────────────────────────────── */
.blog-content blockquote {
  position: relative;
  margin: 1.75em auto !important;
  padding: 1.1rem 1.4rem 1.1rem 1.65rem;
  border-left: 4px solid var(--blog-accent);
  background: var(--blog-accent-light);
  border-radius: 0 var(--blog-radius) var(--blog-radius) 0;
  color: #2d1f1b; font-style: italic;
  max-width: min(var(--reading-width), 100%);
}
.blog-content blockquote::before {
  content: "\201C";
  position: absolute; top: -2px; left: 12px;
  font-size: 3rem; line-height: 1;
  color: var(--blog-accent); opacity: .2;
  font-style: normal; font-family: Georgia, serif;
  pointer-events: none;
}
.blog-content blockquote p { font-size: 1em; margin-bottom: 0; color: inherit; }
.blog-content blockquote cite,
.blog-content blockquote footer {
  display: block; margin-top: .55rem;
  font-size: .82rem; font-style: normal; color: var(--blog-muted);
}

/* ── 11. Inline code & keyboard ─────────────────────────────── */
.blog-content :not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .875em; padding: .15em .42em;
  border-radius: 5px; background: #f1f3f7;
  border: 1px solid #e2e5ea; color: #c7254e;
  white-space: nowrap;
}
.blog-content kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .82em; padding: .2em .5em;
  background: #212529; color: #f8f9fa;
  border-radius: 4px; border-bottom: 2px solid #111;
  display: inline-block; line-height: 1.4;
}

/* Code block (class-based) */
.quotecode {
  display: block; white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 16px 18px; margin: 18px auto;
  border-radius: var(--blog-radius);
  background: #0b1020; color: #e6edf3;
  line-height: 1.65; border: 1px solid #1f2540;
  box-shadow: var(--blog-shadow-sm); font-size: .875rem;
  overflow-x: auto;
}

/* ── 12. Rich text components ───────────────────────────────── */
.fancy-quote {
  position: relative; padding: 18px 22px 18px 64px;
  border-left: 4px solid var(--bs-primary, #0d6efd);
  background: #f8faff; color: #202636;
  border-radius: var(--blog-radius); margin: 20px auto;
}
.fancy-quote::before {
  content: "\201C"; position: absolute; left: 18px; top: 8px;
  font-size: 44px; line-height: 1;
  color: var(--bs-primary, #0d6efd); opacity: .22;
}

.note { border-radius: var(--blog-radius); padding: 14px 16px; margin: 16px auto; border: 1px solid transparent; }
.note .note-title { margin: 0 0 6px; font-weight: 700; }
.note .note-body  { margin: 0; }
.note.note-info   { background: #f0f6ff; border-color: #b6d1ff; }
.note.note-tip    { background: #f4fff0; border-color: #bfe6b6; }
.note.note-warn   { background: #fff8f0; border-color: #f3cf9e; }

/* SEO callout */
.blog-content > .seo-callout {
  max-width: min(var(--reading-width), 100%) !important;
  margin: 24px auto !important;
  padding: 16px 18px;
  border: 1px solid #fde0d8; border-left: 4px solid var(--blog-accent);
  border-radius: var(--blog-radius);
  background: var(--blog-accent-light); color: #2d1f1b;
  box-shadow: 0 8px 24px rgba(215,53,42,.07);
}
.seo-callout strong { display: block; margin-bottom: 6px; color: #141414; font-weight: 900; }
.seo-callout a { color: var(--blog-accent); font-weight: 800; text-decoration: none; }
.seo-callout a:hover { text-decoration: underline; }

/* ── 13. Images — centering & layout ────────────────────────── */
.blog-content figure {
  max-width: min(var(--reading-width), 100%) !important;
  text-align: center; margin: 32px auto !important;
}
.blog-content figure > img { display: block; margin-left: auto; margin-right: auto; }

/* General figcaption */
.blog-content figcaption {
  font-size: 13px; color: var(--blog-muted);
  text-align: center; margin-top: 8px;
  line-height: 1.5; font-style: italic;
}

/* All images: block-centered, no float, no overflow */
.blog-content img,
.blog-content .wp-caption img,
.blog-content img.aligncenter,
.blog-content .aligncenter img,
.blog-content a > img {
  display: block !important;
  margin-left: auto !important; margin-right: auto !important;
  margin-top: 0 !important; margin-bottom: 0 !important;
  float: none !important;
  max-width: 100% !important; width: 100% !important; height: auto !important;
}
.blog-content .media-center { text-align: center; }
.blog-content .media-portrait,
.blog-content .media-portrait-tall {
  max-width: min(var(--reading-width), 100%) !important;
  margin: 32px auto !important;
}
.blog-content .media-portrait > a.glightbox,
.blog-content .media-portrait > a[data-gallery],
.blog-content figure.media-portrait > a.glightbox,
.blog-content figure.media-portrait > a[data-gallery] { max-width: 100% !important; margin: 0 auto !important; }
.blog-content img.is-portrait,
.blog-content .media-portrait img,
.blog-content figure.media-portrait > img,
.blog-content figure.media-portrait > a > img {
  width: 100% !important; max-width: 100% !important;
  height: auto !important; max-height: none !important;
  margin: 0 auto !important; border-radius: 0; box-shadow: none;
}
.blog-content .media-portrait figcaption,
.blog-content figure.media-portrait figcaption {
  margin-top: 10px !important; max-width: min(44ch, 100%) !important;
  font-size: 13px; line-height: 1.55; color: #6a6f7d;
  text-align: center; letter-spacing: .01em;
}

/* Lightbox links: cursor hint */
.blog-content a.glightbox,
.blog-content a[data-gallery] {
  display: block !important;
  max-width: min(var(--reading-width), 100%) !important;
  margin: 0 auto !important;
  text-decoration: none;
  cursor: zoom-in;
}

/* Undo hard-coded width/height attrs from editor */
.blog-content img[width],
.blog-content img[height] { width: auto !important; height: auto !important; }

/* Strip floats */
.blog-content img.alignleft,  .blog-content .alignleft img,
.blog-content img[style*="float:left"],  .blog-content img[style*="float: left"],
.blog-content img.alignright, .blog-content .alignright img,
.blog-content img[style*="float:right"], .blog-content img[style*="float: right"] { float: none !important; }
.blog-content :where(.ratio,.embed,.video,.media,.wp-block-image) > img { width: auto !important; height: auto !important; max-width: 100% !important; }
.blog-content img:not(.is-portrait) { max-height: none; }

/* Vertical rhythm: text ↔ media spacing */
.blog-content > p + :is(figure, .media-portrait, .responsive-media),
.blog-content > ul + :is(figure, .media-portrait, .responsive-media),
.blog-content > ol + :is(figure, .media-portrait, .responsive-media),
.blog-content > blockquote + :is(figure, .media-portrait, .responsive-media) { margin-top: 34px !important; }
.blog-content > :is(figure, .media-portrait, .responsive-media) + :is(p,ul,ol,blockquote,h2,h3,h4) { margin-top: 30px !important; }

/* Media-block stacking */
.blog-content > .media-block.media-block--stack { margin-top: 12px !important; }
.blog-content > .media-block.media-block--has-next { margin-bottom: 0 !important; }
.blog-content > .media-block.media-block--start:not(.media-block--has-next) { margin-bottom: 30px !important; }
.blog-content > .media-block + .media-block { margin-top: 12px !important; }

/* ── 14. Responsive video/iframe ────────────────────────────── */
.blog-content .responsive-media {
  position: relative; width: 100%;
  max-width: min(var(--media-width), 100%);
  aspect-ratio: 16 / 9; min-height: 200px; overflow: hidden;
  margin: 1.5rem auto; border-radius: 10px;
  box-shadow: var(--blog-shadow-sm);
}
.blog-content .responsive-media.asp-43 { aspect-ratio: 4 / 3; }
.blog-content .responsive-media.asp-11 { aspect-ratio: 1 / 1; }
.blog-content .responsive-media iframe,
.blog-content .responsive-media video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Fallback: browsers without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
  .blog-content .responsive-media { padding-bottom: 56.25%; height: auto; }
  .blog-content .responsive-media.asp-43 { padding-bottom: 75%; }
  .blog-content .responsive-media.asp-11 { padding-bottom: 100%; }
}

/* ── 15. Lists ──────────────────────────────────────────────── */
.blog-content ul,
.blog-content ol {
  margin-inline: auto !important;
  max-width: min(var(--reading-width), 100%);
  padding-left: 1.65em; margin-top: .5em; margin-bottom: .5em;
}
.blog-content ul { list-style-type: disc !important;    list-style-position: outside; }
.blog-content ol { list-style-type: decimal !important; list-style-position: outside; }
.blog-content li { line-height: 1.72; margin: .25em 0; padding-left: .15em; }
.blog-content ul ul { list-style-type: circle !important; padding-left: 1.4em; margin: .2em 0; }
.blog-content ul ul ul { list-style-type: square !important; }
.blog-content ol ol, .blog-content ul ol, .blog-content ol ul { padding-left: 1.4em; margin: .2em 0; }

/* ── 16. Tables ─────────────────────────────────────────────── */
.blog-content > .table-wrap {
  max-width: min(var(--media-width), 100%) !important;
  width: 100% !important; overflow-x: auto;
  margin: 26px auto !important;
  border: 1px solid var(--blog-border); border-radius: 14px;
  background: #fff; box-shadow: 0 12px 30px rgba(16,24,40,.07);
}
.blog-content > .table-wrap::-webkit-scrollbar { height: 5px; }
.blog-content > .table-wrap::-webkit-scrollbar-thumb { background: #cfd4dc; border-radius: 999px; }
.blog-content .table-wrap table,
.blog-content table.seo-table {
  width: 100% !important; min-width: 640px; max-width: none !important;
  margin: 0 !important; border-collapse: separate !important; border-spacing: 0 !important;
  background: #fff; font-size: 14px;
}
.blog-content .table-wrap thead th,
.blog-content table.seo-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #151515 !important; color: #fff !important;
  padding: 13px 16px !important; border: 0 !important;
  font-weight: 800; line-height: 1.35; white-space: nowrap;
}
.blog-content .table-wrap tbody td,
.blog-content table.seo-table tbody td {
  padding: 12px 16px !important; border: 0 !important;
  border-bottom: 1px solid #edf0f4 !important;
  color: #252b37; line-height: 1.55; vertical-align: top;
}
.blog-content .table-wrap tbody tr:nth-child(even) td,
.blog-content table.seo-table tbody tr:nth-child(even) td { background: #fafbfc; }
.blog-content .table-wrap tbody tr:hover td,
.blog-content table.seo-table tbody tr:hover td { background: var(--blog-accent-light); transition: background .15s; }
.blog-content .table-wrap tbody tr:last-child td,
.blog-content table.seo-table tbody tr:last-child td { border-bottom: 0 !important; }
.blog-content .table-wrap td:first-child,
.blog-content table.seo-table td:first-child { font-weight: 800; color: #111827; white-space: nowrap; }
.blog-content .table-wrap a,
.blog-content table.seo-table a { color: var(--blog-accent); font-weight: 700; text-decoration: none; }
.blog-content .table-wrap a:hover,
.blog-content table.seo-table a:hover { text-decoration: underline; }
/* Table caption */
.blog-content table caption {
  caption-side: bottom; font-size: 12px; color: var(--blog-muted);
  padding: 8px 16px; text-align: left;
  border-top: 1px solid var(--blog-border);
}

/* Image table */
.blog-content table.blog-img-table {
  max-width: min(var(--media-width), 100%) !important;
  width: 100% !important; table-layout: fixed !important;
  border-collapse: collapse !important; margin: 18px auto !important;
}
.blog-content > .table-wrap:has(> table.blog-img-table) {
  max-width: min(var(--media-width), 100%) !important; width: 100% !important;
}
.blog-content table.blog-img-table td { vertical-align: top; padding: 3px 5px; }
.blog-content table.blog-img-table td p,
.blog-content table.blog-img-table td figure { margin: 0 !important; padding: 0 !important; }
.blog-content table.blog-img-table td a.glightbox,
.blog-content table.blog-img-table td a[data-gallery] { margin: 0 !important; }

/* ── 17. Table of Contents ──────────────────────────────────── */
/* Scroll offset for sticky header */
[id^="heading-"]::before {
  content: ""; display: block;
  height: var(--toc-offset); margin-top: calc(-1 * var(--toc-offset));
}

#toc-container {
  background: #fafbfc;
  border: 1px solid var(--blog-border);
  border-left: 3px solid var(--blog-accent);
  border-radius: 0 var(--blog-radius) var(--blog-radius) 0;
  padding: .9rem 1.1rem;
}
#toc-container ul {
  padding-left: .9rem; margin-bottom: 0;
  list-style: none !important;
}
#toc-container > ul { padding-left: 0; }
#toc-container li { margin: 4px 0; line-height: 1.4; }
#toc-container a {
  color: #3a3a3a; text-decoration: none;
  font-size: .87rem; font-weight: 500;
  padding: 3px 6px; border-radius: 5px;
  display: block;
  transition: color .14s ease, background .14s ease;
}
#toc-container a:hover,
#toc-container a:focus-visible { color: var(--blog-accent); background: rgba(215,53,42,.07); }
/* Active heading: JS adds this class via IntersectionObserver */
#toc-container a.toc-active {
  color: var(--blog-accent); font-weight: 700;
  background: rgba(215,53,42,.09);
}
/* Nested levels */
#toc-container ul ul a { padding-left: 1rem; font-size: .83rem; color: #555; }
#toc-container ul ul ul a { padding-left: 1.75rem; font-size: .8rem; color: #777; }

/* ── 18. Share bar ──────────────────────────────────────────── */
html { scroll-behavior: smooth; }

.share-bar { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-share {
  --h: 44px;
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--h); line-height: 1; padding: 0 18px;
  border-radius: 999px; border: 1.5px solid var(--bs-primary, #0d6efd);
  background: #fff; color: #0d6efd;
  font-weight: 700; letter-spacing: .2px; text-transform: uppercase; font-size: .8rem;
  text-decoration: none; box-shadow: 0 2px 8px rgba(13,110,253,.07);
  transition: background .15s ease, color .15s ease, box-shadow .2s ease, transform .15s ease;
}
.btn-share:hover {
  background: var(--bs-primary, #0d6efd); color: #fff;
  transform: translateY(-1px); box-shadow: 0 8px 18px rgba(13,110,253,.2);
}
.btn-share:active { transform: translateY(0); }
.btn-share:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; }
.btn-share svg { display: block; }

/* ── 19. Prev / Next article navigation ─────────────────────── */
.blog-post-nav {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin: 2.5rem 0;
}
.blog-post-nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .85rem 1rem;
  background: #f8f9fa; border: 1px solid var(--blog-border);
  border-radius: var(--blog-radius);
  text-decoration: none; color: #222;
  transition: background var(--blog-dur) ease,
              box-shadow var(--blog-dur) ease,
              transform var(--blog-dur) ease;
  min-width: 0;
}
.blog-post-nav-link:hover {
  background: #fff; box-shadow: var(--blog-shadow-md);
  transform: translateY(-2px); color: #111;
}
.blog-post-nav-link--next { justify-content: flex-end; text-align: right; }
.blog-post-nav-link i { flex-shrink: 0; font-size: 1rem; color: var(--blog-muted); }
.blog-post-nav-meta { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.blog-post-nav-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--blog-muted);
}
.blog-post-nav-title {
  font-size: .88rem; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ── 20. Pagination ─────────────────────────────────────────── */
.blog-pagination {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: .35rem; margin: 2rem 0;
}
.blog-pagination .page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 .6rem;
  border-radius: 8px; border: 1px solid var(--blog-border);
  background: #fff; color: #333; font-weight: 600; font-size: .88rem;
  text-decoration: none;
  transition: background var(--blog-dur) ease, border-color var(--blog-dur) ease, color var(--blog-dur) ease;
}
.blog-pagination .page-link:hover { background: #f8f9fa; border-color: #c9d1d9; color: #111; }
.blog-pagination .page-link.active { background: #111; border-color: #111; color: #fff; }
.blog-pagination .page-link:focus-visible { outline: 2px solid var(--blog-accent); outline-offset: 2px; }

/* ── 21. Product cards (inline in article) ──────────────────── */
.blog-content .blog-product-grid {
  max-width: min(var(--media-width), 100%) !important;
  width: 100% !important; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; margin: 22px auto 28px !important;
}
.blog-content .blog-product-grid.blog-product-grid--single {
  max-width: min(360px, 100%) !important; grid-template-columns: 1fr;
}
.blog-content .blog-product-grid.blog-product-grid--two {
  max-width: min(620px, 100%) !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.blog-content .blog-product-card {
  min-width: 0; display: flex; flex-direction: column;
  overflow: hidden; position: relative; isolation: isolate;
  border: 1px solid #e6e9ef !important; border-radius: 12px !important;
  background: #fff !important; box-shadow: 0 8px 22px rgba(17,24,39,.07) !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.blog-content .blog-product-card:hover {
  transform: translateY(-2px);
  border-color: #ffb8aa !important;
  box-shadow: 0 14px 30px rgba(17,24,39,.12) !important;
}
.blog-content .blog-product-media {
  display: flex; align-items: center; justify-content: center;
  position: relative; height: 160px; min-height: 160px;
  background: #fff; padding: 0; overflow: hidden; text-decoration: none !important;
}
.blog-content .blog-product-media img {
  width: 100% !important; height: 160px !important; max-height: none !important;
  object-fit: cover !important; object-position: center !important;
  margin: 0 !important; transform: scale(1.02); transition: transform .22s ease;
}
.blog-content .blog-product-card:hover .blog-product-media img { transform: scale(1.06); }
.blog-content .blog-product-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center;
  min-height: 22px; padding: 0 8px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.75);
  background: var(--blog-accent); color: #fff;
  box-shadow: 0 6px 14px rgba(215,53,42,.2);
  font-size: 10px; font-weight: 900; line-height: 1;
  letter-spacing: .04em; text-transform: uppercase;
}
.blog-content .blog-product-body {
  flex: 1 1 auto; display: flex; flex-direction: column;
  gap: 7px; padding: 12px 14px 14px;
}
.blog-content .blog-product-brand {
  display: inline-flex; width: fit-content; padding: 3px 8px; border-radius: 999px;
  background: #111827; color: #fff; font-size: 10px; font-weight: 800;
  line-height: 1.2; letter-spacing: .06em; text-transform: uppercase;
}
.blog-content .blog-product-title {
  margin: 0; min-height: 38px; color: #111827;
  font-size: 14px; font-weight: 900; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-content .blog-product-title a { color: inherit; text-decoration: none; }
.blog-content .blog-product-title a:hover { color: var(--blog-accent); }
.blog-content .blog-product-specs { display: flex; flex-wrap: wrap; gap: 5px; }
.blog-content .blog-product-specs span {
  display: inline-flex; align-items: center; min-height: 22px;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid #f3d3ce; color: #963126; background: #fff7f5;
  font-size: 11px; font-weight: 700;
}
.blog-content .blog-product-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: auto; padding-top: 5px;
}
.blog-content .blog-product-price { color: #d0021b; font-size: 16px; font-weight: 900; line-height: 1; white-space: nowrap; }
.blog-content .blog-product-cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  background: linear-gradient(135deg, #151515, #343434);
  color: #fff !important; font-size: 11px; font-weight: 900;
  line-height: 1; text-decoration: none !important;
  text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 8px 18px rgba(17,24,39,.14);
  transition: background .18s, box-shadow .18s;
}
.blog-content .blog-product-cta:hover {
  background: linear-gradient(135deg, var(--blog-accent), #ff624d);
  color: #fff !important; box-shadow: 0 12px 22px rgba(215,53,42,.25);
}

/* ── 22. Ad product card ────────────────────────────────────── */
.blog-ad-product {
  max-width: min(var(--reading-width), 100%);
  margin: 16px auto !important;
}
.blog-ad-card {
  display: flex; gap: 14px; align-items: center;
  padding: 14px 16px; background: #fff;
  border: 1px solid rgba(0,0,0,.07); border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,.07);
  transition: box-shadow var(--blog-dur) ease, transform var(--blog-dur) ease;
}
.blog-ad-card:hover { box-shadow: 0 14px 32px rgba(0,0,0,.1); transform: translateY(-1px); }
.blog-ad-left { flex: 0 0 auto; display: flex; align-items: center; }
.blog-ad-thumb {
  width: 130px; height: 130px; border-radius: 14px;
  overflow: hidden; background: #fff; display: block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.blog-ad-thumb img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: center; transform: scale(1.06);
}
.blog-ad-right {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
}
.blog-ad-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 10px 0 7px; border-radius: 999px;
  border: 1px solid transparent; font-size: 10.5px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; margin-bottom: 8px;
  background: rgba(16,185,129,.07); color: #047857; border-color: rgba(16,185,129,.22);
}
.blog-ad-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0; opacity: .85;
}
.blog-ad-badge--new    { background: rgba(16,185,129,.07);  color: #047857; border-color: rgba(16,185,129,.22); }
.blog-ad-badge--cart   { background: rgba(245,158,11,.08);  color: #92400e; border-color: rgba(245,158,11,.28); }
.blog-ad-badge--wish   { background: rgba(244,63,94,.07);   color: #9f1239; border-color: rgba(244,63,94,.22); }
.blog-ad-badge--viewed { background: rgba(99,102,241,.07);  color: #3730a3; border-color: rgba(99,102,241,.2); }
.blog-ad-badge--hot    { background: rgba(234,179,8,.08);   color: #78350f; border-color: rgba(234,179,8,.28); }
.blog-ad-card[data-signal="new"]        { border-left: 3px solid rgba(16,185,129,.55); }
.blog-ad-card[data-signal="cart"]       { border-left: 3px solid rgba(245,158,11,.6); }
.blog-ad-card[data-signal="wishlist"]   { border-left: 3px solid rgba(244,63,94,.55); }
.blog-ad-card[data-signal="viewed"]     { border-left: 3px solid rgba(99,102,241,.5); }
.blog-ad-card[data-signal="bestseller"] { border-left: 3px solid rgba(234,179,8,.6); }
.blog-ad-name {
  font-weight: 900; line-height: 1.25; margin: 0 0 6px 0; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.blog-ad-desc {
  color: #6b7280; font-size: 13px; line-height: 1.35; margin: 0; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.blog-ad-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.blog-ad-price { color: #d0021b; font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.blog-ad-buy {
  display: flex !important; align-items: center !important; justify-content: center !important;
  min-height: 44px; padding: 0 22px !important;
  font-weight: 900 !important; font-size: 14px;
  letter-spacing: .3px; text-transform: uppercase; line-height: 1 !important;
  border-radius: 14px !important; border: 0 !important; color: #fff !important;
  background: linear-gradient(135deg, #ff3b30, #ff6a3d);
  box-shadow: 0 8px 18px rgba(220,53,69,.22);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  white-space: nowrap;
}
.blog-ad-buy:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(220,53,69,.3); filter: brightness(1.03); }
.blog-ad-buy:active { transform: translateY(0); }

/* ── 23. Responsive — Tablet (≤ 991px) ─────────────────────── */
@media (max-width: 991.98px) {
  .blog-content .blog-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .fixed-ratio-img { height: 180px; }
}

/* ── 24. Responsive — Mobile (≤ 767px) ─────────────────────── */
@media (max-width: 767.98px) {
  .thumbnail-wrapper { width: 100%; aspect-ratio: 16 / 9; }
  .blog-main-img { aspect-ratio: 16 / 9; height: auto; }
  .blog-highlight-item { flex-direction: column; gap: 8px; }
  .card-title, .card-title.truncate-2 { font-size: 1rem; }
  .card-text.truncate-3 { font-size: .875rem; }
  .custom-dropdown .list-group { font-size: .9rem; }
  .post-img { aspect-ratio: 16 / 9; height: auto; border-radius: .5rem .5rem 0 0; }
  .blog-card .row { flex-direction: column; }
  .blog-post-nav { grid-template-columns: 1fr; }
  .blog-ad-card { gap: 12px; padding: 12px; }
  .blog-ad-thumb { width: 96px; height: 96px; }
  .blog-ad-name { -webkit-line-clamp: 2; }
  .blog-ad-bottom { flex-wrap: wrap; }
  .blog-ad-buy { width: 100%; text-align: center; }
  .btn-share { width: 100%; justify-content: center; }
}

/* ── 25. Responsive — Small mobile (≤ 575px) ───────────────── */
@media (max-width: 575.98px) {
  .fixed-ratio-img { height: 155px; }

  /* Product grid: single column, horizontal card layout */
  .blog-content .blog-product-grid { grid-template-columns: 1fr; gap: 10px; margin: 16px auto 24px !important; }
  .blog-content .blog-product-grid.blog-product-grid--two,
  .blog-content .blog-product-grid.blog-product-grid--single {
    max-width: min(var(--reading-width), 100%) !important; grid-template-columns: 1fr;
  }
  .blog-content .blog-product-card {
    display: grid; grid-template-columns: 94px minmax(0, 1fr); border-radius: 10px !important;
  }
  .blog-content .blog-product-media { min-height: 100%; padding: 0; border: 0; }
  .blog-content .blog-product-badge {
    top: 6px; left: 6px; min-height: 18px; max-width: calc(100% - 12px);
    padding: 0 6px; font-size: 8.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .blog-content .blog-product-media img { height: 100% !important; min-height: 90px; }
  .blog-content .blog-product-body { gap: 5px; padding: 9px 10px; }
  .blog-content .blog-product-brand { padding: 2px 7px; font-size: 9px; }
  .blog-content .blog-product-title { min-height: 0; font-size: 13px; line-height: 1.3; }
  .blog-content .blog-product-specs span { min-height: 20px; padding: 1px 6px; font-size: 10px; }
  .blog-content .blog-product-footer { flex-direction: row; gap: 6px; padding-top: 3px; }
  .blog-content .blog-product-price { font-size: 14px; }
  .blog-content .blog-product-cta { min-height: 30px; padding: 0 10px; font-size: 10px; }

  /* Image spacing */
  .blog-content .media-portrait { max-width: 100% !important; margin: 24px auto !important; }
  .blog-content > p + :is(figure,.media-portrait,.responsive-media),
  .blog-content > ul + :is(figure,.media-portrait,.responsive-media) { margin-top: 26px !important; }
  .blog-content > :is(figure,.media-portrait,.responsive-media) + :is(p,ul,ol,blockquote,h2,h3,h4) { margin-top: 22px !important; }
  .blog-content > .media-block + .media-block { margin-top: 10px !important; }

  /* Image table: stack to single column */
  .blog-content table.blog-img-table,
  .blog-content table.blog-img-table tbody,
  .blog-content table.blog-img-table tr { display: block !important; }
  .blog-content table.blog-img-table td { display: block !important; width: 100% !important; padding: 4px 0 !important; }
}

/* ── 26. Tiny screens (≤ 359px) ────────────────────────────── */
@media (max-width: 359.98px) {
  .blog-content .blog-product-card { grid-template-columns: 86px minmax(0, 1fr); }
  .blog-content .blog-product-media img { height: 100% !important; min-height: 82px; }
  .blog-content .blog-product-footer { align-items: flex-start; flex-direction: column; }
  .blog-content .blog-product-cta { width: 100%; }
}

/* ── 27. Print ──────────────────────────────────────────────── */
@media print {
  /* Hide interactive / non-content elements */
  #read-progress, .share-bar, .blog-ad-product,
  .blog-product-cta, .blog-post-nav, .blog-pagination,
  nav, .page-banner .banner-overlay { display: none !important; }

  /* Full-width text, no constrained reading column */
  .blog-content, .blog-content > * { max-width: 100% !important; }
  .blog-content p  { font-size: 11pt !important; line-height: 1.6 !important; color: #000 !important; }
  .blog-content h2 { font-size: 16pt !important; page-break-after: avoid; }
  .blog-content h3 { font-size: 13pt !important; page-break-after: avoid; }
  .blog-content img { max-width: 100% !important; page-break-inside: avoid; }
  /* Print URLs for external links */
  .blog-content a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
  .blog-content a[href^="#"]::after   { content: ""; }
  .page-banner { padding: 1rem 0 !important; }
  .banner-hero-img { position: static !important; }
}

/* ── 28. Prefers-reduced-motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .blog-card,
  .thumbnail-img,
  .btn-share,
  .blog-ad-card,
  .blog-content .blog-product-card,
  .blog-content .blog-product-media img,
  .blog-post-nav-link,
  #toc-container a,
  .blog-ad-buy { transition: none !important; transform: none !important; }
  #read-progress { transition: none; }
  .blog-category-banner { animation: none; }
}
