/* ช่องรอโหลดส่วนที่ใช้ร่วม (includes/*.html) และเนื้อหาสำรองตอนโหลดไม่ได้
   ทำไม: จองความสูงไว้ก่อน หน้าจะไม่กระโดด และหน้าไม่ว่างแม้ fetch ล้มเหลว */

/* ===== เนื้อหาสำรอง: ซ่อนระหว่างรอโหลด ===== */
/* รอ 1.2 วิ ถ้ายังไม่ถูกแทน (ไม่มี JS หรือช้า) จึงโผล่ ถ้าโหลดพลาด JS ติด .inc-failed ให้โผล่ทันที */
[data-include] > .inc-fb {
  visibility: hidden;
  animation: inc-show 0s linear 1.2s forwards;
}

[data-include].inc-failed > .inc-fb {
  visibility: visible;
  animation: none;
}

@keyframes inc-show {
  to { visibility: visible; }
}

/* ลิงก์เมนูของหน้าปัจจุบัน chrome-loader.js เป็นคนติด aria-current */
.menu .cols a[aria-current="page"],
.menu .drop-intro a[aria-current="page"] {
  color: #7d4485;
  font-weight: 700;
}

.menu .side > li > button[aria-current="true"] {
  color: #7d4485;
  background: #ffffffc0;
}

/* ===== ส่วนหัวสำรอง (อยู่ใน .chrome ที่เป็น fixed) ===== */
.inc-header {
  left: var(--g, 16px);
  top: var(--g, 16px);
  min-width: 52px;
  min-height: 136px;
}

.inc-header .inc-fb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 200px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px #0002;
  font-family: "LINE Seed Sans TH", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.inc-header .inc-fb a { color: #111; text-decoration: none; }

.inc-header .inc-fb .inc-brand { color: #7d4485; font-weight: 700; }

/* ===== ท้ายหน้าสำรอง ===== */
footer.site-foot.inc-footer { min-height: 650px; }

.inc-footer .inc-fb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 48px);
  font-family: "LINE Seed Sans TH", "Noto Sans Thai", system-ui, sans-serif;
  line-height: 1.7;
}

.inc-footer .inc-fb p { margin: 0 0 8px; }

.inc-footer .inc-fb a { color: #7d4485; }

/* ===== รายการหน้าในหมวด ===== */
/* วัดจริง 2 พ.ย. 69: 112–145px (1440) / 145–313px (390) จองเท่าค่าต่ำสุด */
.inc-siblings { min-height: 112px; }

@media (max-width: 900px) {
  footer.site-foot.inc-footer { min-height: 1380px; }

  .inc-siblings { min-height: 145px; }
}

/* ===== เมนูมือถือด้านล่าง ===== */
/* ทำไม: เมนูหลักยาวและอยู่ไกลนิ้วโป้ง จึงใช้แถบล่างกับแผงเต็มเฉพาะจอมือถือ */
.mnav {
  --mnav-bg: #fbf8fc;
  --mnav-fg: #2b2230;
  --mnav-primary: #7d4485;
  --mnav-accent: #9e5da5;
  --mnav-soft: #ebdcee;
  --mnav-muted: #6f6473;
  --mnav-white: #fff;
  display: none;
  font-family: "LINE Seed Sans TH", system-ui, sans-serif;
}

@media (max-width: 768px) {
  /* แถบล่างสูง ~84px เผื่ออีกช่วงให้เนื้อหาท้ายหน้าเลื่อนพ้นแถบได้สบาย */
  html[data-chrome="ready"] body {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  body.mnav-open {
    overflow: hidden;
  }

  .logo-v,
  .inq,
  nav.menu,
  .menu-toggle,
  #menu-list,
  nav.menu .drop,
  .hdr-sbtn {
    display: none !important;
  }

  .chrome > .mnav {
    position: fixed;
    inset: 0;
    z-index: 8;
    display: block;
    pointer-events: none;
    color: var(--mnav-fg);
  }

  .mnav-panel {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--mnav-bg);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
  }

  .mnav-panel[hidden] {
    display: none;
  }

  body.mnav-open .mnav-panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mnav-head {
    display: flex;
    flex: none;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 10px;
    background: var(--mnav-white);
  }

  .mnav-head img {
    width: 48px;
    height: 48px;
    object-fit: contain;
  }

  .mnav-head b,
  .mnav-head small {
    display: block;
  }

  .mnav-head b {
    color: var(--mnav-primary);
    font-size: 16px;
    line-height: 1.3;
  }

  .mnav-head small {
    color: var(--mnav-muted);
    font-size: 11px;
    line-height: 1.5;
  }

  .mnav-scroll {
    flex: 1;
    overflow: auto;
    padding: 10px 14px calc(96px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .mnav-main-link,
  .mnav-section > a {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin-bottom: 4px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--mnav-white);
    color: var(--mnav-fg);
    font-size: 13px;
    line-height: 1.5;
    text-decoration: none;
  }

  .mnav-main-link {
    gap: 10px;
    min-height: 48px;
    margin-bottom: 6px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
  }

  .mnav-main-link svg {
    width: 22px;
    height: 22px;
    color: var(--mnav-primary);
  }

  .mnav-main-link span:last-child {
    margin-left: auto;
    color: var(--mnav-accent);
    font-size: 24px;
    line-height: 1;
  }

  .mnav-section {
    margin: 0 0 12px;
  }

  .mnav-section h2 {
    min-height: 44px;
    margin: 0;
    padding: 10px 4px;
    color: var(--mnav-primary);
    font-size: 15px;
    line-height: 1.6;
  }

  .mnav-section h3 {
    margin: 0;
    padding: 10px 4px 4px;
    color: var(--mnav-accent);
    font-size: 11px;
    line-height: 1.5;
  }

  .mnav-section > .mnav-all {
    color: var(--mnav-primary);
    font-weight: 700;
  }

  .mnav-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0 8px;
  }

  .mnav-actions > * {
    display: grid;
    min-height: 48px;
    place-items: center;
    padding: 0 14px;
    border: 0;
    border-radius: 99px;
    font: 700 14px/1 "LINE Seed Sans TH", system-ui, sans-serif;
    text-decoration: none;
  }

  .mnav-booking {
    background: var(--mnav-primary);
    color: var(--mnav-white);
  }

  .mnav-actions .mnav-search {
    background: var(--mnav-soft);
    color: var(--mnav-primary);
  }

  .mnav-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    margin: 0 14px calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 8px 10px;
    border-radius: 18px;
    background: var(--mnav-white);
    pointer-events: auto;
  }

  .mnav-brand {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--mnav-primary);
    text-decoration: none;
  }

  .mnav-brand img {
    width: 40px;
    height: 40px;
    flex: none;
    object-fit: contain;
  }

  .mnav-brand b,
  .mnav-brand small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .mnav-brand b {
    font-size: 14px;
    line-height: 1.2;
  }

  /* 12px เป็นขั้นต่ำที่ยังอ่านออกบนมือถือ และยังพอดีที่ว่างข้างปุ่ม */
  .mnav-brand small {
    color: var(--mnav-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
  }

  .mnav-controls {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mnav-announce,
  .mnav-search-icon,
  .mnav-toggle {
    min-width: 44px;
    height: 44px;
    border: 0;
    font-family: "LINE Seed Sans TH", system-ui, sans-serif;
    cursor: pointer;
  }

  .mnav-announce,
  .mnav-search-icon {
    display: grid;
    width: 44px;
    padding: 0;
    place-items: center;
    border-radius: 14px;
    background: var(--mnav-bg);
    color: var(--mnav-primary);
  }

  /* display:grid ด้านบนชนะ attribute hidden จึงต้องซ่อนซ้ำ */
  .mnav-announce[hidden] {
    display: none;
  }

  .mnav-announce {
    position: relative;
  }

  .mnav-announce svg,
  .mnav-search-icon svg {
    width: 22px;
    height: 22px;
  }

  .mnav-announce-count {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    place-items: center;
    border-radius: 99px;
    background: var(--mnav-primary);
    color: var(--mnav-white);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
  }

  .mnav-toggle {
    position: relative;
    min-width: 88px;
    padding: 0 14px;
    border-radius: 99px;
    background: var(--mnav-primary);
    color: var(--mnav-white);
    font-size: 14px;
    font-weight: 700;
  }

  /* โฟกัสเดิมของเบราว์เซอร์เป็นสีฟ้า กลืนกับแถบขาว ใช้สีแบรนด์ให้เห็นชัด */
  .mnav-announce:focus-visible,
  .mnav-search-icon:focus-visible,
  .mnav-toggle:focus-visible {
    outline: 2px solid #9e5da5;
    outline-offset: 2px;
  }

  .mnav-toggle-closed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 1;
    transform: rotate(0);
    transition: opacity 0.25s, transform 0.25s;
  }

  .mnav-toggle-closed svg {
    width: 18px;
    height: 18px;
  }

  .mnav-toggle-open {
    position: absolute;
    top: 11px;
    left: 11px;
    width: 22px;
    height: 22px;
    opacity: 0;
    transform: rotate(-90deg);
    transition: opacity 0.25s, transform 0.25s;
  }

  body.mnav-open .mnav-toggle {
    width: 44px;
    min-width: 44px;
    padding: 0;
    border-radius: 50%;
    background: var(--mnav-fg);
  }

  body.mnav-open .mnav-toggle-closed {
    opacity: 0;
    transform: rotate(90deg);
  }

  body.mnav-open .mnav-toggle-open {
    opacity: 1;
    transform: rotate(0);
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .mnav-panel,
  .mnav-toggle-closed,
  .mnav-toggle-open {
    transition: none;
  }

  .mnav-panel,
  body.mnav-open .mnav-panel,
  .mnav-toggle-closed,
  body.mnav-open .mnav-toggle-closed,
  .mnav-toggle-open,
  body.mnav-open .mnav-toggle-open {
    transform: none;
  }
}

/* ===== ส่วนหัวเฉพาะมือถือ (F10) ===== */
/* exhibitions.html กับ sritrang มีหัวของตัวเองบนจอคอม จึงโหลด header ร่วมไว้ใช้แค่แถบล่างมือถือ */
@media (min-width: 769px) {
  .chrome-m {
    display: none;
  }
}

/* ===== จุดบอกตำแหน่งแถวเลื่อน (สร้างโดย mobile-nav.js) ===== */
.scroll-dots {
  display: none;
}

@media (max-width: 768px) {
  .scroll-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    pointer-events: none;
  }

  .scroll-dots[hidden] {
    display: none;
  }

  .scroll-dots span {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: #ebdcee;
    transition: transform 0.2s, background-color 0.2s;
  }

  /* จุดปัจจุบันยังเป็นวงกลม ขยายด้วย transform เพื่อไม่ให้แถวจุดขยับ */
  .scroll-dots span.is-on {
    background: #7d4485;
    transform: scale(1.35);
  }
}

/* ===== ระยะบรรทัดไทยในเนื้อหา (F09) ===== */
/* :where ทำให้ specificity เป็น 0 — แก้เฉพาะย่อหน้าที่รับค่าแน่นมาจากแม่
   ส่วนที่แต่ละหน้ากำหนด line-height เองยังชนะ */
@media (max-width: 768px) {
  :where(main) :where(p, li) {
    line-height: 1.7;
  }
}

/* ===== คืนพื้นที่ด้านบนหลังซ่อนเมนูเดิม ===== */
/* ทำไม: หลายหน้าเคยจองพื้นที่ให้โลโก้แนวตั้ง เมื่อซ่อนแล้วต้องไม่เหลือช่องว่างเปล่า */
@media (max-width: 768px) {
  .a3-hin,
  .hero.a3.a3-nob .a3-hin,
  .cl .top,
  .rs .top,
  .act .hero,
  .nw-tag .wrap,
  .cvA,
  .cvB {
    padding-top: 16px !important;
  }

  .sheet > .crumb,
  .sheet > h1,
  .acts .page-head,
  .acts.is-detail .crumb,
  .acts.is-detail .hero-top,
  .ex .ex-head .crumb,
  .ex .ex-head h1,
  .ex .vbh-text .crumb,
  .ex .vbh-text h1,
  .c1 .tools,
  .c1 .tools.is-sticky {
    padding-left: 0 !important;
  }

  .sheet > h1,
  .acts .page-head,
  .acts.is-detail .hero-top,
  .ex .ex-head h1,
  .ex .vbh-text h1 {
    min-height: 0 !important;
  }
}

/* ===== ไอคอนลูกศรในข้อความ (Lucide) ===== */
/* แทนตัวอักษร → ↗ ← เดิม ให้สูงเท่าตัวอักษรและวางตรงเส้นฐานเหมือนตัวอักษร */
.ia { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; flex: none; }
