/* =========================================================
   Phudoi Coffee Roasters — Main Stylesheet
   โครงสร้าง: 1) Variables  2) Reset/Base  3) Layout/Utilities
              4) Header/Nav  5) Buttons  6) Hero  7) Sections
              8) Cards/Grid  9) Forms 10) Footer 11) Responsive
   หมายเหตุ: ออกแบบแบบ Mobile-First (เขียน style มือถือก่อน
             แล้วใช้ media query ขยายสำหรับจอใหญ่)
   ========================================================= */

/* ---------- 1) CSS Variables (ธีมสีกลางของแบรนด์) ---------- */
:root {
  --color-bg: #fbf7f0;          /* พื้นหลังครีม */
  --color-surface: #ffffff;     /* พื้นการ์ด */
  --color-coffee: #4a2c1a;      /* น้ำตาลกาแฟเข้ม (หลัก) */
  --color-coffee-2: #6f4427;    /* น้ำตาลกลาง */
  --color-accent: #c8962f;      /* ทอง (จุดเน้น/ปุ่ม) */
  --color-accent-dark: #a9781f;
  --color-text: #2b2320;        /* สีตัวอักษรหลัก */
  --color-muted: #7a6f67;       /* ตัวอักษรรอง */
  --color-line: #e7ddcf;        /* เส้นขอบบาง */
  --radius: 14px;
  --shadow: 0 8px 24px rgba(74, 44, 26, 0.10);
  --shadow-sm: 0 2px 8px rgba(74, 44, 26, 0.08);
  --max-width: 1180px;
  --font: "Segoe UI", "Prompt", "Sarabun", system-ui, -apple-system, sans-serif;
}

/* ---------- 2) Reset / Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

h1, h2, h3 { color: var(--color-coffee); line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.15rem; }
p  { color: var(--color-text); }

/* ---------- 3) Layout / Utilities ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 64px 0; }
.section-alt { background: #f4ece0; }       /* แถบสีสลับให้อ่านง่าย */

.section-head { text-align: center; max-width: 720px; margin: 0 auto 40px; }
.section-head .eyebrow {
  display: inline-block;
  color: var(--color-accent-dark);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 10px;
}
.section-head p { color: var(--color-muted); margin-top: 10px; }

.text-center { text-align: center; }
.mt-24 { margin-top: 24px; }

/* ---------- 4) Header / Navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251, 247, 240, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand .logo-mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--color-accent), var(--color-coffee));
  display: grid; place-items: center; color: #fff; font-size: 1.1rem;
}
.brand .logo-text { color: var(--color-coffee); font-size: 1.15rem; line-height: 1.1; }
.brand .logo-text small { display: block; font-size: 0.62rem; color: var(--color-muted); font-weight: 600; letter-spacing: 1px; }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 10px 14px; border-radius: 8px; font-weight: 600;
  color: var(--color-coffee-2); transition: background .2s, color .2s;
}
.nav-links a:hover { background: #efe4d4; }
.nav-links a.active { color: var(--color-accent-dark); }

/* ปุ่ม hamburger สำหรับมือถือ (ซ่อนบนจอใหญ่) */
.nav-toggle {
  display: inline-flex; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--color-coffee); border-radius: 2px; transition: .25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 5) Buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; border: 0;
  padding: 13px 26px; border-radius: 10px; font-weight: 700; font-size: 1rem;
  transition: transform .15s, box-shadow .2s, background .2s; font-family: inherit;
}
.btn-primary { background: var(--color-accent); color: #3a2410; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-accent-dark); color: #fff; transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--color-coffee); border: 2px solid var(--color-coffee); }
.btn-outline:hover { background: var(--color-coffee); color: #fff; }
.btn-ghost { background: #fff; color: var(--color-coffee); border: 1px solid var(--color-line); }
.btn-ghost:hover { background: #f4ece0; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------- 6) Hero ---------- */
.hero {
  position: relative; color: #fff; text-align: center;
  background:
    linear-gradient(rgba(40, 22, 12, .62), rgba(40, 22, 12, .72)),
    url("https://loremflickr.com/1600/900/coffee,plantation?lock=10") center/cover no-repeat;
  padding: 96px 0;
}
.hero h1 { color: #fff; }
.hero p { color: #f3e6d6; max-width: 620px; margin: 18px auto 30px; font-size: 1.1rem; }
.hero .hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .badge {
  display: inline-block; background: rgba(200,150,47,.25); border: 1px solid var(--color-accent);
  color: #ffe6b8; padding: 6px 14px; border-radius: 999px; font-size: .85rem; margin-bottom: 18px;
}

/* แถบสถิติใต้ Hero */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 40px; }
.stat { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow-sm); }
.stat .num { font-size: 1.9rem; font-weight: 800; color: var(--color-accent-dark); }
.stat .label { color: var(--color-muted); font-size: .9rem; }

/* ---------- 7) Sections เนื้อหา ---------- */
/* About 2 คอลัมน์ */
.about-grid { display: grid; gap: 32px; align-items: center; }
.about-grid img { border-radius: var(--radius); box-shadow: var(--shadow); }
.about-grid .lead { font-size: 1.05rem; color: var(--color-muted); }

/* จุดเด่น (features) */
.features { display: grid; gap: 22px; }
.feature {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature .icon {
  width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center;
  background: #f4ece0; font-size: 1.5rem; margin-bottom: 14px;
}
.feature p { color: var(--color-muted); margin-top: 6px; }

/* ---------- 8) Cards / Product Grid ---------- */
.product-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
.product-card {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.product-card .thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.product-card:hover .thumb img { transform: scale(1.06); }
.product-card .tag {
  position: absolute; top: 12px; left: 12px; background: var(--color-accent);
  color: #3a2410; font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.product-card .body { padding: 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .cat { font-size: .75rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 1px; }
.product-card h3 { font-size: 1.05rem; }
.product-card .desc { color: var(--color-muted); font-size: .9rem; }
.product-card .price-row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 12px; }
.product-card .price { color: var(--color-accent-dark); font-weight: 800; font-size: 1.2rem; }

/* แถบเครื่องมือค้นหา/กรองในหน้า products */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 30px; }
.toolbar input[type="search"] {
  flex: 1 1 260px; max-width: 360px; padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--color-line); font-family: inherit; font-size: 1rem; background: #fff;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  border: 1px solid var(--color-line); background: #fff; color: var(--color-coffee-2);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-family: inherit; transition: .2s;
}
.chip:hover { background: #f4ece0; }
.chip.active { background: var(--color-coffee); color: #fff; border-color: var(--color-coffee); }
.no-result { text-align: center; color: var(--color-muted); padding: 40px 0; display: none; }

/* รีวิวลูกค้า */
.reviews { display: grid; gap: 22px; }
.review {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm);
}
.review .stars { color: var(--color-accent); letter-spacing: 2px; }
.review blockquote { margin: 12px 0 18px; color: var(--color-text); font-style: italic; }
.review .who { display: flex; align-items: center; gap: 12px; }
.review .who img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.review .who strong { display: block; }
.review .who span { color: var(--color-muted); font-size: .85rem; }

/* โลโก้ลูกค้า (trust bar) */
.logos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; align-items: center; }
.logos .logo-item {
  background: #fff; border: 1px solid var(--color-line); border-radius: 12px;
  padding: 18px; text-align: center; font-weight: 700; color: var(--color-coffee-2);
  box-shadow: var(--shadow-sm);
}

/* ---------- 9) Order page (steps + tables) ---------- */
.steps { display: grid; gap: 22px; counter-reset: step; }
.step {
  position: relative; background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius); padding: 26px 26px 26px 78px; box-shadow: var(--shadow-sm);
}
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 22px; top: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-accent); color: #3a2410;
  display: grid; place-items: center; font-weight: 800;
}
.step p { color: var(--color-muted); margin-top: 6px; }

.pay-grid { display: grid; gap: 24px; }
.pay-card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.pay-card h3 { display: flex; align-items: center; gap: 10px; }

.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 420px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--color-line); }
thead th { background: #f4ece0; color: var(--color-coffee); font-weight: 700; }
tbody tr:hover { background: #fbf6ee; }

.note { background: #fff8ec; border: 1px solid #f0dcb4; border-radius: 10px; padding: 14px 16px; color: #7a5a1e; margin-top: 18px; font-size: .92rem; }

/* ---------- 10) Forms / Contact ---------- */
.contact-grid { display: grid; gap: 30px; }
.info-list { display: grid; gap: 18px; }
.info-item { display: flex; gap: 14px; align-items: flex-start; }
.info-item .ic { font-size: 1.3rem; width: 44px; height: 44px; flex: none; border-radius: 12px; background: #f4ece0; display: grid; place-items: center; }
.info-item strong { display: block; color: var(--color-coffee); }
.info-item span { color: var(--color-muted); }

.form { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.form-row { display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--color-coffee-2); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--color-line); border-radius: 10px;
  font-family: inherit; font-size: 1rem; background: #fff; transition: border .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(200,150,47,.18);
}
.field textarea { resize: vertical; min-height: 130px; }
.field .error-msg { color: #c0392b; font-size: .82rem; margin-top: 4px; display: none; }
.field.invalid input, .field.invalid textarea { border-color: #c0392b; }
.field.invalid .error-msg { display: block; }

.form-success {
  display: none; background: #eaf7ec; border: 1px solid #bfe3c4; color: #246b30;
  padding: 14px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600;
}

.map-embed { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--color-line); }
.map-embed iframe { width: 100%; height: 340px; border: 0; display: block; }

/* ---------- 11) Footer ---------- */
.site-footer { background: var(--color-coffee); color: #e9ddce; padding: 54px 0 24px; margin-top: 20px; }
.footer-grid { display: grid; gap: 30px; }
.site-footer h4 { color: #fff; margin-bottom: 14px; font-size: 1.05rem; }
.site-footer a { color: #e9ddce; transition: color .2s; }
.site-footer a:hover { color: var(--color-accent); }
.site-footer .f-brand p { color: #c9b8a6; margin-top: 10px; font-size: .92rem; }
.footer-links { display: grid; gap: 8px; }
.social { display: flex; gap: 10px; margin-top: 12px; }
.social a { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.social a:hover { background: var(--color-accent); color: #3a2410; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); margin-top: 30px; padding-top: 18px; text-align: center; color: #c9b8a6; font-size: .88rem; }

/* breadcrumb เล็ก ๆ บนหัวหน้า inner */
.page-hero { background: #f4ece0; padding: 50px 0; text-align: center; border-bottom: 1px solid var(--color-line); }
.page-hero p { color: var(--color-muted); margin-top: 8px; }
.breadcrumb { color: var(--color-muted); font-size: .85rem; margin-top: 10px; }
.breadcrumb a:hover { color: var(--color-accent-dark); }

/* scroll reveal (เริ่มจางแล้วเลื่อนขึ้นเมื่อ js ใส่ .visible) */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* =========================================================
   Responsive — Tablet (≥ 640px) และ Desktop (≥ 960px)
   ========================================================= */
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .reviews { grid-template-columns: repeat(3, 1fr); }
  .logos { grid-template-columns: repeat(4, 1fr); }
  .pay-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.two { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .features { grid-template-columns: repeat(4, 1fr); }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .about-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.2fr; }
}

/* เมนูมือถือ: ซ่อน hamburger บนจอใหญ่, แสดงลิงก์เต็ม */
@media (max-width: 859px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; inset: 70px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--color-bg); border-bottom: 1px solid var(--color-line);
    padding: 10px 16px 18px; box-shadow: var(--shadow);
    transform: translateY(-130%); transition: transform .3s ease; max-height: calc(100vh - 70px); overflow-y: auto;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 14px; border-radius: 8px; }
  .nav-links .btn { margin-top: 8px; text-align: center; }
}
@media (min-width: 860px) {
  .nav-toggle { display: none; }
}
