/* ─────────────────────────────────────────────────────────────────────────
   canhotot.vn — base tokens + reset + utilities
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* light theme */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F3F4F6;
  --ink: #222222;
  --ink-mute: #6A6A6A;
  --ink-soft: #A0A0A0;
  --border: #EBEBEB;
  --border-strong: #DDDDDD;

  /* brand */
  --red: #FD292E;
  --red-deep: #D22226;
  --red-soft: #FFE9E9;
  --navy: #222222;
  --navy-deep: #000000;
  --amber: #B8893A;

  /* typography */
  --font-display: "Be Vietnam Pro", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Be Vietnam Pro", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* scale */
  --container: 1240px;
  --gutter: 24px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  /* density */
  --density-pad-y: 80px;
  --density-card-gap: 24px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0F0F0F;
  --surface: #1A1A1A;
  --surface-2: #222222;
  --ink: #F7F7F7;
  --ink-mute: #A8A8A8;
  --ink-soft: #6F6F6F;
  --border: #2A2A2A;
  --border-strong: #3A3A3A;
  --red-soft: #2A1618;
  color-scheme: dark;
}

[data-density="compact"] {
  --density-pad-y: 56px;
  --density-card-gap: 16px;
}
[data-density="comfy"] {
  --density-pad-y: 112px;
  --density-card-gap: 32px;
}

/* alt font pairs */
[data-fontset="modern"] {
  --font-display: "Sora", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Sora", ui-sans-serif, system-ui, sans-serif;
}
[data-fontset="classic"] {
  --font-display: "Newsreader", "Source Serif 4", Georgia, serif;
  --font-sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--ink); color: var(--bg); }

/* ── layout helpers ─── */
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--density-pad-y) 0; }
.section-tight { padding: calc(var(--density-pad-y) * 0.55) 0; }

.section-eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 12px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 14px;
  text-wrap: balance;
}
.section-title em { font-style: normal; color: var(--red); font-weight: 700; }
.section-sub {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-mute);
  max-width: 56ch;
  margin: 0;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.section-head .link-more {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  white-space: nowrap;
  align-self: flex-end;
}
.section-head .link-more:hover { color: var(--red); border-color: var(--red); }

/* ── buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 44px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-weight: 500; font-size: 14.5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); }
.btn-secondary { background: var(--ink); color: var(--bg); }
.btn-secondary:hover { background: var(--navy-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 15.5px; }

/* ── chips/tags ─── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--ink-mute);
  border-radius: 999px;
}
.chip-solid { background: var(--ink); color: var(--bg); }
.chip-red { background: var(--red); color: #fff; }
.chip-verified { background: rgba(200,146,58,0.12); color: var(--amber); }

/* ── divider ─── */
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ── visually-hidden ─── */
.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── hover lift ─── */
.lift { transition: transform 0.25s cubic-bezier(.2,.7,.3,1); }
.lift:hover { transform: translateY(-3px); }

/* ── focus ─── */
*:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* ── mobile breakpoints ─── */
@media (max-width: 900px) {
  :root { --gutter: 20px; --density-pad-y: 60px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 24px; }
  .section-head .link-more { align-self: flex-start; }
}
/* Mobile — "Xem tất cả" thành nút viền nằm DƯỚI cards (reorder ra khỏi header bằng display:contents + order) */
@media (max-width: 720px) {
  body.home .wrap:has(> .section-head .link-more) { display: flex; flex-direction: column; }
  body.home .wrap:has(> .section-head .link-more) > .section-head { display: contents; }
  body.home .wrap:has(> .section-head .link-more) > .section-head > div:first-child { margin-bottom: 18px; }
  body.home .wrap:has(> .section-head .link-more) .link-more {
    order: 10;                      /* xuống cuối, sau grid cards */
    align-self: center;            /* nút gọn theo nội dung, căn giữa */
    justify-content: center;
    margin-top: 18px;
    padding: 11px 22px;
    border: 1px solid var(--border-strong);  /* override gạch chân → viền nút */
    border-radius: 10px;
  }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; --density-pad-y: 48px; }
  body { font-size: 14.5px; }
}

/* ── prevent body scroll while modal/menu open (iOS-effective) ─── */
/* Phase 16: position:fixed + JS-set top = -scrollY → khoá touch-scroll iOS thật (overflow:hidden không đủ). */
body.no-scroll { overflow: hidden; position: fixed; left: 0; right: 0; width: 100%; }
/* Phase 16: ẩn header (logo + heart + hamburger) khi sheet/modal/menu mở → KHÔNG lòi heart sáng lên trên bottom-sheet lọc. */
body.no-scroll .hdr { display: none !important; }

/* Phase 16 — Smooth chuyển trang.
   Modern (iOS 18.2+ / Chrome mới): crossfade trang cũ ↔ mới qua View Transitions API (không JS).
   Trình duyệt cũ KHÔNG hỗ trợ: fallback fade-in nội dung mỗi trang. Tôn trọng prefers-reduced-motion. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.3s; }
@keyframes chtPageFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  @supports not (view-transition-name: none) {
    body { animation: chtPageFade 0.3s ease-out both; }
  }
}
