/* =========================================================
   Ember War — ธีมฟอนต์ + ปรับขนาดตัวอักษร
   ไฟล์: static/font-theme.css  (โหลดต่อจาก site.css)
   ตัวแปร --ew-body / --ew-head / --ew-nav-w / --ew-zoom
   ถูกตั้งค่าจาก static/font-theme.js
   ========================================================= */

/* ---------- ฟอนต์ (ทุกธีมยกเว้น classic) ---------- */
html[data-font]:not([data-font="classic"]) body {
  font-family: var(--ew-body);
  font-size: 14px;                       /* ฟอนต์ไทยเว็บที่ 13px จะเล็กไป */
}

html[data-font]:not([data-font="classic"]) :is(
  nav.menu a, .title, .side-h, .side-i, .tagline,
  h1, h2, h3, h4, .sec h3,
  .btn, button, .pbtn,
  .ntitle, .ntag, .tag, .stat,
  table.list th, .slide .cap, .cta-sub span
) {
  font-family: var(--ew-head);
}

/* เมนูบนแบบ TopTwo: ตัวหนาปานกลาง ไม่หนาทึบ */
html[data-font]:not([data-font="classic"]) nav.menu a      { font-weight: var(--ew-nav-w, 500); letter-spacing: .1px; }
html[data-font]:not([data-font="classic"]) nav.menu a.on   { font-weight: var(--ew-nav-on-w, 600); }
html[data-font]:not([data-font="classic"]) .title          { font-weight: var(--ew-nav-w, 500); }

/* ---------- ขนาด (ซูมเฉพาะเนื้อหาเว็บ ไม่ซูมพื้นหลัง/ประกายไฟ) ---------- */
.wrap { zoom: var(--ew-zoom, 1); }

/* ---------- ปุ่ม Aa + แผงตั้งค่า ---------- */
#ew-fbtn {
  position: fixed; right: 18px; bottom: 18px; z-index: 9998;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  font: 600 17px var(--ew-head, Tahoma), Tahoma, sans-serif; color: #fff;
  background: linear-gradient(var(--ember-top, #F6A06A), var(--ember-bottom, #D9541E));
  border: 2px solid var(--ember-border, #8A2E0C);
  box-shadow: 0 3px 10px rgba(0,0,0,.45);
  padding: 0; display: flex; align-items: center; justify-content: center;
}
#ew-fbtn:hover { filter: brightness(1.08); }

#ew-fpanel {
  position: fixed; right: 18px; bottom: 74px; z-index: 9999;
  width: 290px; max-width: calc(100vw - 36px); max-height: calc(100vh - 100px); overflow: auto;
  background: #fff; color: #1F1F1F; border: 1px solid #8C8C8C; border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  font: 14px var(--ew-body, Tahoma), Tahoma, sans-serif;
  display: none;
}
#ew-fpanel.open { display: block; }
#ew-fpanel .ew-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; font-weight: 600;
  background: linear-gradient(var(--title-top, #FAFAFA), var(--title-bottom, #DCDCDC));
  border-bottom: 1px solid #B4B4B4; border-radius: 6px 6px 0 0;
}
#ew-fpanel .ew-x { background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: #555; padding: 0 2px; min-height: 0; }
#ew-fpanel .ew-sec { padding: 10px; }
#ew-fpanel .ew-sec + .ew-sec { border-top: 1px solid #E5E5E5; }
#ew-fpanel .ew-lbl { font-size: 12px; color: #6B7280; margin-bottom: 6px; }

#ew-fpanel .ew-fonts { display: grid; gap: 5px; }
#ew-fpanel .ew-font {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; cursor: pointer; padding: 6px 10px; min-height: 0;
  background: linear-gradient(#fff, #F1F1F1); border: 1px solid #C8C8C8; border-radius: 4px;
  font-size: 15px; color: #1F1F1F;
}
#ew-fpanel .ew-font small { font-size: 11px; color: #6B7280; white-space: nowrap; }
#ew-fpanel .ew-font:hover { border-color: #6E9BCB; background: linear-gradient(#fff, #D9E8F8); }
#ew-fpanel .ew-font.on {
  border-color: var(--ember-border, #8A2E0C); color: #fff;
  background: linear-gradient(var(--ember-top, #F6A06A), var(--ember-bottom, #D9541E));
}
#ew-fpanel .ew-font.on small { color: #FFE8D6; }

#ew-fpanel .ew-size { display: flex; align-items: center; gap: 6px; }
#ew-fpanel .ew-size button {
  min-width: 38px; min-height: 30px; padding: 0 8px; cursor: pointer;
  background: linear-gradient(#fff, #E2E2E2); border: 1px solid #9E9E9E; border-radius: 15px;
  font-weight: 600; color: #1F1F1F;
}
#ew-fpanel .ew-size button:disabled { opacity: .4; cursor: default; }
#ew-fpanel .ew-size .ew-val { flex: 1; text-align: center; font-weight: 600; }
#ew-fpanel .ew-reset { margin-top: 8px; width: 100%; font-size: 12px; background: none; border: 0; color: #2563EB; cursor: pointer; text-decoration: underline; min-height: 0; }

@media (max-width: 600px) {
  #ew-fbtn { right: 12px; bottom: 12px; width: 42px; height: 42px; }
  #ew-fpanel { right: 12px; bottom: 62px; }
}
