/* trandinhphat.com — CSS dùng chung
   Học từ: Apple/Stripe (thanh menu dính, dải màu xen kẽ), Linktree (nút kênh to),
   Wirecutter (công bố + "cách chọn"), Notion (lưới ô bento). Giữ bản sắc "bản vẽ QS". */
:root {
  /* Bộ màu anh Phát chọn 06/11: XANH (dương) – ĐỎ – ĐEN. Tên biến giữ như cũ cho khỏi sửa nhiều chỗ:
     --amber = đỏ (nút chính, điểm nhấn) · --navy = đen (dải tối) · --blue = xanh (nhãn, link) */
  --paper: #f3f5f8; --sheet: #ffffff; --ink: #0e1116; --ink-soft: #4b5563;
  --grid: #dde3ec; --amber: #d7262e; --amber-wash: #fdecec; --navy: #0e1116; --on-navy: #f1f3f6;
  --blue: #1f5fd6; --green: #1f8a55; --shopee: #ee4d2d;
  --font-display: "Lexend", "Segoe UI", system-ui, sans-serif;
  --font-body: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius: 14px; --shadow: 0 1px 2px rgb(23 35 58 / .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0d11; --sheet: #151922; --ink: #eef1f5; --ink-soft: #a3adbd; --grid: #262c37;
    --amber: #ff4d55; --amber-wash: #2a1416; --navy: #050608; --on-navy: #eef1f5;
    --blue: #6aa1ff; --green: #5fd09a; --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b0d11; --sheet: #151922; --ink: #eef1f5; --ink-soft: #a3adbd; --grid: #262c37;
  --amber: #ff4d55; --amber-wash: #2a1416; --navy: #050608; --on-navy: #eef1f5;
  --blue: #6aa1ff; --green: #5fd09a; --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.7 var(--font-body); overflow-x: hidden; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.24; }
p { margin: 0; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
img, svg { max-width: 100%; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.band { padding-block: clamp(3.5rem, 8vw, 6rem); }
.band.grid-bg {
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px;
}
.band.dark { background: var(--navy); color: var(--on-navy); }
.band.dark .muted { color: color-mix(in srgb, var(--on-navy) 72%, transparent); }
.band.warm { background: var(--amber-wash); }
.band.white { background: var(--sheet); }

.label { display: inline-block; font: 700 .9rem/1.3 var(--font-body); color: var(--blue); }
.muted { color: var(--ink-soft); }
.sec-head { display: grid; gap: .8rem; margin-bottom: 2.4rem; max-width: 46rem; }
.sec-head h2 { font-weight: 700; font-size: clamp(1.75rem, 4.2vw, 2.7rem); letter-spacing: -.01em; }
.sec-head.center { margin-inline: auto; text-align: center; justify-items: center; }

/* ---------- Thanh menu dính (Apple/Stripe) ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--grid) 70%, transparent);
}
.nav .container { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font: 700 1.05rem/1 var(--font-display); white-space: nowrap; }
.brand .mono { width: 34px; height: 34px; border-radius: 8px; background: var(--amber); color: #fff; display: grid; place-items: center; font: 800 .8rem/1 var(--font-display); letter-spacing: .02em; }

.nav ul { list-style: none; display: flex; gap: .45rem; margin: 0 0 0 auto; padding: 0; }
/* Menu nổi: nút viên thuốc, chữ đậm đen, viền rõ; rê chuột → đỏ; trang hiện tại → nền đỏ */
.nav ul a { display: block; padding: .62rem 1rem; border-radius: 999px; text-decoration: none; color: var(--ink); font: 700 1rem/1 var(--font-body); background: var(--sheet); border: 1.5px solid var(--grid); box-shadow: 0 1px 2px rgb(10 18 32 / .06); transition: color .15s, background .15s, border-color .15s, transform .15s; }
.nav ul a:hover { color: var(--amber); border-color: var(--amber); background: var(--amber-wash); transform: translateY(-1px); }
.nav ul a[aria-current="page"] { color: #fff; background: var(--amber); border-color: var(--amber); }
.nav .cta { margin-left: .4rem; }
.theme-btn { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--grid); background: var(--sheet); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.theme-btn svg { width: 18px; height: 18px; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px;
  padding: .7rem 1.25rem; border-radius: 999px; text-decoration: none; cursor: pointer;
  font: 600 .95rem/1 var(--font-body); border: 1.5px solid transparent; transition: transform .15s, filter .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--amber); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #fff; }
.btn.ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.shopee { background: var(--shopee); color: #fff; border-radius: 8px; }
.btn.shopee:hover { filter: brightness(1.07); }
.btn.small { min-height: 38px; padding: .55rem 1rem; font-size: .88rem; }
.arrow { transition: transform .2s; }
a:hover > .arrow { transform: translateX(3px); }

/* ---------- Dải chữ chạy (Stripe) ---------- */
.ticker { border-block: 1px solid var(--grid); background: var(--sheet); overflow: hidden; }
.ticker-track { display: flex; width: max-content; gap: 2.4rem; padding-block: .9rem; font: 600 .8rem/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.ticker-track span::before { content: "◆"; color: var(--amber); margin-right: 2.4rem; font-size: .6rem; vertical-align: .15em; }

/* ---------- Thẻ ---------- */
.card { background: var(--sheet); border: 1px solid var(--grid); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Chân trang nhiều cột ---------- */
.footer { background: var(--navy); color: var(--on-navy); padding-block: 3.5rem 2rem; font-size: .93rem; }
.footer .cols { display: grid; grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr)); gap: 2rem; }
.footer h4 { margin: 0 0 .9rem; font: 700 .95rem/1.2 var(--font-body); color: var(--blue); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer a { color: var(--on-navy); text-decoration: none; opacity: .85; }
.footer a:hover { opacity: 1; text-decoration: underline; }
.footer .brand { color: var(--on-navy); margin-bottom: 1rem; }
.footer .brand .mono { background: var(--amber); color: #ffffff; }
.brand img.mono { border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 2px var(--amber); }
.footer p { opacity: .75; max-width: 34ch; }
.footer .bottom { margin-top: 2.8rem; padding-top: 1.3rem; border-top: 1px solid rgb(255 255 255 / .12); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem; font: 400 .8rem/1.5 var(--font-mono); opacity: .7; }

/* ---------- Hiện dần khi cuộn ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .3s ease-out, transform .3s ease-out; }
  .js .reveal.in { opacity: 1; transform: none; }
  .ticker-track { animation: slide 38s linear infinite; }
  @keyframes slide { to { transform: translateX(-50%); } }
}

@media (max-width: 860px) {
  /* Di động: menu thành hàng thứ hai cuộn ngang (như sàn TMĐT), không giấu đi */
  .nav .container { flex-wrap: wrap; row-gap: 0; }
  .nav .cta { margin-left: auto; }
  .nav ul { order: 9; flex: 1 0 100%; margin: 0 -.4rem; padding-bottom: .5rem; overflow-x: auto; scrollbar-width: none; }
  .nav ul::-webkit-scrollbar { display: none; }
  .nav ul { margin: 0; padding: .1rem 0 .6rem; }
  .nav ul a { white-space: nowrap; padding: .5rem .85rem; font-size: .92rem; }
  [id] { scroll-margin-top: 110px; }
  .footer .cols { grid-template-columns: 1fr 1fr; }
  .footer .cols > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .brand { font-size: .95rem; gap: .45rem; }
}

/* ---------- Tối ưu tốc độ & truy cập (học từ trang lớn) ---------- */
/* Phần dưới màn hình đầu: trình duyệt bỏ qua vẽ cho tới khi cuộn gần tới */
main > .band { content-visibility: auto; contain-intrinsic-size: auto 900px; }
img { max-width: 100%; height: auto; }
.skip { position: absolute; left: 1rem; top: -100px; z-index: 100; padding: .7rem 1rem; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 600; text-decoration: none; }
.skip:focus { top: .8rem; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

/* ---------- Chốt đơn (học ninhdon.com): một đường tiền rõ, nhắc lại ở mọi điểm dừng ---------- */
/* Thanh dính đáy trên di động: chỉ hiện khi đã cuộn qua phần mở đầu */
.stick-cta { display: none; }
@media (max-width: 860px) {
  .stick-cta { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .8rem .7rem 1.1rem;
    border-radius: 14px; background: var(--navy); color: #fff; text-decoration: none; box-shadow: 0 10px 30px rgb(10 18 32 / .35);
    transform: translateY(140%); transition: transform .3s ease-out; }
  .stick-cta.on { transform: none; }
  .stick-cta b { display: block; font: 700 1rem/1.2 var(--font-display); }
  .stick-cta small { display: block; font-size: .8rem; opacity: .75; }
  .stick-cta .go { flex: none; padding: .6rem 1rem; border-radius: 8px; background: var(--amber); color: #ffffff; font-weight: 700; }
  body:has(.stick-cta) .footer { padding-bottom: 6rem; }
}
/* Hộp tác giả cuối trang (người thật đứng sau lời giới thiệu) */
.author { margin-top: 2.2rem; max-width: 760px; padding: 1.4rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.author .avatar { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--navy); color: var(--amber); font: 800 .95rem/1 var(--font-display); }
.author .who { margin-bottom: .4rem; }
.author p { color: var(--ink-soft); }
.author .who b { color: var(--ink); }
.author .follow { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .6rem; }

/* Mở link thẳng tới một món (#sp-...): làm nổi thẻ đó */
.item { scroll-margin-top: 140px; }
.item:target { outline: 3px solid var(--amber); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { .item:target { animation: ping .3s ease-out 2; } @keyframes ping { 50% { outline-offset: 9px; } } }

/* ---------- Thẻ video + khung YouTube bấm mới nạp (dùng ở mọi trang kênh) ---------- */
.vcard { display: grid; gap: .5rem; text-decoration: none; color: var(--ink); padding: .7rem; align-content: start; }
.vcard .th { position: relative; aspect-ratio: 16/10; border-radius: 8px; overflow: hidden; background: #000; }
.vcard .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .th::after { content: "▶"; position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgb(215 38 46 / .92); color: #fff; font-size: .9rem; padding-left: 3px; }
.vcard b { font: 700 1rem/1.35 var(--font-display); }
.vcard small { font: 400 .76rem/1.3 var(--font-mono); color: var(--ink-soft); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.ylite { position: relative; display: block; width: 100%; max-width: 340px; aspect-ratio: 9/16; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: #000; cursor: pointer; }
.ylite img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.ylite span { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 68px; height: 68px; border-radius: 50%; background: var(--amber); color: #fff; display: grid; place-items: center; font-size: 1.5rem; padding-left: 5px; box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.ylite iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.door { display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; text-decoration: none; color: var(--ink); border-top: 5px solid var(--blue); transition: transform .2s, box-shadow .2s; }
.door:hover { transform: translateY(-3px); }
.door.door-red { border-top-color: var(--amber); }
.door .pic { aspect-ratio: 16/8; background: #000; overflow: hidden; }
.door .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.door .txt { padding: 1.2rem 1.3rem 1.4rem; display: grid; gap: .5rem; }
.door b { font: 800 1.45rem/1.2 var(--font-display); }
.door .who { font-weight: 600; color: var(--blue); font-size: .92rem; }
.door p { color: var(--ink-soft); }
.door .go { margin-top: .3rem; justify-self: start; padding: .6rem 1rem; border-radius: 999px; background: var(--amber); color: #fff; font-weight: 700; font-size: .95rem; }

/* === Học từ vantheweb.com (bản nháp 07/11): tìm kiếm · tác giả · chia sẻ · mục lục · lên đầu trang · theo dõi kênh === */
.search-btn { display: inline-flex; align-items: center; gap: .35rem; height: 38px; padding: 0 .8rem; border-radius: 8px; border: 1px solid var(--grid); background: var(--sheet); color: var(--ink); cursor: pointer; font: 700 .9rem/1 var(--font-body); margin-left: .4rem; }
.search-btn svg { width: 18px; height: 18px; }
.search-btn:hover { border-color: var(--amber); color: var(--amber); }
.tim { position: fixed; inset: 0; z-index: 100; background: rgb(8 10 14 / .55); display: none; padding: 9vh 16px 16px; }
.tim.on { display: block; }
.tim .box { max-width: 640px; margin: 0 auto; background: var(--sheet); border-radius: 14px; box-shadow: 0 20px 60px rgb(0 0 0 / .35); overflow: hidden; }
.tim input { width: 100%; border: 0; border-bottom: 1px solid var(--grid); padding: 1.1rem 1.2rem; font: 600 1.1rem/1.3 var(--font-body); background: transparent; color: var(--ink); outline: none; }
.tim ul { list-style: none; margin: 0; padding: .4rem; max-height: 60vh; overflow-y: auto; }
.tim li a { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: .8rem; align-items: center; padding: .6rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
.tim li a:hover, .tim li a:focus { background: var(--amber-wash); outline: none; }
.tim li img, .tim li .ph { width: 72px; height: 41px; object-fit: cover; border-radius: 8px; background: var(--paper); }
.tim li b { display: block; font: 600 .98rem/1.35 var(--font-body); }
.tim li small { color: var(--ink-soft); font-size: .8rem; }
.tim .hint { padding: .9rem 1.2rem; color: var(--ink-soft); font-size: .9rem; }
.tim .hint button { margin: .35rem .3rem 0 0; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: .35rem .8rem; border-radius: 999px; border: 1.5px solid var(--grid); background: var(--sheet); color: var(--ink); font: 600 .88rem/1 var(--font-body); text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--amber); color: var(--amber); }
.home-search { margin-top: 1rem; display: flex; width: 100%; max-width: 560px; padding: 0; background: var(--sheet); border: 1.5px solid var(--grid); border-radius: 14px; overflow: hidden; cursor: text; font: inherit; }
.home-search:hover { border-color: var(--amber); }
.home-search span { flex: 1; padding: .9rem 1rem; color: var(--ink-soft); font-size: 1rem; text-align: left; }
.home-search b { padding: .9rem 1.2rem; background: var(--amber); color: #fff; font: 700 1rem/1 var(--font-body); display: grid; place-items: center; }
.share { margin-top: 1.4rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .92rem; color: var(--ink-soft); }
.share span { margin-right: .2rem; }
.tac-gia { margin-top: 1.2rem; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 1rem; padding: 1.1rem 1.2rem; align-items: start; }
.tac-gia img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.tac-gia b { display: block; font: 700 1.1rem/1.3 var(--font-display); margin-top: .15rem; }
.tac-gia p { margin-top: .3rem; color: var(--ink-soft); font-size: .93rem; }
.tac-gia a { display: inline-block; margin-top: .4rem; font-weight: 700; color: var(--amber); text-decoration: none; }
.toc { margin: 1.4rem 0 .4rem; padding: 1rem 1.2rem; }
.toc b { font: 700 1rem/1.3 var(--font-display); }
.toc ol { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: 44px; height: 44px; border-radius: 8px; border: 0; background: var(--amber); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 6px 18px rgb(0 0 0 / .25); }
.to-top.on { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 20px; height: 20px; }
body:has(.stick-cta.on) .to-top { bottom: 84px; }
.footer .follow { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem .8rem; font-size: .88rem; }
.footer .follow span { opacity: .7; width: 100%; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem; z-index: 120; }
@media (max-width: 860px) { .search-btn { margin-left: auto; width: 38px; padding: 0; justify-content: center; } .search-btn span { display: none; } }
@media print { .search-btn, .share, .to-top, .tim { display: none !important; } }

@media (max-width: 860px) { .nav .cta ~ .search-btn { margin-left: .4rem; } }
@media (max-width: 480px) { .nav:has(.cta) .brand .full { display: none; } }
@media (max-width: 1180px) { .nav ul a { white-space: nowrap; } .search-btn { width: 38px; padding: 0; justify-content: center; } .search-btn span { display: none; } }
@media (min-width: 861px) and (max-width: 1000px) { .nav:has(.cta) .brand { font-size: 0; gap: 0; } }

/* Người dùng tắt chuyển động: bỏ cuộn mượt, băng chạy, hiệu ứng ping */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; }
  .item:target { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
