/* พุทธคุณ — "Sacred Thai Heritage" theme (v2)
   Ported from the client's second Stitch export (see
   obsidian-vault/01-clients/buddhakhun/06-graphics/brand-assets/DESIGN-v2.md).
   Charcoal canvas, gold-leaf primary, monk-orange secondary accents, and the
   signature parchment "manuscript" reading surface for long-form articles.
   Tonal layering over heavy shadows; gold aura glow on interaction. */

:root {
  --bg: #0f0f0f;
  --surface: #131313;
  --surface-low: #1c1b1b;
  --surface-container: #20201f;
  --surface-high: #2a2a2a;
  --surface-highest: #353535;
  --ink: #e5e2e1;
  --ink-variant: #d0c5af;
  --muted: #99907c;
  --gold: #d4af37;
  --gold-bright: #f2ca50;
  --gold-soft: #ffe088;
  --on-gold: #3c2f00;
  --orange: #ea6b1e;
  --orange-deep: #cc5500;
  --parchment: #f4ebd0;
  --parchment-high: #faf4e3;
  --parchment-ink: #2b2416;
  --parchment-muted: #6b5d3f;
  --parchment-line: #d9cba4;
  --outline: #4d4635;
  --outline-strong: #99907c;

  --font-display: "Noto Serif Thai", "Noto Serif", serif;
  --font-body: "Prompt", sans-serif;

  --radius: 6px;
  --radius-img: 12px;
  --aura: 0 0 0 1px rgba(212, 175, 55, 0.35), 0 0 28px rgba(212, 175, 55, 0.18);
  --container: 1200px;
  --gutter: 24px;
  --section-gap: clamp(80px, 9vw, 112px);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
}

a { color: var(--gold-bright); }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.skip:focus { background: var(--surface-high); color: var(--ink); }

::selection { background: var(--gold); color: var(--on-gold); }

/* ---------- header (glass nav) ---------- */

.site-header {
  max-width: none;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--outline);
  background: rgba(15, 15, 15, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0;
}

.site-header .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--container);
  margin-inline: auto;
  padding: 0.9rem var(--gutter);
  width: 100%;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  color: var(--gold-bright);
  text-decoration: none;
}
.wordmark small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-header nav { display: flex; align-items: center; gap: 1.6rem; }
.site-header nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding-block: 0.3rem;
  border-bottom: 2px solid transparent;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}
.site-header nav a.nav-cta {
  background: var(--gold-bright);
  color: var(--on-gold);
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.1rem;
  font-weight: 600;
  transition: box-shadow 180ms ease;
}
.site-header nav a.nav-cta:hover { box-shadow: var(--aura); }

/* ---------- shared blocks ---------- */

.shell {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label-caps {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
.label-caps.orange { color: var(--orange); }

.chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-variant);
  background: var(--surface-highest);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 0.25rem 0.7rem;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--gold);
  margin-block: 1.25rem;
}
.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--outline-strong));
}
.ornament::after {
  background: linear-gradient(90deg, var(--outline-strong), transparent);
}
.ornament svg { flex: none; }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-block: var(--section-gap);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0.9rem 0 1rem;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--gold-bright); }

.hero .lede {
  color: var(--ink-variant);
  font-size: 1.0625rem;
  font-weight: 300;
  max-width: 33rem;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.8rem 1.5rem;
  transition: box-shadow 180ms ease, border-color 180ms ease, color 180ms ease;
}
.btn-primary {
  background: var(--gold-bright);
  color: var(--on-gold);
  border: 1px solid var(--gold-bright);
}
.btn-primary:hover { box-shadow: var(--aura); }
.btn-ghost {
  color: var(--parchment);
  border: 1px solid var(--outline-strong);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: var(--aura); }

/* framed relic figure — Krop Phra style frame + caption plate */
.hero-figure {
  position: relative;
  border-radius: var(--radius-img);
  background:
    radial-gradient(120% 90% at 50% 12%, #2e2a1e 0%, #191712 55%, #100f0c 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
  padding: clamp(2rem, 4vw, 3.25rem) clamp(2rem, 4vw, 3.25rem) 5.25rem;
  display: grid;
  place-items: center;
  min-height: 340px;
}
.hero-figure svg { width: min(220px, 58%); height: auto; }

/* รูปพระปิดตาในกล่อง hero — ภาพต้นฉบับพื้นหลังดำ จึงกลืนกับพื้นกล่องเอง
   ไม่ต้องทำ mask เพิ่ม · เผื่อที่ด้านล่างไว้ให้แถบชื่อกับบรรทัดเครดิต */
.hero-figure .hero-photo {
  width: min(230px, 62%);
  height: auto;
  border-radius: 6px;
  /* พื้นหลังของภาพเป็นสีดำเรียบ ส่วนพื้นกล่องเป็นไล่เฉด ขอบภาพจึงเห็นเป็นสี่เหลี่ยม
     ใส่กรอบบางสีเดียวกับกรอบกล่อง เพื่อให้อ่านเป็นภาพที่ใส่กรอบไว้ ไม่ใช่ภาพที่วางไม่พอดี */
  border: 1px solid rgba(212, 175, 55, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 10px 26px rgba(0, 0, 0, 0.45);
}
.hero-figure .hero-credit {
  position: absolute;
  left: 50%;
  bottom: 0.5rem;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 2rem);
  margin: 0;
  font-size: 0.5625rem;
  line-height: 1.5;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: center;
}
.hero-figure .hero-credit a { color: var(--muted); text-decoration: underline; }
.hero-figure .hero-credit a:hover { color: var(--gold); }
.hero-figure figcaption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 15, 15, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: var(--radius);
  padding: 0.55rem 1.2rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-align: center;
  white-space: nowrap;
}
.hero-figure figcaption small {
  display: block;
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- sections ---------- */

.section { padding-block: 0 var(--section-gap); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 2rem;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  line-height: 1.3;
  margin: 0.4rem 0 0;
}
.section-head .meta { margin: 0; font-size: 0.875rem; color: var(--muted); }
.section-head .meta a { text-decoration: none; }
.section-head .meta a:hover { text-decoration: underline; }

/* centered variant, like "The Archive Showcase" */
.section-head.centered {
  display: block;
  text-align: center;
}
.section-head.centered h2 { color: var(--gold-bright); }

/* ---------- knowledge cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/* featured layout: one lead card + compact stack */
.featured-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--gutter);
  list-style: none;
  padding: 0;
  margin: 0;
}
.featured-grid .stack { display: grid; gap: var(--gutter); align-content: start; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--surface-low);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: var(--radius-img);
  padding: 1rem 1.1rem 1.05rem;
  transition: box-shadow 200ms ease, border-color 200ms ease, transform 200ms ease;
  overflow: hidden;
}
.card:hover {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: var(--aura);
  transform: translateY(-4px);
}
@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
}

.card .label-caps { font-size: 0.65rem; }

.card h3 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0;
  text-wrap: balance;
}
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card:hover h3 a { color: var(--gold-bright); }

.card p {
  margin: 0;
  color: var(--ink-variant);
  font-weight: 300;
  font-size: 0.8125rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .card-meta {
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--outline);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.card.lead {
  justify-content: flex-end;
  min-height: 100%;
  padding: 1.5rem;
  background:
    radial-gradient(140% 100% at 20% 0%, #262215 0%, var(--surface-low) 60%);
}
.card.lead h3 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); }
.card.lead p { font-size: 0.9375rem; -webkit-line-clamp: 3; }
.card.lead .card-photo {
  width: calc(100% + 3rem);
  margin: -1.5rem -1.5rem 0.75rem;
  aspect-ratio: 16 / 9;
  flex: 1;
  min-height: 0;
}

/* ---------- trust strip ---------- */

.trust {
  background: var(--surface-low);
  border: 1px solid rgba(234, 107, 30, 0.25);
  border-radius: var(--radius-img);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem var(--gutter);
}
.trust h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.5rem 0 0.4rem;
  color: var(--parchment);
}
.trust p { margin: 0; color: var(--ink-variant); font-weight: 300; font-size: 0.9rem; }

/* ---------- article header (on charcoal) ---------- */

.article-head {
  max-width: 46rem;
  margin-inline: auto;
  padding-top: clamp(2.5rem, 5vw, 4rem);
}
.article-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0.9rem 0 0.75rem;
  text-wrap: balance;
}
.article-head .meta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- the manuscript (parchment reading surface) ---------- */

.manuscript {
  max-width: 46rem;
  margin-inline: auto;
  background:
    linear-gradient(180deg, var(--parchment-high) 0%, var(--parchment) 100%);
  color: var(--parchment-ink);
  border-radius: var(--radius-img);
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: clamp(1.75rem, 4vw, 3.25rem);
  margin-block: 2rem 2.5rem;
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.07);
}

.manuscript a { color: var(--orange-deep); }
.manuscript a:hover { color: var(--gold-deep, #735c00); }

.manuscript h2 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--parchment-ink);
  border-left: 3px solid var(--orange-deep);
  padding-left: 0.75rem;
  margin-top: 2.75rem;
  font-size: 1.45rem;
  line-height: 1.4;
}
.manuscript h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--parchment-ink);
  font-size: 1.15rem;
  margin-top: 2rem;
}

.manuscript p, .manuscript li { font-weight: 400; }
.manuscript strong { color: #1d1810; }

.manuscript table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  border: 1px solid var(--parchment-line);
  background: rgba(255, 255, 255, 0.35);
}
.manuscript th, .manuscript td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--parchment-line);
  text-align: left;
}
.manuscript th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-deep);
  background: rgba(212, 175, 55, 0.12);
}
.manuscript tr:last-child td { border-bottom: none; }

.manuscript blockquote {
  margin-inline: 0;
  padding: 1rem 1.25rem;
  border: none;
  border-block: 1px solid var(--parchment-line);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  color: #4a3d22;
}
.manuscript blockquote::before {
  content: "❝";
  display: block;
  color: var(--gold);
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.manuscript hr {
  border: none;
  height: 1px;
  background: var(--parchment-line);
  margin-block: 2.25rem;
}

/* disclaimer note after the closing hr */
.manuscript hr + p em { color: var(--parchment-muted); font-size: 0.875rem; }

/* ---------- article tail: tags + author ---------- */

.article-tail {
  max-width: 46rem;
  margin-inline: auto;
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.author-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--surface-low);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: var(--radius-img);
  padding: 1.25rem 1.5rem;
}
.author-card .seal {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  display: grid;
  place-items: center;
  color: var(--gold-bright);
}
.author-card h4 {
  margin: 0 0 0.15rem;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-bright);
}
.author-card p { margin: 0; font-size: 0.85rem; font-weight: 300; color: var(--ink-variant); }

/* ---------- amulet profile ---------- */

.spec-grid {
  max-width: 46rem;
  margin: 1.75rem auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  background: var(--surface-low);
  border: 1px solid var(--outline);
  border-radius: var(--radius-img);
  overflow: hidden;
}
.spec-grid > div {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--outline);
  border-bottom: 1px solid var(--outline);
  margin-right: -1px;
  margin-bottom: -1px;
}
.spec-grid dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 0.2rem;
}
.spec-grid dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--parchment);
}

.phim-row {
  max-width: 46rem;
  margin: 1rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.phim-row .label-caps { margin-right: 0.25rem; }

.video-card {
  max-width: 46rem;
  margin: 0 auto 2.5rem;
  background: var(--surface-low);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-img);
  padding: 1.25rem;
}
.video-card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gold-bright);
  margin: 0 0 0.9rem;
}
.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-card .meta {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.video-card .meta a { color: var(--muted); }
.video-card .meta a:hover { color: var(--gold-bright); }

/* placeholder arch figure used on amulet cards without a free-license photo.
   Both figure styles bleed to the card edges for a tight, modern crop. */
.card .arch {
  width: calc(100% + 2.2rem);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  margin: -1rem -1.1rem 0.45rem;
  border-bottom: 1px solid var(--outline);
  background: radial-gradient(90% 85% at 50% 18%, #242115 0%, #14120d 100%);
  color: var(--gold);
}
.card .arch svg { width: 44px; height: auto; }

/* photo on amulet cards — flush with the card top */
.card .card-photo {
  width: calc(100% + 2.2rem);
  /* ต้องปลด max-width ของ reset ไม่งั้น calc ข้างบนถูก clamp กลับมาที่ 100%
     แล้วรูปจะเลยขอบซ้าย (จาก margin ติดลบ) แต่ขาดขอบขวาราว 36px */
  max-width: none;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: -1rem -1.1rem 0.45rem;
  object-fit: cover;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  background: #000;
}

/* สารานุกรมพระ (/amulets/) — ให้รูปเด่นกว่าหัวข้อ
   การ์ดหน้านี้ข้อความยาวกว่าการ์ดบทความ (จังหวัด + ชื่อ + วัด/สมัย + meta)
   รูป 16:9 จึงดูเล็กกว่าบล็อกข้อความ ขยับเป็น 4:3 ให้รูปสูงขึ้นราวหนึ่งในสาม
   จำกัดขอบเขตไว้ที่หน้านี้หน้าเดียว เพราะการ์ดบทความกับหน้าแรกใช้ 16:9 อยู่แล้วและพอดี */
body.post-type-archive-wt_amulet .card .card-photo,
body.post-type-archive-wt_amulet .card .arch {
  aspect-ratio: 4 / 3;
}

/* lead photo on the amulet profile page */
.profile-figure {
  max-width: 46rem;
  margin: 1.75rem auto 0;
  background:
    radial-gradient(120% 90% at 50% 12%, #2e2a1e 0%, #191712 55%, #100f0c 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-img);
  padding: clamp(1.25rem, 3vw, 2rem);
  display: grid;
  justify-items: center;
  gap: 0.75rem;
}
.profile-figure img {
  max-height: 380px;
  width: auto;
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.profile-figure figcaption {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
}
.profile-figure figcaption a { color: var(--muted); }
.profile-figure figcaption a:hover { color: var(--gold-bright); }

/* ---------- editions timeline (รายรุ่น/รายปี) ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.6rem;
  display: grid;
  gap: 1.5rem;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--gold-deep, #735c00), var(--outline) 70%, transparent);
}
.timeline li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  align-items: start;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.6rem + 0.5px);
  top: 0.5rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.55);
}
.timeline .year-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold-bright);
  white-space: nowrap;
  padding-top: 0.1rem;
}
.timeline h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  line-height: 1.5;
}
.timeline h3 a { color: var(--ink); text-decoration: none; }
.timeline h3 a:hover { color: var(--gold-bright); }
.timeline p { margin: 0; font-size: 0.85rem; font-weight: 300; color: var(--ink-variant); }

.editions-card {
  max-width: 46rem;
  margin: 0 auto 2.5rem;
  background: var(--surface-low);
  border: 1px solid rgba(234, 107, 30, 0.3);
  border-radius: var(--radius-img);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.editions-card > h2 { margin: 0 0 1.25rem; }

.sources-card {
  max-width: 46rem;
  margin: 0 auto 2.5rem;
  background: var(--surface-low);
  border: 1px dashed var(--outline-strong);
  border-radius: var(--radius-img);
  padding: 1.25rem 1.5rem;
}
.sources-card h2 { margin: 0 0 0.6rem; }
.sources-card ul { margin: 0; padding-left: 1.1rem; }
.sources-card li { font-size: 0.85rem; font-weight: 300; color: var(--ink-variant); }

.edition-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.edition-nav a.chip { text-decoration: none; }
.edition-nav a.chip:hover { border-color: var(--gold-bright); color: var(--gold-bright); }

.article-head .crumb { color: inherit; text-decoration: none; }
.article-head .crumb:hover { color: var(--gold-bright); }

/* compact positioning strip (replaces the tall trust grid on home) */
.trust-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: center;
  width: fit-content;
  margin-inline: auto;
  background: var(--surface-low);
  border: 1px solid rgba(234, 107, 30, 0.25);
  border-radius: 999px;
  padding: 1rem 2rem;
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--ink-variant);
}

/* years teaser band on home */
.years-teaser {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background:
    radial-gradient(120% 140% at 8% 0%, #262215 0%, var(--surface-low) 55%);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: var(--radius-img);
  padding: clamp(1.5rem, 3vw, 2.25rem);
}
.years-teaser h2 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.5vw, 1.7rem);
  font-weight: 600;
  margin: 0.35rem 0 0;
}
.years-teaser .year-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.years-teaser a.chip { text-decoration: none; }
.years-teaser a.chip:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
.trust-line strong { color: var(--parchment); font-weight: 500; }

@media (max-width: 600px) {
  .timeline li { grid-template-columns: 84px 1fr; }
}

/* ---------- footer ---------- */

.site-footer {
  max-width: none;
  margin-top: var(--section-gap);
  border-top: 1px solid var(--outline);
  background: var(--surface-container-lowest, #0e0e0e);
  color: var(--muted);
  padding: 0;
  display: block;
}

.site-footer .cols {
  max-width: var(--container);
  margin-inline: auto;
  padding: 3.5rem var(--gutter) 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem var(--gutter);
}

.site-footer .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gold-bright);
  margin: 0 0 0.6rem;
}
.site-footer p { margin: 0 0 0.5rem; font-size: 0.85rem; font-weight: 300; line-height: 1.7; }

.site-footer h4 {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 0.9rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer a { color: var(--ink-variant); text-decoration: none; font-size: 0.85rem; }
.site-footer a:hover { color: var(--gold-bright); }

.site-footer .legal {
  max-width: var(--container);
  margin-inline: auto;
  padding: 1.25rem var(--gutter) 2rem;
  border-top: 1px solid var(--outline);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-align: center;
}
.site-footer .legal p { margin: 0; }

/* ---------- listing page ---------- */

.listing { padding-top: clamp(2.5rem, 5vw, 4rem); }
.listing h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  margin: 0.5rem 0 0;
}
.listing .intro {
  color: var(--ink-variant);
  font-weight: 300;
  max-width: 40rem;
  margin: 1rem 0 2rem;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-block: 3.5rem; }
  .hero-figure { min-height: 280px; }
  .featured-grid { grid-template-columns: 1fr; }

  /* nav becomes a horizontal scroller: whole items never break mid-word */
  .site-header .bar { padding-block: 0.75rem; gap: 0.6rem; }
  .site-header nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { white-space: nowrap; font-size: 0.85rem; flex: none; }
  .site-header nav a.nav-cta { padding: 0.4rem 0.9rem; }
}

/* ══════════ องค์พระเด่นประจำสัปดาห์ (แถบเต็มความกว้าง หลัง hero) ══════════ */

.featured-week {
  /* วางนอก .shell จึงกินเต็มความกว้างจอโดยไม่ต้องใช้ 100vw
     ซึ่งจะทำให้เกิด scrollbar แนวนอนเวลามี scrollbar แนวตั้ง */
  margin-block: clamp(48px, 6vw, 72px);
  padding-block: clamp(36px, 5vw, 56px);
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(212, 175, 55, 0.09), transparent 55%),
    radial-gradient(100% 130% at 88% 100%, rgba(204, 85, 0, 0.07), transparent 55%),
    var(--surface-low);
  border-block: 1px solid var(--outline);
}

.featured-week-inner {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}

.featured-week-media {
  position: relative;
  border: 1px solid var(--outline);
  border-radius: var(--radius-img);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--aura);
}
.featured-week-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
/* หน้าที่ยังไม่มีภาพถ่ายจะได้ซุ้มลายเส้นแทน จัดให้อยู่กลางกรอบ */
.featured-week-media .arch {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
}

.featured-week-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.25;
  margin: 0.4rem 0 0.5rem;
  text-wrap: balance;
}
.featured-week-body h2 a { color: var(--ink); text-decoration: none; }
.featured-week-body h2 a:hover { color: var(--gold-bright); }

.featured-week-where {
  margin: 0 0 0.2rem;
  color: var(--gold-bright);
  font-weight: 500;
}
.featured-week-era {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.featured-week-lede {
  margin: 0 0 1.4rem;
  color: var(--ink-variant);
  font-weight: 300;
  max-width: 54ch;
}

.featured-week-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.4rem;
}
.featured-week-count {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .featured-week-inner { grid-template-columns: 1fr; }
}

/* ══════════ ไทม์ไลน์ปี พ.ศ. แนวนอน (หมุดทองแดง) ══════════ */

.tl-wrap {
  position: relative;
  margin-block: 1.5rem 2rem;
  /* ไม่ใส่ padding บน เพราะ .tl-scroll เว้นที่ให้ป้ายชื่อรุ่นไว้แล้ว
     ถ้าใส่ซ้ำจะเกิดช่องว่างใหญ่เกินจำเป็นตอนที่ยังไม่มีใคร hover */
  padding: 0 0 clamp(18px, 2.5vw, 28px);
  border: 1px solid var(--outline);
  border-radius: var(--radius-img);
  overflow: hidden;
  /* texture กระดาษ — ทำด้วย CSS ล้วน ไม่มีไฟล์ภายนอก จึงไม่เพิ่ม request
     และไม่มีปัญหาลิขสิทธิ์ภาพ */
  background-color: #14130f;
  background-image:
    radial-gradient(90% 120% at 15% 0%, rgba(212, 175, 55, 0.07), transparent 55%),
    radial-gradient(80% 120% at 85% 100%, rgba(204, 85, 0, 0.06), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

.tl-scroll {
  overflow-x: auto;
  /* หมายเหตุ: ตั้ง overflow-y: visible ที่นี่ไม่ได้ผล เพราะสเปก CSS บังคับให้
     overflow-y กลายเป็น auto เมื่อ overflow-x เป็น auto — ป้ายชื่อรุ่นและ
     ภาพวงกลมจึงถูกตัด วิธีที่ใช้จริงคือเว้น padding ด้านบนให้พอ
     แล้วให้ทุกอย่างอยู่ในกล่องที่เลื่อนได้ */
  padding: 104px clamp(16px, 3vw, 32px) 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--outline-strong) transparent;
  overscroll-behavior-x: contain;
}
.tl-scroll::-webkit-scrollbar { height: 8px; }
.tl-scroll::-webkit-scrollbar-thumb {
  background: var(--outline-strong);
  border-radius: 4px;
}

.tl-rail {
  display: flex;
  align-items: flex-end;
  gap: clamp(18px, 2.4vw, 34px);
  position: relative;
  width: max-content;
  min-width: 100%;
}
/* เส้นเวลาแนวนอน — จัดให้ตรงกลางหมุดพอดี
   (จากล่างขึ้นบน: ปี ~20px + gap 8 + ครึ่งหมุด 6.5 ≈ 34px) */
.tl-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, var(--gold-deep, #735c00) 6%, var(--outline-strong) 50%, var(--gold-deep, #735c00) 94%, transparent);
}

.tl-pin {
  position: relative;
  flex: none;
  width: 74px;
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

/* ภาพพระวงกลมเล็ก — ปีที่ไม่มีภาพใช้ตัวเว้นที่สูงเท่ากัน เพื่อให้หมุดเรียงตรงกัน */
.tl-thumb,
.tl-thumb-gap {
  flex: none;
  width: 46px;
  height: 46px;
}
.tl-thumb {
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--gold-deep, #735c00);
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.tl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* หมุดทองแดง */
.tl-dot {
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #e2a26a, #b87333 55%, #7d4a1f);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 10px rgba(184, 115, 51, 0.5);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
/* เหตุการณ์สำคัญ ใช้หมุดทองเพื่อให้แยกจากหน้ารุ่นจริง */
.tl-pin.is-milestone .tl-dot {
  background: radial-gradient(circle at 32% 28%, #f2ca50, #d4af37 55%, #8a6f14);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 12px rgba(212, 175, 55, 0.55);
}

.tl-year {
  flex: none;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink-variant);
  white-space: nowrap;
  transition: color 0.18s ease;
}

/* ชื่อรุ่น — โผล่เมื่อ hover หรือโฟกัสด้วยคีย์บอร์ด อยู่ในพื้นที่ padding ด้านบน */
.tl-name {
  position: absolute;
  bottom: 100%;
  margin-bottom: 12px;
  left: 50%;
  translate: -50% 6px;
  width: max-content;
  max-width: 220px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  background: var(--surface-container);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, translate 0.18s ease, visibility 0.18s;
  z-index: 3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.tl-name::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  translate: -50% 0;
  border: 6px solid transparent;
  border-top-color: var(--outline);
}
.tl-name b { display: block; font-weight: 600; color: var(--gold-bright); }

.tl-pin:hover .tl-name,
.tl-pin:focus-visible .tl-name {
  opacity: 1;
  visibility: visible;
  translate: -50% 0;
}
.tl-pin:hover .tl-dot,
.tl-pin:focus-visible .tl-dot { transform: scale(1.35); }
.tl-pin:hover .tl-thumb,
.tl-pin:focus-visible .tl-thumb {
  transform: scale(1.1);
  border-color: var(--gold-bright);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
}
.tl-pin:hover .tl-year,
.tl-pin:focus-visible .tl-year { color: var(--gold-bright); }

.tl-hint {
  margin: 0;
  padding: 0 clamp(16px, 3vw, 32px) 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* รายการเต็มใต้ไทม์ไลน์ — เก็บเนื้อหาไว้ให้ครบสำหรับคนที่ไม่ใช้เมาส์และสำหรับ Google */
.tl-full { margin-top: 2rem; }
.tl-full > summary {
  cursor: pointer;
  color: var(--gold-bright);
  font-weight: 500;
  padding: 0.5rem 0;
}
.tl-full[open] > summary { margin-bottom: 0.5rem; }

@media (prefers-reduced-motion: reduce) {
  .tl-thumb, .tl-dot, .tl-year, .tl-name { transition: none; }
  .tl-pin:hover .tl-dot, .tl-pin:focus-visible .tl-dot { transform: none; }
  .tl-pin:hover .tl-thumb, .tl-pin:focus-visible .tl-thumb { transform: none; }
}

/* ข้อความสำหรับโปรแกรมอ่านหน้าจอเท่านั้น — ต้องไม่ใช้ display:none
   เพราะ display:none จะถูกตัดออกจาก accessibility tree ไปด้วย */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Display-only title break for editorially formatted article headings. */
.article-head--display-title h1 {
  font-size: clamp(1.9rem, 3.7vw, 2.4rem);
}

/* Display-only title break for editorially formatted article headings. */
.article-head--display-title h1 {
  font-size: clamp(1.9rem, 3.7vw, 2.4rem);
}


/* ค้นหาพระบนหน้าแรกและหน้าสารานุกรม */
.home-discovery,
.listing-search {
  border: 1px solid var(--outline);
  border-radius: var(--radius-img);
  background: var(--surface-low);
}

.home-discovery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 1.2fr) auto;
  gap: 1.25rem 1.75rem;
  align-items: center;
  margin-bottom: var(--section-gap);
  padding: 1.35rem 1.5rem;
}

.home-discovery h2,
.listing-search h2 {
  margin: 0.18rem 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.25;
}

.home-discovery p,
.listing-search p { margin: 0.3rem 0 0; color: var(--muted); }

.home-discovery-form,
.listing-search-form { display: flex; gap: 0.65rem; }

.home-discovery-form input,
.listing-search-form input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--outline);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 0.65rem 0.85rem;
}

.home-discovery-form input::placeholder,
.listing-search-form input::placeholder { color: var(--muted); opacity: 1; }

.home-discovery-form input:focus-visible,
.listing-search-form input:focus-visible,
.home-discovery-random:focus-visible,
.listing-search-status a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.home-discovery-form .btn,
.listing-search-form .btn { min-height: 48px; white-space: nowrap; }

.home-discovery-random {
  color: var(--gold-bright);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.home-discovery-random:hover { color: var(--gold); }

.listing-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(21rem, 1.15fr);
  gap: 1rem 1.75rem;
  align-items: center;
  margin: 1.75rem 0 2rem;
  padding: 1.35rem 1.5rem;
}

.listing-search-status {
  grid-column: 1 / -1;
  border-top: 1px solid var(--outline);
  padding-top: 0.9rem;
  font-size: 0.94rem;
}
.listing-search-status a { color: var(--gold-bright); font-weight: 700; margin-left: 0.6rem; }
.listing-search-empty { margin: 0 0 2rem; color: var(--muted); }

@media (max-width: 760px) {
  .home-discovery,
  .listing-search { grid-template-columns: 1fr; gap: 1rem; padding: 1.15rem; }
  .home-discovery-random { justify-self: start; }
}

@media (max-width: 440px) {
  .home-discovery-form,
  .listing-search-form { flex-direction: column; }
  .home-discovery-form .btn,
  .listing-search-form .btn { width: 100%; }
}
