/* ========= Base ========= */
:root{
  --container: min(760px, calc(100% - 48px));
  --muted: #6b6b6b;
  --border: #eaeaea;
  --accent: #111;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  color:#222; line-height:1.8; background:#fff;
}
img{max-width:100%;height:auto;display:block}

/* ========= Layout ========= */
.container{width:var(--container);margin:0 auto}
.site-header{padding:28px 0}
.header-inner{display:flex;align-items:center;justify-content:space-between;gap:24px}
.logo a{font-family:'Poppins',system-ui,sans-serif;font-weight:800;font-size:28px;letter-spacing:-0.02em;color:#000;text-decoration:none}
.primary-nav .menu{list-style:none;display:flex;gap:24px;margin:0;padding:0}
.primary-nav a{font-size:14px;color:#666;text-decoration:none}
.primary-nav a:hover{text-decoration:underline}
.site-main{padding:8px 0 40px}
.site-footer{padding:28px 0;color:#777;font-size:12px;border-top:1px solid var(--border)}
.site-footer a{color:inherit}

/* ========= Single ========= */
body.single .post-title{
  font-family:'Poppins',system-ui,sans-serif; font-weight:600;
  font-size:36px; line-height:1.2; margin:8px 0 18px;
}
.featured-image{margin:14px 0 22px}
body.single .entry-content{font-size:18px;line-height:1.8}
body.single .entry-content p{margin:0 0 18px}
body.single .entry-content h2, body.single .entry-content h3{
  font-family:'Poppins',system-ui,sans-serif;margin:24px 0 12px
}
.post-footer{display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--border);padding-top:12px;margin-top:18px}
.post-tags a{font-size:12px;color:var(--muted);margin-right:8px}

/* Single max-width 820px (text zone only) */
body.single .post-title,
body.single .entry-content,
body.single .post-footer,
body.single .comments-area{
  max-width:820px;margin-left:auto;margin-right:auto
}

/* ========= Related Posts (desktop base) ========= */
.related-posts{margin-top:28px}
.related-posts h3{font-family:'Poppins',system-ui,sans-serif;margin-bottom:10px}
.related-grid{display:grid;gap:16px;grid-template-columns:repeat(3,1fr)}
.related-card{display:flex;flex-direction:column}
.related-card .thumb{margin-bottom:10px;border-radius:12px;overflow:hidden}
.related-card .thumb img{width:100%;height:100%;object-fit:cover}
.related-card .title a{font-family:'Poppins',system-ui,sans-serif;font-weight:600;font-size:15px;line-height:1.4;color:#000;text-decoration:none}
.related-card .title a:hover{color:#333}
.related-card .excerpt{font-size:13px;color:#555;margin:6px 0 10px;line-height:1.6}
.related-card .read{font-size:12px;color:#888;text-decoration:none}
.related-card .read:hover{text-decoration:underline}

/* ========= Listing (Home + Category/Archive) ========= */
/* Cho phép khu main không bó cứng container 760px trên listing */
body.home .site-main.container,
body.blog .site-main.container,
body.archive .site-main.container{width:auto;max-width:90%;padding-left:10px;padding-right:10px}

/* Khung listing rộng 820px */
body.home .listing,
body.blog .listing,
body.archive .listing{max-width:820px;margin-left:auto;margin-right:auto;padding:12px 15px 36px}

/* Header của Category đồng bộ chiều rộng */
body.archive .archive-header{max-width:820px;margin:0 auto 16px}
body.archive .archive-title{
  font-family:'Poppins',system-ui,sans-serif;font-weight:800;font-size:28px;line-height:1.2;
  margin:8px 0;word-break:break-word;hyphens:auto
}
.archive-description{color:#666;font-size:14px}

/* Grid 2 cột desktop */
body.home .posts-grid,
body.blog .posts-grid,
body.archive .posts-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:64px 60px;max-width:820px;margin-left:auto;margin-right:auto
}

/* Card */
.grid-card{display:flex;flex-direction:column;margin-bottom:20px;padding-bottom:10px}
.grid-card .thumb{
  position:relative;aspect-ratio:16/9;border-radius:12px;overflow:hidden;display:block;background:#f4f4f4;margin:0 0 12px
}
.grid-card .thumb img{width:100%;height:100%;object-fit:cover;transition:transform .35s ease}
.grid-card:hover .thumb img{transform:scale(1.03)}
.grid-title{margin:6px 0}
.grid-title a{
  font-family:'Poppins',system-ui,sans-serif;font-weight:600;
  font-size:24px;line-height:1.35;color:#0b0b0b;text-decoration:none;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden
}
.grid-title a:hover{text-decoration:underline}
.grid-meta{color:#7a7a7a;font-size:14px;font-style:italic;margin:0 0 10px}
.grid-excerpt{
  font-size:15px;line-height:1.7;color:#444;margin:0 0 10px;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
  min-height:calc(1.7em * 3);max-height:calc(1.7em * 3)
}
.grid-tags a{color:#8a8a8a;font-size:12px;text-decoration:none;margin-right:8px}
.grid-tags a::before{content:'#'}

/* Pagination */
.pagination{display:flex;justify-content:center;margin-top:28px}
.pagination .nav-links{display:flex;gap:8px;align-items:center}
.pagination a,.pagination span{
  padding:6px 10px;border:1px solid var(--border);border-radius:6px;font-size:13px;color:#333;text-decoration:none
}
.pagination .current{background:#111;color:#fff;border-color:#111}

/* ========= Embeds ========= */
.entry-content iframe[src*="youtube.com"],
.entry-content iframe[src*="youtu.be"],
.entry-content iframe[src*="vimeo.com"]{width:100%!important;height:auto!important;aspect-ratio:16/9;display:block}

/* ========= Mobile styles ========= */
@media (max-width:1024px){
  /* Grid 1 cột */
  body.home .posts-grid,
  body.blog .posts-grid,
  body.archive .posts-grid{grid-template-columns:1fr !important;gap:28px !important;max-width:100%!important}

  /* Card spacing */
  .grid-card{margin-bottom:12px;padding-bottom:8px}

  /* Thumb */
  .grid-card .thumb{border-radius:12px;margin-bottom:10px}

  /* Title/Meta/Excerpt nhỏ lại */
  .grid-title a{font-size:22px !important}
  .grid-meta{font-size:13px !important;margin-bottom:8px}
  .grid-excerpt{
    font-size:15px !important;line-height:1.7;color:#444;
    -webkit-line-clamp:2;min-height:calc(1.7em * 2);max-height:calc(1.7em * 2);margin-bottom:8px
  }

  /* Related -> card đơn */
  .related-grid{
  gap:16px !important}
  .related-card{
    background:#fff;
  }
}
@media (max-width:640px){
  .header-inner{gap:12px}
  .primary-nav .menu{gap:14px}
  body.single .post-title{font-size:30px}
}

/* --- MOBILE HAMBURGER --- */
@media (max-width: 991px) {

  /* Để dropdown định vị theo header */
  .site-header .header-inner { position: relative; }

  /* Nút hamburger */
  .hamburger{
    display:inline-block;
    width:36px; height:26px;
    margin-left:auto;            /* đẩy nút sang phải */
    position:relative; cursor:pointer;
  }
  /* 3 gạch (dùng 2 pseudo + 1 bóng để làm gạch giữa) */
  .hamburger::before,
  .hamburger::after{
    content:"";
    position:absolute; left:0; right:0;
    height:2px; background:#111; border-radius:2px;
  }
  .hamburger::before{ top:4px; box-shadow:0 9px 0 #111; } /* gạch trên + giữa */
  .hamburger::after{ bottom:4px; }                         /* gạch dưới */

  /* Ẩn menu mặc định, dùng dạng dropdown */
  .primary-nav{
    position:absolute; top:100%; left:0; right:0;
    background:#fff; border-radius:12px;
    box-shadow:0 10px 24px rgba(0,0,0,.08);
    padding:10px; z-index:999;
    max-height:0; overflow:hidden; opacity:0;
    transition:max-height .25s ease, opacity .2s ease;
  }

  /* Dọc lại các item */
  .primary-nav .menu{
    display:flex; flex-direction:column; gap:8px;
    margin:0; padding:0; list-style:none;
  }
  .primary-nav .menu a{ display:block; padding:10px 8px; }

  /* Khi tick checkbox -> mở menu */
  .nav-toggle:checked ~ .primary-nav{
    max-height:70vh; opacity:1;
  }
}

/* Desktop giữ nguyên menu ngang, ẩn hamburger */
@media (min-width: 992px){
  .nav-toggle, .hamburger{ display:none !important; }
  .primary-nav{ position:static; max-height:none; opacity:1; overflow:visible; box-shadow:none; padding:0; }
  .primary-nav .menu{ display:flex; flex-direction:row; gap:24px; }
}

/* Ảnh trong nội dung bài luôn căn giữa */
.entry-content img,
.entry-content a > img {
  display: block;
  margin: 16px auto;          /* căn giữa */
}

/* Giới hạn bề rộng trang */
.container{
  width: 100%;
  max-width: 820px !important;  /* ép nếu theme đặt lớn hơn */
  margin-left: auto;
  margin-right: auto;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
}

/* Hiện meta nếu theme đang ẩn */
.entry-meta, .post-meta, .grid-meta, .byline, .posted-on {
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6b7280;
}
.post-meta .post-author,
.grid-meta .meta-author { display: inline-flex; align-items: center; gap: 6px; }
.post-meta img.avatar { width: 20px; height: 20px; border-radius: 50%; }
.grid-meta .meta-sep { opacity: .6; }

/* Căn giữa author + date ở single post */
.post-meta{
  display:flex;
  justify-content:center;   /* căn giữa ngang */
  align-items:center;        /* canh giữa dọc */
  gap: 8px;                  /* khoảng cách giữa các phần */
  text-align:center;
  margin: 10px 0 20px;
}

.post-meta .post-author,
.post-meta time{ white-space: nowrap; }

.post-meta .post-sep{ opacity:.5; }

/* Nếu meta ở trang listing dùng .grid-meta thì căn giữa luôn */
.grid-meta{
  text-align:center;
  margin-top: 6px;
}


/* === BlogNews additions === */

/* Global container max width */
.container, .site-main.container, .single.container {
  max-width: 820px;
  margin-inline: auto;
  padding-inline: 10px;
}

/* Grid cards */
.posts-grid, .related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
}

.grid-card .thumb,
.related-card .thumb,
.single .single-thumb .thumb {
  display: block;
  aspect-ratio: 16 / 9;
  background: #ececec;
  border-radius: 12px;
  overflow: hidden;
}
.grid-card .thumb img,
.related-card .thumb img,
.single .single-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Post meta */
.post-meta{
  display:inline-flex;
  align-items:center;
  gap:.6rem;
  color:#6b7280;
  font-size:14px;
}
.meta-centered{
  text-align:center;
}
.meta-centered .post-meta{
  justify-content:center;
}
.post-meta .meta-author::before{
  content:'\01F464';
  margin-right:.35rem;
  opacity:.7;
}

/* Related titles two lines clamp */
.related-card .title{
  margin-top:10px;
  font-size:16px;
  line-height:1.4;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
  min-height: calc(1.4em * 2);
}

/* Sidebar */
.sidebar{
  max-width:820px;
  margin:32px auto;
  padding:0 16px;
}
.sidebar .widget{
  background:#f8f8f8;
  border-radius:12px;
  padding:16px;
  margin-bottom:16px;
}

/* Quill embed: YouTube iframe (.ql-video) responsive, không tràn mobile */
iframe{
  display: block;
  width: 100% !important;   /* ghi đè width="790" */
  max-width: 100%;
  height: auto !important;  /* bỏ height cố định */
  aspect-ratio: 16 / 9;     /* giữ tỉ lệ 16:9 */
  border: 0;
}

/* Nếu có wrapper của block embed, vẫn đảm bảo full width */
.entry-content .wp-block-embed__wrapper iframe {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
}
