/*
Theme Name: Dream Tech House
Theme URI: https://example.com/
Author: Dream Tech House Co., Ltd.
Author URI: https://example.com/
Description: Minimal white/gray/green AI Smart Home theme with WooCommerce support.
Version: 1.1
Text Domain: dream-tech-house
*/
/* Force nav to horizontal */

/* ==============================
   DTH SHOP PAGE LAYOUT FIX
   4 Columns every row (Desktop)
   Responsive for Tablet/Mobile
   ============================== */
/* ============================
   FIX WooCommerce Product Grid
   ใช้กับทุก ul.products ของ WooCommerce
   ============================ */
/* ================================
   DTH SHOP FIX — ใช้เฉพาะหน้า Shop
   ================================ */


/* ทำให้หน้าร้าน WooCommerce เป็นกริดแบบ responsive */
.woocommerce ul.products,
.woocommerce-page ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  padding-left: 0;   /* กันไม่ให้เยื้องเกินไป */
}

/* กล่องสินค้าแต่ละชิ้น */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  margin: 0;              /* ตัด margin เดิมของ WooCommerce */
  width: 100% !important; /* บังคับให้ใช้ layout จาก grid แทน float เดิม */
  box-sizing: border-box;
}

/* รูปสินค้าให้ย่อได้ตามหน้าจอ */
.woocommerce ul.products li.product img,
.woocommerce-page ul.products li.product img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ปรับ layout สำหรับจอเล็กมาก ๆ */
@media (max-width: 480px) {
  .ql-container {
    padding: 0 14px;
  }
  .woocommerce ul.products,
  .woocommerce-page ul.products {
    grid-template-columns: minmax(0, 1fr); /* 1 คอลัมน์บนมือถือแคบ */
  }
}
/* ลบ ::before / ::after ที่ WooCommerce ใส่มา */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
    content: none !important;
    display: none !important;
}

/* พื้นหลัง + ระยะห่าง */
.post-type-archive-product .site-main {
  background-color: #f5f7fb;
  padding: 60px 0 80px;
}

/* จัด result count + sorting ให้อยู่ในกรอบเดียวกับ content */
.post-type-archive-product .woocommerce-result-count,
.post-type-archive-product .woocommerce-ordering {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  float: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== รีเซ็ต layout เดิมของ WooCommerce บนหน้า Shop ===== */
.post-type-archive-product .woocommerce ul.products,
.post-type-archive-product .woocommerce-page ul.products {
  display: grid !important;                          /* ใช้ grid แทนทุกอย่าง */
  grid-template-columns: repeat(4, minmax(0, 1fr));  /* 4 คอลัมน์บนเดสก์ท็อป */
  
  padding: 0;
  margin: 0 auto;
  list-style: none;
}

/* ล้าง float/width เดิม แล้วให้ grid จัดเอง */
.post-type-archive-product .woocommerce ul.products li.product,
.post-type-archive-product .woocommerce-page ul.products li.product {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  background: #ffffff;
  border-radius: 18px;
  padding: 16px 16px 20px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

/* รูปสินค้าให้สูงเท่ากันทุกใบ จะได้ไม่ดันแถวให้เพี้ยน */
.post-type-archive-product .woocommerce ul.products li.product img,
.post-type-archive-product .woocommerce-page ul.products li.product img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  border-radius: 14px;
  margin-bottom: 12px;
}

/* ========= Responsive ========= */

/* หน้าจอประมาณ Tablet ให้อยู่ 3 คอลัมน์ */
@media (max-width: 1024px) {
  .post-type-archive-product .woocommerce ul.products,
  .post-type-archive-product .woocommerce-page ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tablet เล็ก / จอแนวตั้ง = 2 คอลัมน์ */
@media (max-width: 768px) {
  .post-type-archive-product .woocommerce ul.products,
  .post-type-archive-product .woocommerce-page ul.products {
    grid-template-columns: repeat(2, minmax(0, 1, 1fr));
  }
}

/* มือถือ = 1 คอลัมน์ */
@media (max-width: 540px) {
  .post-type-archive-product .woocommerce ul.products,
  .post-type-archive-product .woocommerce-page ul.products {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

.dth-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dth-nav li {
  display: inline-flex !important;
  margin: 0;
  padding: 0;
}

.dth-nav li a {
  display: inline-block;
  padding: 0.25rem 0;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
}

.dth-nav li a:hover {
  color: var(--primary);
}

:root {
  --primary: #111827;
  --accent: #16a34a;
  --accent-soft: #dcfce7;
  --bg: #f3f4f6;
  --text-main: #111827;
  --text-muted: #6b7280;
  --max-width: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Prompt", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.dth-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.dth-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e7eb;
}

.dth-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
}

.dth-logo {
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 1rem;
  color: var(--primary);
  text-transform: uppercase;
}

.dth-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}

.dth-nav a {
  color: var(--text-muted);
  position: relative;
  padding-bottom: 0.15rem;
}

.dth-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.18s ease;
}

.dth-nav a:hover {
  color: var(--primary);
}

.dth-nav a:hover::after {
  width: 100%;
}

/* Hero */

.dth-hero {
  background: radial-gradient(circle at top right, #dcfce7 0, transparent 55%),
              #ffffff;
  color: var(--primary);
  padding: 4.25rem 0 3.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.dth-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}

.dth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 0.75rem;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.9rem;
}

.dth-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.dth-hero-title {
  font-size: clamp(2.2rem, 4vw, 3rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.dth-hero-title span {
  color: var(--accent);
}

.dth-hero-text {
  font-size: 0.95rem;
  max-width: 30rem;
  color: var(--text-muted);
  margin-bottom: 1.6rem;
}

.dth-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.dth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  border-radius: 999px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease,
              border-color 0.15s ease, color 0.15s ease;
}

.dth-btn-primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  box-shadow: 0 16px 30px rgba(22, 163, 74, 0.35);
}

.dth-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 38px rgba(22, 163, 74, 0.4);
}

.dth-btn-outline {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid #d1d5db;
}

.dth-btn-outline:hover {
  background: #f3f4f6;
  border-color: var(--accent);
  color: var(--accent);
}

.dth-hero-footnote {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Hero visual / main image slot */

.dth-hero-visual {
  background: #f9fafb;
  border-radius: 1.5rem;
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.dth-hero-visual-title {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
}

.dth-image-slot {
  border-radius: 1rem;
  border: 1px dashed #d1d5db;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
  padding: 1rem;
}

/* Sections */

.dth-section {
  padding: 3.25rem 0;
}

.dth-section-header {
  text-align: center;
  margin-bottom: 2.25rem;
}

.dth-section-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.dth-section-title {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.dth-section-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Cards grid */

.dth-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
}

.dth-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.2rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.04);
}

.dth-card-title {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.dth-card-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Image grid (Projects) */

.dth-grid-3-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
}

.dth-image-card {
  background: #fff;
  border-radius: 1rem;
  border: 1px dashed #d1d5db;
  padding: 0.9rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Extra gallery section */

.dth-section-muted {
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.dth-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.dth-gallery-item {
  background: #ffffff;
  border-radius: 1rem;
  border: 1px dashed #d1d5db;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
  padding: 0.75rem;
}

/* Contact section */

.dth-contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2rem;
}

.dth-contact-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.4rem;
  border: 1px solid #e5e7eb;
}

.dth-contact-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.dth-contact-list li {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.dth-input {
  width: 100%;
  border-radius: 0.7rem;
  border: 1px solid #e5e7eb;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}

.dth-textarea {
  min-height: 110px;
}

/* WooCommerce basic layout overrides */

.woocommerce ul.products,
.woocommerce-page ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  padding-left: 0;
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  margin: 0;
  width: 100% !important;
  border-radius: 0.9rem;
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.03);
  background: #ffffff;
}

/* Footer */

.dth-footer {
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

/* Responsive */

@media (max-width: 900px) {
  .dth-hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .dth-grid-3,
  .dth-grid-3-images,
  .dth-contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .dth-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dth-header-inner {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .dth-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .dth-gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
