:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);

  /* ===== ชุดสีของเว็บ: น้ำเงิน + ครีม (แก้สีทั้งเว็บที่นี่ที่เดียว) ===== */

  /* พื้นหลังและการ์ด (ครีม) */
  --bg: #faf5e8;          /* พื้นหลังทั้งหน้า */
  --surface: #fffdf7;     /* การ์ดสินค้า สไลด์ กล่องข้อมูล */
  --line: #e6dcc4;        /* เส้นขอบ จุดสไลด์ที่ยังไม่เลือก */

  /* ตัวอักษร */
  --ink: #1b2a49;         /* ตัวอักษรหลัก (น้ำเงินเข้ม) */
  --muted: #5a6783;       /* ตัวอักษรรอง */

  /* สีน้ำเงิน */
  --brand: #2c5fa8;       /* ปุ่ม ราคา จุดสไลด์ที่เลือก */
  --brand-dark: #1f3a6b;  /* แถบเมนู ส่วนหัว ส่วนท้ายเว็บ */
  --brand-soft: #e8eef7;  /* พื้นปุ่มตอนชี้เมาส์ */
  --on-brand: #ffffff;    /* ตัวอักษรบนปุ่มสีน้ำเงิน */

  /* ตัวอักษรบนพื้นน้ำเงินเข้ม (เมนู ส่วนหัว ส่วนท้าย) */
  --on-dark: #fffdf7;         /* หัวข้อ โลโก้ */
  --on-dark-muted: #d9e3f3;   /* ข้อความทั่วไป ลิงก์เมนู */
  --on-dark-faint: #aebfdc;   /* ข้อความลิขสิทธิ์ท้ายเว็บ */
  --nav-hover: #2d5090;       /* พื้นเมนูตอนชี้เมาส์ / หน้าปัจจุบัน */
  --dark-line: #3b5a93;       /* เส้นคั่นในส่วนท้ายเว็บ */

  /* ช่องค้นหา */
  --input-bg: #fffdf7;
  --input-ink: #1b2a49;
  --placeholder: #7a869e;
  --focus: #8fb2e6;           /* กรอบช่องค้นหาตอนคลิก */

  /* เงา */
  --shadow: rgba(31, 58, 107, .35);
}
html { height: 100%; scroll-behavior: smooth; scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 72px); }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  line-height: 1.7;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

/* เมนูด้านบน */
.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--brand-dark);
  color: var(--on-dark);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}
.logo { font-weight: 700; font-size: 1.25rem; text-decoration: none; letter-spacing: .2px; }
.menu { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.menu a {
  display: block;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--on-dark-muted);
  font-weight: 500;
}
.menu a:hover, .menu a.active { background: var(--nav-hover); color: var(--on-dark); }

/* หน้าแรก */
.hero { background: var(--brand-dark); color: var(--on-dark); padding: 56px 20px 120px; }
.hero-inner { max-width: 1080px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.2; margin: 0 0 12px; max-width: 18ch; }
.hero p { margin: 0; color: var(--on-dark-muted); max-width: 46ch; font-size: 1.05rem; }

main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* สไลด์สินค้า */
.slider { margin-top: -88px; }
.track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 18px 40px -18px var(--shadow);
}
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; }
.slide img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.caption {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 22px;
}
.caption h2 { margin: 0; font-size: 1.2rem; }
.caption p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.btn {
  display: inline-block;
  background: var(--brand);
  color: var(--on-brand);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.arrow {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.2rem;
  cursor: pointer;
}
.arrow:hover { background: var(--brand-soft); }
.dots { display: flex; gap: 8px; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--line);
  cursor: pointer;
}
.dot[aria-current="true"] { background: var(--brand); width: 26px; border-radius: 6px; }

/* เกี่ยวกับ + ติดต่อ */
section.block { padding: 64px 0 8px; }
section.block h2 { font-size: 1.7rem; margin: 0 0 12px; }
section.block p { max-width: 62ch; color: var(--muted); margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: 20px; }
.fact { background: var(--surface); border-left: 4px solid var(--brand); padding: 14px 18px; border-radius: 6px; }
.fact b { display: block; }
.fact span { color: var(--muted); font-size: .95rem; }

/* ฟุตเตอร์ */
footer { margin-top: 72px; background: var(--brand-dark); color: var(--on-dark-muted); padding: 40px 20px 28px; }
.foot-inner { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
footer h3 { margin: 0 0 8px; color: var(--on-dark); font-size: 1.05rem; }
footer p { margin: 0 0 4px; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }
.copy { max-width: 1080px; margin: 28px auto 0; padding-top: 16px; border-top: 1px solid var(--dark-line); font-size: .9rem; color: var(--on-dark-faint); }

/* หน้ารายการสินค้า */
.page-head { background: var(--brand-dark); color: var(--on-dark); padding: 40px 20px 72px; }
.page-head-inner { max-width: 1080px; margin: 0 auto; }
.page-head h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.25; margin: 10px 0 6px; }
.page-head p { margin: 0; color: var(--on-dark-muted); max-width: 50ch; }
.back { color: var(--on-dark-muted); text-decoration: none; font-weight: 500; }
.back:hover { text-decoration: underline; }
.grid {
  margin-top: -44px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.card {
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 30px -18px var(--shadow);
}
.card:target { outline: 3px solid var(--brand); outline-offset: 3px; }
.card img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.card h2 { margin: 0; font-size: 1.15rem; }
.card .price { margin: 4px 0 0; color: var(--brand); font-weight: 700; font-size: 1.1rem; }
.card .desc { margin: 8px 0 0; color: var(--muted); }
.card ul { margin: 12px 0 18px; padding-left: 20px; color: var(--ink); font-size: .95rem; flex: 1; }
.card .btn { align-self: flex-start; }

/* หน้ารายละเอียดสินค้า (เลือกชิ้นเดียว) */
.card > a { display: block; }
.title-link { text-decoration: none; }
.title-link:hover { text-decoration: underline; }
.detail {
  margin-top: -44px;
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  box-shadow: 0 18px 40px -18px var(--shadow);
}
.detail > img { display: block; width: 100%; height: 100%; min-height: 280px; object-fit: cover; }
.detail-body { padding: 28px 30px 32px; display: flex; flex-direction: column; }
.detail-body h2 { margin: 0; font-size: 1.5rem; line-height: 1.3; }
.detail-body .price { margin: 6px 0 0; color: var(--brand); font-weight: 700; font-size: 1.4rem; }
.detail-body .desc { margin: 10px 0 0; color: var(--muted); }
.detail-body ul { margin: 16px 0 24px; padding-left: 20px; flex: 1; }
.detail-body li { margin-bottom: 4px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn-ghost {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.btn-ghost:hover { background: var(--brand-soft); }
@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; }
  .detail > img { aspect-ratio: 16 / 10; height: auto; min-height: 0; }
}

/* ช่องค้นหา */
.search { display: flex; gap: 8px; margin-top: 24px; width: 100%; max-width: none; }
.search[hidden] { display: none; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 15px 20px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--input-bg);
  color: var(--input-ink);
  font: inherit;
  font-size: 1.05rem;
}
.search input::placeholder { color: var(--placeholder); }
.search input:focus-visible { outline: none; border-color: var(--focus); }
.search button {
  padding: 15px 28px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.search button:hover { filter: brightness(1.1); }
.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 36px 20px;
  background: var(--surface);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
}

/* โลโก้ในส่วนหัวหน้าแรก (ด้านขวา) */
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.hero-logo {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 50%;
  border: 4px solid var(--surface);  /* ขอบครีมรอบโลโก้ ให้เห็นชัดบนพื้นน้ำเงิน */
  background: var(--surface);
}
/* ตัวเลือกสินค้า (สี เบอร์ ขนาด) */
.opt-group { margin-top: 16px; }
.opt-label { margin: 0 0 8px; color: var(--muted); font-weight: 500; }
.opt-label b { color: var(--ink); }
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.chip:hover:not(:disabled) { background: var(--brand-soft); }
.chip[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
  font-weight: 600;
}
.chip:disabled { opacity: .5; text-decoration: line-through; cursor: not-allowed; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); }
.summary { margin: 18px 0 0; padding: 10px 14px; background: var(--brand-soft); border-radius: 10px; font-size: .95rem; }
.summary:empty { display: none; }
.opts { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.opts b { color: var(--ink); }
.detail-body ul { flex: none; margin-bottom: 4px; }
.detail-actions { margin-top: auto; padding-top: 22px; }

@media (max-width: 560px) {
  .hero-top { gap: 14px; }
  .hero-logo { width: 84px; height: 84px; border-width: 3px; }
}

@media (max-width: 560px) {
  html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 110px); }
  .nav-inner { padding: 6px 12px; }
  .menu { flex-wrap: wrap; }
  .menu a { padding: 6px 10px; font-size: .92rem; }
  .logo { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
