:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-2: #f0ebe1;
  --ink: #242424;
  --muted: #6c675f;
  --line: #ded7ca;
  --accent: #2f6f73;
  --accent-strong: #174f52;
  --accent-soft: #e3f0ee;
  --rose: #b75a5b;
  --moon: #ead27a;
  --shadow: 0 14px 34px rgba(53, 45, 35, 0.07);
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", "Prompt", "Leelawadee UI", Tahoma, ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.76;
}

body.nav-is-open {
  overflow: hidden;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.site-header,
.site-footer,
.page {
  margin: 0 auto;
  width: min(1120px, calc(100% - 32px));
}

.site-header {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px 0 14px;
  position: relative;
}

.brand {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
  text-decoration: none;
}

.brand img {
  display: block;
  height: auto;
  width: clamp(178px, 22vw, 272px);
}

.menu-toggle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: none;
  flex-direction: column;
  gap: 5px;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.menu-toggle span:not(.sr-only) {
  background: var(--ink);
  border-radius: 999px;
  display: block;
  height: 2px;
  width: 20px;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
  align-items: center;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  gap: 4px;
  padding: 5px;
}

.drawer-header,
.nav-section-title {
  display: none;
}

.nav-section {
  display: flex;
  gap: 4px;
}

.nav-categories {
  display: flex;
}

.site-nav a,
.back-link {
  border-radius: 999px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  min-height: 38px;
  padding: 7px 13px;
  text-decoration: none;
}

.site-nav .nav-all-posts {
  background: var(--accent-strong);
  color: #fffdf8;
  margin-left: 4px;
}

.site-nav a:hover,
.back-link:hover,
.post-card a:hover h2 {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.site-nav .nav-all-posts:hover {
  background: var(--rose);
  color: #fffdf8;
}

.nav-backdrop {
  display: none;
}

.menu-close {
  display: none;
}

.page {
  padding: 24px 0 68px;
}

.intro {
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  margin-bottom: 18px;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.kicker {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 8px;
}

.hero-picture,
.hero-picture img {
  display: block;
  width: 100%;
}

.hero-picture img {
  aspect-ratio: 1672 / 941;
  height: auto;
  max-height: 540px;
  object-fit: cover;
}

.ornament {
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.ornament-rabbit {
  flex: 0 0 auto;
  margin-left: auto;
  width: 76px;
}

.study-tools {
  align-items: end;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 0.85fr) minmax(260px, 1fr);
  margin-bottom: 28px;
  padding: 18px;
}

.category-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 28px;
  padding: 18px;
}

.category-panel-header {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.category-panel h2 {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.2;
  margin: 0;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-filter {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  min-height: 42px;
  padding: 8px 14px;
}

.category-filter:hover,
.category-filter.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fffdf8;
}

.study-tools h2,
.section-heading h2,
.post-card h2,
.post-header h1,
.archive h1,
.prose h1,
.prose h2,
.prose h3 {
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", "Prompt", "Leelawadee UI", sans-serif;
  letter-spacing: 0;
}

.study-tools h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.18;
  margin: 0;
}

.search-box {
  display: grid;
  gap: 6px;
}

.search-box span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.search-box input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  min-height: 48px;
  outline: none;
  padding: 10px 14px;
  width: 100%;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 115, 0.14);
}

.section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 0 18px;
  padding-bottom: 12px;
}

.section-heading p {
  color: var(--rose);
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

.section-heading h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.18;
  margin: 0;
}

.post-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(53, 45, 35, 0.04);
}

.post-card[hidden] {
  display: none;
}

.post-card a {
  display: flex;
  flex-direction: column;
  min-height: 265px;
  padding: 20px;
  text-decoration: none;
}

.post-card-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
}

.post-card-meta span {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-strong);
  font-weight: 800;
  padding: 3px 8px;
}

.post-card h2 {
  font-size: 25px;
  line-height: 1.26;
  margin: 18px 0 9px;
}

.post-card p,
.post-header p {
  color: var(--muted);
  margin: 0 0 14px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  padding: 3px 8px;
}

.read-more {
  color: var(--accent-strong);
  display: inline-block;
  font-size: 14px;
  font-weight: 800;
  margin-top: 14px;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  margin: 16px 0 0;
  padding: 22px;
  text-align: center;
}

.post-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  max-width: 780px;
  padding: 18px 0 28px;
}

.post-header time,
.post-card time {
  color: var(--muted);
}

.post-header h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.14;
  margin: 10px 0 12px;
}

.back-link {
  display: inline-block;
  margin: 0 0 12px -12px;
}

.prose {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 44px);
  position: relative;
  width: min(780px, 100%);
}

.post-sticker {
  float: right;
  margin: -12px -8px 14px 18px;
  max-width: 104px;
  width: 22vw;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.22;
  margin: 1.45em 0 0.55em;
}

.prose h1 {
  font-size: 34px;
}

.prose h2 {
  font-size: 28px;
}

.prose h3 {
  font-size: 22px;
}

.prose p,
.prose li {
  font-size: 18px;
}

.prose p {
  margin: 0 0 1.08em;
}

.prose img {
  border-radius: 8px;
  display: block;
  height: auto;
  margin: 22px 0;
}

.prose code {
  background: #eee8dc;
  border-radius: 4px;
  font-size: 0.95em;
  padding: 2px 5px;
}

.prose pre {
  background: #20201e;
  border-radius: 8px;
  color: #fffaf2;
  overflow-x: auto;
  padding: 16px;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

.prose blockquote {
  border-left: 4px solid var(--rose);
  color: var(--muted);
  margin: 1.5em 0;
  padding-left: 16px;
}

.archive h1 {
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.14;
  margin: 0 0 24px;
}

.category-page .kicker {
  margin-bottom: 4px;
}

.category-post-list {
  margin-top: 18px;
}

.empty-category {
  align-items: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  font-size: 20px;
  gap: 16px;
  justify-items: center;
  margin: 0;
  padding: 28px;
  text-align: center;
}

.empty-category img {
  border-radius: 8px;
  display: block;
  height: auto;
  max-width: 260px;
  width: min(72vw, 260px);
}

.empty-category p {
  margin: 0;
}

.archive-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.archive-list li {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 136px 1fr;
  padding: 14px 18px;
}

.archive-list li + li {
  border-top: 1px solid var(--line);
}

.archive-list time {
  color: var(--muted);
  font-size: 14px;
}

.archive-list a {
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  padding: 18px 0 32px;
}

.footer-brand {
  display: inline-flex;
  line-height: 0;
}

.footer-brand img {
  height: auto;
  width: 170px;
}

@media (max-width: 900px) {
  .study-tools {
    grid-template-columns: 1fr;
  }

  .post-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 16px;
  }

  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    align-items: center;
    flex-direction: row;
    gap: 12px;
  }

  .brand img {
    width: min(282px, 78vw);
  }

  .menu-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .site-nav {
    align-items: stretch;
    border-radius: 0;
    border-width: 0 0 0 1px;
    bottom: 0;
    box-shadow: -18px 0 38px rgba(36, 36, 36, 0.14);
    flex-direction: column;
    gap: 18px;
    justify-content: flex-start;
    opacity: 1;
    overflow-y: auto;
    padding: 18px;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(100%);
    transition: transform 180ms ease;
    width: min(84vw, 340px);
    z-index: 20;
  }

  .site-nav.is-open {
    pointer-events: auto;
    transform: translateX(0);
  }

  .site-nav a {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 48px;
    padding: 11px 14px;
    text-align: left;
    width: 100%;
  }

  .site-nav .nav-all-posts {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: #fffdf8;
    display: block;
    margin-left: 0;
    margin-top: 2px;
    min-height: 54px;
    padding: 13px 16px;
    text-align: center;
  }

  .drawer-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding-bottom: 14px;
  }

  .drawer-header span {
    color: var(--accent-strong);
    font-size: 20px;
    font-weight: 850;
  }

  .menu-close {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 28px;
    font-weight: 500;
    height: 42px;
    justify-content: center;
    line-height: 1;
    padding: 0 0 3px;
    width: 42px;
  }

  .nav-section {
    display: grid;
    gap: 8px;
  }

  .nav-categories {
    display: grid;
  }

  .nav-section-title {
    color: var(--rose);
    display: block;
    font-size: 13px;
    font-weight: 850;
    margin: 0 0 2px;
  }

  .nav-backdrop {
    background: rgba(36, 36, 36, 0.28);
    border: 0;
    display: block;
    inset: 0;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 180ms ease;
    z-index: 10;
  }

  .nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .page {
    padding-top: 18px;
  }

  .hero-picture img {
    aspect-ratio: 864 / 1821;
    height: min(56vh, 460px);
    object-position: center 58%;
  }

  .study-tools {
    padding: 16px;
  }

  .category-panel {
    margin-bottom: 24px;
    padding: 16px;
  }

  .category-panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .category-filters {
    flex-wrap: nowrap;
    margin: 0 -16px;
    overflow-x: auto;
    padding: 0 16px 2px;
    scroll-snap-type: x proximity;
  }

  .category-filter {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .section-heading {
    align-items: flex-start;
  }

  .ornament-rabbit {
    display: none;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .post-card a {
    min-height: 0;
  }

  .post-card h2 {
    font-size: 23px;
  }

  .post-sticker {
    max-width: 82px;
  }

  .prose p,
  .prose li {
    font-size: 17px;
  }

  .archive-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
