/**
 * CCT PAK 20 — PROFILE CARD "APPLE GLASS" (khổ dọc, ảnh nhân sự tràn viền)
 *
 * Dùng CHUNG cho 2 trang:
 *   - districts.php  (คณะเสริมสร้าง / คริสตจักรเขต)
 *   - about.php      (เกี่ยวกับเรา, ยกเว้น «คณะกรรมการฝ่ายต่างๆ»)
 *
 * Cách dùng: bọc lưới thẻ trong một khối có class .church-county-section
 * rồi đặt markup .card-apple-glass (desktop) / .ios-profile-card (mobile).
 *
 * Tách khỏi county-profile-cards.css ngày 2026-11-11 để about.php dùng lại được
 * mà không kéo theo khối tối ưu header riêng của trang districts.
 * Zero !important — thuần specificity.
 */

/* Thẻ iOS chỉ hiển thị ở mobile (≤991.98px) */
.church-county-section .county-card-mobile {
  display: none;
}

/* ==========================================================================
   1. GRID CONTAINER — số thẻ mỗi hàng (hardcode theo số lượng thẻ)
   - 1..4 thẻ  → 2 thẻ/hàng, thẻ 290 × 315
   - từ 5 thẻ  → 3 thẻ/hàng, thẻ 237 × 315 (giữ nguyên chiều cao)
   Biến đặt ở khối BỌC (không đặt trên lưới) để thanh tìm kiếm / pager bên trong
   đọc được và canh đúng mép lưới.
   ========================================================================== */
.church-county-section .county-card-profile-wrapper,
.church-county-section.abt-cards {
  --county-card-w: 290px;
  --county-cols: 2;
}

/* Chỉ đủ chỗ cho 3 cột khi cột nội dung đạt 760px (≥1200px màn hình).
   Hẹp hơn thì giữ 2 cột để thẻ không bị bóp còn ~190px. */
@media (min-width: 1200px) {
  .church-county-section .county-card-profile-wrapper.is-3col,
  .church-county-section.abt-cards.is-3col {
    --county-card-w: 237px;
    --county-cols: 3;
  }
}

.church-county-section .county-profile-grid {
  margin-top: 16px;
  margin-bottom: 30px;
}

@media (min-width: 992px) {
  /* Canh lưới thẻ theo đúng cột chữ 760px của trang (--abt-measure), không theo
     toàn bộ cột bài viết 968px — nếu không lưới bị đẩy lệch sang phải. */
  .church-county-section .county-card-profile-wrapper,
  .church-county-section.abt-cards {
    max-width: var(--abt-measure, 760px);
  }

  .church-county-section .county-profile-grid {
    /* Bề rộng lưới = (bề rộng thẻ + 1 rãnh) × số cột → 2 cột 612px, 3 cột 759px.
       Chiều cao thẻ giữ nguyên (min-height 315px của .card-apple-glass). */
    max-width: calc((var(--county-card-w, 290px) + 16px) * var(--county-cols, 2));
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
    margin-top: 0;
    margin-bottom: 20px;
    --bs-gutter-x: 16px;
    --bs-gutter-y: 16px;
  }
}

/* ==========================================================================
   6. CONCEPT 5: "APPLE GLASS CINEMATIC" (DESKTOP VIEW - OPTION 2 COMPACT)
   - Zero Important Directive • Pure CSS Specificity
   - Symmetrical 2x2 Layout (Max-width 820px, Card ~390px x 360px)
   - GPU-accelerated crisp image rendering (image-rendering: -webkit-optimize-contrast)
   - Full-bleed portrait image with soft scrim (56%-100%)
   - Monogram for missing photo: gold Thai initial on crisp white background
   - Apple Liquid Frosted Glass dock for contact actions
   - Department pill with high contrast (light frosted glass + dark navy text)
   - Zero jump / zero transform on hover
   ========================================================================== */
.church-county-section .card-apple-glass {
  background: #0b0f26;
  border-radius: 16px;
  box-shadow: 0 10px 32px rgba(11, 15, 38, 0.22);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 315px;
  height: 100%;
  width: 100%;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  margin: 0;
  box-sizing: border-box;
}

/* Desktop Hover: Pure Radiant Golden/Amber Glow, Zero Transform / Zero Scale */
@media (min-width: 992px) and (hover: hover) {
  .church-county-section .card-apple-glass.card-ecclesiastical:hover {
    border-color: rgba(245, 158, 11, 0.7);
    box-shadow: 0 12px 42px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.25);
    transform: none;
  }

  .church-county-section .card-apple-glass.is-monogram:hover {
    border-color: rgba(212, 175, 55, 0.85);
    box-shadow: 0 10px 36px rgba(212, 175, 55, 0.22);
    transform: none;
  }

  .church-county-section .card-apple-glass.is-vacant-card:hover {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transform: none;
  }
}

/* Full-bleed portrait image with GPU anti-aliasing */
.church-county-section .card-apple-glass picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

.church-county-section .card-apple-glass .c5-bg-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  z-index: 1;
  image-rendering: -webkit-optimize-contrast;
  transform: translateZ(0);
}

/* Soft lower gradient scrim (does not darken chest/face) */
.church-county-section .card-apple-glass .c5-gradient-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(11, 15, 38, 0) 0%,
    rgba(11, 15, 38, 0) 56%,
    rgba(11, 15, 38, 0.25) 70%,
    rgba(11, 15, 38, 0.55) 85%,
    rgba(11, 15, 38, 0.74) 100%
  );
  pointer-events: none;
}

/* Top ribbon navigation */
.church-county-section .card-apple-glass .c5-top-ribbon {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Badge chức danh — góc trái trên, thay chỗ pill ban ngành + năm (đã bỏ).
   Phong cách Apple Liquid Glass: nền đặc + blur + viền sáng + highlight trong.
   Chủ tịch = vàng đặc chữ navy; chức danh khác = trắng bóng kính chữ navy.
   Một dòng duy nhất: chữ 10px, quá dài thì cắt "…" để không che ảnh. */
.church-county-section .card-apple-glass .c5-role-tag {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(22px) saturate(190%);
  -webkit-backdrop-filter: blur(22px) saturate(190%);
  color: #141a3e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), inset 0 1px 1px #ffffff;
  margin: 0;
}

.church-county-section .card-apple-glass .c5-role-tag.is-president {
  background: rgba(245, 158, 11, 0.94);
  color: #0b0f26;
  border-color: rgba(254, 240, 138, 0.6);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.55);
}

/* Caption box */
.church-county-section .card-apple-glass .c5-caption-box {
  position: relative;
  z-index: 3;
  padding: 10px 15px 14px;
  color: #ffffff;
  width: 100%;
  box-sizing: border-box;
}

/* ชื่อ-นามสกุลไทย — ตัวหนาขึ้น + เงาเข้มขึ้นเพื่อให้อ่านชัดบนภาพถ่ายทุกโทน */
.church-county-section .card-apple-glass .c5-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.26;
  letter-spacing: -0.012em;
  margin: 0 0 3px;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 2px 8px rgba(0, 0, 0, 0.9),
    0 4px 16px rgba(0, 0, 0, 0.6);
  word-break: break-word;
}

/* ชื่อภาษาม้ง — 13px สีทองอำพัน
   เลือก #fbbf24 (amber-400) ไม่ใช่เหลืองสด #fde047 เพราะบนพื้น navy #0b0f26
   ให้คอนทราสต์ 11.3:1 (AAA) แต่ยังไม่แสบตาเหมือนเหลืองนีออน
   เงา 3 ชั้น: ชั้นใน 1px เกาะขอบตัวอักษรกันภาพสว่างกลืน + ชั้นกลางไล่ขอบ + ชั้นนอกพรมนุ่ม
   ทำให้อ่านออกแม้ฉากหลังเป็นเสื้อขาวหรือท้องฟ้า */
.church-county-section .card-apple-glass .c5-name-hmong {
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
  line-height: 1.32;
  letter-spacing: 0.002em;
  margin: 0 0 4px;
  text-shadow:
    0 1px 1px rgba(0, 0, 0, 0.98),
    0 1px 3px rgba(0, 0, 0, 0.92),
    0 2px 10px rgba(0, 0, 0, 0.75);
  word-break: break-word;
}

/* Thẻ «ยังไม่มีภาพถ่าย» (nền trắng): vàng tươi #fbbf24 trên nền xám sáng chỉ đạt
   ~1.7:1 nên chuyển sang tông vàng đậm #a16207 (~3:1 + viền bóng) để đọc được
   mà vẫn giữ sắc vàng. Thẻ có ảnh nền tối giữ #fbbf24 (11.3:1). */
.church-county-section .card-apple-glass.is-monogram .c5-name-hmong {
  color: #a16207;
  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.85),
    0 1px 3px rgba(255, 255, 255, 0.55);
}

.church-county-section .card-apple-glass .c5-affiliation {
  font-size: 11.5px;
  color: #f1f5f9;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
  min-height: 28px;
}

/* Contact Footer Dock */
.church-county-section .card-apple-glass .c5-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
  /* Giữ chỗ bằng đúng chiều cao nút gọi: thẻ không có số điện thoại vẫn
     thẳng hàng tên với các thẻ khác trong cùng lưới. */
  min-height: 36px;
}

/* Apple Liquid Frosted Glass Call Button */
.church-county-section .card-apple-glass .c5-btn-call {
  flex: 1;
  height: 36px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), 0 4px 14px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 12px;
  box-sizing: border-box;
}

.church-county-section .card-apple-glass .c5-btn-call:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.65);
  color: #ffffff;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 6px 20px rgba(0, 0, 0, 0.25);
}

.church-county-section .card-apple-glass .c5-btn-call:active {
  background: rgba(255, 255, 255, 0.22);
}

/* Apple Liquid Frosted Glass Action Icons */
.church-county-section .card-apple-glass .c5-btn-action-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), 0 4px 14px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.church-county-section .card-apple-glass .c5-btn-action-icon:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.65);
  color: #fde68a;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 6px 20px rgba(0, 0, 0, 0.25);
}

.church-county-section .card-apple-glass .c5-btn-action-icon:active {
  background: rgba(255, 255, 255, 0.22);
}

/* Case A: Monogram State (Awaiting Official Photo - Gold initial on white background) */
.church-county-section .card-apple-glass.is-monogram {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 8px 28px rgba(20, 26, 62, 0.08);
}

.church-county-section .card-apple-glass.is-monogram .c5-bg-monogram {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 28px;
  z-index: 1;
}

.church-county-section .card-apple-glass.is-monogram .c5-mono-letter {
  font-size: 85px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(145deg, #f59e0b 0%, #d97706 50%, #92400e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(217, 119, 6, 0.25));
  user-select: none;
  letter-spacing: -0.02em;
}

.church-county-section .card-apple-glass.is-monogram .c5-mono-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 12px;
  border-radius: 20px;
  margin-top: 4px;
  letter-spacing: 0.03em;
}

.church-county-section .card-apple-glass.is-monogram .c5-gradient-scrim {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0) 56%,
    rgba(11, 15, 38, 0.25) 70%,
    rgba(11, 15, 38, 0.55) 85%,
    rgba(11, 15, 38, 0.74) 100%
  );
}

/* Thẻ monogram nền trắng: badge trắng cần viền + bóng nhẹ mới tách khỏi nền */
.church-county-section .card-apple-glass.is-monogram .c5-role-tag {
  border-color: rgba(20, 26, 62, 0.14);
  box-shadow: 0 2px 10px rgba(20, 26, 62, 0.14), inset 0 1px 1px #ffffff;
}

/* Case C: Vacant State (Position currently vacant) */
.church-county-section .card-apple-glass.is-vacant-card {
  border: 1.5px dashed rgba(255, 255, 255, 0.25);
  background: #111633;
}

.church-county-section .card-apple-glass.is-vacant-card .c5-vacant-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.church-county-section .card-apple-glass.is-vacant-card .c5-vacant-placeholder svg {
  width: 80px;
  height: 80px;
  opacity: 0.25;
  color: #ffffff;
}

.church-county-section .card-apple-glass.is-vacant-card .c5-role-tag.is-vacant {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.92);
  color: #475569;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), inset 0 1px 1px #ffffff;
}

.church-county-section .card-apple-glass.is-vacant-card .c5-name.is-vacant {
  color: #cbd5e1;
  font-style: italic;
  font-weight: 600;
  font-size: 17px;
}


/* ==========================================================================
   9. TRANG «เกี่ยวกับเรา» — ẨN NHÃN CHỨC DANH TRÊN THẺ ẢNH
   --------------------------------------------------------------------------
   Sếp chốt 2026-11-18: lưới thẻ của about.php không hiện badge chức danh nữa.
   Giữ nguyên markup `.c5-top-ribbon` trong about.php (chỉ ẩn bằng CSS) để bật
   lại dễ dàng; `display:none` cũng bỏ badge khỏi trình đọc màn hình.
   Phạm vi: CHỈ lưới `.abt-cards` của about.php. Trang /districts dùng
   `#countyBody` nên vẫn giữ badge. Muốn áp cho cả /districts thì đổi
   `.church-county-section.abt-cards` thành `.church-county-section`.
   Độ đặc hiệu 4 class > 3 class của khối 175 nên thắng bằng cascade, không
   dùng !important.
   ========================================================================== */
.church-county-section.abt-cards .card-apple-glass .c5-role-tag {
  display: none;
}
