@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --page: #f5f7f0;
  --paper: #fffef9;
  --green: #126047;
  --forest: #113e30;
  --deep: #0b2c22;
  --ink: #193329;
  --muted: #4c685d;
  --line: #d6e1d8;
  --tint: #e7f0e8;
  --gold: #f1d990;
  --radius: 18px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 500 16px/1.65 Inter, 'IBM Plex Sans Thai', sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid #17795a; outline-offset: 4px; }
img { display: block; max-width: 100%; object-fit: cover; }
h1, h2, h3, p { margin: 0 0 .65em; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(2.1rem, 5vw, 4.65rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.35rem, 2.6vw, 2rem); }
small, .muted { color: var(--muted); }
.wrap { width: min(1250px, calc(100% - 52px)); margin-inline: auto; }

.site-header { background: var(--deep); color: #fffdf4; position: relative; z-index: 2; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--gold); }
.top { display: flex; gap: clamp(12px, 2.3vw, 30px); align-items: center; justify-content: space-between; min-height: 77px; padding-block: 8px; }
.brand { width: 151px; flex-shrink: 0; }
.brand img { width: 100%; height: 48px; object-fit: contain; object-position: left center; }
.nav, .account, .actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.nav { gap: 17px; }
.nav a, .nav summary { font-size: .9rem; font-weight: 700; cursor: pointer; }
.nav a:hover, .nav summary:hover { text-decoration: underline; text-underline-offset: 5px; }
.nav details { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 186px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 7px; box-shadow: 0 12px 30px #102f2329; }
.menu a { display: block; padding: 8px 10px; border-radius: 7px; }
.menu a:hover { background: var(--tint); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 7px 14px; color: var(--green); border: 1px solid #afc4b7; background: var(--paper); border-radius: 8px; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(.94); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.lang { padding-inline: 10px; }
.account .btn { color: #fffef9; border-color: #5d8173; background: transparent; }
.account .btn.primary { color: var(--deep); border-color: var(--gold); background: var(--gold); }

.searchbar { display: flex; gap: 8px; max-width: min(100%, 392px); margin: 15px 0 0 auto; }
.searchbar input, .filters select { min-width: 0; background: var(--paper); border: 1px solid #afc4b7; border-radius: 8px; color: var(--ink); padding: 8px 12px; }
.searchbar input { flex: 1; }

.hero { overflow: hidden; display: grid; grid-template-columns: 1fr .88fr; background: var(--forest); color: #fffdf5; margin: 18px 0 28px; border: 1px solid #285748; border-radius: 24px; min-height: 235px; }
.hero.home { grid-template-columns: 1fr 1.04fr; min-height: clamp(340px, 37vw, 465px); }
.hero img { width: 100%; height: 100%; min-height: 0; object-position: center; }
.hero-inner { align-self: center; padding: clamp(22px, 4.9vw, 60px); }
.hero h1 { margin-bottom: .24em; }
.hero p { color: #dbebe1; max-width: 43ch; }
.hero .actions { margin-top: 22px; }
.hero .btn.primary { border-color: var(--gold); background: var(--gold); color: var(--deep); }
.hero .btn.secondary { border-color: #83a698; background: transparent; color: #fffdf5; }

.section { margin: 36px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 13px; }
.section-head h2 { margin: 0; }
.section-head a, .prose a, .crumb a { color: var(--green); text-decoration: underline; text-decoration-color: #81a998; text-underline-offset: .2em; }
.grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.grid.categories { grid-template-columns: repeat(5,minmax(0,1fr)); }
.card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); transition: border-color .18s, box-shadow .18s; }
.card:hover { border-color: #55967a; box-shadow: 0 5px 16px #143c2415; }
.card img { width: 100%; aspect-ratio: 1.96; background: var(--tint); }
.categories img { aspect-ratio: 1.8; }
.card-body { padding: 14px 15px 16px; }
.card h3 { font-size: 1.04rem; margin: .28em 0; overflow-wrap: anywhere; }
.card .eyebrow { color: var(--green); font-size: .77rem; font-weight: 800; }
.card small { display: block; }
.crumb { margin: 18px 0 5px; color: var(--muted); font-size: .86rem; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(17px, 3.5vw, 40px); }
.panel section + section { margin-top: 27px; }
.prose { line-height: 1.85; }
.prose p { max-width: 75ch; color: #304b3f; margin-bottom: 1em; }
.prose h2 { line-height: 1.4; color: var(--forest); }
.prose section { scroll-margin-top: 18px; }
.prose li { max-width: 74ch; }
.prose figure { margin: 20px 0; }
.prose img { width: min(100%,760px); aspect-ratio: 1.7; object-fit: cover; border-radius: 12px; margin: 20px 0 6px; }
.filters, .pagination { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.pagination a[aria-current=page] { background: var(--green); color: #fff; border-color: var(--green); }
.article-head { width: min(900px,100%); margin: 18px auto; }
.article-head h1 { font-size: clamp(1.85rem,4.5vw,3.4rem); }
.article-head .eyebrow { display: inline-block; color: var(--green); font-weight: 800; margin-bottom: 9px; }
.article-head time { color: var(--muted); font-size: .9rem; }
.article-cover { width: min(900px,100%); max-height: 390px; margin-inline: auto; overflow: hidden; border-radius: 16px; }
.article-cover img { width: 100%; aspect-ratio: 2.3; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:first-child { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.site-footer { background: var(--deep); color: #fffdf4; margin-top: 42px; padding: 24px 0; }
.foot { display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.foot a { font-size: .9rem; }
.notice { color: var(--green); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.toc { background: var(--tint); border-left: 3px solid var(--green); border-radius: 0 9px 9px 0; padding: 12px 15px; margin: 0 0 23px; }
.toc strong { display: block; margin-bottom: 3px; }
.toc a { display: block; }
.source-list a { overflow-wrap: anywhere; }

@media(max-width: 960px) {
  .top { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; padding-block: 4px 7px; }
  .grid.categories { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(max-width: 580px) {
  .wrap { width: calc(100% - 24px); }
  .top { gap: 7px; }
  .brand { width: 85px; }
  .brand img { height: 36px; }
  .account { gap: 4px; }
  .btn { min-height: 40px; padding: 5px 7px; font-size: .8rem; }
  .nav { gap: 6px 10px; }
  .nav a,.nav summary { font-size: .78rem; }
  .searchbar { margin-top: 11px; max-width: none; }
  .hero,.hero.home { display: flex; flex-direction: column; min-height: 0; border-radius: 15px; margin-top: 13px; }
  .hero-inner { align-self: stretch; padding: 20px 17px 19px; }
  .hero img { height: auto; aspect-ratio: 2.2; }
  .hero.home img { aspect-ratio: 1.85; }
  .hero .actions { margin-top: 13px; }
  .grid,.grid.categories { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .card-body { padding: 9px; }
  .card h3 { font-size: .9rem; }
  .card small { font-size: .74rem; }
  .section { margin: 25px 0; }
  .panel { border-radius: 12px; }
}
@media(prefers-reduced-motion: reduce) { .card { transition: none; } }

/* Keep the published artwork intact; its embedded lettering reaches the edges. */
.hero { grid-template-columns: minmax(0,.94fr) minmax(0,1.2fr); }
.hero.home {
  grid-template-columns: minmax(0,.73fr) minmax(0,1.27fr);
  min-height: clamp(350px,40vw,520px);
  background: radial-gradient(ellipse at 85% 0%,#235e44 0%,transparent 56%), linear-gradient(113deg,#0a2c20,#103b2a);
  border-color: #527056;
  box-shadow: 0 14px 40px #12342525;
}
.hero.home h1 { color: #fff7df; }
.hero.home .hero-inner { padding-right: 9px; }
.hero-media { display: grid; align-items: center; min-width: 0; margin: 0; padding: 16px 16px 16px 12px; }
.hero-media img { width: 100%; height: auto; object-fit: contain; border: 1px solid #86966a; border-radius: 14px; }
.hero.home .hero-media { padding: clamp(15px,2.4vw,32px); }
.hero.home .hero-media img { box-shadow: 0 10px 28px #061a13a6; }
.category-card { position: relative; border-top: 3px solid #75a68b; }
.category-card .card-body { padding-right: 28px; }
.category-art { display: grid; place-items: center; padding: 10px; background: radial-gradient(ellipse at center,#fcfcf3,#e1eee3); border-bottom: 1px solid #e1e9df; }
.category-art img { width: min(126px,100%); aspect-ratio: 1; object-fit: contain; background: transparent; }
.category-arrow { position: absolute; right: 11px; bottom: 12px; font-weight: 800; color: var(--green); }
@media(max-width:580px) {
  .hero.home { min-height: 0; }
  .hero.home .hero-inner { padding-right: 17px; }
  .hero-media,.hero.home .hero-media { padding: 0 10px 10px; }
  .hero-media img,.hero.home .hero-media img { height: auto; aspect-ratio: auto; border-radius: 9px; }
  .section-head a { font-size: .85rem; }
}

/* Image-first banners keep every part of the source artwork visible. */
.hero,.hero.home { display: flex; flex-direction: column; min-height: 0; border: 0; padding: 0; background: transparent; color: var(--ink); box-shadow: none; overflow: visible; border-radius: 0; }
.hero-media,.hero.home .hero-media { display: block; width: 100%; margin: 0; padding: 0; }
.hero-media img,.hero.home .hero-media img { width: 100%; height: auto; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.hero-inner,.hero.home .hero-inner { align-self: stretch; padding: clamp(16px,3vw,34px) 0 0; }
.hero.home h1 { color: var(--ink); }
.hero p { color: var(--muted); max-width: none; }
.hero .btn.secondary { color: var(--forest); border-color: #9cb8aa; background: var(--paper); }
.prose p,.prose li { max-width: none; }
.article-head,.article-cover { width: 100%; max-height: none; }
.article-cover img { display: block; width: 100%; height: auto; aspect-ratio: auto; }
.prose figure img { width: 100%; max-height: 460px; }

.draw-results { padding: clamp(12px,2.2vw,24px); border-radius: 17px; background: linear-gradient(120deg,#218040,#164e37); }
.draw-results > h2 { margin: 0 0 13px; border-radius: 999px; padding: 9px 15px; text-align: center; color: #231a00; background: linear-gradient(105deg,#fbc33b,#ffd479); }
.draw-body { background: #fffefb; border: 2px solid #fce4ac; border-radius: 13px; padding: clamp(8px,1.55vw,18px); max-height: 555px; overflow: auto; scrollbar-color: #237449 #fdf4df; }
.draw-group + .draw-group { margin-top: 15px; }
.draw-group h3 { text-align: center; margin: 0 0 12px; padding: 7px 9px; border: 1px solid #f2d989; border-radius: 9px; background: #fdf4dd; color: #17613b; }
.draw-feature { border-radius: 12px; background: linear-gradient(120deg,#fdf6e6,#fffefb); border: 1px solid #f4dfa9; padding: clamp(9px,1.6vw,17px); }
.draw-feature p { text-align: center; color: #17613b; font-weight: 700; }
.draw-feature dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; text-align: center; }
.draw-feature dt { font-size: .88rem; }
.draw-feature dd { margin: 3px 0 0; padding: 4px; background: #fff; border-radius: 6px; border: 1px solid #f0db9f; color: #185f3a; font-size: clamp(1rem,2.3vw,1.55rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.draw-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: clamp(.78rem,1.3vw,.95rem); }
.draw-table th,.draw-table td { padding: 6px 3px; border-bottom: 1px solid #eaf0e7; text-align: center; }
.draw-table thead th:first-child { width: 56%; }
.draw-table th:first-child { text-align: left; }
.draw-table td { color: #17613b; font-weight: 800; font-variant-numeric: tabular-nums; }
.draw-name { display: flex; gap: 7px; align-items: center; overflow-wrap: anywhere; }
.draw-name img { width: 22px; height: 22px; border-radius: 3px; flex: 0 0 auto; }
.draw-name time { display: block; font-size: .76em; color: var(--muted); font-weight: 500; }
.draw-status { margin: 9px 0 0; color: #fffdf1; font-size: .84rem; }

.site-footer { padding: 0; background: var(--deep); color: #eef5eb; }
.footer-banks { background: #e5efe5; color: var(--ink); border-bottom: 1px solid #abc4af; text-align: center; padding: clamp(28px,5vw,62px) 0; }
.footer-banks h2::after { content: ''; display: block; width: 72px; height: 2px; margin: 12px auto 0; background: linear-gradient(90deg,transparent,#dfbd6a,transparent); }
.site-footer p { color: #c7dfd0; }
.footer-banks p { color: var(--muted); }
.footer-banks img { width: min(760px,98%); height: auto; margin: 24px auto 0; }
.footer-columns { display: grid; grid-template-columns: 1fr 1.2fr .83fr; gap: clamp(15px,4vw,55px); padding-block: clamp(26px,4.5vw,54px); }
.footer-columns h2 { color: #e7f2e6; font-size: clamp(1.2rem,2vw,1.55rem); }
.footer-brand { display: inline-block; margin-bottom: 8px; }
.footer-brand img { width: 195px; height: 58px; object-fit: contain; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-links a { border: 1px solid #537b6d; border-radius: 999px; background: #163d30; padding: 5px 10px; font-size: .87rem; }
.footer-links a:hover { border-color: #e3c77b; }
.footer-actions .btn { display: flex; width: 100%; margin: 8px 0 0; border-radius: 999px; border-color: #ddba64; background: transparent; color: #ebcb78; }
.footer-actions .btn.primary { color: #201704; background: linear-gradient(150deg,#f0d184,#cea047); }
.footer-copyright { text-align: center; margin-bottom: 0; border-top: 1px solid #375e4d; padding: 12px 0; font-size: .83rem; }
@media(max-width:580px) {
 .footer-columns { grid-template-columns: 1fr; }
 .draw-body { max-height: 435px; }
}

.h1-intro { width: 100%; max-width: none; margin-top: 14px; line-height: 1.78; color: #304b3f; }
.h1-intro p:last-child { margin-bottom: 0; }
.h1-intro a { color: var(--green); text-decoration: underline; text-underline-offset: .18em; }
.prose .editorial-figure { width: 100%; max-width: none; margin: 18px 0 25px; }
.prose .editorial-figure img { display: block; width: 100%; height: auto; max-height: none; aspect-ratio: auto; object-fit: contain; margin: 0; }

/* The texture sits behind the chapter rather than interrupting the reading flow. */
.prose .chapter-backdrop {
  padding: clamp(15px,3vw,34px);
  border-radius: 12px;
  background: linear-gradient(105deg,rgba(8,38,29,.96),rgba(8,38,29,.88)), var(--chapter-art) center/cover no-repeat, var(--deep);
}
.prose .chapter-backdrop h2 { color: #fff9e6; }
.prose .chapter-backdrop p { color: #ecf6ee; }
.prose .chapter-backdrop a { color: #dbf4c7; text-decoration-color: #a9cfad; }
.prose .chapter-backdrop :focus-visible { outline-color: var(--gold); }

.prose .editorial-split {
  display: grid;
  grid-template-columns: minmax(0,1.25fr) minmax(0,1fr);
  align-items: center;
  gap: clamp(16px,3vw,38px);
}
.prose .editorial-split .editorial-figure { margin: 0; }
.prose .editorial-split p:last-child { margin-bottom: 0; }
@media (max-width: 740px) {
  .prose .editorial-split { grid-template-columns: 1fr; }
}

.branded-cover {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0c3127;
}
.branded-cover img { position: absolute; display: block; max-width: none; }
.branded-cover img:first-child { inset: 0 0 0 48%; width: 52%; height: 100%; aspect-ratio: auto; object-fit: cover; }
.branded-cover img:nth-child(2) { inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: fill; background: transparent; }
.branded-cover img:nth-child(3) { top: 8%; left: 4.6%; width: 19.4%; height: 12.3%; aspect-ratio: auto; object-fit: contain; object-position: left center; background: transparent; }
.branded-cover-title {
  position: absolute;
  inset: 25% 54% 18% 4.6%;
  display: grid;
  align-content: center;
  color: #fff9e9;
  font-family: 'IBM Plex Sans Thai',Inter,sans-serif;
  font-size: 4.2cqw;
  font-weight: 700;
  line-height: 1.36;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.prose .article-illustration img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.prose .editorial-split.image-first {
  grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
}
@media (max-width: 740px) {
  .prose .editorial-split.image-first { grid-template-columns: 1fr; }
}
