/* ==========================================================================
   I CAN ECU — design system
   สีทุกค่ามาจาก tokens.css เท่านั้น ห้ามเขียน hex ในไฟล์นี้ (ดู AGENTS.md)
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* กฎ [hidden] ที่เบราว์เซอร์ให้มาอ่อนมาก คลาสไหนตั้ง display เองก็ทับได้หมด
   ผลคือ JS ที่ซ่อนของด้วย el.hidden = true ไม่มีผลจริง
   เคยทำฟิลเตอร์หน้าแคตตาล็อกกับเมนูมือถือพังมาแล้วทั้งสองที่
   ประกาศทับตรงนี้ครั้งเดียวจบ ไม่ต้องไล่เขียน .คลาส[hidden] ทีละอัน */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  width: 100%;
  background-color: var(--bg);
  overflow-x: hidden;
  /* แถบเลื่อนแบบคลาสสิกบน Windows จองร่อง 10–17px ทางขวา
     พื้น --bg จึงโผล่เป็นแถบข้าง hero สี navy ซ่อนร่องนั้น เลื่อนด้วยล้อเมาส์ได้ตามปกติ */
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* พื้นหน้าเรียบแบบ ORI REMAP — เทาเย็นทึบชั้นเดียว ไม่ไล่เฉดฟ้า ไม่โปร่ง
   แถบสลับใช้ .section--alt เป็นขาวทึบ ไม่ซ้อนโปร่งบนพื้นอีกชั้น */
body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-x: hidden;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-heading);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  margin: 0;
}

h3 {
  font-size: var(--fs-h3);
}

p {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ลิงก์ในเนื้อความใช้ --brand-link (7.51) ไม่ใช่ --brand (5.30)
   เพราะช่างอ่านบนมือถือกลางแดด ปุ่มที่เป็นพื้นทึบใช้ --brand ได้ตามปกติ */
a {
  color: var(--brand-link);
  text-decoration: none;
}

a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* การ์ดที่เป็นลิงก์ทั้งใบ ห้ามขีดเส้นทั้งก้อนตอนชี้ — ดูเลอะและไม่เป็นทางการ */
a[class*="-card"]:hover {
  color: inherit;
  text-decoration: none;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: 3px solid var(--brand-bright);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

main {
  flex: 1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--brand);
  color: var(--text-on-dark);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

/* ข้อความที่โปรแกรมอ่านหน้าจออ่านได้ แต่ไม่กินที่บนจอ
   ใช้กับหัวข้อของแถบที่ตัวหนังสืออยู่ในคลิปแล้ว ถ้าแสดงซ้ำจะรกและอ่านชนกัน */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- layout ------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.section {
  padding: var(--section-pad-m) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--section-pad) 0;
  }
}

.section--soft {
  background: var(--surface);
}

/* แถบสลับขาวทึบบนพื้นเทาเย็น — แบบ ORI REMAP ไม่โปร่ง ไม่ซ้อนไล่เฉด */
.section--alt {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section--dark {
  background: var(--dark);
  color: var(--text-on-dark);
}

.section__head {
  max-width: 62ch;
  margin-bottom: var(--space-6);
}

.section__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--space-2);
}

.section--dark .section__eyebrow {
  color: var(--brand-on-dark);
}

.section__title {
  font-size: var(--fs-h2);
  font-weight: 700;
}

.section__lead {
  margin-top: var(--space-3);
  color: var(--text-secondary);
}

.section--dark .section__lead {
  color: var(--brand-tint);
}

/* เส้นใต้หัวข้อสี amber — จุดเน้นเดียวที่อนุญาตต่อหนึ่งหน้าจอ */
.rule-accent {
  width: 44px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  margin: var(--space-4) 0;
}

/* ---------- wordmark ---------------------------------------------------- */

.wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.wordmark__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  color: var(--brand-deep);
}

.wordmark__tagline {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.wordmark--lg .wordmark__name {
  font-size: 1.5rem;
}

.wordmark--lg .wordmark__tagline {
  font-size: 0.56rem;
}

.wordmark--light .wordmark__name {
  color: var(--text-on-dark);
}

.wordmark--light .wordmark__tagline {
  color: var(--brand-on-dark);
}

/* ---------- header ------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: var(--nav-h);
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-brand {
  text-decoration: none;
  flex-shrink: 0;
}

.site-brand:hover {
  text-decoration: none;
}

.site-nav {
  display: none;
  gap: var(--space-5);
  margin-left: auto;
}

.site-nav__link {
  color: var(--text-secondary);
  font-size: var(--fs-small);
  font-weight: 500;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
}

.site-nav__link:hover {
  color: var(--brand);
  text-decoration: none;
}

.site-nav__link.is-active {
  color: var(--brand-deep);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.site-burger {
  width: 40px;
  height: 40px;
  display: grid;
  place-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.site-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: var(--radius-pill);
}

.site-nav-mobile {
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--space-5) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* เมนูนี้ปิดด้วย attribute hidden จาก site.js ซึ่งกฎ [hidden] ที่ต้นไฟล์จัดการให้แล้ว */

.site-nav-mobile .site-nav__link {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.site-nav-mobile .site-nav__link.is-active {
  border-bottom-color: var(--brand);
}

@media (min-width: 900px) {
  .site-nav {
    display: flex;
  }

  .site-header__actions {
    margin-left: 0;
  }

  .site-burger,
  .site-nav-mobile {
    display: none !important;
  }
}

/* ---------- buttons ----------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 11px var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn--sm {
  padding: 7px var(--space-4);
  font-size: var(--fs-tiny);
}

.btn--primary {
  background: var(--brand);
  color: var(--text-on-dark);
}

.btn--primary:hover {
  background: var(--brand-bright);
  color: var(--text-on-dark);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--brand-line);
  color: var(--brand);
}

.btn--ghost:hover {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.btn--on-dark {
  background: transparent;
  border-color: var(--dark-line);
  color: var(--brand-tint);
}

.btn--on-dark:hover {
  background: var(--dark-surface);
  color: var(--text-on-dark);
}

.btn--accent {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn--accent:hover {
  background: var(--accent-strong);
  color: var(--text-on-accent);
}

/* ปุ่ม LINE ใช้สีแบรนด์ของ LINE ตัวอักษรต้องเข้มเพื่อให้ contrast ผ่าน */
.btn--line {
  background: var(--line-green);
  color: var(--text-on-line);
  font-weight: 700;
}

.btn--line:hover {
  background: var(--line-green-dark);
  color: var(--text-on-line);
}

/* ---------- hero -------------------------------------------------------- */

.hero {
  position: relative;
  background: var(--dark);
  color: var(--text-on-dark);
  overflow: hidden;
}

/* คลิปอยู่ชั้นล่างสุด เนื้อหาอยู่ชั้นบนและไม่ถูกบัง
   ปล่อยคลิกทะลุไปที่เนื้อหา ยกเว้นปุ่มหยุดคลิปที่ต้องกดได้

   ต้องเจาะจงกว่า .reel ที่ประกาศทีหลังในไฟล์นี้ ไม่งั้น position: relative ของ .reel
   จะชนะ พื้นหลังหลุดออกจาก absolute ไปอยู่ใน flow แล้วดันความสูง hero เพิ่มอีกเท่าตัว
   ส่วน border-radius กับพื้นสีอ่อนของ .reel ก็ต้องล้าง เพราะอันนี้เต็มขอบจอบนพื้น navy */
.hero > .hero__bg {
  position: absolute;
  inset: 0;
  border-radius: 0;
  background: var(--dark);
  pointer-events: none;
}

.hero__bg .reel__btn {
  pointer-events: auto;
}

.hero__bg video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  /* hero กว้างกว่าคลิป 16:9 จึงต้องตัดความสูงออกราวหนึ่งในสาม
     ยึดขอบบนไว้ เพราะเทียบทั้ง 5 ฉากแล้วเป็นตำแหน่งเดียวที่หัวมาสคอตไม่ถูกตัด */
  object-position: center top;
}

/* เข้มทางซ้ายให้หัวข้อสีขาวอ่านได้ จางทางขวาให้เห็นมาสคอตในคลิป
   ค่านี้ทำให้ตัวอักษรขาวบนฝั่งซ้ายได้ contrast ระดับเดียวกับพื้น navy ทึบ */
.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--dark) 94%, transparent) 0%,
    color-mix(in srgb, var(--dark) 88%, transparent) 38%,
    color-mix(in srgb, var(--dark) 55%, transparent) 68%,
    color-mix(in srgb, var(--dark) 28%, transparent) 100%
  );
}

/* จอแคบเนื้อหาวางทับกลางคลิป ไล่เฉดตามแนวนอนจึงเอาไม่อยู่
   เปลี่ยนเป็นไล่จากบนลงล่างและเข้มขึ้นทั้งผืน ให้อ่านตัวหนังสือได้ก่อนเป็นอันดับแรก */
@media (max-width: 899px) {
  .hero__scrim {
    background: linear-gradient(
      180deg,
      color-mix(in srgb, var(--dark) 90%, transparent) 0%,
      color-mix(in srgb, var(--dark) 82%, transparent) 100%
    );
  }
}

.hero__inner {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

/* ---------- reveal ตอนเลื่อนถึง ---------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.hero__title {
  font-size: var(--fs-h1);
  font-weight: 700;
}

.hero__lead {
  margin-top: var(--space-4);
  color: var(--brand-tint);
  max-width: 46ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--dark-line);
}

/* ตัวเลขเป็นสีขาว ไม่ใช่ amber — กฎแบรนด์ให้ใช้ amber ได้จุดเดียวต่อหน้าจอ
   ซึ่งในหน้าแรกคือปุ่ม CTA หลัก */
.hero__stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-on-dark);
}

.hero__stat span {
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

/* ---------- กรอบคลิปวน ---------------------------------------------------
   ใช้ทั้งคลิปมาสคอตข้าง hero และแบนเนอร์คอมมูนิตี้
   คลิปต้นฉบับพื้นหลังสว่าง จึงวางบนกรอบสว่างด้วย ไม่ให้ดูเหมือนรูปลอยบนพื้น navy */

.reel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  line-height: 0;
}

.reel__video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* ปุ่มหยุด/เล่น มุมล่างขวา จางไว้ก่อนแล้วชัดขึ้นเมื่อชี้หรือโฟกัส
   ตอนหยุดอยู่ให้ชัดเสมอ เพื่อบอกว่ากดเล่นต่อได้ */
.reel__btn {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--text-on-dark) 55%, transparent);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--dark) 62%, transparent);
  color: var(--text-on-dark);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.reel:hover .reel__btn,
.reel__btn:focus-visible,
.reel.is-paused .reel__btn {
  opacity: 1;
}

.reel__btn:hover {
  background: color-mix(in srgb, var(--dark) 85%, transparent);
}

.reel__icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

/* โชว์ไอคอนให้ตรงกับสถานะ: กำลังเล่นเห็นปุ่มหยุด หยุดอยู่เห็นปุ่มเล่น */
.reel__icon--play,
.reel.is-paused .reel__icon--pause {
  display: none;
}

.reel.is-paused .reel__icon--play {
  display: block;
}

/* แถบแบนเนอร์คอมมูนิตี้ — ต้นฉบับ 1280x486 ใช้อัตราส่วนนั้นตรง ๆ
   ไม่ครอปและไม่ใส่ letterbox เพราะตัวหนังสือถูกจัดวางมาในภาพแล้ว */
.reel--banner {
  width: 100%;
  aspect-ratio: 1280 / 486;
  border: 1px solid var(--border);
}

.reel__foot {
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  justify-content: space-between;
}

.reel__foot p {
  max-width: 58ch;
  margin: 0;
}

/* หัวข้อวางบนแผ่นกระจก ไม่ลอยบนวิดีโอเปล่า ๆ
   ได้สองอย่างคือดูเป็นชั้นแบบ iOS และตัวอักษรมีพื้นรองรับจึงอ่านออกทุกฉากของคลิป */
.hero__panel {
  padding: var(--space-6);
}

@media (min-width: 620px) {
  .hero__panel {
    padding: var(--space-7);
  }
}

/* เนื้อหา hero อยู่คอลัมน์เดียวชิดซ้าย เพราะฝั่งขวาต้องเว้นให้เห็นมาสคอตในคลิป */
@media (min-width: 900px) {
  .hero__inner {
    max-width: min(var(--max-w), 100%);
    padding: var(--space-8) var(--space-5);
  }

  .hero__inner > [data-reveal] {
    max-width: 42rem;
  }
}

/* ---------- ส่วนปิดการขาย ------------------------------------------------- */

/* พื้นไล่เฉด navy ทั้งแถบ แล้ววางแผ่นกระจกทับ ให้เข้าชุดกับ hero และชั้นวางปก */
.closing {
  background: linear-gradient(168deg, var(--navy-700) 0%, var(--navy-900) 100%);
  color: var(--text-on-dark);
}

.closing__panel {
  display: grid;
  gap: var(--space-6);
  padding: var(--space-6);
}

@media (min-width: 900px) {
  .closing__panel {
    grid-template-columns: 1.15fr 0.85fr;
    gap: var(--space-8);
    padding: var(--space-8);
    align-items: start;
  }
}

/* .section__eyebrow ตั้งสีไว้สำหรับพื้นสว่าง ซึ่งบน navy ได้ contrast แค่ 3.06
   ต่ำกว่าเกณฑ์ AA ของตัวอักษรเล็ก จึงต้องเปลี่ยนเป็นสีสำหรับพื้นเข้ม (10.69) */
.closing .section__eyebrow {
  color: var(--brand-on-dark);
}

.closing__title {
  font-size: var(--fs-h2);
  font-weight: 700;
}

.closing__lead {
  margin-top: var(--space-4);
  max-width: 44ch;
  color: var(--brand-tint);
}

.closing__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.closing__hours {
  margin-top: var(--space-5);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

.closing__hours a {
  color: var(--sky-400);
}

/* ลำดับสามขั้น ตัวเลขอยู่ในวงกลมเหมือน .steps ในบทความ แต่เป็นชุดสีบนพื้นเข้ม */
.closing__steps {
  counter-reset: closing;
  list-style: none;
  margin: 0;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--official-white) 7%, transparent);
  border: 1px solid var(--glass-dark-line);
}

.closing__steps li {
  counter-increment: closing;
  position: relative;
  padding-left: calc(var(--space-7) + var(--space-1));
  padding-bottom: var(--space-5);
}

.closing__steps li:last-child {
  padding-bottom: 0;
}

/* เส้นต่อระหว่างข้อ ทำให้อ่านเป็นลำดับ ไม่ใช่สามข้อที่ไม่เกี่ยวกัน */
.closing__steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 6px;
  width: 1px;
  background: var(--glass-dark-line);
}

.closing__steps li::before {
  content: counter(closing);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: var(--radius-pill);
  background: var(--sky-500);
  color: var(--navy-900);
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
}

.closing__steps strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
}

.closing__steps span {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  color: var(--brand-tint);
}

/* ---------- ช่องทางติดต่อ ------------------------------------------------- */

.social-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.social-row--wide {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.social-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.social-link:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

.social-link__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
}

.social-link__icon svg {
  width: 17px;
  height: 17px;
}

.social-link__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.social-link__text strong {
  font-size: var(--fs-small);
}

.social-link__text em {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-style: normal;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* แบบย่อ เหลือแค่ไอคอนวงกลม เรียงแนวนอน ใช้ใน footer
   การ์ดแบบมีชื่อกับไอดีสูงเกินไปสำหรับ footer ทำให้คอลัมน์ยาวกว่าเพื่อนสามคอลัมน์ */
.social-row--compact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.social-dot {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--dark-line);
  background: color-mix(in srgb, var(--official-white) 8%, transparent);
  color: var(--sky-400);
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out),
    transform 0.15s var(--ease-out);
}

.social-dot:hover {
  background: color-mix(in srgb, var(--brand) 50%, transparent);
  border-color: var(--brand-on-dark);
  color: var(--text-on-dark);
  transform: translateY(-2px);
}

.social-dot svg {
  width: 18px;
  height: 18px;
}

/* ใน footer พื้นเป็น navy จึงต้องกลับสีการ์ดให้เป็นกระจกบนพื้นเข้ม */
.site-footer .social-link {
  background: color-mix(in srgb, var(--official-white) 8%, transparent);
  border-color: var(--dark-line);
  color: var(--text-on-dark);
}

.site-footer .social-link:hover {
  background: color-mix(in srgb, var(--official-white) 16%, transparent);
  border-color: var(--brand-on-dark);
}

.site-footer .social-link__icon {
  background: color-mix(in srgb, var(--official-white) 12%, transparent);
  color: var(--sky-400);
}

.site-footer .social-link__text em {
  color: var(--brand-on-dark);
}

/* ---------- การ์ดช่องทางติดต่อ -------------------------------------------- */

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}

.channel {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.channel:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
}

.channel__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand);
}

.channel__icon svg {
  width: 21px;
  height: 21px;
}

.channel__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.channel__body strong {
  font-family: var(--font-display);
  font-size: var(--fs-small);
}

.channel__body em {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-style: normal;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- แผนที่ ------------------------------------------------------- */

.map {
  position: relative;
  margin-top: var(--space-5);
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--brand-soft);
  overflow: hidden;
}

.map__preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  text-align: center;
}

.map__pin {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--brand-line);
  color: var(--brand);
}

.map__pin svg {
  width: 24px;
  height: 24px;
}

.map__text {
  margin: 0;
  font-size: var(--fs-tiny);
  color: var(--text-secondary);
}

.map__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- รายการหมายเหตุ ----------------------------------------------- */

.note-list {
  list-style: none;
  margin: var(--space-6) 0 0;
  padding: 0;
}

.note-list li {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.note-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.note-list strong {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
  color: var(--text);
}

/* ---------- แถบหมวดความรู้ ----------------------------------------------- */

.know__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.know-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--fs-small);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.know-chip:hover {
  border-color: var(--brand-line);
  background: var(--brand-soft);
}

.know-chip span {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--brand-link);
}

/* ---------- grids ------------------------------------------------------- */

.grid {
  display: grid;
  gap: var(--space-5);
}

.grid--2 {
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.grid--3 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* การ์ดเว็บในเครือมีสามใบเสมอ ล็อกสามคอลัมน์เพื่อไม่ให้เหลือช่องว่างท้ายแถว */
.grid--network {
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .grid--network {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid--books {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ---------- แผ่นกระจก iOS ------------------------------------------------
   ใช้ซ้ำได้ทุกที่ · ชุดสว่างวางบนพื้นเว็บ ชุด --dark วางบนพื้น navy หรือบนวิดีโอ
   backdrop-filter คือหัวใจ ถ้าเบราว์เซอร์ไม่รองรับจะเหลือพื้นทึบซึ่งยังอ่านได้ */

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-glass);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}

.glass--dark {
  background: var(--glass-dark);
  border-color: var(--glass-dark-line);
  box-shadow: var(--glass-dark-shadow);
  color: var(--text-on-dark);
}

/* ประกายบาง ๆ ที่ขอบบน เลียนแบบขอบแผ่นกระจกที่รับแสง */
.glass--sheen {
  position: relative;
  overflow: hidden;
}

.glass--sheen::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--official-white) 85%, transparent),
    transparent
  );
}

.glass-btn {
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-dark-line);
  border-radius: var(--radius-pill);
  background: var(--glass-dark);
  color: var(--text-on-dark);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  cursor: pointer;
  transition: background 0.2s var(--ease-out), transform 0.15s var(--ease-out);
}

.glass-btn:hover {
  background: color-mix(in srgb, var(--brand) 55%, transparent);
}

.glass-btn:active {
  transform: scale(0.94);
}

/* ---------- Cover Flow ---------------------------------------------------- */

.cf-section {
  position: relative;
  overflow: hidden;
  padding: var(--section-pad-m) 0;
  background: linear-gradient(168deg, var(--navy-700) 0%, var(--navy-900) 100%);
  color: var(--text-on-dark);
}

@media (min-width: 768px) {
  .cf-section {
    padding: var(--section-pad) 0;
  }
}

/* แสงนวลหลังปกใบกลาง ทำให้ชั้นวางดูมีไฟส่องแบบห้องแสดงงาน */
.cf-section::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 50%;
  width: min(760px, 92vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--sky-500) 22%, transparent) 0%,
    transparent 62%
  );
  pointer-events: none;
}

.cf-section__head {
  position: relative;
  max-width: 46rem;
  margin: 0 auto var(--space-7);
  text-align: center;
}

.cf-section__head .section__eyebrow {
  color: var(--sky-400);
}

.cf-section__title {
  font-size: var(--fs-h2);
  font-weight: 700;
}

.cf-section__lead {
  margin-top: var(--space-4);
  color: var(--brand-tint);
}

.cf {
  position: relative;
  /* จำนวนปกที่แสดงข้างละเท่าไร JS อ่านค่านี้ไปใช้ตัดสินว่าจะซ่อนใบไหน
     กำหนดใน CSS เพื่อให้ตั้งต่างกันตามขนาดจอได้ */
  --cf-range: 4;
}

/* เวทีสามมิติ · perspective ต้องอยู่ที่ตัวแม่ ลูกจึงหมุนเข้าออกจากจอได้ */
.cf__stage {
  position: relative;
  /* สูงพอสำหรับปก 170px (สูง 248px) บวกเงาสะท้อน */
  height: 340px;
  perspective: 1500px;
  perspective-origin: 50% 42%;
  transform-style: preserve-3d;
  touch-action: pan-y;
  cursor: grab;
}

.cf__stage.is-dragging {
  cursor: grabbing;
}

.cf__item {
  position: absolute;
  left: 50%;
  top: 0;
  width: 170px;
  margin-left: -85px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-style: preserve-3d;

  /* |off| กับเครื่องหมายของ off คำนวณด้วย max และ clamp
     clamp ทำหน้าที่เป็นตัวอิ่มตัว ปกใบที่ 2 กับใบที่ 5 จึงเอียงเท่ากัน */
  --abs: max(var(--off), calc(var(--off) * -1));
  --dir: clamp(-1, var(--off), 1);

  /* ระยะฐานต้องกว้างกว่าครึ่งความกว้างปก ไม่งั้นใบข้างจะไปหลบอยู่หลังใบกลางจนมองไม่เห็น

     translateZ ใช้ min(--abs, 1) คือถอยลึกเท่ากันทุกใบที่ไม่ใช่ใบกลาง
     ห้ามให้ลึกขึ้นตามระยะ เพราะ perspective จะดูดใบไกลกลับเข้าหาจุดกลาง
     ผลคือปกหกใบอัดกันอยู่ในช่วงแคบ ๆ แล้วเหลือช่องว่างสองข้างจอ */
  transform: translateX(calc(var(--dir) * (5.6rem + var(--abs) * 2.6rem)))
    translateZ(calc(min(var(--abs), 1) * -5rem)) rotateY(calc(var(--dir) * -40deg))
    scale(calc(1 - var(--abs) * 0.02));
  /* ใบไกลจางลงเรื่อย ๆ ให้ขอบสองข้างละลายไปกับพื้น ไม่ใช่ตัดจบห้วน ๆ */
  opacity: calc(1 - var(--abs) * 0.11);
  transition: transform 0.45s var(--ease-out), opacity 0.45s var(--ease-out);
}

.cf__item.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.cf__cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 18px 38px rgb(5 15 33 / 55%);
}

.cf__item.is-active .cf__cover {
  box-shadow: 0 22px 50px rgb(5 15 33 / 62%),
    0 0 0 1px color-mix(in srgb, var(--sky-500) 45%, transparent);
}

/* เงาสะท้อนใต้ปก คือรูปเดิมพลิกกลับแล้วไล่ให้จางหาย
   ตัดความสูงไว้แค่ช่วงล่างของปก object-position: bottom แล้วพลิก
   จึงได้ขอบล่างของปกมาอยู่ติดกับตัวปกพอดีเหมือนสะท้อนบนพื้นมัน
   ถ้าปล่อย height: auto เงาจะสูงเท่าปกและล้นเวทีออกไป */
.cf__mirror {
  display: block;
  width: 100%;
  height: 66px;
  margin-top: 2px;
  object-fit: cover;
  object-position: bottom;
  transform: scaleY(-1);
  opacity: 0.26;
  mask-image: linear-gradient(to top, transparent 8%, rgb(0 0 0 / 85%) 100%);
  -webkit-mask-image: linear-gradient(to top, transparent 8%, rgb(0 0 0 / 85%) 100%);
  pointer-events: none;
}

.cf__controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  margin-top: var(--space-6);
}

.cf__arrow {
  width: 46px;
  height: 46px;
}

.cf__arrow svg {
  width: 22px;
  height: 22px;
}

.cf__counter {
  min-width: 5rem;
  margin: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--brand-on-dark);
}

.cf__dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.cf__dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--official-white) 28%, transparent);
  cursor: pointer;
  transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.cf__dot.is-active {
  background: var(--sky-500);
  transform: scale(1.5);
}

.cf__info {
  position: relative;
  max-width: 34rem;
  margin: var(--space-7) auto 0;
  padding: var(--space-5) var(--space-6);
  text-align: center;
}

.cf__info__series {
  margin: 0;
  font-size: var(--fs-tiny);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sky-400);
}

.cf__info__title {
  margin: var(--space-2) 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.cf__info__meta {
  margin: 0 0 var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

@media (min-width: 768px) {
  .cf {
    --cf-range: 6;
  }

  .cf__stage {
    height: 440px;
  }

  .cf__item {
    width: 220px;
    margin-left: -110px;

    /* ใบนอกสุด (--abs 6) อยู่ที่ 9 + 24 = 33rem = 528px จากกลาง
       ระนาบ Z เท่ากันทุกใบข้าง จึงไม่ถูก perspective ย่อกลับ
       ระยะห่างระหว่างใบติดกันราว 60px กับปกกว้าง 163px หลังหมุน จึงยังซ้อนกันเป็นชั้น */
    transform: translateX(calc(var(--dir) * (9rem + var(--abs) * 4rem)))
      translateZ(calc(min(var(--abs), 1) * -5rem)) rotateY(calc(var(--dir) * -40deg))
      scale(calc(1 - var(--abs) * 0.02));
  }

  .cf__mirror {
    height: 88px;
  }
}

/* ปิดการหมุนสามมิติเมื่อผู้ใช้ขอลดการเคลื่อนไหว เหลือปกใบกลางใบเดียว
   เพราะการหมุนเข้าออกจอเป็นการเคลื่อนไหวที่ทำให้บางคนเวียนหัวได้ */
@media (prefers-reduced-motion: reduce) {
  .cf__item {
    transition: none;
    transform: translateX(calc(var(--dir) * (5.6rem + var(--abs) * 2.6rem)));
  }

  .cf__item:not(.is-active) {
    opacity: 0;
    pointer-events: none;
  }

  .cf__mirror {
    display: none;
  }
}

/* ---------- หน้าบทความ --------------------------------------------------- */

/* เนื้อความยาวต้องแคบกว่าคอนเทนต์ทั่วไป ประมาณ 70 ตัวอักษรต่อบรรทัดจึงอ่านสบาย */
.container--narrow {
  max-width: 46rem;
}

.page-head {
  padding: var(--space-8) 0 var(--space-6);
}

.page-head__title {
  font-size: var(--fs-h1);
  font-weight: 700;
}

.page-head__lead {
  margin-top: var(--space-4);
  max-width: 60ch;
  color: var(--text-secondary);
}

.article__head {
  padding: var(--space-8) 0 var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.article__title {
  margin-top: var(--space-3);
  font-size: var(--fs-h1);
  font-weight: 700;
}

.article__lead {
  margin-top: var(--space-4);
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.article__meta {
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

.article__hero {
  margin: var(--space-6) 0 0;
}

.article__hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.article__body {
  padding: var(--space-7) 0;
}

.article__body p {
  margin: 0 0 var(--space-4);
}

.article__h2 {
  margin: var(--space-7) 0 var(--space-3);
  font-size: 1.35rem;
  font-weight: 700;
  scroll-margin-top: calc(var(--nav-h, 64px) + var(--space-5));
}

.article__list {
  margin: 0 0 var(--space-5);
  padding-left: var(--space-5);
}

.article__list li {
  margin-bottom: var(--space-2);
}

/* สารบัญบนสุด ให้คนกดข้ามไปหัวข้อที่ต้องการได้เลย ไม่ต้องเลื่อนหา */
.article__toc {
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  font-size: var(--fs-small);
}

.article__toc strong {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
}

.article__toc ol {
  margin: 0;
  padding-left: var(--space-5);
}

.article__toc li {
  margin-bottom: var(--space-1);
}

.article__toc a {
  color: var(--brand-link);
}

/* ขั้นตอนใช้ตัวเลขวงกลม เพราะช่างจะไล่ตามลำดับจริงตอนทำงาน */
.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: calc(var(--space-7) + var(--space-1));
  margin-bottom: var(--space-4);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--text-on-dark);
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
}

.callout {
  display: block;
  padding: var(--space-4) var(--space-5);
  margin: 0 0 var(--space-5);
  border-radius: var(--radius);
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  font-size: var(--fs-small);
}

.callout strong {
  display: block;
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
  color: var(--brand-link);
}

.callout p {
  margin: 0 !important;
}

/* คำเตือนใช้สีเตือนของแบรนด์ ไม่ใช่แดงดิบ เพื่อไม่ให้หลุดจากชุดสี */
.callout--warn {
  border-left-color: var(--warning, var(--brand-deep));
  background: var(--surface-soft);
}

.callout--warn strong {
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--brand-soft);
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.article__cta {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--dark);
  color: var(--text-on-dark);
}

.article__cta h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.article__cta p {
  margin: var(--space-3) 0 var(--space-5);
  color: var(--brand-tint);
  font-size: var(--fs-small);
}

.article__cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.article__related {
  padding: var(--space-7) 0 0;
}

.article__related h2 {
  margin-bottom: var(--space-5);
  font-size: 1.2rem;
  font-weight: 700;
}

/* ---------- ภาพประกอบลายเส้น ---------------------------------------------
   SVG เขียนเองใน scripts/lib/art.mjs ฝังลง HTML จึงเปลี่ยนสีตาม token ได้
   ถ้าเป็นไฟล์ .svg แยกจะทำแบบนี้ไม่ได้ ต้องแก้สีในไฟล์ทีละใบ */

.art {
  display: block;
  width: 100%;
  height: auto;
}

.art__line {
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.art__soft {
  stroke: var(--sky-600);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.art__fill {
  fill: var(--brand-soft);
  stroke: none;
}

/* ลายวงจรที่มุมภาพเป็นของประกอบ ให้จางกว่าตัวภาพหลักชัดเจน */
.art__trace {
  opacity: 0.45;
}

/* ---------- การ์ดกลุ่มคนอ่าน หน้า /for-who ------------------------------- */

.grid--who {
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .grid--who {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1180px) {
  .grid--who {
    grid-template-columns: repeat(3, 1fr);
  }
}

.who-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.who-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
}

.who-card__art {
  display: block;
  padding: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

/* ถ้ายังไม่มีรูปถ่าย ลายเส้นต้องมีระยะและพื้นซีรีส์ ไม่งั้นเส้นลอยบนพื้นว่าง */
.who-card__art:has(.art) {
  padding: var(--space-5) var(--space-6) var(--space-4);
  aspect-ratio: auto;
  background: linear-gradient(180deg, var(--series-bg) 0%, var(--surface) 100%);
}

.who-card__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.who-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  flex: 1;
}

.who-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--series);
}

.who-card__text {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.who-card__link {
  margin-top: auto;
  padding-top: var(--space-3);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--brand-link);
}

/* ---------- หัวหน้าเพจที่มีภาพประกอบ ------------------------------------- */

.page-head--art {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.page-head__grid {
  display: grid;
  gap: var(--space-6);
  align-items: center;
}

@media (min-width: 900px) {
  .page-head__grid {
    grid-template-columns: 1.25fr 0.75fr;
  }
}

.page-head__art {
  display: none;
}

@media (min-width: 900px) {
  .page-head__art {
    display: block;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
  }
}

/* ---------- การ์ดบทความ ------------------------------------------------- */

.art-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.art-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
}

.art-card__cat {
  font-size: var(--fs-tiny);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

.art-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.45;
}

.art-card__text {
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.art-card__meta {
  margin-top: auto;
  padding-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

.art-group {
  margin-bottom: var(--space-8);
}

/* การ์ดบทความแบบมีภาพหัวการ์ด
   ภาพผูกกับ slug ของบทความ ไม่ใช่กับหมวด ดู ARTICLE_ART ใน scripts/lib/art.mjs */
.art-card--art {
  padding: 0;
  overflow: hidden;
}

.art-card__thumb {
  display: block;
  padding: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.art-card__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  flex: 1;
}

.grid--1 {
  grid-template-columns: 1fr;
}

/* กริดบทความกำหนดจำนวนคอลัมน์ตรง ๆ ไม่ใช้ auto-fill
   auto-fill จะให้คอลัมน์ตามความกว้างจอ ทำให้จำนวนช่องไม่ตรงกับจำนวนการ์ด
   แล้วเหลือช่องว่างท้ายแถว ตัวเลือกคอลัมน์มาจากจำนวนบทความ ดู articleGridClass()
   ใน scripts/build-pages.mjs */

.grid--articles-2,
.grid--articles-3 {
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .grid--articles-2,
  .grid--articles-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1040px) {
  .grid--articles-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* การ์ดแนวนอนสำหรับหมวดที่มีบทเดียว ภาพอยู่ซ้าย เนื้อหาอยู่ขวา */
@media (min-width: 700px) {
  .art-card--row {
    flex-direction: row;
    align-items: stretch;
  }

  .art-card--row .art-card__thumb {
    flex: none;
    width: 280px;
    aspect-ratio: auto;
    display: block;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    background: var(--surface-soft);
  }

  .art-card--row .art-card__body {
    justify-content: center;
    padding: var(--space-6);
  }

  .art-card--row .art-card__text {
    max-width: 62ch;
  }
}

.art-group__name {
  font-size: 1.15rem;
  font-weight: 700;
}

.art-group__name span {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-weight: 400;
  color: var(--text-tertiary);
}

.art-group__text {
  margin: var(--space-2) 0 var(--space-5);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

/* คิวหัวข้อที่ยังไม่เขียน แสดงเป็นรายการจาง ๆ ไม่ทำเป็นลิงก์ */
.backlog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

/* แถบปกเล่มเล็กใต้บทความ */
.mini-book-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.mini-book {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.mini-book:hover {
  border-color: var(--brand-line);
  box-shadow: var(--shadow-sm);
}

.mini-book img {
  width: 56px;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.mini-book span {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mini-book strong {
  font-size: var(--fs-small);
}

.mini-book em {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-style: normal;
  color: var(--text-tertiary);
}

/* ---------- เหตุผลรูปเล่ม ----------------------------------------------- */

.why-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.why-item__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
}

.why-item__text {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

/* แถบสเปกสั้น ๆ ใต้เนื้อหา ใช้บอกตัวเลือกที่สั่งได้ */
.spec-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.spec-row__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.spec-row__item strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--brand);
}

.spec-row__item span {
  font-size: var(--fs-tiny);
  color: var(--text-secondary);
}

/* ---------- การ์ดเว็บในเครือ --------------------------------------------
   โลโก้เต็มความกว้างชิดขอบการ์ด เนื้อหาอยู่แผ่นขาวด้านล่าง
   ไม่ใส่ป้ายยาหลายใบ ไม่ขีดเส้นทั้งการ์ดตอนชี้ — ให้ดูเป็นชุดแบรนด์ทางการ */

.net-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

a.net-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
  text-decoration: none;
  color: inherit;
}

.net-card--self {
  border-color: var(--brand-line);
}

.net-card--soon {
  opacity: 0.72;
}

.net-card__icon {
  display: grid;
  place-items: center;
  height: 92px;
  background: var(--dark);
  color: var(--text-on-dark);
}

.net-card__icon svg {
  width: 28px;
  height: 28px;
}

/* พื้น navy เต็มแถบบน เพราะโลโก้ทั้งสามออกแบบมาให้อยู่บนพื้นเข้ม */
.net-card__logo {
  display: grid;
  place-items: center;
  height: 92px;
  padding: 0 var(--space-5);
  background: var(--dark);
}

.net-card__logo img {
  max-width: 100%;
  max-height: 44px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.net-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  flex: 1;
}

.net-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
}

.net-card__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

.net-card__role {
  font-size: var(--fs-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.net-card__flag {
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--text-on-dark);
  font-size: var(--fs-tiny);
}

.net-card__flag--soon {
  background: var(--surface-soft);
  color: var(--text-secondary);
}

.net-card__text {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.65;
}

.net-card__tags {
  margin: 0;
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

.net-card__host {
  margin-top: auto;
  padding-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

a.net-card:hover .net-card__host {
  color: var(--brand-link);
}

/* ---------- book card --------------------------------------------------- */

.book-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.book-card:hover {
  border-color: var(--brand-line);
  transform: translateY(-2px);
  text-decoration: none;
}

.book-card__cover {
  aspect-ratio: 721 / 1053;
  width: 100%;
  object-fit: cover;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.book-card__body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.book-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.book-card__meta {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
  margin-top: auto;
}

.book-card__price {
  font-size: var(--fs-tiny);
  font-weight: 600;
  color: var(--brand);
}

/* ---------- series badge / chips ---------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: var(--fs-tiny);
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.6;
}

.badge--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

/* สีประจำซีรีส์ — ผูกกับ data-series ให้ HTML ไม่ต้องรู้เรื่องสี */
[data-series="ecu"] {
  --series: var(--series-ecu);
  --series-bg: var(--series-ecu-bg);
  --series-line: var(--series-ecu-line);
}

[data-series="meter"] {
  --series: var(--series-meter);
  --series-bg: var(--series-meter-bg);
  --series-line: var(--series-meter-line);
}

[data-series="canbus"] {
  --series: var(--series-canbus);
  --series-bg: var(--series-canbus-bg);
  --series-line: var(--series-canbus-line);
}

[data-series="pinout"] {
  --series: var(--series-pinout);
  --series-bg: var(--series-pinout-bg);
  --series-line: var(--series-pinout-line);
}

.badge--series {
  background: var(--series-bg);
  border-color: var(--series-line);
  color: var(--series);
}

/* การ์ดหมวดโชว์ปกจริงซ้อนกัน ทั้งใบเป็นลิงก์เดียว ไม่มีลิงก์ซ้อนลิงก์ */
.series-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.series-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
}

/* ปกสามเล่มวางเยื้องกันเป็นชั้น เล่มหน้าสุดตรง เล่มหลังเอียงออกทั้งสองข้าง */
.series-card__media {
  position: relative;
  display: grid;
  place-items: end center;
  height: 132px;
  padding-top: var(--space-5);
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}

.series-card__cover {
  grid-area: 1 / 1;
  width: auto;
  height: 104px;
  border-radius: 3px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgb(11 31 68 / 14%);
  transform: translateX(calc((var(--i) - 1) * 34px)) rotate(calc((var(--i) - 1) * 6deg));
  transform-origin: bottom center;
  transition: transform 0.25s var(--ease-out);
}

/* ชี้แล้วปกกางออกเล็กน้อย ให้รู้สึกว่าหยิบดูได้ */
.series-card:hover .series-card__cover {
  transform: translateX(calc((var(--i) - 1) * 42px)) rotate(calc((var(--i) - 1) * 9deg));
}

.series-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  flex: 1;
}

.series-card__top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.series-card__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--series-bg);
  border: 1px solid var(--series-line);
  color: var(--series);
  flex: none;
}

.series-card__icon svg {
  width: 18px;
  height: 18px;
}

.series-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--series);
}

.series-card__count {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

.series-card__text {
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.series-card__link {
  margin-top: auto;
  padding-top: var(--space-3);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--brand-link);
}

.series-card:hover .series-card__link {
  text-decoration: underline;
}

/* ปิดแค่การขยับ ไม่ปิดการเยื้องของปก เพราะถ้าเอา transform ออกหมด
   ปกสามเล่มจะทับกันสนิทเหลือให้เห็นเล่มเดียว */
@media (prefers-reduced-motion: reduce) {
  .series-card,
  .series-card__cover {
    transition: none;
  }

  .series-card:hover {
    transform: none;
  }

  .series-card:hover .series-card__cover {
    transform: translateX(calc((var(--i) - 1) * 34px)) rotate(calc((var(--i) - 1) * 6deg));
  }
}

/* 4 / 2 / 1 คอลัมน์ หารลงตัวทุกช่วง จึงไม่มีการ์ดตกไปอยู่แถวล่างลำพัง */
.grid--series {
  grid-template-columns: 1fr;
}

@media (min-width: 620px) {
  .grid--series {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1080px) {
  .grid--series {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---------- bundle card ------------------------------------------------- */

.bundle-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.bundle-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
}

/* สองคอลัมน์ตรง ๆ ไม่ใช้ auto-fit เพราะการ์ดสี่ใบกับอีกใบที่กินเต็มแถว
   ถ้าปล่อยให้ auto-fit เลือกเองจะได้สามคอลัมน์ แล้วใบที่สี่เหลืออยู่ลำพัง */
.grid--bundles {
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .grid--bundles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ชั้นวางปก ปกซ้อนเหลื่อมกันเหมือนหนังสือเรียงบนชั้น
   overflow hidden เพราะชุด 10 กับ 18 เล่มมีปกกว้างเกินการ์ด ต้องให้เลยขอบแล้วถูกตัด */
.bundle-card__shelf {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 132px;
  padding: var(--space-5) var(--space-5) var(--space-4);
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.bundle-card__cover {
  flex: none;
  width: auto;
  height: 92px;
  border-radius: 3px;
  border: 1px solid var(--border);
  box-shadow: 0 3px 10px rgb(11 31 68 / 16%);
  transition: transform 0.2s var(--ease-out);
}

/* ปกใบแรกไม่เหลื่อม ใบถัดไปซ้อนทับใบก่อนหน้าเข้ามา */
.bundle-card__cover:not(:first-of-type) {
  margin-left: -22px;
}

.bundle-card:hover .bundle-card__cover {
  transform: translateY(-3px);
}

/* ป้ายบอกจำนวนเล่มที่เหลือ ลอยชิดขวาพร้อมไล่เฉดให้ปกที่ถูกตัดดูจบอย่างนุ่มนวล */
.bundle-card__more {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  padding: 0 var(--space-4) 0 var(--space-6);
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--official-white) 88%, transparent) 45%,
    var(--surface) 100%
  );
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.bundle-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  flex: 1;
}

/* จอกว้างให้ชุดยกครบกินสองคอลัมน์ แล้ววางปกคู่กับข้อความแนวนอน
   ของเดิมมันยืดเป็นเสาสูง 877px เพราะไล่ชื่อ 18 เล่ม */
@media (min-width: 900px) {
  .bundle-card--wide {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .bundle-card--wide .bundle-card__shelf {
    flex: 0 0 46%;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    align-items: center;
  }

  .bundle-card--wide .bundle-card__cover {
    height: 128px;
  }
}

.bundle-card__name {
  font-size: 1.15rem;
  font-weight: 700;
}

/* รายชื่อเล่มพับเก็บไว้ เปิดดูได้ ไม่ดันการ์ดให้สูงต่างกันลิบ */
.bundle-card__details {
  font-size: var(--fs-small);
}

.bundle-card__details summary {
  cursor: pointer;
  padding: var(--space-2) 0;
  font-weight: 600;
  color: var(--brand-link);
}

.bundle-card__details summary:hover {
  text-decoration: underline;
}

.bundle-card__meta {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.bundle-card__text {
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.bundle-card__list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-size: var(--fs-small);
  list-style: none;
}

.bundle-card__list li {
  color: var(--text-secondary);
}

.bundle-card .btn {
  align-self: flex-start;
  margin-top: auto;
}

/* ---------- filter chips ------------------------------------------------ */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.chip {
  padding: 6px var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  cursor: pointer;
}

.chip:hover {
  border-color: var(--brand-line);
  color: var(--brand);
}

.chip.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--text-on-dark);
  font-weight: 600;
}

.search-field {
  width: 100%;
  max-width: 360px;
  padding: 10px var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  color: var(--text);
}

.search-field::placeholder {
  color: var(--text-tertiary);
}

.result-count {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.empty-state {
  padding: var(--space-7) var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-secondary);
}

/* ---------- breadcrumb -------------------------------------------------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

.breadcrumb a {
  color: var(--text-secondary);
}

/* ---------- book detail ------------------------------------------------- */

.book-detail {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 900px) {
  .book-detail {
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: var(--space-8);
    align-items: start;
  }
}

.book-detail__cover {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.book-detail__title {
  font-size: var(--fs-h2);
  font-weight: 700;
  margin-top: var(--space-3);
}

.book-detail__summary {
  margin-top: var(--space-4);
  color: var(--text-secondary);
}

.spec-list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-5) 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-small);
}

.spec-list div {
  display: flex;
  gap: var(--space-3);
}

.spec-list dt {
  min-width: 9rem;
  color: var(--text-tertiary);
}

.spec-list dd {
  margin: 0;
  font-weight: 500;
}

.contents-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.contents-list li {
  display: flex;
  gap: var(--space-3);
  font-size: var(--fs-small);
}

.contents-list li::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: var(--radius-pill);
  background: var(--series, var(--brand));
}

.preview-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  margin-top: var(--space-4);
}

.preview-item {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.preview-item:hover {
  border-color: var(--brand-line);
  transform: translateY(-2px);
}

.preview-item img {
  width: 100%;
  /* กันลากภาพออกไปและกันเมนูคลิกขวาบันทึกภาพ */
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.preview-item__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-2);
  background: var(--dark);
  color: var(--text-on-dark);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  text-align: center;
}

.preview-note {
  margin-top: var(--space-3);
  font-size: var(--fs-tiny);
  line-height: 1.7;
  color: var(--text-tertiary);
}

/* ---------- lightbox ---------------------------------------------------- */

/* กว้างขึ้นและไม่ให้ตัวกล่องเลื่อนเอง เพราะการเลื่อนดูภาพเป็นหน้าที่ของตัวซูม */
.lightbox {
  width: min(1180px, 96vw);
  max-height: 94vh;
  padding: var(--space-4);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-glass);
  background: var(--dark);
  color: var(--text-on-dark);
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgb(5 15 33 / 82%);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.lightbox__label {
  font-size: var(--fs-small);
  font-weight: 600;
}

.lightbox__close {
  padding: 6px var(--space-4);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--brand-on-dark);
  font-family: var(--font-body);
  font-size: var(--fs-tiny);
  cursor: pointer;
}

/* เวทีคุมขอบเขตการมองเห็น ภาพขยายเกินขอบแล้วถูกตัด ไม่ดันกล่องให้โต */
.lightbox__stage {
  position: relative;
  overflow: hidden;
  height: min(74vh, 900px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--dark-deeper);
  touch-action: none;
  cursor: zoom-in;
}

.lightbox__stage.is-zoomed {
  cursor: grab;
}

.lightbox__stage.is-panning {
  cursor: grabbing;
}

/* ระหว่างโหลดชั้นความละเอียดสูง ให้ขอบบนวิ่งเป็นแถบบอกว่ากำลังทำงาน */
.lightbox__stage.is-loading::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  height: 2px;
  width: 40%;
  background: var(--sky-500);
  animation: zoom-loading 1.1s var(--ease) infinite;
}

@keyframes zoom-loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  border-radius: var(--radius-sm);
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

/* ---------- บล็อก "เขียนโดยคนที่ซ่อมเอง" หน้าแรก ------------------------
   ห้ามโยนข้อความ + ภาพหลายใบ + กล่องข้าง ลงกริด auto-fit พร้อมกัน
   จอกว้างจะแตกเป็นสามคอลัมน์ ภาพปกแนวตั้งหกใบกองกลางแล้วดันหน้าสูงผิดปกติ */

.about {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 900px) {
  .about {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-7);
  }
}

.about__copy {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about__copy .trust-note {
  margin-top: var(--space-6);
}

.about__figs .fig-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.about__figs .fig img {
  aspect-ratio: 4 / 3;
}

/* ---------- แถบภาพจากในเล่ม ---------------------------------------------- */

.fig-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
}

.fig {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: zoom-in;
  color: inherit;
  text-align: left;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.fig:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-line);
}

.fig img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1100 / 1558;
  object-fit: cover;
  object-position: top;
}

.fig__label {
  padding: 0 var(--space-3) var(--space-3);
  font-size: var(--fs-tiny);
  color: var(--text-secondary);
}

.fig-row__note {
  margin-top: var(--space-3);
  font-size: var(--fs-tiny);
  color: var(--text-tertiary);
}

/* ---------- ปุ่มซูม ------------------------------------------------------- */

.zoom-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.zoom-tools__level {
  min-width: 4.5rem;
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

.zoom-tools__btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--official-white) 8%, transparent);
  color: var(--text-on-dark);
  cursor: pointer;
  transition: background 0.2s var(--ease-out);
}

.zoom-tools__btn:hover {
  background: color-mix(in srgb, var(--brand) 55%, transparent);
}

.zoom-tools__btn svg {
  width: 15px;
  height: 15px;
}

.zoom-tools__btn--text {
  width: auto;
  padding: 0 var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-tiny);
}

@media (max-width: 560px) {
  .zoom-tools__level,
  .zoom-tools__btn--text {
    display: none;
  }
}

.lightbox__note {
  margin-top: var(--space-3);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

/* ---------- cta panel --------------------------------------------------- */

.cta-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius);
  background: var(--brand-soft);
}

.cta-panel__text {
  flex: 1;
  min-width: 200px;
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

.cta-panel__text strong {
  display: block;
  font-size: var(--fs-body);
  color: var(--text);
}

/* ---------- faq --------------------------------------------------------- */

.faq-list {
  display: grid;
  gap: var(--space-3);
  max-width: 74ch;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.faq-item summary {
  padding: var(--space-4);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--brand);
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item__body {
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

/* ---------- footer ------------------------------------------------------ */

.site-footer {
  margin-top: var(--space-8);
  background: var(--dark);
  color: var(--text-on-dark);
}

.site-footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-6);
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* จอกว้างกำหนดความกว้างเอง ไม่ใช้ auto-fit
   เพราะห้าคอลัมน์ที่ขั้นต่ำ 200px รวมช่องไฟแล้วเกิน 1152px คอลัมน์สุดท้ายจะตกลงไปแถวล่างลำพัง
   คอลัมน์แบรนด์กว้างกว่าเพราะมีที่อยู่บริษัทอยู่ด้วย */
@media (min-width: 1040px) {
  .site-footer__inner {
    grid-template-columns: 1.5fr 1fr 1.12fr 1fr 1.12fr;
    gap: var(--space-6) var(--space-5);
  }
}

.site-footer__heading {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-on-dark);
  margin-bottom: var(--space-3);
}

.site-footer__tagline {
  margin-top: var(--space-4);
  font-size: var(--fs-small);
  color: var(--accent);
}

.site-footer__note {
  margin-top: var(--space-4);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

.site-footer__note a {
  color: var(--brand-tint);
}

.site-footer__col a {
  color: var(--brand-tint);
}

.site-footer__link {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  font-size: var(--fs-small);
  border-bottom: 1px solid var(--dark-surface);
}

.site-footer__link span {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

.site-footer__sibling {
  display: block;
  padding: var(--space-4);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
}

.site-footer__sibling strong {
  display: block;
  color: var(--text-on-dark);
}

.site-footer__sibling span {
  color: var(--brand-on-dark);
  font-size: var(--fs-tiny);
}

.site-footer__bar {
  background: var(--dark-deeper);
}

.site-footer__bar__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  font-size: var(--fs-tiny);
  color: var(--brand-on-dark);
}

/* ---------- misc -------------------------------------------------------- */

.page-hero {
  background: var(--brand-soft);
  border-bottom: 1px solid var(--brand-line);
  padding: var(--space-6) 0 var(--space-7);
}

.page-hero__title {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--brand-deep);
}

.page-hero__lead {
  margin-top: var(--space-3);
  max-width: 62ch;
  color: var(--text-secondary);
}

.trust-note {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
