/* ============================================================
   SAVINA · GIAO DIỆN GIÁNG SINH (NOEL) 2026
   ------------------------------------------------------------
   Tệp theme Noel tự chứa, chỉ bật khi <html> có
   data-savina-season... không, data-savina-noel="on".
   Thuộc tính này do noel.js (và đoạn boot inline trong <head>)
   đặt theo lựa chọn đã lưu trong localStorage (mặc định: BẬT).

   NGUYÊN TẮC:
   · Không đổi nội dung, URL, title/meta/canonical — chỉ trang trí.
   · Không đụng ::before/::after của .card/.term/.step (savina-season.css
     đã dùng cho tuyết/cành mai/mạng nhện) — thẻ chỉ đổi viền trên.
   · Không dùng nền xanh navy. Nền giữ tông cà phê sữa, điểm Noel
     bằng đỏ ấm + xanh thông + vàng gold.
   · Mọi lớp phủ đều pointer-events:none, không bắt chuột, không
     che nội dung. Tắt hẳn khi in giấy hoặc khi người đọc xin
     giảm chuyển động (prefers-reduced-motion).
   · Gỡ theme: chỉ cần bỏ 2 thẻ include (noel.css + noel.js) và
     đoạn boot inline — trang về y nguyên giao diện thường.
   ============================================================ */

:root {
  --noel-banner-h: 40px;          /* chiều cao dải banner Noel trên cùng */
  --noel-red: #a63a2e;            /* đỏ ấm */
  --noel-pine: #1e4d2b;           /* xanh thông */
  --noel-pine-deep: #14301c;
  --noel-gold: #b7791f;           /* caramel / gold */
  --noel-gold-soft: #c9a227;
  --noel-gold-pale: #e8c468;
  --noel-latte: #f3e9d7;          /* nền cà phê sữa */
}

/* Dải sọc kẹo Noel: đỏ – xanh thông – vàng gold. Dùng chung. */
:root {
  --noel-stripe: repeating-linear-gradient(
    90deg,
    var(--noel-red) 0 28px,
    var(--noel-pine) 28px 56px,
    var(--noel-gold) 56px 84px
  );
}

/* ============================================================
   NÚT CHUYỂN GIAO DIỆN — luôn hiển thị, cả khi Noel đang tắt
   (đây chính là lối quay lại giao diện Noel).
   ============================================================ */
.noel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font: 700 13px/1 "Roboto", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(62, 39, 35, .18);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.noel-toggle:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(62, 39, 35, .24); }
.noel-toggle:active { transform: translateY(0); }
.noel-toggle:focus-visible { outline: 3px solid var(--noel-gold-soft); outline-offset: 2px; }
.noel-toggle .noel-toggle-ico { font-size: 15px; line-height: 1; }

/* Noel đang TẮT: nút mời bật Noel — vàng caramel chuyển sắc. */
.noel-toggle[data-state="off"] { background: linear-gradient(135deg, #c98a1e, #b7791f); color: #fff; }
/* Noel đang BẬT: nút chỉ đường về giao diện thường — đỏ ấm chuyển sắc. */
.noel-toggle[data-state="on"] { background: linear-gradient(135deg, #b0402f, #8c2f24); color: #fff; }
.noel-toggle { box-shadow: 0 6px 18px rgba(62, 39, 35, .20), inset 0 1px 0 rgba(255, 255, 255, .28); }

/* Nút nổi góc trái dưới — chỉ desktop (mobile đã có thanh điều
   hướng dưới cùng, không chen thêm nút nổi). Đặt cao hơn viên
   "Quản trị" mờ ở góc trái dưới (bottom:14px) để không chồng. */
.noel-toggle-float {
  position: fixed;
  left: 24px;
  bottom: 64px;
  z-index: 45;
}
@media (max-width: 800px) {
  .noel-toggle-float { display: none; }
}
/* Màn hẹp: nút trong header thu lại thành vòng tròn chỉ còn icon,
   cho vừa hàng nút EN / tìm kiếm / menu. */
@media (max-width: 800px) {
  .noel-toggle { padding: 0; width: 40px; height: 40px; justify-content: center; }
  .noel-toggle .noel-toggle-txt { display: none; }
  .noel-toggle .noel-toggle-ico { font-size: 18px; }
}

/* ============================================================
   DẢI BANNER NOEL — chỉ tồn tại khi Noel bật (noel.js chèn).
   ============================================================ */
.noel-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  height: var(--noel-banner-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  background: linear-gradient(90deg, var(--noel-pine-deep), var(--noel-pine) 50%, var(--noel-pine-deep));
  border-bottom: 1px solid rgba(232, 196, 104, .45);
  color: var(--noel-gold-pale);
  font: 700 13px/1.2 "Roboto", system-ui, sans-serif;
  letter-spacing: .4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.noel-banner .noel-banner-main { color: #fff; }
@media (max-width: 640px) {
  .noel-banner { font-size: 12.5px; }
  .noel-banner .noel-banner-sub { display: none; }
}

/* ============================================================
   KHI NOEL BẬT — mọi thay đổi giao diện nằm trong khối này.
   ============================================================ */

/* 1. Nhường chỗ cho banner cố định trên cùng. Quy tắc này đúng
   cho cả 2 kiểu nav của trang: nav fixed (trang chủ) và nav
   sticky (thư viện, bài viết) — vì cả hai đều dính theo top. */
html[data-savina-noel="on"] body {
  padding-top: var(--noel-banner-h);
  background: var(--noel-latte); /* nền cà phê sữa, ấm hơn nền kem gốc */
}
html[data-savina-noel="on"] .nav { top: var(--noel-banner-h); }
html[data-savina-noel="on"] .savina-scroll-progress { top: var(--noel-banner-h); }
html[data-savina-noel="on"] { scroll-padding-top: calc(96px + var(--noel-banner-h)); }
@media (max-width: 640px) {
  html[data-savina-noel="on"] { scroll-padding-top: calc(62px + var(--noel-banner-h)); }
}
/* Các khối sticky khác phải lùi xuống theo banner, không thì
   sẽ chui xuống dưới nav khi cuộn. */
html[data-savina-noel="on"] .toc { top: calc(95px + var(--noel-banner-h)); }
html[data-savina-noel="on"] #knowledge .knowledge > div:first-child { top: calc(110px + var(--noel-banner-h)); }

/* 2. Sọc kẹo Noel dưới mép nav — thay cho đường kẻ 1px thường. */
html[data-savina-noel="on"] .nav::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--noel-stripe);
  pointer-events: none;
}

/* 2b. Dây đèn vàng ấm treo ngay dưới nav — đi theo nav khi cuộn,
   thấy trên mọi trang (nav fixed ở trang chủ, sticky ở các trang
   còn lại). Dây treo là vệt sẫm mảnh, bóng có quầng sáng ấm,
   nhấp nháy nhẹ nhàng. */
html[data-savina-noel="on"] .nav::after {
  content: "";
  position: absolute;
  top: 100%; left: 0; right: 0;
  height: 30px;
  z-index: 3;
  pointer-events: none;
  background-image:
    linear-gradient(to bottom, transparent 0, transparent 4px, rgba(12, 26, 17, .7) 4px, rgba(12, 26, 17, .7) 5px, transparent 5px),
    radial-gradient(circle at 18px 15px, #fff8d6 0 2px, #ffcf6e 3px, rgba(255, 190, 80, .45) 6px, transparent 10px),
    radial-gradient(circle at 54px 19px, #fff3c4 0 2px, #ffd98a 3px, rgba(255, 205, 110, .4) 6px, transparent 9px);
  background-size: 100% 30px, 72px 30px, 72px 30px;
  background-repeat: no-repeat, repeat-x, repeat-x;
  animation: noelTwinkle 3s ease-in-out infinite;
}
@keyframes noelTwinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* 3. Thẻ bài / thẻ từ / bước quy trình: viền trên vàng gold.
   (Không dùng ::before/::after ở đây — savina-season.css đã giữ.) */
html[data-savina-noel="on"] .card,
html[data-savina-noel="on"] .term,
html[data-savina-noel="on"] .step { border-top: 3px solid var(--noel-gold); }

/* 4. Sọc kẹo Noel trên đầu các khối lớn: chân trang, khối tối,
   khối AI, đầu bài viết, khối đăng ký nhận tin. */
html[data-savina-noel="on"] .site-footer,
html[data-savina-noel="on"] .dict-footer,
html[data-savina-noel="on"] .section.dark,
html[data-savina-noel="on"] .article-head,
html[data-savina-noel="on"] .newsletter { position: relative; }
html[data-savina-noel="on"] .site-footer::before,
html[data-savina-noel="on"] .dict-footer::before,
html[data-savina-noel="on"] .section.dark::before,
html[data-savina-noel="on"] .article-head::before,
html[data-savina-noel="on"] .newsletter::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: var(--noel-stripe);
  pointer-events: none;
}
/* Khối AI bo tròn + overflow:hidden nên sọc tự ôm theo bo góc. */
html[data-savina-noel="on"] .ai { position: relative; }
html[data-savina-noel="on"] .ai::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: var(--noel-stripe);
  pointer-events: none;
}

/* 5. Nhãn kicker / eyebrow: thêm bông tuyết nhỏ phía trước. */
html[data-savina-noel="on"] .kicker::before,
html[data-savina-noel="on"] .eyebrow::before { content: "❄ "; }

/* 5b. HERO — lời chúc Noel + huy hiệu Noel.
   Eyebrow thành huy hiệu pill (nền thông mờ, viền vàng gold),
   thêm lời chúc sau tên thương hiệu. */
html[data-savina-noel="on"] .hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid rgba(232, 196, 104, .65);
  border-radius: 999px;
  background: rgba(20, 48, 28, .55);
  color: #f3d98b;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}
html[data-savina-noel="on"] .hero .eyebrow::after {
  content: "· Merry Christmas 2026";
  color: var(--noel-gold-pale);
}
@media (max-width: 640px) {
  html[data-savina-noel="on"] .hero .eyebrow { padding: 7px 13px; letter-spacing: 2px; }
  html[data-savina-noel="on"] .hero .eyebrow::after { content: "· Noel 2026"; }
}

/* 6. Tiêu đề khối tối: gạch chân vàng gold mảnh dưới tiêu đề. */
html[data-savina-noel="on"] .section.dark .title,
html[data-savina-noel="on"] .ai h2 {
  text-decoration: underline;
  text-decoration-color: var(--noel-gold-soft);
  text-decoration-thickness: 3px;
  text-underline-offset: 10px;
}

/* ============================================================
   TÔN TRỌNG NGƯỜI ĐỌC: giảm chuyển động + in giấy.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .noel-toggle { transition: none; }
  html[data-savina-noel="on"] .nav::after { animation: none; opacity: 1; }
}
@media print {
.noel-banner, .noel-toggle, .noel-toggle-float { display: none !important; }
  html[data-savina-noel="on"] body { padding-top: 0; background: #fff; }
  html[data-savina-noel="on"] .nav { top: 0; }
  html[data-savina-noel="on"] .nav::before,
  html[data-savina-noel="on"] .nav::after,
  html[data-savina-noel="on"] .site-footer::before,
  html[data-savina-noel="on"] .dict-footer::before,
  html[data-savina-noel="on"] .section.dark::before,
  html[data-savina-noel="on"] .article-head::before,
  html[data-savina-noel="on"] .newsletter::before,
  html[data-savina-noel="on"] .ai::before { background-image: none !important; }
}
