/* Responsive images + caption + lightbox + article layout helpers */

/* Figures & captions */
.adv-figure,
figure.wp-caption,
.article-body figure,
.sample-article figure {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0.85rem 0 0.9rem;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
}
.adv-figure img,
.article-body img,
.sample-article img,
.article-body figure img,
.paper-wrap img,
.wp-caption img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  border-radius: 10px;
  margin: 0;
  box-shadow: none;
  object-fit: cover;
  background: transparent;
}
.adv-caption,
figcaption.adv-caption,
figcaption.wp-caption-text,
.wp-caption-text,
.article-body figcaption {
  display: block;
  text-align: center;
  font-style: italic;
  font-size: 15px;
  line-height: 1.45;
  color: #64748b;
  margin: 0.55rem 0 0;
  padding: 0 0.5rem;
}

/* Kill WP fixed widths */
.article-body .wp-caption,
.article-body figure[style],
.sample-article figure[style] {
  width: 100% !important;
  max-width: 100% !important;
}

/* Lightbox */
.adv-lb {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(7, 12, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 3.5rem 4rem;
  box-sizing: border-box;
}
.adv-lb[hidden] { display: none !important; }
body.adv-lb-open { overflow: hidden; }
.adv-lb-stage {
  max-width: min(1100px, 100%);
  max-height: 100%;
  text-align: center;
}
.adv-lb-img {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #0f172a;
}
.adv-lb-cap {
  color: rgba(255, 255, 255, 0.88);
  font-style: italic;
  font-size: 15px;
  margin: 0.75rem 0 0;
  text-align: center;
}
.adv-lb-count {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}
.adv-lb-close,
.adv-lb-prev,
.adv-lb-next {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
  z-index: 2;
}
.adv-lb-close:hover,
.adv-lb-prev:hover,
.adv-lb-next:hover { background: rgba(255, 255, 255, 0.22); }
.adv-lb-close { top: 1rem; right: 1rem; font-size: 1.1rem; }
.adv-lb-prev { left: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 1.8rem; }
.adv-lb-next { right: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 1.8rem; }

@media (max-width: 768px) {
  .adv-lb { padding: 3.5rem 0.65rem 3.5rem; }
  .adv-lb-prev,
  .adv-lb-next { width: 40px; height: 40px; }
  .adv-lb-img { max-height: 70vh; }
  .adv-caption,
  figcaption.wp-caption-text,
  .article-body figcaption { font-size: 15px; }
}

/* Sample product cards (keep gallery feel) */
.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.sample-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.25s, box-shadow 0.25s;
  text-decoration: none;
  color: inherit;
}
.sample-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
}
.sample-card .thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f1f5f9;
}
.sample-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
  box-shadow: none;
  border-radius: 0;
}
.sample-card:hover .thumb img { transform: scale(1.06); }
.sample-card .body { padding: 1rem 1.1rem 1.15rem; flex: 1; display: flex; flex-direction: column; }
.sample-card .tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1d6ef5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.sample-card h3 {
  font-size: 1.02rem;
  line-height: 1.35;
  margin: 0 0 0.4rem;
}
.sample-card p {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 1024px) {
  .sample-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
}
@media (max-width: 560px) {
  .sample-grid { grid-template-columns: 1fr 1fr; gap: 0.55rem; }
  .sample-card h3 { font-size: 0.82rem; }
  .sample-card p { font-size: 0.72rem; -webkit-line-clamp: 2; }
  .sample-card .body { padding: 0.65rem 0.7rem 0.75rem; }
}

/* Article layout with sidebar (quangcaoadv + optional inbackdrop) */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.75rem;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
}
/* Full-bleed product detail: no sidebar column — tràn ngang */
.article-layout.is-fullbleed {
  display: block !important;
  max-width: none !important;
  width: 100% !important;
  grid-template-columns: none !important;
}
.article-layout.is-fullbleed .paper-wrap,
.article-layout.is-fullbleed .article-main {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
}
/* Chỉ giới hạn 1000px khi KHÔNG fullbleed */
.article-layout:not(.is-fullbleed) .paper-wrap,
.article-layout:not(.is-fullbleed) .article-main {
  max-width: 1000px;
  width: 100%;
  margin: 0;
}
.article-main {
  min-width: 0;
}
.article-sidebar {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.side-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 1.1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.side-card h4 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  color: #0f172a;
}
.side-card .side-list a {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  color: #334155;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  line-height: 1.35;
}
.side-card .side-list a:hover { color: #ea580c; }
.side-cta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.side-cta .btn { width: 100%; justify-content: center; }

.article-toc,
#articleToc,
[data-article-toc] {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  margin: 1rem 0 1.5rem;
}
.article-toc strong,
#articleToc strong,
[data-article-toc] strong {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  color: #0f172a;
}
.article-toc a,
#articleToc a,
[data-article-toc] a {
  display: block;
  padding: 0.28rem 0;
  font-size: 0.88rem;
  color: #2563eb;
  line-height: 1.35;
}
.article-toc a:hover,
#articleToc a:hover { text-decoration: underline; }

/* Article content width + font (quangcaoadv override) */
.paper-wrap.is-wide:not(.is-full):not(.is-product-gallery) {
  max-width: 1000px;
}
.paper-wrap.is-full,
.paper-wrap.is-product-gallery {
  max-width: 100% !important;
}
.paper-wrap.is-wide .article-body,
.article-main .article-body {
  font-size: 16px;
  line-height: 1.75;
  color: #334155;
}
.paper-wrap.is-wide .article-body h2 { font-size: 1.35rem; }
.paper-wrap.is-wide .article-body h3 { font-size: 1.12rem; }

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}
.btn-call {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff !important;
  border: 0;
}
.btn-zalo {
  background: #0068ff;
  color: #fff !important;
  border: 0;
}

@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    position: static;
    order: 2;
  }
  .article-main { order: 1; }
}


/* Product pages: no decorative borders / no leftover white gap */
body[data-page="projects"] .paper-wrap,
body[data-page="projects"] .adv-figure,
body[data-page="projects"] .article-body figure,
body[data-page="projects"] .article-body img {
  border: 0 !important;
  box-shadow: none !important;
}
body[data-page="projects"] .adv-figure,
body[data-page="projects"] .article-body figure {
  margin: 0.75rem 0 !important;
  padding: 0 !important;
  background: transparent !important;
}
body[data-page="projects"] .sp-gallery-item { border: 0 !important; }
body[data-page="projects"] .article-layout.is-fullbleed { margin-bottom: 0 !important; }


/* FIX ALL article image whitespace */
.adv-caption:empty, .wp-caption-text:empty, figcaption:empty { display:none!important; height:0!important; margin:0!important; }
