/* ==========================================================
   Lịch Vạn Sự - giao diện màu cam, cảm hứng tờ lịch bloc
   ========================================================== */
:root {
  --cam: #e8590c;
  --cam-dam: #c2410c;
  --cam-nhat: #fff1e4;
  --cam-vien: #fbd5b5;
  --giay: #fffdf9;
  --nen: #fbf7f2;
  --muc: #3b1405;
  --muc-2: #6b4433;
  --muc-3: #9a7b6c;
  --ngoc: #0f7b5f;
  --ngoc-nhat: #e3f4ee;
  --do: #c81e1e;
  --vang: #e9a400;
  --duong-ke: #efe3d7;
  --bong: 0 1px 0 rgba(59, 20, 5, .04), 0 12px 32px -18px rgba(120, 45, 5, .35);
  --r-lon: 18px;
  --r: 12px;
  --r-nho: 8px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --so: "Oswald", "Be Vietnam Pro", sans-serif;
  --rong: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--muc);
  background: var(--nen);
}
img { max-width: 100%; height: auto; }
a { color: var(--cam-dam); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--cam); }
:focus-visible { outline: 3px solid var(--vang); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--rong); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muc-3); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--muc); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header { background: var(--cam); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 0 var(--cam-dam); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.logo:hover { color: #fff; }
.logo-mark { width: 34px; height: 36px; flex: none; }
.logo small { display: block; font-weight: 500; font-size: .7rem; opacity: .85; margin-top: -3px; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .93rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { background: rgba(255, 255, 255, .18); color: #fff; }
.nav-toggle { display: none; margin-left: auto; background: transparent; border: 2px solid rgba(255,255,255,.6); color: #fff; border-radius: 10px; padding: 6px 10px; font: inherit; font-weight: 700; cursor: pointer; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 62px; background: var(--cam-dam); flex-direction: column; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { border-radius: 10px; padding: 12px; }
}

/* ---------- Breadcrumb ---------- */
.crumbs { font-size: .85rem; color: var(--muc-3); margin: 18px 0 6px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--cam-vien); }
.crumbs a { color: var(--muc-2); text-decoration: none; }
.crumbs a:hover { color: var(--cam); text-decoration: underline; }

/* ---------- Layout ---------- */
main { padding-bottom: 56px; }
.page-head { margin: 8px 0 22px; }
.page-head p { color: var(--muc-2); max-width: 70ch; margin: 0; }
.grid-hero { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 28px; align-items: start; margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-main { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
@media (max-width: 960px) {
  .grid-hero, .grid-main, .grid-2 { grid-template-columns: 1fr; }
}
.panel { background: var(--giay); border: 1px solid var(--duong-ke); border-radius: var(--r-lon); padding: 22px; box-shadow: var(--bong); }
.panel + .panel { margin-top: 22px; }
.panel h2 { display: flex; align-items: center; gap: 10px; }
.panel h2::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--cam); flex: none; }
.section { margin-top: 28px; }

/* ---------- Tờ lịch bloc (điểm nhấn) ---------- */
.bloc { position: relative; filter: drop-shadow(0 18px 24px rgba(120, 45, 5, .18)); }
.bloc-gay {
  height: 30px; background: var(--muc); border-radius: 14px 14px 0 0; position: relative;
  display: flex; justify-content: center; gap: 70px; align-items: center;
}
.bloc-gay span { width: 14px; height: 14px; border-radius: 50%; background: var(--nen); box-shadow: inset 0 2px 3px rgba(0,0,0,.45); }
.bloc-to {
  background: var(--giay); border-radius: 0 0 6px 6px; padding: 18px 22px 22px; text-align: center;
  border-top: 2px dashed var(--duong-ke);
  position: relative;
}
.bloc-to::after { /* các tờ lịch bên dưới */
  content: ""; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 6px;
  background: #f4ebe1; border-radius: 0 0 6px 6px; z-index: -1;
  box-shadow: 0 5px 0 -1px #ecdfd2;
}
.bloc-thang { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--muc-2); font-size: .95rem; }
.bloc-thang a { text-decoration: none; color: var(--muc-2); }
.bloc-so {
  font-family: var(--so); font-weight: 700; font-size: clamp(8rem, 30vw, 11.5rem); line-height: .86;
  color: var(--cam); margin: 6px 0 2px; letter-spacing: -.02em; font-variant-numeric: lining-nums;
}
.bloc.chu-nhat .bloc-so, .bloc.ngay-le .bloc-so { color: var(--do); }
.bloc-thu { font-size: 1.25rem; font-weight: 800; color: var(--muc); }
.bloc-le { display: inline-block; margin-top: 6px; background: var(--do); color: #fff; border-radius: 999px; padding: 2px 12px; font-size: .82rem; font-weight: 600; }
.bloc-am {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; text-align: left;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--duong-ke);
}
.bloc-am-so { font-family: var(--so); font-size: 3.6rem; line-height: 1; color: var(--muc); font-weight: 600; text-align: center; min-width: 76px; }
.bloc-am-so small { display: block; font-family: var(--font); font-size: .78rem; color: var(--muc-3); font-weight: 600; }
.bloc-am dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .9rem; }
.bloc-am dt { color: var(--muc-3); }
.bloc-am dd { margin: 0; font-weight: 700; }
.bloc-nav { display: flex; justify-content: space-between; margin-top: 16px; gap: 10px; }
.bloc-chuyen { animation: lat-to .45s ease-out; transform-origin: top center; }
@keyframes lat-to { from { transform: rotateX(-14deg); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bloc-chuyen { animation: none; } html { scroll-behavior: auto; } }

.badge-hd { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: .85rem; }
.badge-hd.tot { background: var(--ngoc-nhat); color: var(--ngoc); }
.badge-hd.xau { background: #f1eae6; color: var(--muc-2); }

/* ---------- Nút & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: .93rem; cursor: pointer; text-decoration: none;
  border-radius: 999px; padding: 9px 18px; border: 2px solid transparent; transition: background .15s, color .15s;
}
.btn-cam { background: var(--cam); color: #fff; }
.btn-cam:hover { background: var(--cam-dam); color: #fff; }
.btn-vien { background: transparent; border-color: var(--cam-vien); color: var(--cam-dam); }
.btn-vien:hover { background: var(--cam-nhat); color: var(--cam-dam); }
.btn-nho { padding: 5px 12px; font-size: .85rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muc-2); }
.field select, .field input {
  font: inherit; font-size: 1rem; color: var(--muc); background: #fff;
  border: 1.5px solid var(--cam-vien); border-radius: 10px; padding: 9px 12px; min-width: 88px;
}
.field input[type=color] { padding: 4px; height: 44px; min-width: 64px; cursor: pointer; }
.field select:focus, .field input:focus { border-color: var(--cam); outline: none; box-shadow: 0 0 0 3px var(--cam-nhat); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; padding-bottom: 10px; }
.alert { padding: 12px 16px; border-radius: var(--r); background: #fdecec; color: var(--do); font-weight: 600; margin-top: 14px; }

/* ---------- Lưới lịch tháng ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; }
.cal-head .cal-tools { display: flex; gap: 6px; align-items: center; }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal th { font-size: .78rem; font-weight: 700; color: var(--muc-3); padding: 4px 0; }
.cal th:last-child { color: var(--do); }
.cal td { padding: 0; vertical-align: top; }
.cal a.o {
  display: flex; flex-direction: column; justify-content: space-between; height: 100%; min-height: 66px;
  padding: 6px 7px; border-radius: 10px; text-decoration: none; color: var(--muc);
  background: #fff; border: 1px solid var(--duong-ke); position: relative; transition: border-color .12s, background .12s;
}
.cal a.o:hover { border-color: var(--cam); background: var(--cam-nhat); }
.cal .o .dl { font-family: var(--so); font-size: 1.45rem; font-weight: 500; line-height: 1; }
.cal .o .al { font-size: .76rem; color: var(--muc-3); text-align: right; font-weight: 600; }
.cal .o .al.mung1 { color: var(--cam-dam); font-weight: 800; }
.cal .o.cn .dl, .cal .o.le .dl { color: var(--do); }
.cal .o.tot::after { content: ""; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--ngoc); }
.cal .o.ngoai { opacity: .38; }
.cal .o.hom-nay { background: var(--cam); border-color: var(--cam); color: #fff; }
.cal .o.hom-nay .dl, .cal .o.hom-nay .al { color: #fff; }
.cal .o.hom-nay.tot::after { background: #fff; }
.cal .o.chon { outline: 2.5px solid var(--cam); outline-offset: -1px; }
.cal .o .tk { font-size: .66rem; color: var(--ngoc); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muc-3); margin-top: 10px; }
.cal-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.cal-legend .l-tot::before { background: var(--ngoc); }
.cal-legend .l-cn::before { background: var(--do); }
.cal-legend .l-nay::before { background: var(--cam); }
@media (max-width: 520px) {
  .cal { border-spacing: 2px; }
  .cal a.o { min-height: 52px; padding: 4px; border-radius: 8px; }
  .cal .o .dl { font-size: 1.15rem; }
  .cal .o .al { font-size: .68rem; }
  .cal .o .tk { display: none; }
  .cal .o.tot::after { top: auto; bottom: 6px; right: auto; left: 5px; width: 6px; height: 6px; }
  .panel { padding: 16px; }
}
.cal-mini a.o { min-height: 44px; }
.cal-mini .o .dl { font-size: 1.05rem; }
.cal-mini .o .tk { display: none; }

/* ---------- Giờ hoàng đạo ---------- */
.gio { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.gio div { border-radius: 10px; padding: 8px 4px; text-align: center; background: #f6f0ea; color: var(--muc-3); }
.gio div.tot { background: var(--ngoc-nhat); color: var(--ngoc); }
.gio b { display: block; font-size: 1rem; }
.gio small { font-size: .72rem; font-weight: 600; }
@media (max-width: 520px) { .gio { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Bảng thông tin ---------- */
.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td { text-align: left; padding: 10px 0; border-bottom: 1px solid var(--duong-ke); vertical-align: top; font-size: .95rem; }
.kv th { color: var(--muc-3); font-weight: 600; width: 38%; padding-right: 12px; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: .8rem; font-weight: 700; margin: 2px 4px 2px 0; }
.tag.tot { background: var(--ngoc-nhat); color: var(--ngoc); }
.tag.xau { background: #fbe7e7; color: var(--do); }
.tag.bt { background: #f4ece5; color: var(--muc-2); }
.list-sao { list-style: none; padding: 0; margin: 0; }
.list-sao li { padding: 8px 0; border-bottom: 1px dashed var(--duong-ke); }
.list-sao li:last-child { border: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--duong-ke); text-align: left; }
.table thead th { background: var(--cam-nhat); color: var(--cam-dam); font-weight: 700; }
.table tbody tr:hover { background: #fffaf5; }
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--duong-ke); background: #fff; }

/* ---------- Danh sách ngày lễ / ngày tốt ---------- */
.le-list { list-style: none; margin: 0; padding: 0; }
.le-list li { display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--duong-ke); }
.le-list li:last-child { border: 0; }
.le-ngay { text-align: center; border-radius: 10px; background: var(--cam-nhat); color: var(--cam-dam); padding: 4px 0; line-height: 1.1; }
.le-ngay b { display: block; font-family: var(--so); font-size: 1.45rem; font-weight: 600; }
.le-ngay small { font-size: .7rem; font-weight: 700; }
.le-ten { font-weight: 700; }
.le-ten small { display: block; font-weight: 500; color: var(--muc-3); font-size: .82rem; }
.con-lai { font-size: .82rem; font-weight: 700; color: var(--muc-2); white-space: nowrap; }
.con-lai.gan { color: var(--do); }

.day-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.day-card { display: block; text-decoration: none; color: var(--muc); background: #fff; border: 1px solid var(--duong-ke); border-radius: var(--r); padding: 14px 16px; }
.day-card:hover { border-color: var(--cam); color: var(--muc); }
.day-card .dc-top { display: flex; align-items: baseline; gap: 10px; }
.day-card .dc-so { font-family: var(--so); font-size: 2.2rem; color: var(--cam); line-height: 1; }
.day-card .dc-diem { margin-left: auto; font-weight: 800; color: var(--ngoc); }

/* ---------- Năm ---------- */
.year-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.year-months .panel { padding: 16px; margin: 0; }
.year-months h3 a { text-decoration: none; color: var(--muc); }
.year-months h3 a:hover { color: var(--cam); }
.year-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.year-strip a { display: block; text-decoration: none; color: var(--muc); background: #fff; border: 1px solid var(--duong-ke); border-radius: var(--r); padding: 12px 14px; }
.year-strip a:hover { border-color: var(--cam); }
.year-strip a.nay { border: 2px solid var(--cam); background: var(--cam-nhat); }
.year-strip .ys-nam { font-family: var(--so); font-size: 1.7rem; color: var(--cam); line-height: 1.1; }
.year-strip small { display: block; color: var(--muc-3); font-size: .8rem; }

/* ---------- Đếm ngược ---------- */
.dem { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.dem div { min-width: 96px; background: var(--muc); color: #fff; border-radius: var(--r); padding: 14px 10px 10px; text-align: center; }
.dem b { display: block; font-family: var(--so); font-size: 3rem; line-height: 1; color: #ffd8b8; font-weight: 600; }
.dem span { font-size: .85rem; opacity: .85; }

/* ---------- Bài viết ---------- */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.post { background: var(--giay); border: 1px solid var(--duong-ke); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; }
.post h3 a { color: var(--muc); text-decoration: none; }
.post h3 a:hover { color: var(--cam); }
.post p { color: var(--muc-2); font-size: .92rem; flex: 1; }
.post .cat { font-size: .8rem; font-weight: 700; color: var(--cam-dam); text-decoration: none; margin-bottom: 6px; }
.prose { max-width: 72ch; font-size: 1.04rem; line-height: 1.75; }
.prose h2 { margin-top: 1.6em; }
.prose blockquote { margin: 1.2em 0; padding: 14px 20px; background: var(--cam-nhat); border-left: 4px solid var(--cam); border-radius: 0 var(--r) var(--r) 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--duong-ke); padding: 8px 10px; text-align: left; }
.prose th { background: var(--cam-nhat); }

/* ---------- Widget builder ---------- */
.w-builder { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
@media (max-width: 960px) { .w-builder { grid-template-columns: 1fr; } }
.w-types { display: grid; gap: 8px; }
.w-type { display: flex; gap: 10px; align-items: flex-start; text-align: left; font: inherit; background: #fff; border: 1.5px solid var(--duong-ke); border-radius: var(--r); padding: 12px; cursor: pointer; color: var(--muc); }
.w-type[aria-pressed="true"] { border-color: var(--cam); background: var(--cam-nhat); }
.w-type b { display: block; }
.w-type small { color: var(--muc-3); }
.w-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.w-swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--duong-ke); cursor: pointer; }
.w-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--muc); }
.w-preview { background: repeating-conic-gradient(#f6efe8 0 25%, #fbf7f2 0 50%) 0 0 / 22px 22px; border-radius: var(--r-lon); padding: 28px; display: flex; justify-content: center; min-height: 340px; border: 1px solid var(--duong-ke); }
.w-preview iframe { border: 0; max-width: 100%; background: transparent; }
.code { position: relative; margin-top: 14px; }
.code textarea { width: 100%; min-height: 130px; padding-top: 52px !important; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: #fde7d4; background: var(--muc); border: 0; border-radius: var(--r); padding: 14px; resize: vertical; }
.code .btn { position: absolute; right: 10px; top: 10px; }
.tabs { display: flex; gap: 6px; margin-top: 18px; }
.tabs button { font: inherit; font-weight: 700; font-size: .88rem; border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--muc-2); }
.tabs button[aria-selected="true"] { background: var(--cam-nhat); color: var(--cam-dam); }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; text-align: center; padding: 7px 12px; border-radius: 10px; text-decoration: none; border: 1px solid var(--duong-ke); background: #fff; color: var(--muc); font-weight: 600; }
.pager .active { background: var(--cam); border-color: var(--cam); color: #fff; }
.pager .disabled { opacity: .4; }

/* ---------- Footer ---------- */
.site-footer { background: var(--muc); color: #e8d6cb; padding: 40px 0 24px; font-size: .92rem; }
.site-footer a { color: #ffd8b8; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.foot-grid h3 { color: #fff; font-size: 1rem; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: #bfa597; font-size: .85rem; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }

/* Quick links trên trang chủ */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 28px; }
.quick a { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--muc); background: var(--giay); border: 1px solid var(--duong-ke); border-radius: var(--r); padding: 14px; font-weight: 700; }
.quick a:hover { border-color: var(--cam); color: var(--cam-dam); }
.quick svg { width: 30px; height: 30px; flex: none; color: var(--cam); }
.quick small { display: block; font-weight: 500; color: var(--muc-3); font-size: .8rem; }
@media (max-width: 960px) { .quick { grid-template-columns: 1fr 1fr; } }

@media print {
  .site-header, .site-footer, .bloc-nav, .quick, .no-print { display: none !important; }
  body { background: #fff; }
}

/* Vị trí quảng cáo */
.ad-slot { margin: 18px 0; text-align: center; overflow: hidden; }
.ad-slot.ad-top { margin-top: 16px; }
aside .ad-slot { margin: 0 0 22px; }
