/* โหลด CSS ของ shared หลังไฟล์นี้ เพื่อให้กฎ component มีผลหลัง page reset.
   โครงเดียวกับ home-page.css (prefix .tci-jacket- แทน .tci-e40211-). */

/* Typography: ใช้ font และ type tokens จาก shared/tci-shared.css. */

.tci-jacket-title {
  padding: 0;
  margin: 0;
  color: #414141;
  font-family: var(--tci-font-heading);
  font-size: var(--tci-title-size);
  font-style: normal;
  font-weight: var(--tci-title-weight);
  line-height: var(--tci-title-line-height);
  letter-spacing: 0;
  text-align: center;
}

.tci-jacket-subtitle {
  padding: 0;
  margin: 0;
  color: #414141;
  font-family: var(--tci-font-heading);
  font-size: var(--tci-subtitle-size);
  font-style: normal;
  font-weight: var(--tci-subtitle-weight);
  line-height: var(--tci-subtitle-line-height);
  letter-spacing: 0;
  text-align: center;
}

/* กล่องของ title/subtitle สูงกว่าตัวหนังสือจริงมาก (half-leading ของ
   line-height บวกกับ ascent/descent ที่ฟอนต์ไทยกันไว้ให้วรรณยุกต์) ทำให้
   ปรับ padding-top ของ section ไปเท่าไหร่ก็ยังดูห่างเกินจริง เพราะช่องว่าง
   ส่วนใหญ่มาจากตรงนี้ไม่ใช่ padding — ตัดส่วนนั้นออกให้กล่องหุ้มตัวหนังสือพอดี
   (ตามรูปแบบเดียวกับ home-page.css/tni-product.css ที่เจอปัญหาเดียวกันมาก่อน
   เบราว์เซอร์ที่ยังไม่รองรับจะข้ามกฎนี้ไปและได้ระยะแบบเดิม). */
.tci-jacket-title,
.tci-jacket-subtitle {
  text-box: trim-both text text;
}

.tci-jacket-content {
  margin: 0;
  color: #414141;
  font-family: var(--tci-font-body);
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  letter-spacing: 0;
  text-align: center;
}

/* Reset เฉพาะเนื้อหาภายใน page wrapper. */

.tci-jacket-page,
.tci-jacket-page * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.tci-jacket-page :where(a) {
  text-decoration: none;
  color: inherit;
}

.tci-jacket-page :where(button) {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.tci-jacket-page :where(ul) {
  list-style: none;
}

.tci-jacket-page {
  max-width: none;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--tci-font-body);
  color: #414141;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

/* header ติดด้านบนตอนเลื่อน (position: sticky ใน tci-shared.css) ใช้ไม่ได้ถ้า wrapper
   เป็น scroll container (overflow hidden/auto) จึงใช้ clip แทน: ยังตัดส่วนล้นแนวนอน
   เหมือนเดิมแต่ไม่สร้าง scroll container. เบราว์เซอร์เก่าที่ไม่รู้จัก clip ใช้ค่าเดิมด้านบน */
@supports (overflow: clip) {
  .tci-jacket-page {
    overflow-x: clip;
    overflow-y: visible;
  }
}

/* แบ่งระยะ section เป็น padding ครึ่งหนึ่งต่อด้าน. */
.tci-jacket-page > section { margin-block: 0; }
.tci-jacket-page > .tci-jacket-section {
  padding-block: var(--tci-section-padding);
}

.tci-jacket-section-gray {
  background: var(--tci-section-bg);
}

.tci-jacket-section-title {
  margin-inline: 16px;
}

.tci-jacket-section-subtitle {
  margin-top: var(--tci-title-subtitle-gap);
  margin-inline: 16px;
}

/* padding-top ของ section แรก (หัวข้อ "เงื่อนไขและความคุ้มครองฯ") — ใช้ id
   (#jacket-section-1 มีอยู่ใน jacket.html แล้ว) ให้ specificity สูงกว่า class
   เพื่อ override .tci-jacket-page > .tci-jacket-section ได้เสมอโดยไม่ต้องพึ่ง
   !important. ค่านี้ไม่ใช่ตัวการหลักของช่องว่างที่ดูกว้างเกิน (ตัวการจริงคือ
   text-box: trim-both ด้านบนที่เพิ่งเพิ่ม แก้ half-leading ของหัวข้อ 60px) จึง
   ตั้งไว้ที่ 24-32px ตามที่ขอตรงๆ ได้เลยโดยไม่ต้องคำนวณสัดส่วนซับซ้อน. */
#jacket-section-1 {
  padding-top: 24px;
}

@media (min-width: 768px) {
  #jacket-section-1 {
    padding-top: 32px;
  }
}

/* ===== ค้นหาเอกสาร =====
   หมวดเอกสาร (dropdown) + คำค้นหา (text) + ปุ่มค้นหา เรียงคอลัมน์เดียวบน
   มือถือ, แถวเดียวกันที่ desktop (ดู @media min-width:768px). */
.tci-jacket-search {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 16px 0;
  padding: 20px;
  background: var(--tci-section-bg);
  border: 1px solid var(--tci-border);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.tci-jacket-search__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.tci-jacket-search__label {
  font-size: 16px;
  font-weight: 700;
  color: #414141;
  text-align: left;
}

/* dropdown หมวดเอกสาร = Semantic UI "ui search selection dropdown" (หน้าตาเดียวกับ
   carBrandList ของ SearchDropdownCampaign) ปรับแค่ความกว้าง/ความสูง/ฟอนต์ให้
   สูงเท่าช่องคำค้นหาข้างๆ (padding 15px x2 + line-height 1em + border 2px = 48px) */
.tci-jacket-search .ui.search.selection.dropdown.tci-jacket-search__dropdown {
  width: 100%;
  min-width: 0;
  padding-top: 15px;
  padding-bottom: 15px;
  font-family: inherit;
  font-size: 16px;
  text-align: left;
}

.tci-jacket-search .ui.search.selection.dropdown.tci-jacket-search__dropdown > .dropdown.icon {
  top: 15px;
}

.tci-jacket-search__input {
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--tci-border);
  border-radius: 10px;
  background: #ffffff;
  font-family: inherit;
  font-size: 16px;
  color: #414141;
  transition: border-color 0.2s ease;
}

.tci-jacket-search__input:hover {
  border-color: var(--tci-orange);
}

.tci-jacket-search__input:focus-visible {
  outline: 2px solid var(--tci-orange);
  outline-offset: 2px;
}

.tci-jacket-search__button {
  height: 48px;
  padding: 0 32px;
  border-radius: 10px;
  background: var(--tci-orange);
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.tci-jacket-search__button:hover {
  background: var(--tci-orange-dark);
  transform: translateY(-1px);
}

.tci-jacket-search__button:focus-visible {
  outline: 2px solid var(--tci-orange);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  /* กว้างเท่าการ์ดด้านล่าง (.tci-detail-grid: max-width:1140px + margin-inline:auto
     อยู่ใน section ที่มี padding-inline:16px) — ที่นี่ section ไม่มี
     padding-inline นั้น จึงใช้ width: calc(100% - 32px) แทนเพื่อให้ได้ระยะขอบ
     ซ้าย-ขวา 16px เท่ากันบนจอที่แคบกว่า 1140+32px ได้ผลลัพธ์เหมือนกันทุกจอ. */
  .tci-jacket-search {
    flex-direction: row;
    align-items: flex-end;
    gap: 20px;
    width: calc(100% - 32px);
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding: 24px 28px;
  }

  .tci-jacket-search__label {
    font-size: 17px;
  }

  .tci-jacket-search__input {
    height: 50px;
    font-size: 17px;
  }

  /* 16px x2 + 17px + 2px = 51px ≈ ช่องคำค้นหา 50px */
  .tci-jacket-search .ui.search.selection.dropdown.tci-jacket-search__dropdown {
    padding-top: 16px;
    padding-bottom: 16px;
    font-size: 17px;
  }

  .tci-jacket-search .ui.search.selection.dropdown.tci-jacket-search__dropdown > .dropdown.icon {
    top: 16px;
  }

  .tci-jacket-search__field--text {
    flex: 2;
  }

  .tci-jacket-search__button {
    flex: 0 0 auto;
    height: 50px;
    font-size: 17px;
  }
}

/* ===== Banner Slider =====
   เลื่อนด้วย scroll-snap (ปัดนิ้วได้เองบนมือถือ) ส่วน jacket.js คุมปุ่ม
   ก่อน/ถัดไป จุดบอกหน้า และเล่นอัตโนมัติ. ภาพทุก slide ถูกบังคับสัดส่วน
   เดียวกัน (มือถือ 390:609, desktop 1440:756) ให้สูงเท่ากันแม้ไฟล์ต่างกัน. */
.tci-jacket-banner {
  position: relative;
  width: 100%;
}

.tci-jacket-banner-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.tci-jacket-banner-track::-webkit-scrollbar {
  display: none;
}

.tci-jacket-banner-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.tci-jacket-banner-link {
  display: block;
}

/* ขนาดเท่าแบนเนอร์หน้า product (tni-product.css .tci-product-e51837-main-banner-image):
   มือถือ 390:609 เต็มความกว้าง, desktop 1440:500 (ดู @media min-width:768px)
   ไม่จำกัดความสูงตามจอ. object-fit: cover ให้ทุก slide สูงเท่ากันแม้ไฟล์ภาพต่างสัดส่วน. */
/* ขนาดเท่าแบนเนอร์หลักหน้า HomeCorporate (ใช้รูปชุดเดียวกัน): มือถือ 390:609,
   desktop 1440:500 (ดู @media min-width:768px) เต็มความกว้าง ภาพไม่ถูกครอป */
.tci-jacket-banner-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 609;
  object-fit: cover;
}

/* ปุ่มก่อน/ถัดไป: วงกลมขาวนูน ลูกศร chevron ส้ม — ซ่อนบนมือถือ (ใช้ปัดแทน). */
.tci-jacket-banner-arrow {
  display: none;
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background-color 0.2s ease;
}

.tci-jacket-banner-arrow:hover {
  background: #ffffff;
}

.tci-jacket-banner-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -3px;
  border-style: solid;
  border-color: var(--tci-orange);
  border-width: 2px 2px 0 0;
  transform: rotate(45deg);
}

.tci-jacket-banner-arrow-prev {
  left: 24px;
}

.tci-jacket-banner-arrow-prev::before {
  margin-left: -7px;
  transform: rotate(-135deg);
}

.tci-jacket-banner-arrow-next {
  right: 24px;
}

.tci-jacket-banner-arrow:focus-visible,
.tci-jacket-banner-dot:focus-visible {
  outline: 2px solid var(--tci-orange);
  outline-offset: 2px;
}

.tci-jacket-banner-dots {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ปุ่มจุด: พื้นที่กด 24px แต่จุดที่เห็นเล็กกว่า; จุดของ slide ปัจจุบันยืดเป็นแถบส้ม. */
.tci-jacket-banner-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.tci-jacket-banner-dot::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.tci-jacket-banner-dot[aria-current="true"]::before {
  width: 20px;
  background: var(--tci-orange);
}

@media (prefers-reduced-motion: reduce) {
  .tci-jacket-banner-track {
    scroll-behavior: auto;
  }

  .tci-jacket-banner-arrow,
  .tci-jacket-banner-dot::before {
    transition: none;
  }
}

@media (min-width: 768px) {
  /* เท่าแบนเนอร์หลักหน้า HomeCorporate บน desktop */
  .tci-jacket-banner-image {
    aspect-ratio: 1440 / 500;
  }

  .tci-jacket-banner-arrow {
    display: block;
  }

  .tci-jacket-banner-dots {
    bottom: 24px;
  }
}

/* ===== การ์ดแผนประกัน (geometric pattern) =====
   การ์ดแบ่ง 2 ส่วน: ส่วนบน (__cover) พื้นหลังภาพลายสามเหลี่ยมส้ม
   (assets/image/bg-jacket-card.svg) และส่วนล่าง
   (__body) พื้นขาว มีวันที่ซ้ายล่าง + ไอคอนดาวน์โหลดขวาล่าง. */
.tci-jacket-detail-section {
  padding-inline: 16px;
}

/* ตัด padding บนออก ให้การ์ดต่อจากหัวข้อ section 1 ด้านบนทันที — ต้อง prefix
   .tci-jacket-page > ให้ specificity เท่ากฎ padding-block ของทุก section. */
.tci-jacket-page > .tci-jacket-detail-section {
  padding-top: 0;
}

/* align-content: start — jacket.js ล็อก min-height ไว้เท่าหน้าที่สูงที่สุด
   หน้าที่การ์ดไม่ครบต้องชิดบน ไม่ให้แถวที่เหลือยืดการ์ดจนสูงผิดสัดส่วน. */
.tci-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  gap: 24px;
  max-width: 1140px;
  margin-inline: auto;
}

.tci-detail-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* การ์ดที่ไม่อยู่ในหน้าปัจจุบัน (jacket.js ใส่ hidden) — ต้องเขียนเองเพราะ
   display:flex ด้านบนชนะ [hidden] ของ browser. */
.tci-detail-card[hidden] {
  display: none;
}

.tci-detail-card__cover {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 190px;
  padding: 36px 24px;
  /* ภาพพื้นหลังลายสามเหลี่ยม ครอปให้เต็มพื้นที่ทุกขนาดการ์ด (สัดส่วนภาพ
     338:182 ใกล้เคียง desktop; มือถือการ์ดสูงกว่าจึงถูกครอปด้านข้าง)
     สีส้มทึบด้านหน้าเป็นสีสำรองระหว่างรอภาพโหลด. */
  background: #D9611A url("../assets/image/bg-jacket-card.svg") center / cover no-repeat;
  text-align: center;
}

.tci-detail-card__subtitle {
  position: relative;
  z-index: 1;
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
}

.tci-detail-card__title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

/* พื้นที่สีขาวใต้ส่วนส้ม: ยืดเต็มความสูงที่เหลือ (การ์ดในแถวเดียวกันสูงเท่ากัน)
   วันที่ชิดซ้ายล่าง ไอคอนดาวน์โหลดชิดขวาล่าง. */
.tci-detail-card__body {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-height: 80px;
  padding: 14px 20px;
}

/* ไอคอนปฏิทิน SVG inline ใช้ currentColor ตามสีข้อความ; ตอนนี้เป็นวันที่
   ตัวอย่างเดียวกันทุกใบ — เปลี่ยนทั้ง datetime และข้อความ. */
.tci-detail-card__date {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #767676;
  font-size: 13px;
  line-height: 1;
}

.tci-detail-card__date-icon {
  flex: 0 0 auto;
  display: block;
  color: var(--tci-orange);
}

/* แถบแบ่งหน้า: หน้าตาเดียวกับ .tci-e40211-card-pagination ของหน้า home
   (← pill →) แต่แสดงปุ่มทุกขนาดจอ รวมมือถือ. */
.tci-detail-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.tci-detail-pagination[hidden] {
  display: none;
}

.tci-detail-pagination__button {
  width: 44px;
  height: 44px;
  color: var(--tci-orange);
  font-size: 20px;
}

.tci-detail-pagination__button:disabled {
  opacity: 0.35;
  cursor: default;
}

.tci-detail-pagination__button:focus-visible {
  outline: 2px solid var(--tci-orange);
  outline-offset: 2px;
}

.tci-detail-pagination__pill {
  padding: 4px 14px;
  border: 1px solid #e6ebef;
  border-radius: 999px;
  background: #ffffff;
  color: var(--tci-orange);
  font-size: 12px;
  line-height: 150%;
}

/* ไอคอนดาวน์โหลด: ตกแต่งอย่างเดียว (aria-hidden) — ทั้งการ์ดเป็นลิงก์อยู่แล้ว
   ทำเป็นปุ่มแยกซ้อนใน <a> ไม่ได้ (interactive ซ้อนกันผิด HTML). */
.tci-detail-card__download-icon {
  flex: 0 0 auto;
  display: block;
  color: var(--tci-orange);
}

/* hover ยกการ์ดเฉพาะอุปกรณ์ที่มีเมาส์ (กันการ์ดค้างสถานะ hover หลังแตะบนมือถือ). */
@media (hover: hover) {
  .tci-detail-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(217, 97, 26, 0.3);
  }
}

.tci-detail-card:focus-visible {
  outline: 2px solid var(--tci-orange);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .tci-detail-card {
    transition: none;
  }

  .tci-detail-card:hover {
    transform: none;
  }
}

/* มือถือ: แถวละ 1 ใบ (หน้าละ 2 ใบ ตาม jacket.js) การ์ดกว้างเต็มจอจึงใช้
   ขนาดตัวอักษร/padding ใกล้ desktop ได้. */
@media (max-width: 767.98px) {
  .tci-detail-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tci-detail-card__cover {
    min-height: 220px;
    padding: 32px 20px;
  }

  .tci-detail-card__subtitle {
    font-size: 16px;
  }

  .tci-detail-card__title {
    font-size: 20px;
  }

  .tci-detail-card__body {
    min-height: 72px;
    padding: 14px 18px;
  }

  .tci-detail-pagination {
    margin-top: 20px;
  }
}

/* หัวข้อ section 1 (#jacket-section-1-title): มือถือ 40px, desktop 60px
   — ใหญ่กว่า --tci-title-size ของหัวข้อ section ทั่วไปโดยตั้งใจ. */
#jacket-section-1-title {
  font-size: clamp(28px, 7.5vw, 40px);
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: break-word;
  word-break: normal;
}

@media (min-width: 768px) {
  #jacket-section-1-title {
    font-size: 60px;
    line-height: 1.2;
  }
}

/* ข้อความเมื่อยังไม่มีเอกสารในตาราง dbo.jacket (หรือดึงข้อมูลไม่สำเร็จ) — กินเต็มแถวของกริด */
.tci-detail-empty {
  grid-column: 1 / -1;
  margin: 24px 0;
  text-align: center;
  font-size: 16px;
  color: #7a7a7a;
}