/* ===== DWR Inquiry — Contact Page Layout ===== */

@import url("https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

/* ── Hero Banner (plugin-managed) ── */
.dwr-contact-hero {
  position: relative;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 3.4375rem 1.25rem 2.8125rem;
  text-align: center;
}

.dwr-contact-hero-title {
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 2.375rem !important;
  font-weight: 400 !important;
  margin: 0 !important;
  padding: 0 !important;
  text-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.3);
  font-family: "Prompt", sans-serif;
}

/* ── Divider ── */
.dwr-divider {
  width: 100%;
  max-width: 100rem;
  margin: 0rem auto 0 auto;
  border-top: 0.125rem solid #dfe8ef;
}

/* WD-659: ตัวห่อของ layout = กล่องที่ใช้วัดความกว้าง (container query)
   ตัดสิน 2 คอลัมน์/1 คอลัมน์จากความกว้างจริงของพื้นที่ที่หน้านี้ได้รับ ไม่ใช่ความกว้างจอ */
.dwr-contact-cq {
  container-type: inline-size;
  container-name: dwr-contact;
  /* ตัวห่อเป็นลูกตรงของ post-content ที่ WP จำกัดกว้าง 620px (contentSize ของธีม)
     ด้วยกฎ :where() น้ำหนักศูนย์ — ตั้ง max-width เองแบบเดียวกับที่ .dwr-contact-layout
     ทำมาตลอด จึงกว้างได้เต็มพื้นที่หน้า (สูงสุด 100rem) เหมือนเดิม ไม่งั้นติดอยู่ที่ 620px */
  max-width: 100rem;
  margin-left: auto;
  margin-right: auto;
}

/* ขยาย layout ให้กว้างเต็มหน้า (break ออกจาก WP content width) */
.dwr-contact-layout {
  display: grid;
  /* WD-659: เดิม minmax(764px, 1fr) 1fr = ล็อกฟอร์มไว้ไม่ต่ำกว่า 764px
     จอแคบลงเมื่อไหร่ ฝั่งที่โดนบีบคือข้อมูลติดต่อ (การ์ดแคบ ปุ่ม "หมายเลขโทรศัพท์ทั้งหมด" ล้น)
     กลับด้าน: ข้อมูลติดต่อไม่ต่ำกว่า 26rem (พอให้หัวข้อ+ปุ่มอยู่แถวเดียว) ฟอร์มหดแทน
     ฟอร์มขยายได้ถึง 48.75rem (780px = ครึ่งพอดีตอนกว้างสุด 100rem) → จอกว้างหน้าตาเหมือนเดิม
     ต่างจากเดิมเฉพาะช่วงที่เดิมบีบ/ล้น · ฟอร์มแคบเกินกรอกสบาย → คอลัมน์เดียว (ดู @container ท้ายไฟล์) */
  grid-template-columns: minmax(0, 48.75rem) minmax(26rem, 1fr);
  gap: 2.5rem;
  /* WD-528: สองฝั่งจบที่บรรทัดเดียวกัน — เดิม start = ต่างฝ่ายต่างสูงตามเนื้อหา
     ไม่ได้ไปหดฝั่งซ้าย เพราะความสูงของมันคือความยาวของฟอร์มจริง ๆ (มี/ไม่มี reCAPTCHA,
     ข้อความ error ตอน validate ก็ยืดได้) — กำหนดตายตัวเมื่อไหร่ก็เพี้ยนอีกเมื่อนั้น
     ใช้ stretch แล้วให้ "แผนที่" ฝั่งขวายืดลงมาปิดส่วนต่างแทน */
  align-items: stretch;
  padding: 1.25rem 0;
  padding-bottom: 8rem;
  /* width: 100vw; */
  max-width: 100rem;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}

/* ===== Left: Form ===== */
.dwr-contact-form-section {
  background: rgba(223, 232, 239, 0.85);
  border-radius: 1rem;
  padding: 2rem 3rem;
  padding-bottom: 2.35rem;
}
.dwr-contact-form-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9375rem;
  margin-top: 1.5rem;
  margin-bottom: 3rem;
}
.dwr-contact-form-title .dwr-icon-circle {
  width: 3.75rem;
  height: 3.75rem;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dwr-contact-form-title .dwr-icon-circle img {
  width: 2.375rem;
  height: 2.375rem;
}
.dwr-contact-form-title h2 {
  font-family: "Prompt", sans-serif;
  font-size: 1rem; /* WD-161: 16px ตาม design */
  font-weight: 400;
  color: #2a5f9e;
  margin: 0;
  line-height: 1.4;
}

/* Override form wrap styles inside this layout */
.dwr-contact-form-section .dwr-inquiry-form-wrap {
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  max-width: 100% !important;
  border-radius: 0 !important;
}
.dwr-contact-form-section .dwr-form-header {
  display: none !important;
}

/* ===== Right: Contact Info ===== */
.dwr-contact-info-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.9375rem;
  /* WD-528: สูงเต็มความสูงของแถว (grid stretch ให้มาแล้ว) — min-height:0 กัน
     flex item ล้นกล่องตัวเองตามค่า min-height:auto ของ flexbox */
  min-height: 0;
}

/* ── [dwr_contact_info] ใช้เดี่ยว ๆ นอกหน้าติดต่อเรา ──
   ตัวเนื้อหาเดิมเป็น flex item ของ .dwr-contact-layout · พอเอามาวางที่อื่น
   ไม่มี flex parent แล้ว จึงต้องกลับเป็นบล็อกปกติ ไหลเต็มพื้นที่ที่ได้รับ
   (direction #1: ไม่กำหนดความกว้างเอง — client ครอบผ่าน Page editor) */
.dwr-contact-standalone {
  width: 100%;
}
.dwr-contact-standalone > .dwr-contact-info-section {
  flex: none;
  width: 100%;
}
/* WD-528: ใช้เดี่ยว ๆ ไม่มีฝั่งซ้ายให้จบเท่ากัน แผนที่จึงกลับไปสูงคงที่ตามเดิม */
.dwr-contact-standalone .dwr-map-container {
  flex: none;
  height: 25rem;
}

.dwr-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;   /* WD-659: แคบจนไม่พอ → ปุ่มลงบรรทัดใหม่ ไม่ล้นออกนอกคอลัมน์ */
  gap: 0.9375rem;
  margin-bottom: 0.625rem;
}
/* WD-660: ซ่อนหัวข้อไว้ ปุ่มเหลือตัวเดียว → ยังชิดขวาเหมือนตอนมีหัวข้อ */
.dwr-info-header > .dwr-phone-badge:only-child {
  margin-left: auto;
}
.dwr-info-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.dwr-info-title-group .dwr-separator {
  width: 0.9375rem;
  height: 3.8125rem;
  object-fit: contain;
}
.dwr-info-title-group h2 {
  font-family: "Prompt", sans-serif;
  font-size: 1rem; /* WD-161: 16px ตาม design */
  font-weight: 500;
  /* WD-545: ตามสี "ข้อความ Title" ที่ตั้งในหน้าตั้งค่า — เดิม hardcode ขาว
     พอพื้นหลังไม่เข้ม (เช่นเลือก "ไม่มีพื้นหลัง" ของ WD-527) หัวข้อนี้ก็หายไปเลย */
  color: var(--dwr-inq-title, #ffffff);
  margin: 0;
  white-space: nowrap;
}

.dwr-phone-badge {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: #fff;
  padding: 0.5rem 2rem 0.5rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
  height: 4.0625rem;
}
.dwr-phone-badge img {
  width: 2.0625rem;
  height: 2.0625rem;
}
.dwr-phone-badge span {
  font-family: "Prompt", sans-serif;
  font-size: 0.875rem; /* WD-161: 14px ตาม design */
  font-weight: 500;
  color: #1a5276;
  white-space: nowrap;
}

/* Info cards */
.dwr-info-card {
  background: #dfe8ef;
  border-radius: 1rem;
  /* WD-282: 1.5rem → 0.9rem ให้คอลัมน์ข้อมูลสูงเท่าฟอร์มพอดี (ค่าที่ tester วัดมา) */
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  /* gap: 0.5rem; */
}
.dwr-info-card.dwr-card-with-logo {
  padding-top: 1rem;
}
.dwr-info-card-logo img {
  height: 4.375rem;
  width: auto;
  /* WD-659: เดิมไม่มีเพดานกว้าง → การ์ดแคบกว่ารูป (มือถือ) รูปล้นออกนอกจอ
     กันไว้ไม่ให้กว้างเกินการ์ด · ถ้าโดนเพดาน ให้ย่อทั้งรูป (contain) ไม่บีบรูปแบน
     ความสูงยังตายตัว 70px เหมือนเดิม = จอกว้างหน้าตาเท่าเดิมทุกเว็บ รวมเว็บที่โลโก้เล็กกว่า 70px */
  max-width: 100%;
  object-fit: contain;
  object-position: left top;
  padding-bottom: 1rem;
}
.dwr-info-card-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-left: 0.5rem;
}

.dwr-info-icon-circle {
  width: 3.125rem;
  height: 3.125rem;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dwr-info-icon-circle img {
  width: 1.75rem;
  height: 1.75rem;
}
.dwr-info-card-text {
  font-family: "Prompt", sans-serif;
  font-size: 0.875rem; /* WD-161: 14px ตาม design */
  font-weight: 400;
  color: #2a5f9e;
  line-height: 1.5;
  /* padding-top: 0.5rem; */
}

/* Google Maps */
.dwr-map-container {
  border-radius: 1.25rem;
  overflow: hidden;
  border: 0.0625rem solid #e1e8f0;
  box-shadow: 0 0.25rem 0.9375rem rgba(0, 0, 0, 0.05);
  /* WD-528: 25rem กลายเป็น "อย่างน้อย" แล้วยืดรับส่วนต่างจากฝั่งซ้าย
     (ฝั่งขวายาวกว่าเมื่อไหร่ การ์ดฟอร์มฝั่งซ้ายจะยืดลงมาเองจาก align-items:stretch) */
  min-height: 25rem;
  flex: 1 1 auto;
  display: flex;
}
.dwr-map-container iframe {
  width: 100%;
  /* เป็น flex item แล้ว — สูงเต็มกล่องด้วย flex:1 ไม่ใช่ height:100%
     (height:100% ต้องการพ่อที่มีความสูงแน่นอน ซึ่งตอนนี้ไม่มีแล้ว) */
  flex: 1 1 auto;
  min-height: 0;
  border: 0;
}
.g-recaptcha {
  display: flex !important;
  justify-content: center !important; /* จัดให้อยู่กลางหน้าฟอร์ม */
  background-color: #ffffff !important; /* พื้นหลังสีขาวตามรูป */
  padding: 12px !important; /* ระยะห่างระหว่างขอบกับตัวเลือก */
  border-radius: 15px !important; /* ขอบโค้งมนตาม Design */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important; /* เงาบางๆ ให้ดูมีมิติ */
  margin: 20px auto !important; /* ระยะห่างบน-ล่าง */
  margin-top: 0 !important;
  width: fit-content !important; /* ให้ขนาดกล่องพอดีกับตัว reCAPTCHA */
}

/* ===== Responsive ===== */
/* WD-659: สำรองสำหรับเบราว์เซอร์ที่ไม่รู้จัก container query — อยู่ก่อน @container เสมอ
   (ค่าเท่ากัน กฎที่มาทีหลังชนะ ถ้าสลับลำดับ ค่ามือถือด้านล่างจะไม่ถูกใช้)
   minmax(0,1fr) ไม่ใช่ 1fr — 1fr ยอมให้เนื้อหา (reCAPTCHA 304px) ดันคอลัมน์กว้างกว่าจอ */
@media (max-width: 60rem) {
  .dwr-contact-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.875rem;
    padding: 0.625rem;
  }
  .dwr-contact-form-section {
    padding: 1.5rem 1.5rem;
  }
  .dwr-info-header {
    flex-direction: column;
    align-items: flex-start;
  }
  /* WD-161: เดิม override 1.6rem บนจอเล็ก = ใหญ่กว่า desktop → เอาออก ใช้ 16px เท่ากันทุกจอ */
}

/* WD-659: ตัดสินจากความกว้างกล่อง (.dwr-contact-cq) — 60rem ≈ ข้อมูลติดต่อ 26rem + ช่องว่าง
   + ฟอร์มราว 32rem · แคบกว่านี้ฟอร์มเริ่มอึดอัด → เรียงคอลัมน์เดียว (ฟอร์มก่อน แล้วข้อมูลติดต่อ) */
@container dwr-contact (max-width: 60rem) {
  .dwr-contact-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.875rem;
    padding: 0.625rem;
  }
  .dwr-contact-form-section {
    padding: 1.5rem 1.5rem;
  }
  .dwr-info-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* มือถือ: ลดขอบฟอร์ม + เอากรอบขาวรอบ reCAPTCHA ออก ให้เหลือที่ให้ช่องกรอก */
@container dwr-contact (max-width: 26rem) {
  .dwr-contact-form-section {
    padding: 1.25rem 0.75rem;
  }
  .dwr-contact-form-section .g-recaptcha {
    padding: 0 !important;
    box-shadow: none !important;
  }
  .dwr-info-card-row {
    gap: 1rem;
  }
  /* โลโก้: สูงตามสัดส่วนที่ย่อแล้ว (ไม่เหลือช่องว่างใต้รูปจาก contain) ไม่เกิน 70px เท่าเดิม */
  .dwr-info-card-logo img {
    height: auto;
    max-height: 4.375rem;
  }
}

/* reCAPTCHA กว้างตายตัว 304px (Google กำหนด) — จอ 360px หักขอบหน้าแล้วเหลือไม่ถึง
   ย่อด้วย transform (วิธีมาตรฐาน) · ตั้ง width ของกล่องให้เท่าขนาดหลังย่อ ไม่งั้นยังดันจอล้น
   พื้นที่ใช้ได้ = กล่อง − 44px (ขอบ layout 10×2 + ขอบฟอร์ม 12×2)
   ≤ 22rem (352px): เหลือ ≥ 258px ที่จอ 360 → ย่อ 0.84 = 255px
   ≤ 18.75rem (300px): จอ 320 เหลือ ≈ 220px → ย่อ 0.72 = 219px */
@container dwr-contact (max-width: 22rem) {
  .dwr-contact-form-section .g-recaptcha {
    transform: scale(0.84);
    transform-origin: center top;
    width: 255px !important;
    height: 66px;
  }
}
@container dwr-contact (max-width: 18.75rem) {
  .dwr-contact-form-section .g-recaptcha {
    transform: scale(0.72);
    width: 219px !important;
    height: 57px;
  }
}
