/* SaigonGoWhere – giao diện
   Hướng thiết kế: tạp chí du lịch Sài Gòn về đêm. Giấy ấm, mực đậm, xanh ngọc, đỏ đèn lồng.
   Tiêu đề chữ có chân (Fraunces / Noto Serif), chữ thân Be Vietnam Pro (đọc tốt tên tiếng Việt có dấu). */

:root {
  --paper: #f5efe4;
  --paper-2: #ece3d3;
  --surface: #fffaf2;
  --ink: #16201b;
  --ink-soft: #5b6560;
  --line: #ddd2bf;
  --jade: #0e5a43;
  --jade-soft: #dbe8df;
  --lantern: #c8402a;
  --lantern-soft: #f6dfd6;
  --gold: #e7a83e;
  --night: #0d1411;
  --todo: #fff1a8;
  --radius: 18px;
  --display: "Fraunces", "Noto Serif KR", "Noto Serif SC", Georgia, serif;
  --body: "Be Vietnam Pro", "Noto Sans KR", "Noto Sans SC", "Apple SD Gothic Neo", "PingFang SC",
          system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1512;
    --paper-2: #151d19;
    --surface: #18211d;
    --ink: #ece6da;
    --ink-soft: #a4ada7;
    --line: #2a352f;
    --jade: #7fd0ab;
    --jade-soft: #1b2b23;
    --lantern: #ff8a6b;
    --lantern-soft: #3a211b;
    --todo: #5a4c10;
    color-scheme: dark;
  }
}
html[lang="ko"] { --display: "Noto Serif KR", "Fraunces", serif; --body: "Noto Sans KR", "Be Vietnam Pro", "Apple SD Gothic Neo", system-ui, sans-serif; }
html[lang="zh-Hans"] { --display: "Noto Serif SC", "Fraunces", serif; --body: "Noto Sans SC", "Be Vietnam Pro", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
html[lang="ko"] body { word-break: keep-all; overflow-wrap: break-word; }
a { color: var(--jade); }
img { max-width: 100%; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- đầu trang: trong suốt trên ảnh, đổi nền khi cuộn ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 30;
  color: #fff;
  transition: background .35s var(--ease), color .35s var(--ease), box-shadow .35s var(--ease);
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.logo { font-family: "Fraunces", Georgia, serif; font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: inherit; text-decoration: none; }
.logo span { color: var(--gold); font-style: italic; }
.site-header.scrolled .logo span { color: var(--lantern); }
.lang-switch { display: flex; gap: 2px; }
.lang-switch a {
  font-size: 14px; text-decoration: none; color: inherit; opacity: .8;
  padding: 6px 11px; border-radius: 999px; transition: background .2s, opacity .2s;
}
.lang-switch a:hover { opacity: 1; background: rgba(255,255,255,.14); }
.lang-switch a[aria-current] { opacity: 1; font-weight: 700; background: rgba(255,255,255,.18); }
.site-header.scrolled .lang-switch a[aria-current] { background: var(--jade-soft); color: var(--jade); }

/* thanh tiến độ đọc */
.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 40; pointer-events: none; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--lantern)); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- khung ảnh ---------- */
.media { position: relative; display: block; overflow: hidden; background:
  radial-gradient(120% 90% at 20% 10%, #2f6b52 0%, transparent 55%),
  radial-gradient(90% 80% at 85% 90%, #8a3b25 0%, transparent 60%),
  linear-gradient(160deg, #13261e, #1d1410); }
.media-slot { position: absolute; inset: 0; display: block; will-change: transform; }
.media-slot img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transform: scale(1.04); transition: opacity .9s var(--ease), transform 1.4s var(--ease); }
.media.loaded .media-slot img { opacity: 1; transform: none; }
.credit {
  position: absolute; right: 8px; bottom: 6px; z-index: 2; max-width: 80%;
  font: 500 10.5px/1.3 var(--body); color: rgba(255,255,255,.82); text-decoration: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.credit:empty { display: none; }
a.credit:hover { color: #fff; text-decoration: underline; }

/* ---------- ảnh đầu trang (trang chủ, danh sách, bài viết) ---------- */
.page-hero { position: relative; isolation: isolate; color: #fff; display: flex; align-items: flex-end; overflow: hidden; background: var(--night); }
.page-hero .hero-media { position: absolute; inset: 0; z-index: -2; }
.page-hero .hero-media .media-slot { inset: -12% 0 -12% 0; }
.page-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(8,12,10,.55) 0%, rgba(8,12,10,0) 65%),
    linear-gradient(180deg, rgba(8,12,10,.55) 0%, rgba(8,12,10,.12) 32%, rgba(8,12,10,.82) 100%);
}
.page-hero-inner { text-shadow: 0 1px 18px rgba(0,0,0,.45); }
.page-hero-inner { position: relative; width: 100%; padding-top: 120px; padding-bottom: 56px; }
.page-hero h1 {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12;
  margin: 0 0 16px; font-size: clamp(34px, 6vw, 68px); max-width: 16ch; text-wrap: balance;
}
html[lang="ko"] .page-hero h1, html[lang="zh-Hans"] .page-hero h1 { letter-spacing: -0.01em; line-height: 1.25; max-width: 18em; }
.kicker { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.lead { margin: 0; max-width: 620px; font-size: clamp(16px, 2vw, 19px); opacity: .92; }
.hero-count { margin: 18px 0 0; display: inline-block; font-size: 14px; padding: 6px 14px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; }
.hero-credit { right: 14px; bottom: 10px; }

.home-hero { min-height: 100svh; }
.home-hero .page-hero-inner { padding-bottom: 14vh; }
.home-title { font-family: "Fraunces", Georgia, serif !important; font-size: clamp(56px, 13vw, 168px) !important; line-height: .95 !important; max-width: none !important; letter-spacing: -0.04em !important; }
.home-title .w { display: inline-block; }
.home-title .go { color: var(--gold); font-style: italic; padding: 0 .04em; }
.index-hero { min-height: 78svh; }
.article-hero { min-height: 72svh; }
.article-hero .meta { margin: 0; font-size: 14px; opacity: .85; }
.article-hero .crumbs { margin-bottom: 18px; }
.crumbs { font-size: 14px; }
.crumbs a { color: inherit; opacity: .85; text-decoration: none; }
.crumbs a:hover { opacity: 1; text-decoration: underline; }
.crumbs span { margin: 0 6px; opacity: .5; }

.scroll-cue { display: inline-block; margin-top: 40px; width: 26px; height: 42px; border: 2px solid rgba(255,255,255,.7); border-radius: 14px; position: relative; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: #fff; animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* chữ đầu trang trồi lên khi mở trang */
.rise, .home-title .w { opacity: 0; transform: translateY(28px); animation: rise 1s var(--ease) forwards; }
.home-title .w:nth-child(2) { animation-delay: .12s; }
.home-title .w:nth-child(3) { animation-delay: .24s; }
.page-hero .lead.rise { animation-delay: .35s; }
.page-hero .hero-count.rise { animation-delay: .5s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- dải chữ chạy ---------- */
.marquee { overflow: hidden; background: var(--lantern); color: #fff; border-block: 1px solid rgba(0,0,0,.08); }
.marquee-track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee span { font-family: var(--display); font-size: clamp(20px, 3vw, 30px); font-weight: 700; padding: 14px 0; white-space: nowrap; }
.marquee span::after { content: "✦"; font-size: .6em; margin: 0 .9em; color: var(--gold); vertical-align: middle; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- hiện dần khi cuộn ---------- */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- trang chủ ---------- */
.home-main { padding-top: 72px; padding-bottom: 72px; }
.section-title { font-family: var(--display); font-size: clamp(24px, 3.4vw, 36px); margin: 0 0 28px; letter-spacing: -0.01em; }
.lang-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.lang-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 420px; padding: 26px;
  border-radius: var(--radius); overflow: hidden; isolation: isolate; color: #fff; text-decoration: none; justify-content: flex-end;
}
.lang-card .lang-media { position: absolute; inset: 0; z-index: -2; }
.lang-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(8,12,10,.25) 0%, rgba(8,12,10,.1) 30%, rgba(8,12,10,.88)); }
.lang-card { text-shadow: 0 1px 12px rgba(0,0,0,.4); }
.lang-card .media-slot img { transition: opacity .9s var(--ease), transform 1.2s var(--ease); }
.lang-card:hover .media-slot img { transform: scale(1.06); }
.lang-card .credit { top: 10px; bottom: auto; }
.lang-card-name { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.1; }
.lang-card-tag { font-size: 15px; line-height: 1.5; opacity: .92; }
.lang-card-cats { font-size: 13px; opacity: .75; }
.lang-card-count { margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--gold); }

/* ---------- trang danh sách ---------- */
.jump-bar { position: sticky; top: 64px; z-index: 20; background: color-mix(in srgb, var(--paper) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.jump { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 0; }
.jump::-webkit-scrollbar { display: none; }
.jump a {
  flex: none; padding: 7px 15px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: all .2s;
}
.jump a:hover { border-color: var(--lantern); color: var(--lantern); }
.cat { margin: 64px 0; scroll-margin-top: 130px; }
.cat-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.cat-num { font-family: "Fraunces", serif; font-size: 15px; font-weight: 800; color: var(--lantern); }
.cat-head h2 { margin: 0; font-family: var(--display); font-size: clamp(26px, 4vw, 40px); line-height: 1.2; letter-spacing: -0.01em; }
.cat-count { margin-left: auto; font-size: 14px; color: var(--ink-soft); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink);
  transition: opacity .9s var(--ease), transform .9s var(--ease), box-shadow .3s, border-color .3s;
  transition-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * 90ms), 0s, 0s;
}
.card:hover { box-shadow: 0 18px 40px -18px rgba(20, 30, 25, .35); border-color: transparent; }
.card-media { aspect-ratio: 16 / 10; }
.card-media .media-slot img { transition: opacity .9s var(--ease), transform .8s var(--ease); }
.card:hover .card-media .media-slot img { transform: scale(1.06); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 22px; }
.card-num { font-family: "Fraunces", serif; font-size: 14px; font-weight: 800; color: var(--lantern); }
.card-title { font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.4; }
.card-desc {
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- trang bài viết ---------- */
.article-wrap { max-width: 760px; padding-top: 48px; padding-bottom: 64px; }
.article h2 { font-family: var(--display); font-size: clamp(24px, 3.2vw, 30px); line-height: 1.35; margin: 56px 0 14px; letter-spacing: -0.01em; scroll-margin-top: 84px; }
.article h2::before { content: ""; display: block; width: 44px; height: 3px; background: var(--lantern); margin-bottom: 14px; border-radius: 2px; }
.article h3 { font-size: 19px; margin: 32px 0 8px; color: var(--jade); }
.article p { margin: 0 0 1.1em; }
.article > p:first-of-type { font-size: 1.12em; }
.article ul, .article ol { padding-left: 1.3em; }
.article li { margin: 6px 0; }
.article li::marker { color: var(--lantern); }
.article a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0 16px; }
.article hr ~ p { font-size: 13.5px; color: var(--ink-soft); }
.article table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 16px 0; display: block; overflow-x: auto; }
.article th, .article td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.article th, .article td { min-width: 8.5em; overflow-wrap: normal; word-break: keep-all; }
.article td:first-child, .article th:first-child { min-width: 6em; font-weight: 600; }
html[lang="zh-Hans"] .article th, html[lang="zh-Hans"] .article td { word-break: normal; min-width: 6em; }
.article th { background: var(--jade-soft); white-space: nowrap; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px; margin: 0 0 36px; font-size: 15px; }
.toc summary { cursor: pointer; font-weight: 700; padding: 12px 0; color: var(--jade); }
.toc ol { margin: 0 0 14px; padding-left: 1.4em; }
.toc li { margin: 3px 0; }
.toc a { text-decoration: none; color: var(--ink); }
.toc a:hover { color: var(--lantern); }
.other-langs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 40px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px;
}
.other-langs span { color: var(--ink-soft); margin-right: 4px; }
.other-langs a { background: var(--lantern-soft); color: var(--lantern); padding: 4px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; }
.related { margin-top: 56px; }
.related h2 { font-family: var(--display); font-size: 24px; margin: 0 0 18px; }
.related .cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.back { margin: 36px 0 0; font-size: 15px; }
.back a { text-decoration: none; font-weight: 600; }
mark.todo { background: var(--todo); color: inherit; padding: 0 4px; border-radius: 4px; font-size: .9em; }

/* ---------- chân trang ---------- */
.site-footer { background: var(--night); color: #c9cfca; padding: 56px 0 48px; font-size: 14px; }
.site-footer p { margin: 6px 0; }
.site-footer .logo { color: #fff; font-size: 28px; }
.site-footer .logo span { color: var(--gold); }
.footer-langs a { color: #fff; }

/* ---------- điện thoại ---------- */
@media (max-width: 600px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 16px; }
  .logo { font-size: 19px; }
  .lang-switch a { padding: 6px 8px; font-size: 13px; }
  .page-hero-inner { padding-bottom: 40px; }
  .page-hero h1 { max-width: none; }
  .lang-card { min-height: 340px; }
  .cards { grid-template-columns: 1fr; }
  .cat { margin: 48px 0; }
  .article-wrap { padding-top: 36px; }
}

/* người dùng tắt hiệu ứng chuyển động */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise, .home-title .w, .reveal { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .marquee-track, .scroll-cue span { animation: none; }
}
