:root {
  --ink: #fff8f3;
  --muted: #cfc3e8;
  --deep: #120d23;
  --night: #211439;
  --violet: #6e4bd8;
  --rose: #d989b5;
  --gold: #f1c77d;
  --aqua: #8ee7df;
  --line: rgba(255, 255, 255, .16);
  --panel: rgba(255, 255, 255, .08);
  --panel-strong: rgba(255, 255, 255, .13);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Tahoma, "Noto Sans Thai", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(110, 75, 216, .28), transparent 34rem),
    linear-gradient(135deg, #0f0a1e 0%, #201235 48%, #071b2a 100%);
  color: var(--ink);
  line-height: 1.75;
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .9rem clamp(1rem, 4vw, 3rem);
  background: rgba(14, 9, 28, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  min-width: 12rem;
}
.brand img { width: 3.25rem; height: 3.25rem; object-fit: contain; }
.brand strong, .brand em { display: block; font-style: normal; line-height: 1.25; }
.brand strong { font-size: .98rem; }
.brand em { color: var(--muted); font-size: .82rem; }
.site-header nav { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.site-header nav a, .btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .68rem .9rem;
  text-decoration: none;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.site-header nav a { color: var(--muted); background: rgba(255,255,255,.05); }
main { width: min(1160px, calc(100% - 2rem)); margin: 0 auto; }
.hero {
  min-height: calc(100vh - 5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(18rem, .72fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(1.5rem, 5vw, 4rem) 0;
}
.index-hero { min-height: 92vh; }
.hero h1 {
  font-size: clamp(2.25rem, 6vw, 5.7rem);
  line-height: 1.04;
  margin: .35rem 0 1rem;
  letter-spacing: 0;
}
.article-hero h1 { font-size: clamp(2rem, 5.2vw, 4.8rem); }
.lead { color: #ede5ff; font-size: clamp(1.05rem, 2vw, 1.36rem); max-width: 48rem; }
.eyebrow {
  color: var(--aqua);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .08em;
  font-size: .78rem;
  margin: 0;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.4rem; }
.btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: #170d22;
  border: 0;
  font-weight: 800;
}
.btn.ghost { background: var(--panel); color: var(--ink); }
.portrait-frame {
  margin: 0;
  position: relative;
}
.portrait-frame img {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 2rem 5rem rgba(0,0,0,.42);
}
.portrait-frame figcaption {
  color: var(--muted);
  font-size: .9rem;
  margin-top: .7rem;
}
.breadcrumb { padding-top: 1.2rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; font-size: .94rem; }
.breadcrumb a { color: var(--aqua); text-decoration: none; }
.article-shell section, .toc-section, .answer-box, .sound-panel, .site-footer {
  margin: 1.2rem 0;
}
.answer-box, .keyword-card, .sound-panel {
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.8rem);
}
h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); line-height: 1.25; margin: .1rem 0 .8rem; }
h3 { font-size: 1.15rem; margin: 1rem 0 .3rem; color: #fff; }
p { margin: .4rem 0 1rem; }
.content-grid, .image-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1.2rem;
  align-items: start;
}
.keyword-card { position: sticky; top: 6rem; }
.chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.chips a {
  text-decoration: none;
  color: #140e21;
  background: var(--gold);
  border-radius: 999px;
  padding: .34rem .7rem;
  font-weight: 700;
  font-size: .9rem;
}
.step-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  padding: 0;
  counter-reset: steps;
  list-style: none;
}
.step-list li {
  counter-increment: steps;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}
.step-list li::before {
  content: counter(steps);
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-right: .55rem;
  border-radius: 50%;
  background: var(--aqua);
  color: #071b2a;
  font-weight: 800;
}
.image-band {
  grid-template-columns: 18rem minmax(0, 1fr);
  align-items: center;
  background: rgba(9, 22, 35, .5);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}
.image-band img {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
}
.text-link { color: var(--aqua); font-weight: 800; }
.faq-section details {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: .9rem 1rem;
  margin: .7rem 0;
}
.faq-section summary { cursor: pointer; font-weight: 800; color: #fff; }
.related-grid, .sound-grid, .toc-grid {
  display: grid;
  gap: .8rem;
}
.related-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.related-grid a, .sound-card, .toc-item, .channel-list a {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: .9rem;
  text-decoration: none;
}
.related-grid span, .sound-card span, .toc-item span, .channel-list span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
}
.sound-panel {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 1rem;
  align-items: center;
}
.sound-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-head { max-width: 48rem; }
.toc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.toc-item strong { display: block; line-height: 1.45; }
.site-footer {
  width: min(1160px, calc(100% - 2rem));
  margin: 2rem auto 0;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}
.site-footer > div:first-child { display: flex; gap: 1rem; align-items: center; }
.channel-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.small { color: var(--muted); font-size: .9rem; }
@media (max-width: 900px) {
  .site-header { position: static; align-items: flex-start; flex-direction: column; }
  .site-header nav { justify-content: flex-start; }
  .hero, .content-grid, .image-band, .sound-panel { grid-template-columns: 1fr; }
  .portrait-frame { max-width: 28rem; }
  .keyword-card { position: static; }
  .related-grid, .sound-grid, .toc-grid, .channel-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  main, .site-footer { width: min(100% - 1rem, 1160px); }
  .hero { min-height: auto; padding-top: 1rem; }
  .hero h1 { font-size: 2.18rem; }
  .site-header nav a, .btn { width: 100%; }
  .hero-actions, .site-header nav { width: 100%; }
  .step-list, .related-grid, .sound-grid, .toc-grid, .channel-list { grid-template-columns: 1fr; }
  .brand strong { font-size: .9rem; }
  .brand em { font-size: .78rem; }
}
