/*
Theme Name: RunThaiHub
Theme URI: https://runthaihub.com
Author: RunThaiHub
Description: ธีมปฏิทินงานวิ่งประเทศไทย — พอร์ตจากดีไซน์ที่อนุมัติแล้ว (design-preview)
Version: 1.0.2
Requires at least: 6.0
Requires PHP: 7.4
License: Proprietary
Text Domain: runthaihub
*/

/* Run Thailand — design preview (mockup only, not production code) */

:root {
  /* ส้มเข้ม ผ่าน WCAG AA บนพื้นขาว (5.18:1) จึงใช้เป็นสีตัวหนังสือและพื้นปุ่มได้ */
  --brand: #c2410c;
  --brand-dark: #9a3412;
  --brand-light: #ffedd5;
  --accent: #c2410c;
  --accent-light: #ffedd5;
  /* ส้มสด ใช้เฉพาะงานตกแต่งที่ไม่มีตัวหนังสือทับ เช่น เส้นเน้น แสง */
  --accent-bright: #f97316;
  --ink-deep: #0b1220;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-mute: #94a3b8;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --wrap: 1140px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Sarabun", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.65;
}

img { max-width: 100%; display: block; }
/* WordPress แปลงอีโมจิเป็นรูปภาพบนบางเบราว์เซอร์ จึงต้องล็อกขนาด
   ไม่ให้ไอคอนปฏิทิน/หมุดขยายตามขนาดไฟล์ต้นฉบับจนดันการ์ดสูงผิดปกติ */
img.emoji {
  display: inline-block; width: 1em; height: 1em;
  margin: 0 .05em; vertical-align: -.1em;
}
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-bar {
  display: flex; align-items: center; gap: 12px;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.0625rem; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent-bright) 100%);
  display: grid; place-items: center; color: #fff; font-size: 15px;
}
.logo-text { letter-spacing: -0.02em; }
.logo-text span { color: var(--brand); }

.nav { display: none; margin-inline-start: auto; gap: 4px; }
.nav a {
  padding: 8px 12px; border-radius: 8px; font-size: .9375rem;
  color: var(--ink-soft); font-weight: 500;
}
.nav a:hover { background: var(--bg-soft); color: var(--ink); }
/* aria-current="page" = ลิงก์นี้คือหน้าที่เปิดอยู่จริง
   is-section = หน้าลูกที่อยู่ใต้หมวดนี้ (เช่น หน้ารายละเอียดงานอยู่ใต้ "งานวิ่งทั้งหมด")
   แยกกันเพราะ aria-current="page" กับหน้าลูกจะบอก screen reader ผิด */
.nav a[aria-current="page"],
.nav a.is-section { color: var(--brand); font-weight: 600; }

.header-cta { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; cursor: pointer;
}
.menu-btn span { display: block; width: 17px; height: 2px; background: var(--ink); box-shadow: 0 -5px 0 var(--ink), 0 5px 0 var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: .9375rem;
  border: 1px solid transparent; cursor: pointer; transition: .16s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--brand-dark); }
.btn-outline { border-color: var(--line); background: #fff; color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .875rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  color: #fff;
  padding: 44px 0 52px;
  background: var(--ink-deep); /* สีสำรอง เผื่อภาพยังโหลดไม่เสร็จ */
}

/* ชั้นภาพ เร่งความอิ่มสีกับคอนทราสต์ให้ท้องฟ้าตอนเช้าชัดขึ้น */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("img/og-default.jpg") center 58% / cover no-repeat;
  filter: saturate(1.2) contrast(1.08);
}

/* ชั้นม่านสี เส้นความเร็ว และเกรน วางทับภาพทั้งหมด */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    /* เกรนละเอียด กัน gradient เป็นแถบสี (banding) และให้สัมผัสแบบงานพิมพ์ */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E"),
    /* เส้นเฉียงห่าง ๆ ให้ความรู้สึกเคลื่อนที่ไปข้างหน้าแบบกีฬา
       ต้องจางมาก ไม่งั้นอ่านเป็นเม็ดฝนหรือรอยขีดบนฟิล์ม */
    repeating-linear-gradient(114deg,
      rgba(255,255,255,.022) 0px, rgba(255,255,255,.022) 1px,
      transparent 1px, transparent 26px),
    /* แสงส้มมุมขวาบน รับกับดวงอาทิตย์ในภาพ */
    radial-gradient(760px 420px at 88% 0%, rgba(249,115,22,.42), transparent 60%),
    /* แสงส้มเข้มมุมซ้ายล่าง ทำให้ตัวเลขสถิติมีฐานสีรองรับ */
    radial-gradient(600px 440px at -4% 104%, rgba(194,65,12,.34), transparent 62%),
    /* กดขอบบนล่างให้เข้ม ตัวหนังสือกับตัวเลขสถิติจึงลอยขึ้นมา */
    linear-gradient(to bottom,
      rgba(6,9,16,.5) 0%, transparent 22%,
      transparent 58%, rgba(6,9,16,.6) 100%),
    /* ม่านทแยงหลัก เข้มฝั่งซ้ายที่วางตัวหนังสือ แล้วค่อยเปิดให้เห็นถนนฝั่งขวา */
    linear-gradient(104deg,
      rgba(8,12,20,.96) 0%,
      rgba(13,19,31,.92) 40%,
      rgba(20,28,44,.82) 70%,
      rgba(28,37,56,.7) 100%);
}
.hero > .wrap { position: relative; z-index: 2; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 5px 12px; border-radius: 999px; font-size: .8125rem; font-weight: 500;
  margin-bottom: 14px; backdrop-filter: blur(6px);
}
.hero-eyebrow img.emoji { display: inline-block; width: 1em; height: 1em; margin: 0; }
.hero h1 { font-size: 1.875rem; margin-bottom: 12px; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; color: #fdba74; }
.hero-sub { color: rgba(255,255,255,.94); font-size: 1rem; max-width: 46ch; margin-bottom: 22px; }
.hero .search-card { margin-top: 24px; }
.search-submit { min-height: 46px; }

.search-card {
  background: #fff; border-radius: var(--radius); padding: 12px;
  /* เงาสองชั้น ชั้นใกล้ให้ขอบคม ชั้นไกลให้ลอยเหนือภาพพื้นหลัง */
  box-shadow:
    0 2px 6px rgba(6, 9, 16, .22),
    0 20px 44px -14px rgba(6, 9, 16, .6);
  display: grid; gap: 8px;
}
.field { display: grid; gap: 5px; }
.field label { font-size: .75rem; font-weight: 600; color: var(--ink-soft); padding-inline-start: 2px; }
.field input, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font: inherit; font-size: .9375rem;
  color: var(--ink); background: #fff; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 11px;
  padding-inline-end: 32px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }

/* ปุ่มลัดเลือกระยะทาง — ทางลัดที่นักวิ่งใช้จริง และเป็นลิงก์ภายในให้หน้าระยะทาง */
.quick-distance {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; flex-wrap: wrap;
}
.quick-label {
  font-size: .8125rem; font-weight: 600;
  color: rgba(255,255,255,.72); margin-inline-end: 2px;
}
.quick-distance a {
  /* 44px คือขนาดพื้นที่กดขั้นต่ำที่ Apple แนะนำ ต่ำกว่านี้บนมือถือจะกดพลาดบ่อย */
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 6px 16px; border-radius: 999px;
  font-size: .875rem; font-weight: 600; color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.26);
  backdrop-filter: blur(6px);
  transition: .16s ease;
}
.quick-distance a:hover {
  background: var(--accent-bright); border-color: var(--accent-bright);
  transform: translateY(-1px);
}

.hero-stats { display: flex; gap: 0; margin-top: 24px; flex-wrap: wrap; }
.hero-stat { padding-inline: 18px; }
.hero-stat:first-child { padding-inline-start: 0; }
/* เส้นคั่นบาง ๆ แทนการเว้นช่องว่างเฉย ๆ ให้อ่านเป็นกลุ่มตัวเลขชุดเดียวกัน */
.hero-stat + .hero-stat { border-inline-start: 1px solid rgba(255,255,255,.22); }
.hero-stat strong { display: block; font-size: 1.375rem; font-weight: 800; letter-spacing: -0.01em; }
.hero-stat span { font-size: .8125rem; color: rgba(255,255,255,.86); }

/* ---------- Sections ---------- */
.section { padding: 40px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head p { color: var(--ink-soft); font-size: .9375rem; margin-top: 4px; }
.section-link { color: var(--brand); font-weight: 600; font-size: .875rem; white-space: nowrap; }
.section-link:hover { text-decoration: underline; }

/* ---------- Event cards ---------- */
.card-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }

.event-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: .18s ease;
}
.event-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #cbd5e1; }
.event-media { position: relative; aspect-ratio: 16 / 9; background: var(--brand-light); }
/* วางรูปแบบ absolute เพื่อตัดความสูงตามธรรมชาติของรูปออกจากการคำนวณ
   ไม่งั้น .event-card ที่เป็น flex column จะใช้ min-height:auto ดันกรอบให้สูงตามรูป
   ทำให้การ์ดที่ใช้รูป 4:3 สูงไม่เท่ารูป 16:9 ในแถวเดียวกัน */
.event-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.event-badges { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  font-size: .6875rem; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: rgba(15,23,42,.72); color: #fff; backdrop-filter: blur(4px);
}
/* สามป้ายนี้ต้องแยกออกจากกันได้ในขนาด 11px จึงใช้คนละน้ำหนักสี
   ไม่ใช่ส้มกับแดงที่อยู่ติดกันในวงล้อสี */
.badge-new { background: var(--accent); }          /* ส้ม — งานใหม่ */
.badge-hot { background: #111827; }                /* ดำเข้ม — ยอดนิยม */
.badge-soon { background: #b91c1c; }               /* แดง — ใกล้ปิดรับสมัคร */

.event-body { padding: 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.event-date {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8125rem; font-weight: 600; color: var(--brand);
}
.event-card h3 { font-size: 1rem; }
.event-meta { display: flex; flex-direction: column; gap: 5px; font-size: .8125rem; color: var(--ink-soft); }
.event-meta span { display: flex; align-items: center; gap: 6px; }
.icon { flex: none; width: 14px; height: 14px; opacity: .65; }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 6px;
  background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--line);
}
.event-foot {
  margin-top: auto; padding-top: 11px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.price { font-size: .875rem; font-weight: 700; }
/* ใช้ --ink-soft ไม่ใช่ --ink-mute เพราะที่ 11px สีเทาอ่อนได้คอนทราสต์แค่ 2.56:1 ตกมาตรฐาน AA */
.price small { display: block; font-size: .6875rem; font-weight: 500; color: var(--ink-soft); }

/* ---------- Compact list (ใกล้วันแข่ง) ---------- */
.deadline-list { display: grid; gap: 10px; }
.deadline-item {
  /* บนจอแคบให้ห่อบรรทัดได้ ป้ายสถานะจะตกไปบรรทัดใหม่
     แทนที่จะบีบชื่องานจนตกบรรทัด (ยกเลิกการห่อที่ 640px ขึ้นไป) */
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 13px; row-gap: 9px; padding: 13px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: .16s ease;
}
.deadline-item:hover { border-color: var(--brand); }
.date-block {
  flex: none; width: 54px; text-align: center; padding: 7px 0;
  background: var(--brand-light); border-radius: 9px; color: var(--brand-dark);
}
.date-block strong { display: block; font-size: 1.25rem; line-height: 1; }
.date-block span { font-size: .6875rem; font-weight: 600; }
.deadline-info { min-width: 0; flex: 1 1 58%; }
.deadline-info h3 { font-size: .9375rem; margin-bottom: 3px; }
.deadline-info p { font-size: .8125rem; color: var(--ink-soft); }
.countdown {
  flex: none; font-size: .75rem; font-weight: 700; color: #b91c1c;
  background: #fef2f2; border: 1px solid #fecaca; padding: 4px 9px; border-radius: 7px;
  /* 67px = ความกว้างช่องวันที่ (54px) + ระยะห่าง (13px) ให้ตรงคอลัมน์กับชื่องาน */
  margin-inline-start: 67px;
}

/* ---------- Province / type tiles ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  position: relative; border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 4 / 3; background: #0f172a;
}
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: .74; transition: .3s ease; }
.tile:hover img { opacity: .6; transform: scale(1.04); }
.tile-label {
  position: absolute; inset-inline: 0; bottom: 0; padding: 11px;
  background: linear-gradient(to top, rgba(2,6,23,.88), transparent);
  color: #fff;
}
.tile-label strong { display: block; font-size: .9375rem; }
.tile-label span { font-size: .75rem; color: rgba(255,255,255,.78); }

.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.type-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px; transition: .16s ease;
}
.type-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.type-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-light); font-size: 19px; margin-bottom: 9px;
}
.type-card h3 { font-size: .9375rem; margin-bottom: 3px; }
.type-card p { font-size: .8125rem; color: var(--ink-soft); }

/* ---------- Articles ---------- */
.article-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.article-card { display: flex; gap: 13px; }
.article-card .thumb {
  flex: none; width: 104px; aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft);
}
.article-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Featured images are rendered by home.php. Hide the legacy generated cover
   that may still be injected through WordPress Additional CSS. */
body.blog .article-card::before { content: none !important; display: none !important; }
.article-body { min-width: 0; }
.article-cat { font-size: .75rem; font-weight: 700; color: var(--accent); }
.article-card h3 { font-size: .9375rem; margin: 3px 0 5px; }
.article-byline { display:flex; flex-wrap:wrap; gap:8px 18px; color:var(--ink-soft); font-size:.8125rem; }
.article-byline a { color:var(--brand); font-weight:700; }
.article-review-note { margin-top:36px; padding:18px 20px; border-left:3px solid var(--accent); background:var(--bg-soft); border-radius:0 var(--radius-sm) var(--radius-sm) 0; color:var(--ink-soft); font-size:.875rem; }
.article-related { margin-top:36px; padding:20px 22px; border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:var(--radius-sm); background:var(--bg-soft); }
.article-related h2 { margin:0 0 12px; font-size:1.2rem; }
.article-related ul { margin:0; padding-left:20px; }
.article-related li + li { margin-top:7px; }
.article-related a { color:var(--accent-dark); font-weight:650; }
.article-card time { font-size: .75rem; color: var(--ink-mute); }

/* ---------- Organizer CTA ---------- */
.cta-band {
  /* เดิมไล่ไปหาเขียวมรกต ตกค้างจากพาเลตเก่า เปลี่ยนเป็นไล่ไปหาส้มเข้มให้ตรงพาเลตปัจจุบัน */
  background: linear-gradient(135deg, #0f172a 0%, #7c2d12 100%);
  color: #fff; border-radius: var(--radius); padding: 28px 20px; text-align: center;
}
.cta-band h2 { font-size: 1.375rem; margin-bottom: 9px; }
.cta-band p { color: rgba(255,255,255,.82); font-size: .9375rem; margin-bottom: 20px; max-width: 52ch; margin-inline: auto; }
.cta-actions { display: grid; gap: 9px; }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 36px 0 22px; margin-top: 8px; }
.footer-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
.footer-brand .logo { color: #fff; margin-bottom: 11px; }
.footer-brand p { font-size: .875rem; color: #94a3b8; max-width: 40ch; }
.footer-col h3 { font-size: .875rem; color: #fff; margin-bottom: 11px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { font-size: .875rem; color: #94a3b8; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #1e293b; margin-top: 26px; padding-top: 18px;
  display: flex; flex-direction: column; gap: 9px;
  font-size: .8125rem; color: #64748b;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { padding: 13px 0; font-size: .8125rem; color: var(--ink-soft); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; }
.breadcrumb li::after { content: "›"; margin-inline-start: 7px; color: var(--ink-mute); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }

/* ---------- Event detail ---------- */
.detail-hero { position: relative; aspect-ratio: 16 / 9; background: var(--brand-light); }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }

.detail-title-block { padding: 20px 0 8px; }
.detail-title-block h1 { font-size: 1.5rem; margin-bottom: 10px; }
.detail-tagline { color: var(--ink-soft); font-size: .9375rem; }

.key-facts { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 18px 0; }
.fact { background: #fff; padding: 13px 15px; display: flex; gap: 11px; align-items: flex-start; }
.fact-label { font-size: .75rem; color: var(--ink-mute); font-weight: 600; }
.fact-value { font-size: .9375rem; font-weight: 600; }
.fact-value small { display: block; font-weight: 400; font-size: .8125rem; color: var(--ink-soft); }

.detail-body { display: grid; gap: 26px; }
.prose h2 { font-size: 1.1875rem; margin: 22px 0 10px; }
.prose h3 { font-size: 1rem; margin: 18px 0 7px; }
.prose p { color: var(--ink-soft); margin-bottom: 11px; font-size: .9375rem; }
.prose ul { color: var(--ink-soft); font-size: .9375rem; padding-inline-start: 20px; margin: 0 0 11px; }
.prose li { margin-bottom: 5px; }

.dist-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.dist-table th, .dist-table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); }
.dist-table th { background: var(--bg-soft); font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.dist-table td:last-child { font-weight: 700; white-space: nowrap; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }

.register-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 17px;
  background: #fff; box-shadow: var(--shadow);
}
.register-card .price-big { font-size: 1.5rem; font-weight: 800; }
.register-card .price-note { font-size: .8125rem; color: var(--ink-soft); margin-bottom: 14px; }
.register-note { font-size: .75rem; color: var(--ink-mute); margin-top: 10px; text-align: center; }
.reg-status {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600;
  /* เดิมเป็นเขียว/พื้นเขียวอ่อน เปลี่ยนเป็นดำเข้มให้เข้าพาเลตใหม่
     ปกติเขียวสื่อ "เปิด" ได้ชัดที่สุด ถ้าต้องการความหมายนั้นคืนมา แก้เฉพาะบรรทัดนี้ */
  color: #f8fafc; background: #111827; padding: 4px 10px; border-radius: 999px; margin-bottom: 11px;
}
.reg-status.closing { color: #fff; background: #b91c1c; }


.organizer-box {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px;
  display: flex; gap: 12px; align-items: center;
}
.organizer-avatar {
  width: 44px; height: 44px; border-radius: 11px; flex: none;
  background: var(--brand-light); display: grid; place-items: center; font-size: 19px;
}

/* sticky mobile register bar */
.sticky-cta {
  position: sticky; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.sticky-cta .price { flex: none; }
.sticky-cta .btn { flex: 1; }

/* ---------- Mockup notice ---------- */
.mock-note {
  background: #fffbeb; border-bottom: 1px solid #fde68a; color: #92400e;
  font-size: .8125rem; padding: 8px 0; text-align: center;
}
.mock-note a { text-decoration: underline; font-weight: 600; }

/* ---------- หัวหน้าเพจ (หน้ารวมรายการ) ---------- */
.page-head { padding: 22px 0 4px; }
.page-head h1 { margin-bottom: 10px; }
/* Thai glyphs need extra vertical room when the article archive title wraps. */
body.blog .page-head h1 {
  font-size: clamp(2rem, 8.8vw, 3.25rem) !important;
  line-height: 1.18 !important;
  letter-spacing: -0.025em !important;
}
.legal-page, .contact-page { max-width:780px; padding-bottom:64px; }
.contact-form { display:grid; gap:16px; margin-top:28px; }
.contact-form p { display:grid; gap:7px; }
.contact-form label { font-weight:700; }
.contact-form input[type="text"], .contact-form input[type="email"], .contact-form textarea { width:100%; padding:12px 14px; border:1px solid var(--line); border-radius:var(--radius-sm); background:#fff; color:var(--ink); font:inherit; }
.contact-form input:focus, .contact-form textarea:focus { outline:3px solid color-mix(in srgb, var(--accent) 24%, transparent); border-color:var(--accent); }
.contact-form .consent-check { display:flex; align-items:flex-start; gap:9px; font-weight:400; }
.form-honeypot { position:absolute; left:-9999px; }
.form-message { padding:14px 16px; border-radius:var(--radius-sm); margin-top:18px; }
.form-message.is-success { background:#e8f7ef; color:#155b37; }
.form-message.is-error { background:#fff0ed; color:#8b271b; }
.cookie-consent { position:fixed; z-index:99999; left:20px; right:20px; bottom:20px; max-width:760px; margin:auto; padding:16px 18px; border:1px solid var(--line); border-radius:var(--radius); background:#fff; box-shadow:0 14px 45px rgba(15,23,42,.18); display:flex; align-items:center; justify-content:space-between; gap:18px; }
.cookie-consent[hidden] { display:none; }
.cookie-consent p { font-size:.8125rem; color:var(--ink-soft); }
.cookie-consent p a { color:var(--brand); text-decoration:underline; }
.cookie-consent > div { display:flex; gap:8px; flex:none; }
@media (max-width:640px) { .cookie-consent { left:10px; right:10px; bottom:10px; align-items:stretch; flex-direction:column; } .cookie-consent > div .btn { flex:1; } }
.page-lead { color: var(--ink-soft); font-size: .9375rem; max-width: 68ch; margin-bottom: 8px; }
.page-lead a { color: var(--brand); font-weight: 600; }
.page-lead a:hover { text-decoration: underline; }

/* ---------- เกี่ยวกับเรา ---------- */
.about-page { padding-bottom: 64px; }
.about-intro { padding-top: 20px; }
.about-intro h1 { margin-bottom: 8px; }
.about-intro > p { max-width: 72ch; color: var(--ink-soft); }
.about-stats {
  display: grid; margin-top: 24px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.about-stats > div { padding: 16px; background: #fff; border-bottom: 1px solid var(--line); }
.about-stats > div:last-child { border-bottom: 0; }
.about-stats span, .about-stats small { display: block; color: var(--ink-soft); }
.about-stats span { font-size: .75rem; font-weight: 600; }
.about-stats strong { display: block; margin: 3px 0 1px; font-size: 1rem; }
.about-stats small { font-size: .75rem; }
.about-content { max-width: var(--wrap); padding-top: 54px; }
.about-content section + section { margin-top: 24px; }
.about-content h2 { margin-bottom: 8px; }
.about-content .about-notice {
  margin: 16px 0 0; padding: 14px 16px;
  border-inline-start: 4px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-soft); color: var(--ink-soft); font-size: .9375rem;
}
.about-content .btn { margin-top: 8px; }

/* ---------- ฮีโร่หน้ารวมงานวิ่ง ---------- */
.races-hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding: 40px 0 44px; color: #fff; background: var(--ink-deep);
}
.races-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: url("img/og-default.jpg") center 58% / cover no-repeat;
  filter: saturate(.8) contrast(1.08);
}
.races-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(100deg, rgba(7,11,19,.96), rgba(14,20,31,.78));
}
.races-hero h1 { margin-bottom: 8px; }
.races-hero > .wrap > p { color: rgba(255,255,255,.86); max-width: 60ch; margin-bottom: 22px; }

/* ---------- แถบตัวกรอง ---------- */
.filter-section { padding: 16px 0 0; }
.filter-bar {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
  display: grid; gap: 8px;
}
.filter-actions { display: grid; }
.filter-actions .btn { width: 100%; }

/* ---------- แถวสรุปผลลัพธ์ ---------- */
.results-bar {
  display: flex; align-items: end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.results-count { font-size: 1.125rem; }
.sort-field { min-width: 210px; }

/* ---------- แบ่งหน้า ---------- */
.pagination { margin-top: 28px; display: grid; gap: 12px; justify-items: center; }
.page-info { font-size: .8125rem; color: var(--ink-soft); }
.pagination ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.page-link {
  /* 44px คือขนาดพื้นที่กดขั้นต่ำที่ Apple แนะนำ ตัวเลขหน้าเล็กกว่านี้จะกดพลาดบนมือถือ */
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; background: #fff; color: var(--ink);
  transition: .16s ease;
}
.page-link:hover { border-color: var(--brand); color: var(--brand); }
.page-link.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-link.is-disabled { color: var(--ink-mute); background: var(--bg-soft); cursor: not-allowed; }
.page-link.is-disabled:hover { border-color: var(--line); color: var(--ink-mute); }

/* ---------- ตัวกรองที่เลือกอยู่ ---------- */
.active-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.active-label { font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-light); color: var(--brand-dark);
  border-radius: 999px; padding: 4px 4px 4px 12px;
  font-size: .8125rem; font-weight: 600;
}
.filter-chip button {
  display: grid; place-items: center; width: 24px; height: 24px;
  border: 0; border-radius: 999px; background: transparent;
  color: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
.filter-chip button:hover { background: rgba(154, 52, 18, .16); }
.clear-filters { font-size: .8125rem; font-weight: 600; color: var(--brand); }
.clear-filters:hover { text-decoration: underline; }

/* ---------- สถานะเมื่อไม่พบผลลัพธ์ ---------- */
.empty-state {
  border: 1px dashed #cbd5e1; border-radius: var(--radius);
  background: var(--bg-soft); padding: 40px 20px; text-align: center;
}
.empty-icon { font-size: 30px; display: block; margin-bottom: 10px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state > p { color: var(--ink-soft); font-size: .9375rem; max-width: 46ch; margin: 0 auto 18px; }
.empty-actions { display: grid; gap: 8px; justify-content: center; margin-bottom: 20px; }
.empty-suggest {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  align-items: center; font-size: .875rem; color: var(--ink-soft);
}
.empty-suggest a { color: var(--brand); font-weight: 600; }
.empty-suggest a:hover { text-decoration: underline; }

/* ---------- ปฏิทินงานวิ่ง ---------- */
.month-nav-section { padding: 16px 0 0; }
.month-nav {
  /* บนมือถือเลื่อนแนวนอนได้ ไม่ตัดบรรทัด เพื่อไม่ให้กินความสูงจอ */
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin;
}
.month-nav a {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: .875rem; font-weight: 600; white-space: nowrap;
  transition: .16s ease;
}
.month-nav a:hover { border-color: var(--brand); color: var(--brand); }
.month-nav a span {
  display: grid; place-items: center; min-width: 22px; height: 22px;
  border-radius: 999px; background: var(--brand-light); color: var(--brand-dark);
  font-size: .75rem; font-weight: 700;
}

.month-block { margin-bottom: 32px; }
.month-block:last-of-type { margin-bottom: 0; }
.month-head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 10px; margin-bottom: 12px;
  border-bottom: 2px solid var(--line);
  /* เว้นที่ให้ header ที่ปักหมุดอยู่ ไม่ให้บังหัวเดือนตอนกดลิงก์ข้ามเดือน */
  scroll-margin-top: 76px;
}
.month-head h2 { font-size: 1.25rem; }
.month-count { font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.month-block { scroll-margin-top: 76px; }

/* สามสถานะการรับสมัคร ต่อยอดจาก .countdown เดิม (ค่าเริ่มต้น = ใกล้ปิด สีแดง) */
.countdown.is-open { color: #f8fafc; background: #111827; border-color: #111827; }
.countdown.is-closed { color: var(--ink-soft); background: var(--bg-soft); border-color: var(--line); }

.cal-note {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: .875rem; color: var(--ink-soft);
}
.cal-note a { color: var(--brand); font-weight: 600; }
.cal-note a:hover { text-decoration: underline; }

/* กล่องชี้ไปบทความกลาง สำหรับเนื้อหาที่ใช้ร่วมกันหลายจังหวัด
   แยกออกจากย่อหน้าปกติเพื่อไม่ให้เนื้อหาซ้ำกันข้ามหน้าจังหวัด */
.prose-aside {
  margin-top: 14px; padding: 12px 14px;
  background: var(--bg-soft); border-inline-start: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .875rem; color: var(--ink-soft);
}
.prose-aside a { color: var(--brand); font-weight: 600; }
.prose-aside a:hover { text-decoration: underline; }

/* ---------- SEO article ---------- */
.article-page { padding-bottom: 56px; }
.article-hero { padding-top: 20px; }
.article-hero-copy { max-width: 800px; margin-bottom: 22px; }
.article-kicker {
  display: inline-flex; margin-bottom: 10px; padding: 5px 11px;
  border-radius: 999px; background: var(--brand-light); color: var(--brand-dark);
  font-size: .75rem; font-weight: 700;
}
.article-hero h1 {
  max-width: 20ch; font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.16; letter-spacing: -.035em; margin-bottom: 14px;
}
.article-deck { max-width: 62ch; color: var(--ink-soft); font-size: 1.0625rem; }
.article-byline {
  display: flex; flex-wrap: wrap; gap: 5px 18px; margin-top: 18px;
  color: var(--ink-soft); font-size: .8125rem;
}
.article-byline span + span::before { content: "•"; margin-inline-end: 18px; color: var(--ink-mute); }
.article-cover {
  margin: 0; overflow: hidden; border-radius: var(--radius);
  background: var(--bg-soft); aspect-ratio: 16 / 8;
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-layout { display: grid; gap: 28px; padding-top: 32px; }
.article-toc {
  display: grid; gap: 0; padding: 16px;
  align-self: start; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg-soft);
}
.article-toc strong { margin-bottom: 8px; font-size: .875rem; }
.article-toc a {
  padding: 7px 0; border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: .8125rem;
}
.article-toc a:hover { color: var(--brand); }
.article-toc--offset { margin-bottom: 24px; }
.article-content { max-width: 760px; min-width: 0; }
.article-content > *:first-child { margin-top: 0; }
.article-content h2 { font-size: 1.5rem; margin-top: 38px; scroll-margin-top: 84px; }
.article-content h3 { font-size: 1.0625rem; margin-top: 24px; }
.article-content p, .article-content ul { font-size: 1rem; line-height: 1.8; }
.article-intro { color: var(--ink) !important; font-size: 1.125rem !important; font-weight: 500; }
.article-callout {
  margin: 24px 0; padding: 18px 20px;
  border: 1px solid #fed7aa; border-radius: var(--radius-sm); background: #fff7ed;
}
.article-callout strong { display: block; color: var(--brand-dark); margin-bottom: 4px; }
.article-callout p { margin: 0; color: var(--ink-soft); }
.article-table-wrap { overflow-x: auto; margin: 18px 0 26px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.article-table { width: 100%; border-collapse: collapse; min-width: 540px; font-size: .9375rem; }
.article-table th, .article-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.article-table th { background: var(--bg-soft); font-weight: 700; }
.article-table tbody tr:last-child td { border-bottom: 0; }
.check-list { list-style: none; padding: 0 !important; }
.check-list li { position: relative; padding-inline-start: 30px; margin-bottom: 9px; }
.check-list li::before {
  content: "✓"; position: absolute; inset-inline-start: 0; top: 1px;
  display: grid; place-items: center; width: 21px; height: 21px;
  border-radius: 50%; background: var(--brand-light); color: var(--brand-dark);
  font-size: .75rem; font-weight: 800;
}
.article-next {
  display: grid; gap: 18px; margin: 36px 0; padding: 24px;
  border-radius: var(--radius); background: var(--ink-deep); color: #fff;
}
.article-next span { color: #fdba74; font-size: .8125rem; font-weight: 700; }
.article-next strong { display: block; margin-top: 3px; font-size: 1.25rem; }
.article-next p { margin: 5px 0 0; color: rgba(255,255,255,.76); font-size: .875rem; }
.faq-list { display: grid; gap: 9px; }
.faq-list details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.faq-list summary { padding: 14px 16px; cursor: pointer; font-weight: 700; }
.faq-list details p { margin: 0; padding: 0 16px 15px; }
.article-sources { margin-top: 38px; padding-top: 18px; border-top: 1px solid var(--line); }
.article-sources h2 { margin-top: 0; font-size: 1.125rem; }
.article-sources a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Articles index ---------- */
.articles-masthead {
  padding: 38px 0 42px;
  background:
    radial-gradient(500px 220px at 92% 0%, rgba(249,115,22,.16), transparent 70%),
    linear-gradient(135deg, #fff7ed 0%, #fff 58%);
  border-bottom: 1px solid var(--line);
}
.articles-masthead h1 {
  max-width: 21ch; margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.15; letter-spacing: -.035em;
}
.articles-masthead p { max-width: 62ch; color: var(--ink-soft); font-size: 1.0625rem; }
.articles-list-section { padding-top: 32px; }
.articles-toolbar {
  display: flex; flex-direction: column; gap: 16px;
  margin-bottom: 22px;
}
.articles-toolbar p { margin-top: 4px; color: var(--ink-soft); font-size: .875rem; }
.article-filter { display: flex; flex-wrap: wrap; gap: 7px; }
.article-filter button {
  display: inline-flex; align-items: center; min-height: 36px; padding: 5px 13px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-soft); background: #fff; font: inherit;
  font-size: .8125rem; font-weight: 600; cursor: pointer;
}
.article-filter button:hover { border-color: var(--brand); color: var(--brand); }
.article-filter button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.article-filter button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.article-filter button small {
  display: grid; place-items: center; min-width: 19px; height: 19px; margin-inline-start: 6px;
  border-radius: 999px; background: var(--bg-soft); color: var(--ink-soft);
  font-size: .6875rem; font-weight: 700;
}
.article-filter button[aria-pressed="true"] small { background: rgba(255,255,255,.2); color: #fff; }
.articles-index-grid { display: grid; gap: 18px; }
.article-index-card {
  overflow: hidden; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); transition: .18s ease;
}
.article-index-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow); transform: translateY(-2px); }
.article-index-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); }
.article-index-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.article-index-card:hover .article-index-media img { transform: scale(1.025); }
.article-index-body { padding: 18px; }
.article-index-body h2 { margin: 5px 0 9px; font-size: 1.25rem; }
.article-index-body h2 a:hover { color: var(--brand); }
.article-index-body > p { color: var(--ink-soft); font-size: .9375rem; }
.article-index-meta {
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line);
  font-size: .8125rem; color: var(--ink-soft);
}
.article-index-meta a { color: var(--brand); font-weight: 700; }
.article-empty {
  margin-top: 18px; padding: 30px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-soft);
}
.article-empty strong { display: block; margin-bottom: 4px; }
.article-empty p { color: var(--ink-soft); font-size: .875rem; }
.articles-help {
  display: grid; gap: 18px; margin-top: 32px; padding: 24px;
  border-radius: var(--radius); background: var(--ink-deep); color: #fff;
}
.articles-help span { color: #fdba74; font-size: .8125rem; font-weight: 700; }
.articles-help h2 { margin-top: 4px; max-width: 28ch; font-size: 1.25rem; }

/* ---------- ธีมงานวิ่ง (แนวทาง C) ---------- */
.theme-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.theme-card {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 250px; border-radius: var(--radius);
  display: flex; align-items: flex-end; color: #fff;
  transition: .2s ease;
}
.theme-card img {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
/* ม่านไล่สีจากล่างขึ้นบน ให้ตัวหนังสืออ่านได้ทุกภาพโดยไม่ต้องเลือกภาพที่มืดอยู่แล้ว */
.theme-card::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top,
    rgba(6,9,16,.93) 0%, rgba(6,9,16,.64) 44%, rgba(6,9,16,.16) 100%);
}
.theme-card:hover { box-shadow: var(--shadow); }
.theme-card:hover img { transform: scale(1.04); }

.theme-body { position: relative; z-index: 2; padding: 18px; }
.theme-count {
  display: inline-block; margin-bottom: 8px;
  font-size: .75rem; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; background: var(--accent);
}
.theme-body h2, .theme-body h3 { font-size: 1.25rem; margin-bottom: 6px; }
.theme-body p { font-size: .875rem; color: rgba(255,255,255,.9); margin-bottom: 10px; }
.theme-more { font-size: .875rem; font-weight: 700; color: #fdba74; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  h1 { font-size: 2rem; }
  .hero h1 { font-size: 2.25rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .key-facts { grid-template-columns: repeat(2, 1fr); }
  .cta-actions { grid-auto-flow: column; justify-content: center; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .footer-bottom { flex-direction: row; justify-content: space-between; align-items: center; }
  .search-card { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; padding: 14px; }
  .detail-title-block h1 { font-size: 1.875rem; }
  .filter-bar { grid-template-columns: repeat(2, 1fr); align-items: end; }
  .filter-actions { grid-column: 1 / -1; }
  .empty-actions { grid-auto-flow: column; }
  /* จอกว้างพอแล้ว ให้กลับมาอยู่บรรทัดเดียว */
  .deadline-item { flex-wrap: nowrap; }
  .deadline-info { flex: 1 1 auto; }
  .countdown { margin-inline-start: 0; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .theme-card-wide { grid-column: span 2; min-height: 300px; }
  .about-stats { grid-template-columns: repeat(2, 1fr); }
  .about-stats > div:nth-child(odd) { border-inline-end: 1px solid var(--line); }
  .about-stats > div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (min-width: 900px) {
  .wrap { padding-inline: 24px; }
  .section { padding: 56px 0; }
  .hero { padding: 64px 0 72px; }
  .hero h1 { font-size: 2.75rem; }
  .hero-sub { font-size: 1.0625rem; }
  .nav { display: flex; }
  .menu-btn { display: none; }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .tile-grid { grid-template-columns: repeat(6, 1fr); }
  .type-grid { grid-template-columns: repeat(6, 1fr); }
  .article-grid { grid-template-columns: repeat(3, 1fr); }
  .article-card { flex-direction: column; }
  .article-card .thumb { width: 100%; aspect-ratio: 16 / 9; }
  .key-facts { grid-template-columns: repeat(4, 1fr); }
  .cta-band { padding: 44px; }
  .cta-band h2 { font-size: 1.75rem; }
  .detail-body { grid-template-columns: 1fr 340px; align-items: start; }
  .detail-sidebar { position: sticky; top: 76px; display: grid; gap: 16px; }
  .sticky-cta { display: none; }
  .detail-title-block h1 { font-size: 2.125rem; }
  .page-head { padding: 30px 0 6px; }
  .month-nav { flex-wrap: wrap; overflow: visible; }
  .month-head h2 { font-size: 1.5rem; }
  .filter-bar { grid-template-columns: repeat(4, 1fr) auto; padding: 14px; }
  /* หน้าจังหวัดไม่มีช่องเลือกจังหวัด เพราะถูกกำหนดไว้แล้วจาก URL */
  .filter-bar-3 { grid-template-columns: repeat(3, 1fr) auto; }
  .theme-grid { grid-template-columns: repeat(3, 1fr); }
  .theme-card { min-height: 270px; }
  .theme-card-wide { grid-column: span 2; min-height: 340px; }
  .theme-card-wide .theme-body h2 { font-size: 1.625rem; }
  .filter-actions { grid-column: auto; }
  .pagination { grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .article-hero { padding-top: 34px; }
  .article-layout { grid-template-columns: 220px minmax(0, 760px); justify-content: center; gap: 48px; padding-top: 48px; }
  .article-toc { position: sticky; top: 84px; }
  /* สารบัญที่แทรกอยู่หลังภาพปก: ดึงออกไปอยู่คอลัมน์ซ้าย
     เพื่อให้เนื้อหาหลักยังคงกว้างและอ่านง่ายเหมือนบทความต้นฉบับ */
  .article-content .article-toc--offset {
    float: left;
    width: 190px;
    margin-inline-start: -220px;
    margin-inline-end: 30px;
    margin-bottom: 24px;
  }
  .article-next { grid-template-columns: 1fr auto; align-items: center; padding: 28px; }
  .articles-masthead { padding: 56px 0 62px; }
  .articles-toolbar { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .articles-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .article-index-body { padding: 22px; }
  .articles-help { grid-template-columns: 1fr auto; align-items: center; padding: 28px 32px; }
  .about-intro { padding-top: 34px; }
  .about-stats { grid-template-columns: repeat(4, 1fr); }
  .about-stats > div { border-bottom: 0; border-inline-end: 1px solid var(--line); }
  .about-stats > div:last-child { border-inline-end: 0; }
  .about-content { padding-top: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
