/* =========================================================================
   Web Trong Ngày — Blog / Cẩm nang website & landing page
   Bổ sung cho styles.css (dùng chung design token trong :root).
   Load SAU styles.css. Thuần CSS, không phụ thuộc JS để hiển thị nội dung.
   ========================================================================= */

/* ---------- Khung trang bài viết ---------- */
.blog-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.blog-body > main { flex: 1; }
.article-wrap { max-width: 768px; margin-inline: auto; }
.article-wrap,
.article-wrap * { min-width: 0; }

/* ---------- Breadcrumb ---------- */
.crumbs { padding-block: 18px 0; }
.crumbs__list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.crumbs__list a { color: var(--muted); }
.crumbs__list a:hover { color: var(--primary); }
.crumbs__sep { color: var(--line); }
.crumbs__cur { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Article hero ---------- */
.article-hero { padding-block: clamp(22px, 4vw, 40px) clamp(20px, 3vw, 30px); }
.article-hero__cat {
  display: inline-block; font-family: var(--font-body); font-weight: 700;
  font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary); padding: 5px 12px; background: var(--surface-2);
  border-radius: var(--r-pill); margin-bottom: 16px;
}
.article-hero h1 {
  font-size: clamp(1.7rem, 5.2vw, 2.6rem); line-height: 1.14; letter-spacing: 0;
  max-width: 18ch; overflow-wrap: anywhere;
}
.article-wrap > .article-hero h1 { max-width: none; }
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  margin-top: 18px; color: var(--muted); font-size: .92rem;
}
.article-meta__item { display: inline-flex; align-items: center; gap: 6px; }
.article-meta__item .ico { width: 16px; height: 16px; color: var(--primary); }
.article-meta__author { font-weight: 600; color: var(--ink); }

/* ---------- Legal pages ---------- */
.legal-page {
  background: linear-gradient(180deg, #F7F9FF 0, #FFFFFF 440px);
}
.legal-container { max-width: 980px; }
.legal-article {
  max-width: 860px;
  margin-inline: auto;
  padding-bottom: clamp(44px, 8vw, 76px);
}
.legal-hero {
  padding-block: 34px 26px;
  border-bottom: 1px solid var(--line);
}
.legal-hero h1 {
  max-width: none;
  font-size: 2.55rem;
  line-height: 1.12;
  letter-spacing: 0;
}
.legal-hero .article-meta__item {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.legal-content {
  margin-top: 28px;
  padding: clamp(24px, 5vw, 42px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  color: #21304E;
  font-size: 1.03rem;
  line-height: 1.75;
}
.legal-content > p:first-child {
  margin-bottom: 28px;
  padding: 18px 20px;
  border-left: 4px solid var(--primary);
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #EEF3FF 0, #FFFFFF 58%, #FFF4EA 100%);
  color: var(--ink);
  font-size: 1.08rem;
}
.legal-content h2 {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.32rem;
  line-height: 1.28;
  letter-spacing: 0;
  scroll-margin-top: 84px;
}
.legal-content h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.legal-content h2 + p,
.legal-content p + p,
.legal-content ul + p,
.legal-content ol + p {
  margin-top: 12px;
}
.legal-content strong {
  color: var(--ink);
  font-weight: 800;
}
.legal-content a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(30, 91, 255, .28);
}
.legal-content a:hover {
  color: var(--primary-dark);
  text-decoration-color: currentColor;
}
.legal-content ul,
.legal-content ol {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-left: 0;
}
.legal-content li {
  position: relative;
  padding-left: 34px;
}
.legal-content ul li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: .68em;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--grad-orange);
}
.legal-content ol {
  counter-reset: legal-step;
}
.legal-content ol li {
  counter-increment: legal-step;
}
.legal-content ol li::before {
  content: counter(legal-step);
  position: absolute;
  left: 0;
  top: .13em;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
}

/* ---------- Ảnh bìa / ảnh trong bài (tự ẩn nếu thiếu file) ---------- */
figure.article-cover, figure.article-figure { margin: 0 0 4px; }
.article-cover img, .article-figure img {
  width: 100%; height: auto; border-radius: var(--r-lg);
  box-shadow: var(--shadow); background: var(--surface-2);
}
.article-cover { margin-bottom: clamp(20px, 3vw, 30px); }
.article-figure { margin-block: clamp(20px, 3vw, 30px); }
figcaption { margin-top: 10px; font-size: .85rem; color: var(--muted); text-align: center; }

/* ---------- Mục lục (TOC) ---------- */
.toc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px; margin-block: 8px 30px;
}
.toc__title {
  font-family: var(--font-display); font-weight: 800; font-size: .95rem;
  color: var(--ink); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.toc__title .ico { width: 18px; height: 18px; color: var(--primary); }
.toc__list { display: grid; gap: 7px; counter-reset: toc; }
.toc__list a {
  display: block; color: var(--muted); font-size: .95rem; line-height: 1.4;
  padding-left: 26px; position: relative; overflow-wrap: anywhere;
}
.toc__list a::before {
  counter-increment: toc; content: counter(toc, decimal-leading-zero);
  position: absolute; left: 0; top: 0; font-weight: 700; font-size: .8rem;
  color: var(--primary); font-family: var(--font-display);
}
.toc__list a:hover { color: var(--primary); }

/* ---------- Hộp "Tóm tắt nhanh" ---------- */
.takeaways {
  background: var(--grad-tint); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: var(--r); padding: 20px 22px; margin-block: 4px 32px;
}
.takeaways__title {
  font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--ink);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.takeaways__title .ico { width: 19px; height: 19px; color: var(--accent); }
.takeaways ul { display: grid; gap: 9px; }
.takeaways li { position: relative; padding-left: 26px; color: var(--ink); font-size: .98rem; line-height: 1.5; }
.takeaways li::before {
  content: ""; position: absolute; left: 4px; top: 9px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
}

/* ---------- Prose: kiểu chữ nội dung bài ---------- */
.prose { font-size: 1.075rem; line-height: 1.75; color: #21304E; overflow-wrap: anywhere; }
.prose > p { margin-bottom: 1.15em; }
.prose h2 {
  font-size: clamp(1.35rem, 3.6vw, 1.7rem); line-height: 1.25; color: var(--ink);
  margin-top: 1.7em; margin-bottom: .55em; scroll-margin-top: 84px;
}
.prose h3 {
  font-size: clamp(1.1rem, 2.6vw, 1.28rem); color: var(--ink);
  margin-top: 1.4em; margin-bottom: .45em;
}
.prose a { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; text-decoration-color: var(--primary-soft); }
.prose a:hover { color: var(--primary-dark); text-decoration-color: var(--primary-dark); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose ul.prose-list, .prose ol.prose-list { display: grid; gap: 10px; margin-block: 1em 1.3em; padding-left: 4px; }
.prose ul.prose-list li { position: relative; padding-left: 28px; }
.prose ul.prose-list li::before {
  content: ""; position: absolute; left: 4px; top: .62em; width: 9px; height: 9px;
  border-radius: 3px; background: var(--grad-orange);
}
.prose ol.prose-list { counter-reset: li; }
.prose ol.prose-list li { position: relative; padding-left: 36px; counter-increment: li; }
.prose ol.prose-list li::before {
  content: counter(li); position: absolute; left: 0; top: -.05em;
  width: 24px; height: 24px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--primary); border-radius: 8px;
  font-family: var(--font-display); font-weight: 800; font-size: .82rem;
}
.prose blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--accent);
  font-family: var(--font-display); font-weight: 600; font-size: 1.18rem;
  line-height: 1.45; color: var(--ink);
}
.prose-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-block: 1.2em 1.5em;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.prose-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: .98rem;
  line-height: 1.55;
}
.prose-table th,
.prose-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.prose-table th {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  background: var(--surface-2);
}
.prose-table tr:last-child td { border-bottom: 0; }
.prose-note {
  margin-block: 1.4em;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r);
  background: linear-gradient(135deg, #FFF7EF 0, #FFFFFF 54%, #EEF3FF 100%);
}
.prose-note h3 {
  margin-top: 0;
  margin-bottom: 10px;
}
.prose-note ul {
  display: grid;
  gap: 9px;
  margin: 0;
}
.prose-note li {
  position: relative;
  padding-left: 24px;
  color: var(--ink);
  font-size: .98rem;
  line-height: 1.55;
}
.prose-note li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: .68em;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--grad-orange);
}

/* Hộp mẹo / lưu ý trong bài */
.callout {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; margin-block: 1.4em;
}
.callout__icon { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--primary); display: grid; place-items: center; }
.callout__icon .ico { width: 19px; height: 19px; }
.callout p { margin: 0; font-size: .98rem; color: var(--ink); }

/* ---------- FAQ trong bài (accordion thuần CSS) ---------- */
.article-faq { margin-block: clamp(34px, 5vw, 52px) 0; }
.article-faq__h { font-size: clamp(1.35rem, 3.6vw, 1.7rem); margin-bottom: 18px; }
.faq-item { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; background: #fff; overflow: hidden; }
.faq-item > summary {
  list-style: none; cursor: pointer; padding: 16px 20px; font-family: var(--font-display);
  font-weight: 700; color: var(--ink); display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: ""; flex: none; width: 20px; height: 20px; transition: transform .25s var(--ease);
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E5BFF' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.faq-item[open] > summary::after { transform: rotate(180deg); }
.faq-item__a { padding: 0 20px 16px; color: #21304E; line-height: 1.7; }
.faq-item__a p { margin: 0; }

/* ---------- Khối CTA cuối bài ---------- */
.article-cta {
  margin-block: clamp(40px, 6vw, 64px) 0; padding: clamp(28px, 4vw, 40px);
  background: var(--grad-blue); border-radius: var(--r-xl); color: #fff;
  text-align: center; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.article-cta::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 140% at 0% 0%, rgba(255,122,26,.35), transparent 55%); }
.article-cta > * { position: relative; }
.article-cta h2 { color: #fff; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.2; }
.article-cta p { margin-top: 12px; color: #DCE6FF; font-size: 1.05rem; max-width: 46ch; margin-inline: auto; }
.article-cta__actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.article-cta .btn--white { color: var(--primary-dark); }
.article-cta__call { display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 16px 26px; border-radius: var(--r-pill); font-family: var(--font-display); font-weight: 700; color: #fff; border: 2px solid rgba(255,255,255,.5); }
.article-cta__call:hover { background: rgba(255,255,255,.12); }
.article-cta__call .ico { width: 20px; height: 20px; }

/* ---------- Bài viết liên quan ---------- */
.related { margin-block: clamp(40px, 6vw, 64px) 0; }
.related__h { font-size: clamp(1.3rem, 3.4vw, 1.6rem); margin-bottom: 22px; text-align: center; }

/* ---------- Lưới thẻ bài viết (index + liên quan) ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(18px, 2.4vw, 26px); }
.related .post-grid { grid-template-columns: repeat(3, 1fr); }
.post-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card__media {
  position: relative; aspect-ratio: 16 / 10; display: block;
  background: var(--grad-blueorange);
}
.post-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-card__media-cat {
  position: absolute; left: 12px; bottom: 12px; z-index: 1;
  font-family: var(--font-display); font-weight: 700; font-size: .82rem; color: #fff;
  background: rgba(13,27,62,.42); backdrop-filter: blur(4px);
  padding: 5px 11px; border-radius: var(--r-pill);
}
.post-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card__title { font-size: 1.08rem; line-height: 1.3; overflow-wrap: anywhere; }
.post-card__title a:hover { color: var(--primary); }
.post-card__excerpt { color: var(--muted); font-size: .93rem; line-height: 1.55; flex: 1; }
.post-card__meta { color: var(--muted); font-size: .82rem; margin-top: 4px; }

/* ---------- Trang index blog ---------- */
.blog-hero { padding-block: clamp(34px, 6vw, 64px) clamp(20px, 3vw, 32px); text-align: center; }
.blog-hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.1; }
.blog-hero p { margin: 16px auto 0; max-width: 56ch; color: var(--muted); font-size: 1.1rem; }
.cat-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-block: 30px 36px; }
.cat-filter__btn {
  font-family: var(--font-display); font-weight: 600; font-size: .9rem;
  padding: 9px 18px; border-radius: var(--r-pill); border: 1px solid var(--line);
  color: var(--muted); background: #fff; transition: all .18s var(--ease);
}
.cat-filter__btn:hover { border-color: var(--primary-soft); color: var(--primary); }
.cat-filter__btn.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.blog-grid-wrap {
  min-height: clamp(520px, 54vh, 680px);
  padding-bottom: var(--section-y);
}
.post-card.is-hidden { display: none; }

/* ---------- Reveal an toàn (chỉ ẩn khi có JS) ---------- */
html.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
html.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) { .post-grid, .related .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .post-grid, .related .post-grid { grid-template-columns: 1fr; }
  .prose { font-size: 1.04rem; }
  .legal-hero { padding-block: 24px 20px; }
  .legal-hero h1 { font-size: 2rem; }
  .legal-content {
    margin-top: 22px;
    padding: 20px;
    border-radius: var(--r);
    font-size: 1rem;
  }
  .legal-content > p:first-child {
    padding: 16px;
    font-size: 1.02rem;
  }
  .legal-content h2 {
    margin-top: 24px;
    padding-top: 22px;
    font-size: 1.18rem;
  }
  .legal-content li { padding-left: 30px; }
  .article-cta__actions { flex-direction: column; }
  .article-cta__actions .btn, .article-cta__call { width: 100%; }
}
