/* =========================================================
   Desa Tamansari — Tentang Desa
   Diselaraskan ke design system "Gov Clean" di base.css + home.css.
   Wajib load base.css & home.css duluan (token, navbar, footer, AOS).
   ========================================================= */

/* ===== Page Hero ===== */
.hero-section {
  position: relative;
  overflow: hidden;
  padding: 3.5rem 2rem 5rem;
  background: linear-gradient(160deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
}

.hero-section h1 {
  color: var(--white);
  font-weight: 800;
  font-size: 2.3rem;
  margin-bottom: 0.6rem;
  text-shadow: none;
  position: relative;
  z-index: 2;
}

.hero-section p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  font-weight: 500;
  max-width: 560px;
  margin: 0 auto;
  text-shadow: none;
  position: relative;
  z-index: 2;
}

.hero-section::after {
  content: "";
  position: absolute;
  left: -8%; right: -8%; bottom: -1px;
  height: 70px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  z-index: 1;
}

@media (max-width: 768px) {
  .hero-section { padding: 2.75rem 1.5rem 4rem; }
  .hero-section h1 { font-size: 1.9rem; }
}

/* ===== Section spacing ===== */
.about-section {
  padding: 2.75rem 0;
}

.about-section .section-eyebrow {
  text-align: center;
  color: var(--secondary);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

/* ===== Card — flat, terang, sesuai design system ===== */
.card-custom {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-custom:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--secondary);
}

.card-custom .card-header {
  background: var(--accent-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: none;
  border-bottom: 1px solid var(--border);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
}

.card-custom .card-body {
  padding: 1.6rem;
  font-size: 1rem;
  color: var(--text);
  text-shadow: none;
}

.card-custom .card-body p {
  text-align: justify;
  hyphens: auto;
  line-height: 1.75;
  color: var(--text);
}

.card-custom .card-title {
  color: var(--primary);
  font-weight: 700;
  text-shadow: none;
}

/* Visi & Misi — checklist icon, bukan bullet polos */
.card-custom .card-body ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.card-custom .card-body ul li {
  position: relative;
  padding-left: 1.9rem;
  margin-bottom: 0.75rem;
  line-height: 1.6;
  color: var(--text);
  text-shadow: none;
}

.card-custom .card-body ul li:last-child { margin-bottom: 0; }

.card-custom .card-body ul li::before {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--secondary);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   BAGAN STRUKTUR ORGANISASI — COMPACT DESKTOP
========================================================= */
/* =========================================================
   STRUKTUR ORGANISASI
========================================================= */
#struktur-organisasi {
  max-width: 1240px;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.struktur-title {
  margin: 0 0 0.25rem;
  color: var(--primary);
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
}

.struktur-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ===== Mobile Hint ===== */
.bagan-mobile-hint {
  width: max-content;
  max-width: 100%;
  margin: 0 auto 0.85rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.bagan-mobile-hint i {
  margin-right: 0.3rem;
}

/* ===== Scroll Wrapper ===== */
.bagan-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 94, 69, 0.35) transparent;
}

.bagan-scroll::-webkit-scrollbar {
  height: 6px;
}

.bagan-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.bagan-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(27, 94, 69, 0.3);
}

/* ===== Canvas ===== */
.bagan-canvas {
  position: relative;
  width: 1180px;
  min-width: 1180px;
  min-height: 790px;
  margin: 0 auto;
  background: #fbfcfb;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ===== Garis Struktur ===== */
.bagan-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.garis {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.garis-instruksi {
  stroke: var(--primary);
}

.garis-koordinasi {
  stroke: #6d7e75;
  stroke-width: 1.8;
  stroke-dasharray: 7 6;
}

/* ===== Card Jabatan ===== */
.bagan-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(27, 67, 50, 0.08);
  text-align: center;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bagan-box:hover {
  transform: translateY(-3px);
  border-color: rgba(27, 94, 69, 0.35);
  box-shadow: 0 8px 18px rgba(27, 67, 50, 0.12);
}

/* ===== Foto ===== */
.bagan-photo {
  width: 100%;
  height: 110px;
  flex-shrink: 0;
  overflow: hidden;
  background: #e8f0eb;
}

.bagan-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.bagan-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #f1f6f3, #e1ebe5);
  color: rgba(27, 67, 50, 0.34);
  font-size: 2.35rem;
}

/* ===== Informasi Jabatan ===== */
.bagan-info {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 0.65rem 0.45rem 0.55rem;
  background: var(--card);
}

.bagan-info::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 30px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateX(-50%);
}

.bagan-label {
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.22;
  text-transform: uppercase;
}

.bagan-nama {
  display: block;
  margin-top: 0.2rem;
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.25;
}

.bagan-nama-muted {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}

/* ===== BPD ===== */
.slot-bpd {
  left: 40px;
  top: 60px;
  width: 145px;
  height: 175px;
  border-color: rgba(201, 162, 39, 0.7);
}

.slot-bpd .bagan-photo {
  height: 112px;
}

/* ===== Kepala Desa ===== */
.slot-kepala-desa {
  left: 235px;
  top: 25px;
  width: 170px;
  height: 200px;
  border: 2px solid var(--primary);
}

.slot-kepala-desa .bagan-photo {
  height: 135px;
}

.slot-kepala-desa .bagan-info {
  min-height: 65px;
  background: var(--primary);
}

.slot-kepala-desa .bagan-info::before {
  background: rgba(255, 255, 255, 0.45);
}

.slot-kepala-desa .bagan-label {
  color: var(--white);
  font-size: 0.76rem;
}

.slot-kepala-desa .bagan-nama {
  color: rgba(255, 255, 255, 0.86);
}

/* ===== Sekretaris Desa ===== */
.slot-sekretaris-desa {
  left: 625px;
  top: 65px;
  width: 180px;
  height: 180px;
  border-color: rgba(45, 106, 79, 0.45);
}

.slot-sekretaris-desa .bagan-photo {
  height: 115px;
}

/* ===== Baris Kasi & Kaur ===== */
.bagan-jabatan-bawah {
  top: 330px;
  width: 160px;
  height: 175px;
}

.bagan-jabatan-bawah .bagan-photo {
  height: 112px;
}

.slot-kasi-pemerintahan {
  left: 20px;
}

.slot-kasi-kesejahteraan {
  left: 215px;
}

.slot-kasi-pelayanan {
  left: 410px;
}

.slot-kaur-tata-usaha {
  left: 605px;
}

.slot-kaur-keuangan {
  left: 800px;
}

.slot-kaur-perencanaan {
  left: 995px;
}

/* ===== Kepala Dusun ===== */
.dusun-section {
  position: absolute;
  top: 565px;
  left: 0;
  right: 0;
  padding: 40px 35px 35px;
}

.dusun-group {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  width: 100%;
  z-index: 2;
}

.dusun-group .bagan-box {
  position: relative;
  top: auto;
  left: auto;
  width: 170px;
  height: 175px;
  flex: 0 0 170px;
}

.dusun-group .bagan-box:hover {
  transform: translateY(-3px);
}

.dusun-group .bagan-photo {
  height: 112px;
}

/* ===== Desktop ===== */
@media (min-width: 1240px) {
  .bagan-scroll {
    overflow-x: visible;
  }
}

/* ===== Laptop / Tablet ===== */
@media (max-width: 1239px) {
  #struktur-organisasi {
    max-width: 100%;
  }

  .bagan-scroll {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ===== Scale Wrapper ===== */
.bagan-scale {
  width: 1180px;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  #struktur-organisasi {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .struktur-title {
    font-size: 1.25rem;
  }

  .struktur-subtitle {
    margin-bottom: 0.8rem;
    font-size: 0.82rem;
  }

  .bagan-scroll {
    width: calc(100% + 24px);
    margin-left: -12px;
    padding: 0 12px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  .bagan-scale {
    width: max-content;
  }

  .bagan-canvas {
    width: 1180px;
    min-width: 1180px;
    min-height: 790px;
    margin: 0;
    zoom: 0.72;
  }
}

/* ===== Mobile Kecil ===== */
@media (max-width: 430px) {
  .bagan-canvas {
    zoom: 0.68;
  }
}

@media (max-width: 375px) {
  .bagan-canvas {
    zoom: 0.64;
  }
}

/* ===== Mobile Kecil ===== */
@media (max-width: 400px) {
  .bagan-mobile-hint {
    font-size: 0.7rem;
  }
}

/* ===== Lokasi ===== */
#lokasi.about-section {
  max-width: 640px;
  margin: 0 auto;
}

/* Embed peta — dipakai kalau backend berhasil resolve link share
   jadi koordinat (lihat lokasi_embed_cache). */
.lokasi-map {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.75rem;
}

.lokasi-map iframe {
  width: 100%;
  height: 100%;
}

.lokasi-open-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--secondary);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.lokasi-open-link:hover {
  text-decoration: underline;
}

/* Fallback: link-out card kalau resolve embed gagal
   (network error pas save, atau format link gak dikenali). */

.lokasi-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.5rem;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.lokasi-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--secondary);
}

.lokasi-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.lokasi-text {
  flex: 1;
  min-width: 0;
}

.lokasi-text strong {
  display: block;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.lokasi-text span {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.lokasi-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: var(--white);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.lokasi-btn:hover {
  background: var(--secondary);
  color: var(--white);
}

.lokasi-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

@media (max-width: 576px) {
  .lokasi-card {
    flex-direction: column;
    text-align: center;
  }
  .lokasi-btn { width: 100%; justify-content: center; }
}

/* ===== Responsive ===== */
@media (min-width: 992px) {
  .col-lg-5 {
    flex: 0 0 auto;
    width: 45%;
  }
}

@media (max-width: 768px) {
  .card-custom { margin-bottom: 1rem; }
  .card-custom .card-body { padding: 1.25rem; font-size: 0.95rem; }
}

/* =========================================================
   MOBILE REFINEMENTS (tambahan)
   ========================================================= */

/* ===== Hero — extra kecil di HP ===== */
@media (max-width: 480px) {
  .hero-section {
    padding: 2.25rem 1.25rem 3.5rem;
  }
  .hero-section h1 {
    font-size: 1.55rem;
    line-height: 1.3;
  }
  .hero-section p {
    font-size: 0.92rem;
  }
  .hero-section::after {
    height: 45px;
  }
}

/* ===== Sejarah / Potensi / Visi / Misi cards ===== */
@media (max-width: 576px) {
  .about-section {
    padding: 2rem 0;
  }
  .card-custom .card-header {
    font-size: 1rem;
    padding: 0.85rem 1.1rem;
  }
  .card-custom .card-body {
    padding: 1.1rem;
    font-size: 0.92rem;
  }
  .card-custom .card-body p {
    text-align: left; /* justify di layar sempit bikin spasi antar kata jomplang */
  }
  .card-custom .card-body ul li {
    font-size: 0.92rem;
    padding-left: 1.7rem;
  }
}

/* ===== Struktur Organisasi — heading mobile ===== */
@media (max-width: 768px) {
  #struktur-organisasi {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .struktur-title {
    font-size: 1.25rem;
  }

  .struktur-subtitle {
    font-size: 0.82rem;
    margin-bottom: 1.25rem;
  }
}

/* =========================================================
   BAGAN STRUKTUR ORGANISASI — MOBILE (versi tree vertikal)
   Dipakai gantiin canvas+SVG desktop di layar < 768px, jadi
   TANPA geser/scroll. Reuse class .bagan-photo/.bagan-info/
   .bagan-label/.bagan-nama dari markup yang sama.
   ========================================================= */

.bagan-tree {
  display: none;
}

@media (max-width: 768px) {
  .bagan-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: 460px;
    margin: 0 auto;
  }

  .bagan-tree-connector {
    width: 2px;
    height: 20px;
    background: var(--primary);
  }

  .bagan-tree-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
  }

  .bagan-tree-dash {
    width: 22px;
    border-top: 2px dashed #65776d;
    flex-shrink: 0;
  }

  .bagan-tree-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    width: 100%;
  }

  .bagan-m-box {
    width: 100%;
    max-width: 210px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(27, 67, 50, 0.08);
    overflow: hidden;
    text-align: center;
  }

  .bagan-m-box .bagan-photo {
    height: 78px;
  }

  .bagan-m-box .bagan-info {
    min-height: 48px;
    padding: 0.5rem 0.35rem 0.45rem;
  }

  .bagan-m-box .bagan-label {
    font-size: 0.64rem;
  }

  .bagan-m-box .bagan-nama {
    font-size: 0.6rem;
  }

  /* Kepala Desa — ditonjolkan */
  .bagan-m-kepala {
    max-width: 150px;
    border: 2px solid var(--primary);
  }
  .bagan-m-kepala .bagan-photo { height: 95px; }
  .bagan-m-kepala .bagan-info { background: var(--primary); }
  .bagan-m-kepala .bagan-label { color: var(--white); font-size: 0.7rem; }
  .bagan-m-kepala .bagan-nama { color: rgba(255, 255, 255, 0.85); }

  /* BPD — sejajar Kepala Desa, garis putus2 (koordinasi) */
  .bagan-m-bpd {
    max-width: 118px;
    border-color: rgba(201, 162, 39, 0.7);
  }
  .bagan-m-bpd .bagan-photo { height: 68px; }

  /* Sekretaris Desa */
  .bagan-m-sekretaris {
    max-width: 190px;
    border-color: rgba(45, 106, 79, 0.45);
  }
  .bagan-m-sekretaris .bagan-photo { height: 95px; }

  /* Pelaksana Teknis & Unsur Kewilayahan */
  .bagan-m-group {
    max-width: none;
    min-height: 60px;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #f7faf8;
  }
  .bagan-m-group .bagan-label { font-size: 0.66rem; }
  .bagan-m-group .bagan-nama {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.62rem;
  }
}

@media (max-width: 360px) {
  .bagan-m-box { max-width: 170px; }
  .bagan-tree-grid { gap: 0.45rem; }
}

/* ===== Lokasi — mobile ===== */
@media (max-width: 576px) {
  #lokasi.about-section {
    padding: 1.75rem 1rem;
  }
  .lokasi-icon {
    width: 44px;
    height: 44px;
    font-size: 1.15rem;
  }
}