/* ==========================================================
   Thạch Ký 石記 — chất liệu: đá, mực, giấy dó, son triện
   ========================================================== */

:root {
  --muc: #23262B;          /* Mực thác bản */
  --giay: #DCD5C3;         /* Giấy dó */
  --giay-sang: #E7E1D2;    /* Giấy dó, mặt thẻ */
  --da: #5E6B6E;           /* Đá xanh Thanh Hóa (đường kẻ, chi tiết lớn) */
  --da-chu: #4A5558;       /* Đá xanh đậm hơn cho chữ nhỏ, đạt AA trên nền giấy */
  --son: #A8322D;          /* Son triện */
  --nhu: #9C7C38;          /* Nhũ vàng hoành phi */

  --bg: var(--giay);
  --surface: var(--giay-sang);
  --text: var(--muc);
  --muted: var(--da-chu);
  --line: rgba(35, 38, 43, .18);
  --accent: var(--son);
  --accent-text: var(--son);
  --ink-panel: var(--muc);
  --ink-text: #EAE4D6;
  --seal-text: #F3EDE0;

  --font-vi: "Literata", "Noto Serif", Georgia, serif;
  --font-han: "Nom Na Tong", "Noto Serif TC", "Noto Serif CJK TC", "Songti TC", "PMingLiU", serif;

  --wrap: 1180px;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(35,38,43,.06), 0 10px 30px -18px rgba(35,38,43,.45);

  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2  0 0 0 0 .18  0 0 0 0 .14  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .06' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .25  0 0 0 0 .22  0 0 0 0 .17  0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #23262B;
    --surface: #2A2E34;
    --text: #DCD5C3;
    --muted: #A9B2B1;
    --line: rgba(220, 213, 195, .16);
    --accent: #C8463F;
    --accent-text: #E5756C;
    --ink-panel: #16181B;
    --ink-text: #E4DDCC;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 14px 34px -18px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

/* ---------- Nền & chữ ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-vi);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--fiber), var(--paper-noise);
  background-blend-mode: multiply;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (prefers-color-scheme: dark) {
  body { background-image: var(--paper-noise); background-blend-mode: soft-light; }
}
body.no-scroll { overflow: hidden; }
main { flex: 1; outline: none; }
img { max-width: 100%; display: block; }
a { color: var(--accent-text); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.005em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
.han { font-family: var(--font-han); font-weight: 400; }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.eyebrow {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .6rem; font-weight: 500;
}
.muted { color: var(--muted); }
.small { font-size: .9rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--muc); color: var(--giay); padding: .6rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* ---------- Triện (logo) ---------- */
.seal {
  --s: 46px;
  width: var(--s); height: var(--s);
  background: var(--accent);
  color: var(--seal-text);
  border-radius: 3px;
  display: inline-grid;
  grid-template-columns: 1fr;
  place-items: center;
  font-family: var(--font-han);
  line-height: 1;
  padding: 4px 0;
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3.5px rgba(243,237,224,.85);
  flex: none;
  position: relative;
}
.seal span { font-size: calc(var(--s) * .38); }
.seal::after { /* mép son loang */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--paper-noise); mix-blend-mode: screen; opacity: .35; pointer-events: none;
}
.seal--sm { --s: 40px; }
.seal--xs { --s: 26px; padding: 2px 0; box-shadow: none; }
.seal--lg { --s: 92px; }

/* ---------- Đầu trang ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 66px; }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); text-decoration: none; }
.brand__name { font-size: 1.3rem; font-weight: 600; letter-spacing: .01em; }
.site-nav { display: flex; align-items: center; gap: .25rem; }
.site-nav a, .nav-map {
  color: var(--text); text-decoration: none; font: inherit; font-size: .98rem;
  padding: .45rem .75rem; border-radius: var(--radius); background: none; border: 0; cursor: pointer;
}
.site-nav a:hover, .nav-map:hover { background: var(--line); }
.site-nav a[aria-current="page"] { color: var(--accent-text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-map { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); }
@media (max-width: 640px) {
  .site-nav a[data-nav="home"], .site-nav a[data-nav="gioi-thieu"] { display: none; }
  .brand__name { font-size: 1.15rem; }
}

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font: inherit; font-size: 1rem; font-weight: 500;
  padding: .75rem 1.2rem; border-radius: var(--radius);
  border: 1px solid var(--text); background: transparent; color: var(--text);
  text-decoration: none; cursor: pointer; transition: background .15s, color .15s;
}
.btn:hover { background: var(--text); color: var(--bg); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--seal-text); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, black); border-color: transparent; color: var(--seal-text); }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 1px solid var(--line); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--line); }

/* ---------- Huy hiệu ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  padding: .2rem .55rem; border-radius: 2px; white-space: nowrap;
  border: 1px solid currentColor;
}
.badge--bvqg { color: var(--nhu); background: color-mix(in srgb, var(--nhu) 10%, transparent); }
@media (prefers-color-scheme: dark) { .badge--bvqg { color: #CDAA5E; } }
.badge--status { color: var(--muted); }
.badge--draft { color: var(--accent-text); }

/* ==========================================================
   TRANG CHỦ
   ========================================================== */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero__title { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.1rem; }
.hero__title h1 { margin: 0; font-size: clamp(2.6rem, 6vw, 4.4rem); letter-spacing: -.02em; }
.hero__title .han { font-size: .55em; color: var(--muted); font-weight: 400; margin-left: .25em; }
.hero__lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); max-width: 34em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }
.hero__note { margin-top: 1.4rem; font-size: .9rem; color: var(--muted); }

/* khối câu nổi bật: tờ thác bản */
.rubbing {
  position: relative;
  background: var(--ink-panel);
  color: var(--ink-text);
  border-radius: 2px;
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}
.rubbing::before { /* vân mực rập không đều */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 70% at 20% 10%, rgba(255,255,255,.05), transparent 60%),
    radial-gradient(90% 60% at 85% 90%, rgba(0,0,0,.35), transparent 60%),
    var(--paper-noise);
  opacity: .9; mix-blend-mode: screen;
}
.rubbing__label { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(234,228,214,.7); margin: 0 0 1rem; }
.rubbing__seal { position: absolute; top: 1.2rem; right: 1.2rem; }
.rubbing__vertical {
  writing-mode: vertical-rl;
  font-family: var(--font-han);
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.5;
  letter-spacing: .12em;
  height: 9.2em;
  margin: 0 auto 1.2rem;
  text-shadow: 0 0 1px rgba(234,228,214,.4);
}
.rubbing__pa { font-style: italic; margin: 0 0 .3rem; color: rgba(234,228,214,.88); }
.rubbing__dich { font-size: 1.15rem; margin: 0 0 1rem; }
.rubbing__foot { border-top: 1px solid rgba(234,228,214,.18); padding-top: .8rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .88rem; }
.rubbing a { color: #F0A49D; }

.section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section__head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section__head p { max-width: 40em; margin: 0; }

/* lưới thẻ địa điểm */
.place-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem; }
.place-card {
  position: relative;
  display: grid; grid-template-columns: 150px 1fr; gap: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.place-card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.place-card__media { aspect-ratio: 3/4; border-radius: 2px; overflow: hidden; background: var(--ink-panel); }
.place-card__media img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.75) contrast(1.02); }
.place-card__media svg { width: 100%; height: 100%; }
.place-card__body { display: flex; flex-direction: column; }
.place-card__body h3 { margin-bottom: .2rem; font-size: 1.3rem; }
.place-card__han { font-family: var(--font-han); color: var(--muted); font-size: .95rem; margin-bottom: .6rem; }
.place-card__meta { font-size: .88rem; color: var(--muted); margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.place-card__more { color: var(--accent-text); font-weight: 500; }
@media (max-width: 860px) { .place-grid { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .place-card { grid-template-columns: 104px 1fr; } }

/* "Mỗi tấm bia có gì" */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.feature { padding: 1.4rem 1.4rem 1.2rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature__no { font-family: var(--font-han); color: var(--accent-text); font-size: 1.5rem; line-height: 1; display: block; margin-bottom: .6rem; }
.feature h3 { font-size: 1.08rem; margin-bottom: .35rem; }
.feature p { font-size: .95rem; color: var(--muted); margin: 0; }
@media (max-width: 860px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .features { grid-template-columns: 1fr; } }

/* bản đồ thu nhỏ CTA */
.map-cta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center;
  background: var(--ink-panel); color: var(--ink-text); border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.8rem); box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.map-cta h2 { color: var(--ink-text); }
.map-cta p { color: rgba(234,228,214,.85); }
.map-cta .eyebrow { color: rgba(234,228,214,.7); }
.map-cta__art { justify-self: center; width: min(100%, 300px); }
.map-cta__art svg { width: 100%; height: auto; }
.map-cta .btn--primary { background: #C8463F; border-color: #C8463F; }
@media (max-width: 760px) { .map-cta { grid-template-columns: 1fr; } .map-cta__art { order: -1; width: 180px; } }

/* bảng trạng thái nguồn */
.principles { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.cite-sample {
  font-size: .95rem; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); padding: 1rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0;
}
.cite-sample dt { font-weight: 600; float: left; clear: left; margin-right: .4rem; }
.cite-sample dd { margin: 0 0 .25rem; }
.status-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.status-list li { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.status-list strong { font-weight: 600; }
.status-list code { font-size: .8rem; color: var(--muted); display: block; }
.status-list .no-publish { color: var(--accent-text); font-weight: 600; }
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .status-list li { grid-template-columns: 1fr; gap: .2rem; } }

/* lộ trình */
.roadmap { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; counter-reset: phase; }
.roadmap li { position: relative; padding: 2.2rem 1rem 0 0; border-top: 2px solid var(--line); }
.roadmap li::before {
  counter-increment: phase; content: counter(phase, decimal);
  position: absolute; top: -.85rem; left: 0;
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  background: var(--bg); border: 2px solid var(--da); border-radius: 50%; font-size: .8rem; font-weight: 600;
}
.roadmap li:first-child::before { content: "0"; counter-increment: none; }
.roadmap li.is-current { border-top-color: var(--accent); }
.roadmap li.is-current::before { border-color: var(--accent); background: var(--accent); color: var(--seal-text); }
.roadmap h3 { font-size: 1rem; margin-bottom: .2rem; }
.roadmap .dur { font-size: .82rem; color: var(--muted); display: block; margin-bottom: .4rem; }
.roadmap p { font-size: .92rem; margin: 0; }
@media (max-width: 860px) {
  .roadmap { grid-template-columns: 1fr; }
  .roadmap li { border-top: 0; border-left: 2px solid var(--line); padding: 0 0 1.4rem 1.6rem; }
  .roadmap li::before { top: 0; left: -.9rem; }
  .roadmap li.is-current { border-left-color: var(--accent); }
}

/* ==========================================================
   TRANG ĐỊA ĐIỂM
   ========================================================== */
.crumbs { font-size: .9rem; color: var(--muted); padding: 1.3rem 0 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: .4rem; }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--text); }

.place-hero { padding: 1.4rem 0 2.5rem; }
.place-hero__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.place-hero__title { display: flex; gap: 1.2rem; align-items: flex-start; }
.place-hero__han {
  writing-mode: vertical-rl; font-family: var(--font-han); font-size: 1.6rem; color: var(--accent-text);
  letter-spacing: .1em; line-height: 1; border-left: 1px solid var(--line); padding-left: .8rem; flex: none;
}
.place-hero__loc { color: var(--muted); font-size: .95rem; margin-bottom: 1.2rem; }
.place-hero__badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.place-hero__figure { margin: 0; }
.place-hero__figure img, .place-hero__figure .placeholder-art {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow);
}
.place-hero__figure figcaption { font-size: .82rem; color: var(--muted); margin-top: .5rem; }
.placeholder-art { background: var(--ink-panel); display: grid; place-items: center; position: relative; overflow: hidden; }
.placeholder-art svg { width: 58%; height: auto; }
.placeholder-art__note { position: absolute; bottom: .8rem; left: 1rem; right: 1rem; color: rgba(234,228,214,.75); font-size: .82rem; text-align: center; }
@media (max-width: 860px) { .place-hero__grid { grid-template-columns: 1fr; } .place-hero__figure { order: -1; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin: 1.6rem 0; }
.stat { padding: .9rem .8rem .9rem 0; }
.stat + .stat { border-left: 1px solid var(--line); padding-left: 1rem; }
.stat__no { display: block; font-size: 1.45rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat__label { font-size: .85rem; color: var(--muted); }
@media (max-width: 460px) { .stat__no { font-size: 1.15rem; } }

.info-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; font-size: .95rem; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; }
.info-list .pending { color: var(--muted); font-style: italic; }

.place-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
@media (max-width: 960px) { .place-layout { grid-template-columns: 1fr; } }

.stele-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.stele-item a {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 1.1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1.1rem .9rem .9rem; color: var(--text); text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.stele-item a:hover { border-color: var(--accent); transform: translateX(3px); }
.stele-item a.is-hot { border-color: var(--accent); }
.stele-item__art { width: 84px; height: 108px; background: var(--ink-panel); border-radius: 2px; display: grid; place-items: center; }
.stele-item__art svg { width: 80%; height: auto; }
.stele-item h3 { margin: 0 0 .2rem; font-size: 1.12rem; }
.stele-item__meta { font-size: .88rem; color: var(--muted); margin: 0 0 .45rem; }
.stele-item__tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.stele-item__go { color: var(--accent-text); font-size: 1.4rem; }
.stele-item__no { font-size: .78rem; color: var(--muted); letter-spacing: .1em; }

.site-map-card { position: sticky; top: 86px; }
.mini-map { height: 360px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mini-map__note { font-size: .82rem; color: var(--muted); margin-top: .5rem; }

/* ==========================================================
   TRANG BIA
   ========================================================== */
.stele-head { padding: 1.2rem 0 2rem; border-bottom: 1px solid var(--line); }
.stele-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); max-width: 26em; }
.stele-head__han { font-family: var(--font-han); font-size: 1.25rem; color: var(--muted); margin-bottom: .8rem; letter-spacing: .06em; }
.stele-head__meta { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; color: var(--muted); font-size: .97rem; }
.stele-head__meta > span:not(.badge) + span:not(.badge)::before { content: "·"; margin-right: 1.2rem; }

.reader { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: clamp(1.5rem, 4vw, 3rem); padding: 2.2rem 0 1rem; align-items: start; }
.ink-panel {
  position: sticky; top: 86px;
  background: var(--ink-panel); color: var(--ink-text);
  border-radius: 2px; box-shadow: var(--shadow);
  padding: 1.6rem 1.4rem 1.2rem;
  min-height: 420px;
  display: flex; flex-direction: column;
  overflow: hidden; isolation: isolate;
}
.ink-panel::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(100% 60% at 30% 0%, rgba(255,255,255,.06), transparent 60%),
    radial-gradient(80% 50% at 80% 100%, rgba(0,0,0,.4), transparent 60%),
    var(--paper-noise);
  mix-blend-mode: screen; opacity: .9;
}
.ink-panel__label { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(234,228,214,.65); margin: 0 0 1rem; display: flex; justify-content: space-between; }
.ink-panel__text {
  writing-mode: vertical-rl;
  font-family: var(--font-han);
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  line-height: 1.75;
  letter-spacing: .14em;
  height: 12.5em;
  max-height: 60vh;
  margin: 0 auto;
  overflow-x: auto;
}
.ink-panel__text .seg {
  cursor: pointer; border-radius: 2px; padding: .15em 0;
  transition: background .2s, box-shadow .2s;
}
.ink-panel__text .seg:hover { background: rgba(234,228,214,.08); }
.ink-panel__text .seg.is-active { box-shadow: 0 0 0 2px #C8463F; background: rgba(200,70,63,.14); }
.ink-panel__text--title { color: rgba(234,228,214,.55); }
.ink-panel__foot { margin-top: auto; padding-top: 1rem; font-size: .8rem; color: rgba(234,228,214,.6); border-top: 1px solid rgba(234,228,214,.14); }

/* "rập mực": hiệu ứng chủ động duy nhất */
@keyframes rap-muc {
  from { opacity: 0; filter: blur(4px); clip-path: inset(0 0 0 100%); }
  60% { opacity: 1; }
  to { opacity: 1; filter: blur(0); clip-path: inset(0 0 0 0); }
}
.ink-panel__text.reveal { animation: rap-muc 1.6s cubic-bezier(.3,.6,.2,1) both; }

.reader > * { min-width: 0; }
.reader__tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 1.2rem; overflow-x: auto; }
.reader__tabs button {
  font: inherit; font-size: .95rem; background: none; border: 0; color: var(--muted);
  padding: .65rem 1rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.reader__tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.reader__tabs button[data-view="nguyen-van"] { display: none; }

.seg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.seg-row {
  display: grid; grid-template-columns: 2rem 1fr; gap: .5rem;
  padding: .9rem 1rem .9rem .6rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; transition: border-color .2s, background .2s;
}
.seg-row:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.seg-row.is-active { border-color: var(--accent); background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.seg-row__no { font-size: .8rem; color: var(--accent-text); font-weight: 600; padding-top: .3rem; text-align: right; }
.seg-han { display: none; font-family: var(--font-han); font-size: 1.5rem; letter-spacing: .08em; margin-bottom: .3rem; }
.seg-pa { font-style: italic; color: var(--muted); margin: 0 0 .3rem; font-size: 1.02rem; }
.seg-dich { margin: 0 0 .5rem; font-size: 1.15rem; }
.notes { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.note-chip {
  font: inherit; font-size: .84rem; border: 1px dashed var(--da); background: transparent; color: var(--text);
  border-radius: 99px; padding: .15rem .65rem; cursor: pointer;
}
.note-chip .han { margin-right: .25rem; }
.note-chip[aria-expanded="true"] { border-style: solid; border-color: var(--accent); color: var(--accent-text); }
.note-body { font-size: .92rem; background: var(--surface); border-left: 2px solid var(--accent); padding: .5rem .8rem; margin-top: .5rem; }

.reader[data-view="phien-am"] .seg-dich { display: none; }
.reader[data-view="dich-nghia"] .seg-pa { display: none; }

@media (max-width: 1023px) {
  .reader { grid-template-columns: minmax(0, 1fr); padding-top: 1.4rem; }
  .reader__text { order: -1; }
  .reader__tabs button[data-view="nguyen-van"] { display: inline-block; }
  .ink-panel { position: static; min-height: 0; }
  .reader:not([data-view="nguyen-van"]) .ink-panel { display: none; }
  .reader[data-view="nguyen-van"] .seg-list,
  .reader[data-view="nguyen-van"] .source-box { display: none; }
  .reader[data-view="song-song"] .seg-han { display: block; }
  .reader[data-view="nguyen-van"] .reader__text { order: 0; }
  .ink-panel__text { height: 11em; }
}

.source-box {
  margin-top: 1.6rem; font-size: .92rem;
  border-top: 1px solid var(--line); padding-top: 1rem;
}
.source-box h3 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.source-box dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.source-box dt { color: var(--muted); }
.source-box dd { margin: 0; }
.source-box .todo { color: var(--accent-text); font-style: italic; }
.editor-note {
  font-size: .9rem; margin-top: 1rem; padding: .7rem 1rem;
  border: 1px dashed var(--accent); border-radius: var(--radius); color: var(--text);
}
.editor-note strong { color: var(--accent-text); }

/* bia chưa có bản dịch */
.pending-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow);
}
.pending-card h2 { font-size: 1.3rem; }
.pending-card ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.pending-card li { margin-bottom: .35rem; }
.pipeline { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .4rem; counter-reset: step; }
.pipeline li { display: flex; gap: .7rem; align-items: center; font-size: .93rem; color: var(--muted); }
.pipeline li::before {
  counter-increment: step; content: counter(step);
  width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--da); font-size: .75rem; font-weight: 600;
}
.pipeline li.current { color: var(--text); }
.pipeline li.current::before { border-color: var(--accent); background: var(--accent); color: var(--seal-text); }
.pipeline li.done { color: var(--text); }
.pipeline li.done::before { content: "✓"; background: var(--da); border-color: var(--da); color: var(--bg); }

.stele-sections { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); padding: 2rem 0 3rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.stele-sections h2 { font-size: 1.35rem; }
@media (max-width: 860px) { .stele-sections { grid-template-columns: 1fr; } }

.photo-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin-top: .6rem; }
.photo-slot {
  aspect-ratio: 3/4; border: 1.5px dashed var(--da); border-radius: var(--radius);
  display: grid; place-items: center; text-align: center; padding: .5rem;
  font-size: .82rem; color: var(--muted);
}
.photo-slot strong { display: block; color: var(--text); font-size: .9rem; margin-bottom: .2rem; }
@media (max-width: 520px) { .photo-slots { grid-template-columns: repeat(2, 1fr); } }

.callout { border-left: 3px solid var(--nhu); background: color-mix(in srgb, var(--nhu) 8%, transparent); padding: .8rem 1rem; font-size: .95rem; border-radius: 0 var(--radius) var(--radius) 0; }

.pager { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0 3rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); max-width: 48%; }
.pager a span { font-size: .8rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.pager a strong { font-weight: 600; color: var(--accent-text); }
.pager a.next { text-align: right; margin-left: auto; }

/* ==========================================================
   NÚT & HỘP THOẠI BẢN ĐỒ
   ========================================================== */
.map-fab {
  position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem); z-index: 50;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent); color: var(--seal-text);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 28px -8px rgba(35,38,43,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; font: inherit; transition: transform .2s ease;
}
.map-fab:hover { transform: scale(1.06) rotate(-3deg); }
.map-fab__label { font-size: .68rem; font-weight: 600; letter-spacing: .06em; }
.map-fab::after { /* vòng sóng nhẹ gợi ý bấm */
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--accent);
  animation: ping 2.6s ease-out infinite; pointer-events: none;
}
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(1.45); opacity: 0; } }

.map-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: clamp(0rem, 3vw, 2rem); }
.map-modal[hidden] { display: none; }
.map-modal__backdrop { position: absolute; inset: 0; background: rgba(23,25,28,.62); backdrop-filter: blur(3px); }
.map-modal__panel {
  position: relative; width: min(1180px, 100%); height: min(820px, 100%);
  background: var(--bg); background-image: var(--paper-noise);
  border-radius: 6px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in .28s ease both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.map-modal__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); }
.map-modal__head h2 { margin: 0; font-size: 1.4rem; }
.map-modal__head .eyebrow { margin-bottom: .1rem; }
.map-modal__body { flex: 1; display: grid; grid-template-columns: 1fr 320px; min-height: 0; }
.map-modal__map { min-height: 0; }
.map-modal__list { list-style: none; margin: 0; padding: .6rem; overflow-y: auto; border-left: 1px solid var(--line); }
.map-modal__list button {
  width: 100%; text-align: left; font: inherit; color: var(--text); background: none; cursor: pointer;
  display: grid; grid-template-columns: 38px 1fr; gap: .8rem; align-items: center;
  padding: .75rem; border-radius: var(--radius); border: 1px solid transparent;
}
.map-modal__list button:hover, .map-modal__list button.is-hot { background: var(--surface); border-color: var(--accent); }
.map-modal__list .seal { --s: 38px; padding: 0; box-shadow: none; }
.map-modal__list .seal span { font-size: 20px; }
.map-modal__list strong { display: block; font-weight: 600; line-height: 1.3; }
.map-modal__list small { color: var(--muted); font-size: .84rem; line-height: 1.35; display: block; }
.map-fallback { display: grid; place-items: center; height: 100%; padding: 2rem; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .map-modal__panel { border-radius: 0; height: 100%; }
  .map-modal__body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .map-modal__list { border-left: 0; border-top: 1px solid var(--line); display: flex; gap: .5rem; overflow-x: auto; overflow-y: hidden; padding: .6rem; }
  .map-modal__list li { flex: 0 0 240px; }
}

/* ---------- Leaflet: hoà vào giấy dó ---------- */
.leaflet-container { font-family: var(--font-vi); background: #CFC8B6; }
.leaflet-tile-pane { filter: sepia(.38) saturate(.62) contrast(.96) brightness(1.01); }
@media (prefers-color-scheme: dark) {
  .leaflet-container { background: #1d2024; }
  .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) sepia(.25) saturate(.5) brightness(.95) contrast(.9); }
}
.leaflet-control-attribution { font-size: 10px; }

.seal-marker { background: none; border: 0; }
.seal-marker__pin {
  width: 40px; height: 40px; border-radius: 3px;
  background: var(--accent); color: var(--seal-text);
  display: grid; place-items: center;
  font-family: var(--font-han); font-size: 22px; line-height: 1;
  box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3.5px rgba(243,237,224,.85), 0 6px 14px -4px rgba(0,0,0,.5);
  transform: rotate(-4deg);
  transition: transform .2s ease;
  cursor: pointer;
}
.seal-marker:hover .seal-marker__pin, .seal-marker.is-hot .seal-marker__pin { transform: rotate(0) scale(1.15); }
.seal-marker--offset { overflow: visible; }
.seal-marker--offset .seal-marker__pin { position: absolute; }
.seal-marker__dot {
  position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--giay);
}
.seal-marker__leader { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.seal-marker__leader line { stroke: var(--accent); stroke-width: 1.5; }
.seal-marker--small .seal-marker__pin { width: 30px; height: 30px; font-size: 13px; font-family: var(--font-vi); font-weight: 700; }
.leaflet-tooltip.place-tip {
  background: var(--muc); color: var(--giay); border: 0; border-radius: 3px;
  font-family: var(--font-vi); font-size: .88rem; padding: .3rem .6rem; box-shadow: none;
}
.leaflet-tooltip.place-tip::before { border-top-color: var(--muc); }
.sea-label { background: none; border: 0; }
.sea-label span {
  display: block; width: 150px; transform: translate(-50%, -50%); text-align: center;
  font-size: 11px; font-style: italic; letter-spacing: .06em; color: #3F4A4C; white-space: normal; line-height: 1.3;
}
@media (prefers-color-scheme: dark) { .sea-label span { color: #B8C1C0; } }

/* ---------- Chân trang ---------- */
.site-footer { margin-top: 3rem; background: var(--muc); color: #CFC8B6; padding: 2.8rem 0 1.2rem; font-size: .93rem; }
@media (prefers-color-scheme: dark) { .site-footer { background: #16181B; } }
.site-footer a { color: #E9A59E; }
.site-footer__inner { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 2rem; }
.site-footer__brand { display: flex; align-items: center; gap: .6rem; font-size: 1.15rem; font-weight: 600; color: var(--giay); }
.site-footer__title { font-weight: 600; color: var(--giay); margin-bottom: .4rem; }
.site-footer__fine { font-size: .8rem; color: #9AA3A3; border-top: 1px solid rgba(220,213,195,.14); padding-top: 1rem; margin-top: 1.2rem; }
@media (max-width: 760px) { .site-footer__inner { grid-template-columns: 1fr; } }

/* ---------- Trang không tìm thấy ---------- */
.not-found { padding: 5rem 0; text-align: center; }
.not-found .seal { margin-bottom: 1.2rem; }

/* ---------- Giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Bố cục phụ trợ ---------- */
@media (max-width: 960px) { .hero__grid { grid-template-columns: 1fr; } .site-map-card { position: static; } }

/* ---------- Chống tràn ngang trên màn hình hẹp ---------- */
.place-hero__grid > *, .place-layout > *, .stele-item a > *, .hero__grid > * { min-width: 0; }
.place-hero__badges .badge, .stele-head__meta .badge { white-space: normal; }
@media (max-width: 860px) { .place-hero__grid, .place-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 460px) {
  .stele-item a { grid-template-columns: 64px 1fr; padding-right: .9rem; }
  .stele-item__art { width: 64px; height: 84px; }
  .stele-item__go { display: none; }
}
