/* Lịch Âm Việt: phong cách tờ lịch bloc treo tường */

.lav {
  --lav-paper: #ffffff;
  --lav-ink: #1e2a4a;
  --lav-red: #c4122f;
  --lav-gold: #a87300;
  --lav-good: #1f7a55;
  --lav-line: #dadfea;
  --lav-wash: #f2f4f9;
  --lav-mute: #5b6582;
  --lav-num: "Barlow Condensed", "Arial Narrow", sans-serif;
  --lav-text: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;

  max-width: 760px;
  margin: 0 auto;
  font-family: var(--lav-text);
  color: var(--lav-ink);
  font-size: 16px;
  line-height: 1.55;
  scroll-margin-top: 16px;
}
.lav *, .lav *::before, .lav *::after { box-sizing: border-box; }
.lav a { color: inherit; }
.lav h2, .lav h3 { letter-spacing: normal; text-transform: none; }
.lav :focus-visible { outline: 2px solid var(--lav-red); outline-offset: 2px; border-radius: 4px; }
.lav-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tab */
.lav-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--lav-line); }
.lav-nav a {
  padding: 8px 14px; text-decoration: none; font-weight: 500; color: var(--lav-mute);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.lav-nav a:hover { color: var(--lav-ink); }
.lav-nav a[aria-current="page"] { color: var(--lav-ink); border-bottom-color: var(--lav-red); }

/* Tờ lịch */
.lav-sheet {
  --sheet-accent: var(--lav-ink);
  background: var(--lav-paper);
  border: 1px solid var(--lav-line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 1px 0 var(--lav-line), 0 10px 24px -18px rgba(30, 42, 74, .55);
  padding: 0 20px 20px;
  text-align: center;
}
.lav-sheet.is-red { --sheet-accent: var(--lav-red); }
/* Mép xé phía trên */
.lav-sheet::before {
  content: ""; display: block; height: 10px; margin: 0 -20px;
  background: radial-gradient(circle at 6px 0, transparent 4px, var(--lav-ink) 4.5px) 0 0 / 12px 10px repeat-x;
}

.lav-sheet__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0 0; }
.lav .lav-sheet__month { margin: 0; font-family: var(--lav-num); font-weight: 600; font-size: 1.35rem; line-height: 1.2; color: var(--sheet-accent); }

.lav-step {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  font-size: 1.6rem; line-height: 1; text-decoration: none; color: var(--lav-mute);
}
.lav-step:hover { background: var(--lav-wash); color: var(--lav-ink); }

.lav-sheet__solar { display: flex; flex-direction: column; align-items: center; padding: 4px 0 12px; }
.lav-sheet__day {
  font-family: var(--lav-num); font-weight: 700; color: var(--sheet-accent);
  font-size: clamp(7rem, 30vw, 11.5rem); line-height: .9; font-variant-numeric: tabular-nums;
}
.lav-sheet__wd { font-weight: 600; font-size: 1.15rem; color: var(--sheet-accent); margin-top: 4px; }
.lav-sheet__fest { margin-top: 6px; font-weight: 500; color: var(--lav-red); }

.lav-sheet__lunar {
  display: grid; grid-template-columns: 1fr 1.3fr 1fr; align-items: end;
  border-top: 2px solid var(--lav-ink); padding-top: 12px;
}
.lav-sheet__lunar > div { display: flex; flex-direction: column; align-items: center; }
.lav-sheet__lunar b { font-family: var(--lav-num); font-weight: 600; font-size: 2rem; line-height: 1.1; }
.lav-sheet__lunar .is-main b { font-size: 3.4rem; }
.lav-sheet__lunar span:last-child { font-size: .95rem; }
.lav-k { font-size: .85rem; color: var(--lav-mute); }

.lav-sheet__verdict { margin: 14px 0 0; font-weight: 600; }
.lav-sheet__verdict.is-good { color: var(--lav-good); }
.lav-sheet__verdict.is-bad { color: var(--lav-mute); }
.lav-sheet__back { margin: 6px 0 0; font-size: .9rem; }
.lav-sheet__back a { color: var(--lav-red); }

/* Thông tin chi tiết */
.lav-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin: 24px 0; }
.lav-facts > div { padding: 12px 0; border-bottom: 1px solid var(--lav-line); }
.lav-facts__wide { grid-column: 1 / -1; }
.lav-facts dt { font-size: .85rem; font-weight: 400; color: var(--lav-mute); margin: 0 0 2px; }
.lav-facts dd { margin: 0; }
.lav-hours { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.lav-hours li { margin: 0; background: var(--lav-wash); border-radius: 4px; padding: 6px 4px; text-align: center; font-size: .85rem; color: var(--lav-mute); }
.lav-hours b { display: block; font-size: 1rem; color: var(--lav-ink); }

/* Form */
.lav-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 24px; }
.lav-jump label { font-weight: 500; margin: 0; }
.lav input[type="date"], .lav input[type="number"], .lav select {
  font: inherit; color: var(--lav-ink); background: var(--lav-paper); width: auto;
  border: 1px solid var(--lav-line); border-radius: 6px; padding: 7px 10px; min-height: 40px; margin: 0;
}
.lav input[type="number"] { width: 6.5em; }
.lav button {
  font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; margin: 0;
  background: var(--lav-ink); color: #fff; border: 0; border-radius: 6px; padding: 8px 16px;
}
.lav button:hover { background: var(--lav-red); }

/* Lịch tháng */
.lav-month__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.lav-month__head > div { text-align: center; }
.lav .lav-month__head h3 { margin: 0; font-family: var(--lav-num); font-weight: 600; font-size: 1.6rem; line-height: 1.15; }
.lav-month__head p { margin: 0; font-size: .9rem; color: var(--lav-mute); }

.lav-grid-wrap { overflow-x: auto; }
.lav .lav-grid { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0; border: 0; }
.lav-grid th { font-size: .85rem; font-weight: 600; color: var(--lav-mute); padding: 6px 0; text-align: center; border: 0; background: none; }
.lav-grid th:first-child { color: var(--lav-red); }
.lav-grid td { padding: 0; border: 1px solid var(--lav-line); vertical-align: top; background: var(--lav-paper); }
.lav-grid td.is-empty { background: var(--lav-wash); }

.lav-cell {
  position: relative; display: flex; flex-direction: column; min-height: 72px; padding: 6px 8px;
  text-decoration: none;
}
.lav-cell:hover { background: var(--lav-wash); }
.lav-cell__d { font-family: var(--lav-num); font-weight: 600; font-size: 1.5rem; line-height: 1; }
.lav-cell__l { font-size: .85rem; color: var(--lav-mute); margin-top: auto; text-align: right; }
.lav-cell__cc { font-size: .72rem; color: var(--lav-mute); text-align: right; }
.lav-cell.is-red .lav-cell__d { color: var(--lav-red); }
.lav-cell.is-moon .lav-cell__l { color: var(--lav-gold); font-weight: 600; }
.lav-cell.is-good::after {
  content: ""; position: absolute; top: 9px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--lav-good);
}
.lav-cell.is-today { box-shadow: inset 0 0 0 2px var(--lav-red); }
.lav-cell.is-selected { background: var(--lav-ink); }
.lav-cell.is-selected:hover { background: var(--lav-ink); }
.lav-cell.is-selected .lav-cell__d,
.lav-cell.is-selected .lav-cell__l,
.lav-cell.is-selected .lav-cell__cc { color: #fff; }
.lav-cell.is-selected.is-good::after { background: #fff; }

.lav-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: .85rem; color: var(--lav-mute); margin: 8px 0 0; }
.lav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lav-good); }
.lav-legend__moon { color: var(--lav-gold); font-weight: 600; margin-left: 12px; }

.lav-fests { margin-top: 28px; }
.lav .lav-fests h3 { font-family: var(--lav-num); font-weight: 600; font-size: 1.4rem; margin: 0 0 8px; }
.lav-fests ul { list-style: none; margin: 0; padding: 0; }
.lav-fests li { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--lav-line); }
.lav-fests li a { font-weight: 600; color: var(--lav-red); text-decoration: none; margin-right: 4px; }
.lav-fests li span { color: var(--lav-mute); font-size: .9rem; margin-right: 6px; }

/* Đổi ngày */
.lav-convert { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.lav-convert form { display: flex; flex-direction: column; gap: 8px; padding: 18px; margin: 0; border: 1px solid var(--lav-line); border-radius: 6px; }
.lav .lav-convert h3 { font-family: var(--lav-num); font-weight: 600; font-size: 1.35rem; margin: 0 0 4px; }
.lav-convert label { font-size: .9rem; font-weight: 500; margin: 0; }
.lav-convert__row { display: flex; gap: 8px; }
.lav-convert__row > div { display: flex; flex-direction: column; gap: 4px; }
.lav-convert button { margin-top: auto; align-self: flex-start; }
.lav-check { display: flex; align-items: center; gap: 6px; }

.lav-result { padding: 14px 18px; margin-bottom: 20px; border-left: 4px solid var(--lav-good); background: var(--lav-wash); border-radius: 0 6px 6px 0; }
.lav-result p { margin: 0 0 4px; }
.lav-result.is-error { border-left-color: var(--lav-red); }
.lav-result a { font-weight: 600; }

/* Màn hình nhỏ */
@media (max-width: 600px) {
  .lav-facts { grid-template-columns: 1fr; }
  .lav-hours { grid-template-columns: repeat(3, 1fr); }
  .lav-convert { grid-template-columns: 1fr; }
  .lav-cell { min-height: 58px; padding: 4px 5px; }
  .lav-cell__d { font-size: 1.2rem; }
  .lav-cell__cc { display: none; }
  .lav-cell.is-good::after { top: 6px; right: 5px; width: 6px; height: 6px; }
  .lav-sheet__lunar .is-main b { font-size: 2.6rem; }
  .lav-sheet__lunar b { font-size: 1.6rem; }
}

/* Đang tải nội dung mới (chỉ mờ đi nếu chờ quá 120ms, tránh nháy) */
.lav { transition: opacity .15s ease; }
.lav[aria-busy="true"] { opacity: .55; transition-delay: .12s; cursor: progress; }
.lav:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  .lav, .lav[aria-busy="true"] { transition: none; }
}
