/* ============================================================
   css/sound.css — ปุ่มเปิด/ปิดเสียงเพลงบนแถบบน (js/sound.js สร้างปุ่มเอง)

   ★ ปุ่มนี้อยู่บนแถบบนไม่ได้ลอยทับเนื้อหา
     แถบบนเขียนคอมเมนต์ไว้แล้วว่า "เพิ่มปุ่มได้อีกโดยไม่ล้นจอ"
     เพราะที่ 360px แถวบนมีแค่โลโก้กับ TH/EN ส่วนปุ่มสลับโซนลงแถวล่างเต็มความกว้าง

   ★ ใช้ตัวแปร semantic (--fg --surface --accent) ไม่ใช่สีชมพู/ฟ้าตรง ๆ
     ปุ่มจึงสลับโทนตามโซนให้เองโดยไม่ต้องเขียน [data-zone] ซ้ำ
   ============================================================ */

.soundbtn {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  /* 44px คือขนาดเป้าแตะขั้นต่ำของโปรเจกต์ ปุ่มนี้เล็กกว่านั้นไม่ได้
     แม้ไอคอนข้างในจะกว้างแค่ 20px */
  width: 44px; height: 44px;
  border-radius: var(--r-pill);
  border: 1px solid var(--surface-brd);
  background: var(--surface);
  color: var(--fg);
  opacity: .62;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .3s var(--ease), background .3s var(--ease),
              color .3s var(--ease), box-shadow .3s var(--ease);
}
.soundbtn:hover { opacity: 1; }
.soundbtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ตอนเพลงเล่นอยู่ ใช้สัญญาณเดียวกับปุ่มภาษาที่ถูกเลือก เพื่อให้แถบบนพูดภาษาเดียวกัน */
.soundbtn.is-on {
  opacity: 1;
  background: var(--grad-gold);
  color: var(--peg-ink);
}

.soundbtn svg { display: block; }

/* คลื่นเสียงขยับเบา ๆ ตอนเพลงเล่น — บอกสถานะโดยไม่ต้องอ่านอะไร
   ★ ขยับแค่ opacity ไม่ขยับ transform/filter
     แถบบนเป็น sticky + มี backdrop-filter อยู่แล้ว ถ้าทำให้มันต้องคำนวณ layout
     ใหม่ทุกเฟรมจะย้อนรอยปัญหาแลคที่เคยแก้ไปแล้ว (ดูคอมเมนต์ใน css/hero.css)
   ★ base.css มี rule กลางที่ปิด animation ตาม prefers-reduced-motion ให้แล้ว */
.soundbtn.is-on svg path:last-child {
  animation: soundwave 2.4s var(--ease) infinite;
}
@keyframes soundwave {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}
