/* Layout: quiet stone page, one narrow reading column, flag colours as accents */
/* Palette: Thai flag (red, white, navy) with forest green and orange gold */
:root {
  --stone: #f7f6f1;      /* page ground, warm white */
  --paper: #ffffff;      /* raised surfaces, flag white */
  --ink: #241f45;        /* text, Thai flag navy */
  --muted: #545170;      /* secondary text */
  --rule: #dddbe3;       /* hairlines */
  --gold: #c8790a;       /* orange gold, accent */
  --gold-soft: #fbe9c8;
  --leaf: #1f5132;       /* forest green */
  --red: #a51931;        /* Thai flag red */
  --navy: #2d2a4a;       /* Thai flag blue */
  --on-dark: #f4f1e6;    /* text on green bands */
  --display: "Spectral", "Iowan Old Style", Georgia, serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --thai: "Noto Serif Thai", "Spectral", serif;
  --measure: 66ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stone: #13121f; --paper: #1b1a2b; --ink: #ecebf3; --muted: #aaa8bf;
    --rule: #302e47; --gold: #f0a63a; --gold-soft: #3d2c12; --leaf: #7fbf93;
    --red: #e0566c; --navy: #8a86c4; --on-dark: #f4f1e6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --stone: #13121f; --paper: #1b1a2b; --ink: #ecebf3; --muted: #aaa8bf;
  --rule: #302e47; --gold: #f0a63a; --gold-soft: #3d2c12; --leaf: #7fbf93;
  --red: #e0566c; --navy: #8a86c4; --on-dark: #f4f1e6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
}
a { color: var(--leaf); text-underline-offset: 3px; }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }

.wrap { max-width: 68rem; margin-inline: auto; padding-inline: 1.25rem; }

/* Header */
.site-head {
  border-bottom: 1px solid var(--rule);
  background: var(--stone);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
}
.site-head .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 2rem; padding-block: .9rem;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; color: var(--gold); flex: none; }
.brand b { font: 600 1.15rem/1.1 var(--display); display: block; }
.brand small { font: 400 .78rem/1.2 var(--thai); color: var(--muted); }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
nav a {
  text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 500;
  padding-block: .25rem; border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

/* Type */
h1, h2, h3 { font-family: var(--display); font-weight: 500; text-wrap: balance; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0; max-width: var(--measure); }
.eyebrow {
  font: 600 .75rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
.lede { font-size: 1.2rem; color: var(--muted); }
.pali { font-style: italic; font-family: var(--display); }
.thai { font-family: var(--thai); }
.placeholder {
  background: var(--gold-soft); color: var(--ink); padding: 0 .3em; border-radius: 3px;
  font-style: normal;
}

/* Page structure */
main { padding-block: 3rem 5rem; }
.page-intro { display: grid; gap: 1rem; padding-block: 1rem 3rem; border-bottom: 1px solid var(--rule); }
.stack { display: grid; gap: 1.1rem; }
section { padding-block: 3rem; border-bottom: 1px solid var(--rule); }
section:last-child { border-bottom: 0; }
.split { display: grid; gap: 2rem 4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) { .split { grid-template-columns: 16rem minmax(0, 1fr); } }

/* Home hero */
.hero { display: grid; gap: 2.5rem; align-items: center; padding-block: 1rem 3.5rem; }
@media (min-width: 52rem) { .hero { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.hero h1 { max-width: 14ch; }
.hero-quote {
  border-left: 3px solid var(--gold); padding: .25rem 0 .25rem 1.4rem; display: grid; gap: .7rem;
}
.hero-quote blockquote { margin: 0; font: italic 400 1.45rem/1.4 var(--display); }
.hero-quote cite { font-style: normal; font-size: .85rem; color: var(--muted); }

.btns { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.2rem; border-radius: 999px;
  font: 600 .95rem/1 var(--body); text-decoration: none; border: 1.5px solid var(--gold);
  background: var(--gold); color: var(--paper); cursor: pointer;
}
.btn:hover { color: var(--paper); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--gold); }
.btn.ghost:hover { background: var(--gold-soft); color: var(--ink); }

/* Index of pages on home */
.paths { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--rule); }
@media (min-width: 44rem) { .paths { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3rem; } }
.paths a {
  display: grid; gap: .35rem; padding-block: 1.4rem; border-bottom: 1px solid var(--rule);
  text-decoration: none; color: var(--ink);
}
.paths a span { color: var(--muted); font-size: .95rem; }
.paths a h3::after { content: " →"; color: var(--gold); }
.paths a:hover h3 { color: var(--gold); }

/* Definition lists / schedule */
.terms { display: grid; gap: 1.25rem; margin: 0; }
.terms div { display: grid; gap: .2rem; }
.terms dt { font: 600 1.1rem/1.3 var(--display); }
.terms dd { margin: 0; color: var(--muted); max-width: var(--measure); }

.schedule { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.schedule td { padding: .55rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.schedule td:first-child { width: 6.5rem; color: var(--gold); font-weight: 600; }

.note {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.2rem;
  font-size: .95rem; color: var(--muted); max-width: var(--measure);
}

/* Abbot */
.portrait {
  aspect-ratio: 4 / 5; max-width: 100%; border-radius: 4px; background: var(--paper);
  border: 1px solid var(--rule); display: grid; place-items: center; text-align: center;
  color: var(--muted); font-size: .85rem; padding: 1rem;
}
.portrait svg { width: 56px; color: var(--gold); opacity: .7; }

/* Lectures */
.lectures { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.lecture {
  display: grid; gap: .5rem 1.5rem; padding-block: 1.3rem; border-bottom: 1px solid var(--rule);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 44rem) { .lecture { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
.lecture h3 { font-size: 1.15rem; }
.meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.tag { color: var(--leaf); font-weight: 600; }
.filter { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.filter button {
  font: 500 .88rem/1 var(--body); padding: .5rem .9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.filter button[aria-pressed="true"] { background: var(--ink); color: var(--stone); border-color: var(--ink); }

/* Visit */
.facts { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 44rem) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts h3 { margin-bottom: .4rem; }
address { font-style: normal; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); background: var(--paper); font-size: .9rem; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; padding-block: 2rem; }

/* Thai flag stripe: red, white, blue (double), white, red */
.site-head::before {
  content: ""; display: block; height: 6px;
  background: linear-gradient(to bottom, #a51931 0 16.66%, #f4f5f8 16.66% 33.33%, #2d2a4a 33.33% 66.66%, #f4f5f8 66.66% 83.33%, #a51931 83.33%);
}
.site-head { border-bottom: 3px solid var(--leaf); }
.brand b { color: var(--leaf); }
h1, h2 { color: var(--leaf); }
.eyebrow { color: var(--red); }
.paths a h3::after { color: var(--gold); }
.terms dt { color: var(--navy); }
.tag { color: var(--red); }
.filter button[aria-pressed="true"] { background: var(--leaf); color: var(--on-dark); border-color: var(--leaf); }
.site-foot { background: #1f5132; color: var(--on-dark); border-top: 4px solid var(--gold); }
.site-foot .placeholder { color: var(--ink); }
.btn, .btn:hover { color: #1b1a2b; }
.btn.ghost { color: var(--leaf); border-color: var(--leaf); }
.btn.ghost:hover { background: var(--leaf); color: var(--on-dark); }

/* ---------- Photos ---------- */
.photo { margin: 0; position: relative; overflow: hidden; border-radius: 4px; background: var(--paper); aspect-ratio: 4 / 3; max-width: 100%; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo figcaption { display: none; }
.photo.wide { aspect-ratio: 21 / 9; margin-block: 2rem 0; }
.photo.tall { aspect-ratio: 4 / 5; }
.photo-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); max-width: 100%; }
.facts .photo { aspect-ratio: 3 / 2; }

/* Placeholder shown until a real photo file exists at that path */
.photo.missing {
  background: repeating-linear-gradient(135deg, var(--gold-soft) 0 12px, transparent 12px 24px), var(--paper);
  border: 1.5px dashed var(--gold); display: grid; place-items: center;
}
.photo.missing img { display: none; }
.photo.missing figcaption {
  display: grid; gap: .3rem; text-align: center; padding: 1rem; font-size: .88rem; color: var(--ink);
  background: var(--paper); border-radius: 4px; margin: 1rem; max-width: 90%;
}
.photo.missing figcaption span::before { content: "Photo: "; font-weight: 600; color: var(--leaf); }
.photo.missing code { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }

/* Header photo band under the navigation */
.masthead .photo { border-radius: 0; aspect-ratio: auto; height: clamp(9rem, 22vw, 15rem); }
.masthead.home .photo { height: clamp(14rem, 42vw, 30rem); }
.masthead .photo.missing {
  border: 0; border-bottom: 1.5px dashed var(--gold);
  background: repeating-linear-gradient(135deg, rgba(200,121,10,.18) 0 14px, transparent 14px 28px), linear-gradient(120deg, #1f5132, #2d2a4a);
}

/* ---------- Photo album ---------- */
.album-nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.album-nav a {
  text-decoration: none; font-size: .9rem; font-weight: 500; padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--leaf); color: var(--leaf);
}
.album-nav a:hover { background: var(--leaf); color: var(--on-dark); }
.album { scroll-margin-top: 6rem; display: grid; gap: 1.25rem; }
.album-head { display: grid; gap: .3rem; }
.album-head p { color: var(--muted); }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }
.photo.thumb { aspect-ratio: 1; cursor: zoom-in; }
.photo.thumb.missing { cursor: default; }
.photo.thumb:not(.missing) img { transition: transform .4s ease; }
.photo.thumb:not(.missing):hover img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .photo.thumb img { transition: none; } }

.lightbox {
  border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh;
  background: rgba(10, 12, 20, .94); color: #f4f1e6;
}
.lightbox[open] { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 3rem; align-items: center; }
.lightbox::backdrop { background: rgba(0, 0, 0, .6); }
.lightbox figure { margin: 0; display: grid; gap: .75rem; justify-items: center; padding: 3rem .5rem; }
.lightbox img { max-height: 80vh; max-width: 100%; object-fit: contain; }
.lightbox figcaption { font-size: .95rem; text-align: center; }
.lightbox button { background: none; border: 0; color: #f4f1e6; font-size: 2.4rem; cursor: pointer; padding: .5rem; }
.lb-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + .5rem); right: 1rem; }

/* ---------- Contact footer ---------- */
.site-foot .wrap { display: grid; gap: 2rem 3rem; grid-template-columns: minmax(0, 1fr); padding-block: 3rem; }
@media (min-width: 52rem) { .site-foot .wrap { grid-template-columns: 1.3fr 1fr 1fr; } }
.foot-col { display: grid; gap: .8rem; align-content: start; min-width: 0; }
.foot-title { font-size: 1.35rem; color: var(--on-dark); }
.foot-label { font: 600 .75rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: #f0a63a; }
.site-foot p, .site-foot address { color: var(--on-dark); opacity: .9; line-height: 1.6; }
.site-foot a { color: var(--on-dark); }
.site-foot a:hover { color: #f0a63a; }
.contact-list { margin: 0; display: grid; gap: .55rem; }
.contact-list div { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: .5rem; }
.contact-list dt { opacity: .7; font-size: .85rem; padding-top: .1rem; }
.contact-list dd { margin: 0; overflow-wrap: anywhere; user-select: text; }
.map-btn {
  justify-self: start; display: inline-flex; align-items: center; gap: .45rem; margin-top: .25rem;
  padding: .65rem 1.1rem; border-radius: 999px; background: #c8790a; color: #1b1a2b !important;
  font: 600 .92rem/1 var(--body); text-decoration: none;
}
.map-btn:hover { background: #f0a63a; }
.map-btn svg { width: 18px; height: 18px; }
.foot-base { border-top: 1px solid rgba(244, 241, 230, .18); }
.foot-base .wrap { display: block; padding-block: 1rem; font-size: .82rem; opacity: .75; }

/* ---------- Home: abbot hero photo ---------- */
.masthead.home .abbot-hero { height: auto; aspect-ratio: 1706 / 960; max-height: 44rem; width: 100%; }
.abbot-hero img { object-position: 50% 72%; }
.abbot-hero .hero-cap {
  display: grid; gap: .25rem; position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3rem max(1.25rem, calc((100% - 68rem) / 2 + 1.25rem)) 1.5rem;
  background: linear-gradient(to top, rgba(18, 26, 20, .82), rgba(18, 26, 20, 0));
  color: #f4f1e6; text-align: left;
}
.abbot-hero .hero-cap b { font: 500 clamp(1.4rem, 3vw, 2.1rem)/1.15 var(--display); }
.abbot-hero .hero-cap .eyebrow { color: #f0a63a; }
.abbot-hero .hero-cap .placeholder { background: rgba(240, 166, 58, .3); color: #f4f1e6; }
@media (max-width: 40rem) {
  .masthead.home .abbot-hero { aspect-ratio: 4 / 3; }
  .abbot-hero img { object-position: 46% 80%; }
  .abbot-hero .hero-cap { position: static; background: #1f5132; padding: 1rem 1.25rem; }
  .masthead.home .abbot-hero { overflow: visible; }
}
.photo.tall img { object-position: 50% 40%; }
@media (max-width: 40rem) {
  .masthead.home .abbot-hero { aspect-ratio: auto; height: auto; max-height: none; }
  .masthead.home .abbot-hero img { aspect-ratio: 4 / 3; height: auto; }
}
/* Header photo framing: keep the candles and faces in view */
.masthead:not(.home) .photo img { object-position: 50% 38%; }
.masthead:not(.home) .photo { height: clamp(11rem, 26vw, 19rem); }

/* ---------- Home: illustrated banner + abbot feature ---------- */
.masthead.home .art-banner { height: auto; aspect-ratio: 1600 / 600; max-height: 34rem; width: 100%; background: #2d2a4a; }
.masthead.home .art-banner img { object-position: 50% 70%; }
@media (max-width: 40rem) {
  .masthead.home .art-banner { aspect-ratio: 4 / 3; }
  .masthead.home .art-banner img { aspect-ratio: auto; height: 100%; }
}
.abbot-feature {
  display: grid; gap: 1.5rem 3rem; align-items: center; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 52rem) { .abbot-feature { grid-template-columns: minmax(0, 30rem) minmax(0, 1fr); } }
.feature-photo { margin: 0; max-width: 30rem; width: 100%; }
.feature-photo img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 4px;
  box-shadow: 0 0 0 1px var(--rule), 0 14px 30px -18px rgba(31, 81, 50, .55);
}
.abbot-feature h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }

/* ---------- Kanchanaburi: places ---------- */
.places { display: grid; gap: 0 2.5rem; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--rule); }
@media (min-width: 44rem) { .places { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .places { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.places article { display: grid; gap: .35rem; align-content: start; padding-block: 1.2rem; border-bottom: 1px solid var(--rule); }
.places .tag { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; }
.places p:not(.tag) { color: var(--muted); font-size: .97rem; }
.schedule td:first-child { width: 7.5rem; }
.photo.square { aspect-ratio: 1; }
.photo-row .photo.tall img { object-position: 50% 50%; }
.walk-figure { margin: 0; padding-block: 3rem 0; display: grid; gap: .75rem; }
.photo.walk { aspect-ratio: 16 / 9; }
.walk-figure > figcaption { color: var(--muted); font-size: .95rem; max-width: var(--measure); }
.schedule td:first-child { width: 8.5rem; white-space: nowrap; padding-right: 1rem; }

/* ---------- Foundation: campus photos ---------- */
.photo.portrait { aspect-ratio: 3 / 4; }
.campus-grid { display: grid; gap: 1.5rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); margin-top: .5rem; }
.campus-item { margin: 0; display: grid; gap: .5rem; align-content: start; }
.campus-item > figcaption { font-size: .9rem; color: var(--muted); }

/* ---------- Language switch ---------- */
.lang-switch {
  display: inline-flex; border: 1.5px solid var(--leaf); border-radius: 999px; overflow: hidden; flex: none;
  font: 600 .85rem/1 var(--body);
}
.lang-switch a { padding: .45rem .8rem; text-decoration: none; color: var(--leaf); }
.lang-switch a[lang="th"] { font-family: "Noto Sans Thai", var(--body); }
.lang-switch a:hover { background: var(--gold-soft); color: var(--ink); }
.lang-switch a[aria-current="true"] { background: var(--leaf); color: var(--on-dark); }
.site-head .wrap { flex-wrap: wrap; }
@media (min-width: 64rem) { .lang-switch { order: 3; } }
@media (max-width: 63.99rem) {
  .site-head .brand { flex: 1 1 auto; }
  .lang-switch { order: 2; }
  .site-head nav { order: 3; flex-basis: 100%; }
}

/* ---------- Thai typography ---------- */
html[lang="th"] {
  --display: "Noto Serif Thai", "Spectral", Georgia, serif;
  --body: "Noto Sans Thai", "Figtree", system-ui, sans-serif;
}
html[lang="th"] body { line-height: 1.8; }
html[lang="th"] h1, html[lang="th"] h2, html[lang="th"] h3 { line-height: 1.4; letter-spacing: 0; }
html[lang="th"] .eyebrow, html[lang="th"] .foot-label, html[lang="th"] .places .tag { letter-spacing: .04em; }
html[lang="th"] .pali { font-style: normal; font-family: "Noto Serif Thai", serif; }
html[lang="th"] .photo.missing figcaption span::before { content: "ภาพ: "; }
html[lang="th"] .hero h1 { max-width: 20ch; font-size: clamp(2rem, 4.4vw, 3.1rem); }
html[lang="th"] .hero-quote blockquote, html[lang="th"] .hero-quote cite .pali { font-style: normal; }

/* ---------- YouTube ---------- */
.yt-section { display: grid; gap: 2rem; border-bottom: 1px solid var(--rule); }
.yt-head { display: grid; gap: 1.5rem 3rem; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 52rem) { .yt-head { grid-template-columns: minmax(0, 1fr) auto; } }
.yt-eyebrow { display: inline-flex; align-items: center; gap: .5rem; }
.yt-eyebrow svg, .yt-btn svg { width: 22px; height: 16px; color: #c4302b; flex: none; }
.yt-cta { display: grid; gap: .8rem; justify-items: start; }
.yt-stat { display: grid; margin: 0; }
.yt-stat b { font: 600 2rem/1 var(--display); color: var(--leaf); font-variant-numeric: tabular-nums; }
.yt-stat span { color: var(--muted); font-size: .9rem; }
.yt-btn { background: var(--paper); border-color: #c4302b; color: var(--ink) !important; }
.yt-btn:hover { background: #fbe9e7; filter: none; }
.yt-btn svg { color: #c4302b; }
.yt-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.yt-card { display: grid; gap: .6rem; text-decoration: none; color: var(--ink); }
.yt-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; border-radius: 6px;
  background: linear-gradient(135deg, #1f5132, #2d2a4a);
}
.yt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.yt-thumb iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-play { position: relative; width: 64px; transition: transform .2s ease; }
.yt-play svg { display: block; width: 100%; }
a.yt-card:hover .yt-play { transform: scale(1.1); }
a.yt-card:hover .yt-title { color: var(--leaf); }
.yt-card.empty .yt-play { opacity: .55; }
.yt-title { font-weight: 600; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .yt-play { transition: none; } }
.yt-section { scroll-margin-top: 8rem; }
.yt-channel { font: 600 1.05rem/1.4 "Noto Sans Thai", var(--body); color: var(--leaf); }

/* ---------- Follow us (Facebook + YouTube) ---------- */
.social { display: grid; gap: 1.75rem; scroll-margin-top: 8rem; }
.social-cards { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 48rem) { .social-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.social-card {
  display: grid; gap: .8rem; align-content: start; min-width: 0;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 1.5rem;
  border-top: 4px solid var(--leaf);
}
.social-card.fb { border-top-color: #1877f2; }
.social-card.yt { border-top-color: #c4302b; }
.social-top { display: flex; align-items: center; gap: .6rem; }
.social-top svg { width: 30px; height: 30px; flex: none; }
.social-card.fb svg { color: #1877f2; }
.social-card.yt .social-top svg { width: 34px; height: 24px; }
.social-card.yt svg { color: #c4302b; }
.social-name { font: 600 1rem/1.4 "Noto Sans Thai", var(--body); color: var(--leaf); }
.social-card p:not(.social-name) { color: var(--muted); }
.social-btn { background: var(--paper); color: var(--ink) !important; border-color: currentColor; }
.social-card.fb .social-btn { border-color: #1877f2; }
.social-card.yt .social-btn { border-color: #c4302b; }
.social-btn svg { width: 20px; height: 20px; }
.social-card.yt .social-btn svg { width: 22px; height: 16px; }
.social-btn:hover { background: var(--gold-soft); filter: none; }
.fb-embed:empty { display: none; }
.fb-embed { overflow: hidden; border-radius: 6px; }

.foot-social { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.foot-social a {
  display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; font-size: .88rem; font-weight: 600;
  padding: .45rem .85rem; border-radius: 999px; border: 1px solid rgba(244, 241, 230, .35);
}
.foot-social a:hover { background: rgba(244, 241, 230, .12); color: var(--on-dark); }
.foot-social svg { width: 18px; height: 18px; color: var(--on-dark); }
.foot-social a:last-child svg { width: 20px; height: 14px; }

/* ---------- Vipassana: history ---------- */
.history { display: grid; gap: 1.5rem; scroll-margin-top: 8rem; }
.history > h3 { margin-top: 1rem; color: var(--navy); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; position: relative; }
.timeline::before { content: ""; position: absolute; left: .45rem; top: .6rem; bottom: .6rem; width: 2px; background: var(--gold-soft); }
.timeline li { display: grid; gap: .25rem 2rem; grid-template-columns: minmax(0, 1fr); position: relative; padding: 0 0 1.4rem 2rem; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: .35rem; width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--stone); border: 3px solid var(--gold);
}
@media (min-width: 52rem) { .timeline li { grid-template-columns: 12rem minmax(0, 1fr); } }
.tl-when { font-weight: 600; color: var(--gold); font-size: .92rem; padding-top: .1rem; font-variant-numeric: tabular-nums; }
.timeline h4, .figures h4 { margin: 0 0 .25rem; font: 600 1.1rem/1.3 var(--display); color: var(--leaf); }
.timeline p:not(.tl-when), .figures p:not(.fig-meta) { color: var(--muted); max-width: var(--measure); }
.figures { display: grid; gap: 0 2.5rem; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--rule); }
@media (min-width: 44rem) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.figures article { padding-block: 1.1rem; border-bottom: 1px solid var(--rule); min-width: 0; }
.fig-meta { font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--red); margin-bottom: .35rem; }
html[lang="th"] .fig-meta { text-transform: none; letter-spacing: 0; }
@media (min-width: 44rem) { .figures article:last-child:nth-child(odd) { grid-column: 1 / -1; } }

/* ---------- Vipassana: three postures ---------- */
.postures-section { gap: 1.5rem; }
.postures { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) { .postures { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.posture {
  display: grid; gap: .6rem; align-content: start; min-width: 0;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 1.25rem 1.4rem 1.5rem;
}
.posture img { width: 120px; height: auto; max-width: 100%; justify-self: center; margin-bottom: .25rem; }
.posture h3 { color: var(--leaf); font-size: 1.25rem; }
.posture p { color: var(--muted); font-size: .97rem; }
@media (max-width: 51.99rem) {
  .posture { grid-template-columns: 96px minmax(0, 1fr); column-gap: 1.1rem; }
  .posture img { width: 96px; grid-row: span 2; align-self: start; justify-self: start; }
}

/* ---------- Dhamma talks: downloads ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.downloads { display: grid; gap: 1.5rem; scroll-margin-top: 8rem; border-bottom: 1px solid var(--rule); }
.dl-head { display: grid; gap: 1.5rem 3rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 56rem) { .dl-head { grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); } }
.dl-help { background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--gold); border-radius: 6px; padding: 1rem 1.2rem; }
.dl-help h3 { font-size: 1.05rem; margin-bottom: .5rem; color: var(--leaf); }
.dl-help ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .4rem; font-size: .92rem; color: var(--muted); }
.dl-help b { color: var(--ink); }
.dl-tools { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; }
.dl-tools .filter { margin: 0; }
.dl-search input {
  font: inherit; font-size: .95rem; padding: .6rem 1rem; border-radius: 999px; width: min(22rem, 100%);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.dl-search { flex: 1 1 16rem; max-width: 22rem; }
.talks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.talk { display: grid; gap: .8rem 1.5rem; padding-block: 1.2rem; border-bottom: 1px solid var(--rule); grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 52rem) { .talk { grid-template-columns: minmax(0, 1fr) auto; } }
.talk h3 { font-size: 1.15rem; margin-bottom: .35rem; }
.talk-dl { display: flex; flex-wrap: wrap; gap: .5rem; }
.dl-btn { gap: .45rem; padding: .6rem 1rem; }
.dl-btn svg { width: 18px; height: 18px; flex: none; }
.dl-btn small { font-weight: 500; opacity: .75; font-size: .8rem; font-variant-numeric: tabular-nums; }
.dl-none { color: var(--muted); }
.dl-free { color: var(--muted); font-size: .92rem; }
.bio-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 34rem; margin-block: .5rem; } .bio-photos .photo img { object-position: 50% 30%; }
.bio-photos .photo { padding: 0; border: 0; background: none; box-shadow: none; } .bio-photos .photo img { border-radius: 4px; }
.bio-cap { color: var(--muted); font-size: .92rem; margin-top: -.25rem; }

/* ---------- Video library ---------- */
.vl-count { color: var(--leaf); font-weight: 600; font-size: .95rem; }
.vl-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.75rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.vl-item { display: grid; gap: .7rem; align-content: start; min-width: 0; }
.vl-play {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; max-width: 100%; width: 100%;
  border: 0; padding: 0; border-radius: 6px; overflow: hidden; cursor: pointer;
  background: linear-gradient(135deg, #1f5132, #2d2a4a); color: #fff;
}
.vl-play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vl-playicon { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: rgba(200,121,10,.92); transition: transform .2s ease; }
.vl-playicon svg { width: 26px; height: 26px; margin-left: 3px; }
.vl-play:hover .vl-playicon, .vl-play:focus-visible .vl-playicon { transform: scale(1.1); }
.vl-play.is-soon { cursor: default; }
.vl-play.is-soon .vl-playicon { background: rgba(244,241,230,.18); }
.vl-dur { position: absolute; right: .5rem; bottom: .5rem; font-size: .78rem; font-weight: 600; padding: .15rem .45rem; border-radius: 4px; background: rgba(0,0,0,.65); color: #fff; font-variant-numeric: tabular-nums; }
.vl-body { display: grid; gap: .3rem; min-width: 0; }
.vl-body h3 { font-size: 1.1rem; line-height: 1.35; }
.vl-sub { color: var(--muted); font-size: .9rem; }
.vl-body .meta { font-size: .85rem; }
.vl-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .3rem; }
.vl-soon { font-size: .85rem; font-weight: 600; color: var(--muted); padding: .45rem .8rem; border: 1px dashed var(--rule); border-radius: 999px; }
.vl-item.soon h3 { color: var(--muted); }
.vl-player { border: 0; padding: 0; width: min(64rem, 96vw); max-width: 96vw; background: #000; color: #f4f1e6; border-radius: 8px; overflow: hidden; }
.vl-player::backdrop { background: rgba(0,0,0,.75); }
.vl-player-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .6rem .6rem 1rem; background: #13121f; }
.vl-player-bar h3 { font-size: 1rem; color: #f4f1e6; min-width: 0; overflow-wrap: anywhere; }
.vl-close { background: none; border: 0; color: #f4f1e6; font-size: 1.9rem; line-height: 1; cursor: pointer; padding: .1rem .5rem; }
.vl-player video { display: block; width: 100%; max-height: 80vh; background: #000; aspect-ratio: 16 / 9; }
@media (prefers-reduced-motion: reduce) { .vl-playicon { transition: none; } }
.vl-item.soon .dl-btn { display: none; }
.vl-item:not(.soon) .vl-soon { display: none; }
.vl-item.soon .vl-play { cursor: default; pointer-events: none; }
.vl-item.soon .vl-playicon { background: rgba(244,241,230,.18); }

/* Video list: compact rows with small thumbnails, grouped by type (1 Nov 2026) */
.vlib .vl-sec { margin-top: 1.75rem; }
.vlib .vl-sec:not(:has(.vl-item:not([hidden]))) { display: none; }
.vlib .vl-group { font-size: 1.15rem; padding-bottom: .4rem; border-bottom: 1px solid var(--rule); margin-bottom: .25rem; }
.vlib .vl-group span { color: var(--muted); font-weight: 400; font-size: .9rem; margin-left: .3rem; }
.vlib .vl-grid { display: block; }
.vlib .vl-item { display: grid; grid-template-columns: 128px 1fr; gap: .9rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.vlib .vl-item[hidden] { display: none; }
.vlib .vl-play { width: 128px; aspect-ratio: 16 / 9; border-radius: 6px; }
.vlib .vl-playicon { width: 30px; height: 30px; }
.vlib .vl-playicon svg { width: 15px; height: 15px; margin-left: 2px; }
.vlib .vl-dur { right: .25rem; bottom: .25rem; font-size: .68rem; padding: .05rem .3rem; }
.vlib .vl-body { gap: .15rem; }
.vlib .vl-body h3 { font-size: 1rem; }
.vlib .vl-sub { font-size: .85rem; }
.vlib .vl-body .meta { font-size: .8rem; }
.vlib .vl-actions { margin-top: .2rem; gap: .4rem; }
.vlib .vl-actions .dl-btn { padding: .3rem .7rem; font-size: .82rem; min-height: 0; }
.vlib .vl-actions .dl-btn svg { width: 14px; height: 14px; }
@media (min-width: 52rem) {
  .vlib .vl-item { grid-template-columns: 128px 1fr auto; }
  .vlib .vl-body { display: contents; }
  .vlib .vl-body > :not(.vl-actions) { grid-column: 2; }
  .vlib .vl-actions { grid-column: 3; grid-row: 1 / span 3; margin: 0; flex-wrap: nowrap; }
  .vlib .vl-play { grid-row: 1 / span 3; }
}
@media (max-width: 30rem) { .vlib .vl-item { grid-template-columns: 96px 1fr; gap: .7rem; } .vlib .vl-play { width: 96px; } }
.vlib .vl-body .meta .tag { display: none; }
.vlib .vl-item { row-gap: .1rem; padding: .55rem 0; }
@media (max-width: 52rem) { .vlib .vl-item { align-items: start; } .vlib .vl-play { margin-top: .2rem; } }

/* Facebook photo card (replaces the page preview, which Facebook blocks for unmanaged pages) */
.fb-photo { position: relative; display: block; margin-top: 1rem; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 10; text-decoration: none; }
.fb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.fb-photo span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2.5rem 1rem .9rem; color: #fff; font-weight: 600; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.fb-photo:hover img, .fb-photo:focus-visible img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .fb-photo img { transition: none; } }
