/* ============================================
   TERASDESA – Website Desa Theme
   By IndoKoding.net
   Bootstrap 5.3 + Custom CSS
   Identitas: palet sawah/tanah/air, tipografi
   Fraunces + Work Sans — layout navigasi standar,
   didesain sederhana untuk semua kalangan warga.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Variables ────────────────────────── */
:root {
  --sawah:        #2F4B3C;
  --sawah-deep:   #1F3327;
  --padi:         #6F8F49;
  --padi-soft:    #A9C084;
  --tanah:        #B15E30;
  --tanah-soft:   #E3A47C;
  --air:          #3E6C74;
  --air-soft:     #9CC2C6;

  --ink:          #1E2A20;
  --ink-soft:     #4B5B49;
  --parchment:    #EFEADA;
  --parchment-raised: #E4DEC7;
  --surface:      #FAF7EC;
  --line:         #D8D0B4;
  --white:        #FFFFFF;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-base:    'Work Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --radius-sm:    3px;
  --radius:       6px;
  --shadow:       0 10px 30px rgba(31,51,39,.12);
  --transition:   all .25s ease;
}

/* ── Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-base);
  font-size: 1rem;
  color: var(--ink);
  background: var(--parchment);
  line-height: 1.7;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); font-weight: 600; color: var(--ink); line-height: 1.25; }
a { color: var(--sawah); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--tanah); }
img { max-width: 100%; height: auto; }
.tabular { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ── Section utility ─────────────────────── */
.section-padding { padding: 76px 0; }
.section-padding-sm { padding: 48px 0; }
.section-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--air); margin-bottom: .6rem;
}
.section-eyebrow::before { content: ""; width: 16px; height: 2px; background: var(--tanah); }
.section-title { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: .5rem; }
.section-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.bg-surface { background: var(--surface) !important; }
.bg-sawah { background: var(--sawah) !important; }
.bg-parchment-raised { background: var(--parchment-raised) !important; }
.text-sawah { color: var(--sawah) !important; }
.text-tanah { color: var(--tanah) !important; }
.text-ink-soft { color: var(--ink-soft) !important; }

/* ── Buttons ─────────────────────────────── */
.btn-tanah { background: var(--tanah); border-color: var(--tanah); color: #fff; }
.btn-tanah:hover { background: #99512A; border-color: #99512A; color: #fff; }
.btn-outline-sawah { border-color: var(--sawah); color: var(--sawah); }
.btn-outline-sawah:hover { background: var(--sawah); color: #fff; }
.btn-outline-parchment { border-color: rgba(255,255,255,.55); color: #fff; }
.btn-outline-parchment:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }

/* ── Top utility bar ─────────────────────── */
.topbar {
  background: var(--sawah-deep);
  color: var(--parchment);
  font-family: var(--font-mono);
  font-size: .74rem;
  padding: 7px 0;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar a { color: var(--parchment); opacity: .85; }
.topbar a:hover { opacity: 1; color: var(--tanah-soft); }
.topbar .sep { opacity: .35; }
@media (max-width: 576px) { .topbar .hide-xs { display: none; } }

/* ── Main navbar ─────────────────────────── */
.navbar-custom {
  background: var(--parchment);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  transition: var(--transition);
}
.navbar-custom.scrolled { box-shadow: var(--shadow); padding: 10px 0; }
.navbar-custom .navbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: var(--sawah); flex-shrink: 0; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--tanah-soft); }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--ink); line-height: 1.15; display: block; }
.brand-sub { font-family: var(--font-mono); font-size: .66rem; color: var(--ink-soft); letter-spacing: .04em; }
.navbar-custom .nav-link { color: var(--ink-soft); font-weight: 500; padding: .5rem 1rem !important; }
.navbar-custom .nav-link.active, .navbar-custom .nav-link:hover { color: var(--sawah); }
.navbar-toggler { border: none; box-shadow: none !important; }

/* ── Hero ────────────────────────────────── */
.hero-section { padding: 56px 0 76px; }
.hero-title { font-size: clamp(2.3rem, 3.6vw + 1rem, 3.6rem); line-height: 1.06; letter-spacing: -.01em; margin: 12px 0 16px; }
.hero-lede { max-width: 46ch; color: var(--ink-soft); font-size: 1.06rem; }
.hero-stats { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.hero-stats .n { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 600; color: var(--sawah); }
.hero-stats .l { font-size: .76rem; color: var(--ink-soft); }

.hero-carousel { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-carousel .carousel-item img { height: 320px; object-fit: cover; width: 100%; display: block; }
.hero-carousel .carousel-indicators [data-bs-target] { background-color: var(--parchment); opacity: .55; width: 8px; height: 8px; border-radius: 50%; border: none; margin: 0 4px; }
.hero-carousel .carousel-indicators .active { background-color: var(--tanah-soft); opacity: 1; }
.hero-carousel .carousel-control-prev, .hero-carousel .carousel-control-next { width: 44px; opacity: 0; transition: var(--transition); }
.hero-carousel:hover .carousel-control-prev, .hero-carousel:hover .carousel-control-next { opacity: .85; }

/* ── Page head (inner pages) ─────────────── */
.page-head { background: var(--sawah); padding: 44px 0; }
.page-head h1 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.5rem); margin: 0; }

/* ── Stat row ────────────────────────────── */
.stat-cluster { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 760px) { .stat-cluster { grid-template-columns: repeat(2,1fr); } }
.stat-tile { background: var(--surface); padding: 22px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat-tile .n { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 600; color: var(--sawah); }
.stat-tile .l { font-size: .8rem; color: var(--ink-soft); }

.gender-bar { max-width: 560px; }
.gender-bar .track-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.gender-bar .l-seg { background: var(--air); }
.gender-bar .p-seg { background: var(--tanah-soft); }
.gender-bar .legend { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: .78rem; color: var(--ink-soft); }

/* ── Pull quote ──────────────────────────── */
.pull { border-left: 3px solid var(--tanah); padding-left: 18px; font-family: var(--font-display); font-size: 1.2rem; font-style: italic; color: var(--sawah); margin: 18px 0; }

/* ── Simple info card ────────────────────── */
.info-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; height: 100%; }
.info-card .k { font-family: var(--font-mono); font-size: .7rem; color: var(--tanah); letter-spacing: .04em; text-transform: uppercase; }
.info-card h3 { font-size: 1.05rem; margin: 8px 0; }

/* ── News layout (featured + list) ───────── */
.news-featured { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 100%; }
.news-featured .thumb { height: 220px; object-fit: cover; width: 100%; display: block; }
.news-featured .body { padding: 22px; }
.news-list { display: flex; flex-direction: column; }
.news-item { display: flex; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.news-item:hover h4 { color: var(--tanah); }
.news-item:first-child { padding-top: 0; }
.news-item:last-child { border-bottom: none; }
.news-item .swatch { width: 6px; align-self: stretch; border-radius: 3px; flex-shrink: 0; background: var(--tanah-soft); }
.news-item h4 { font-family: var(--font-base); font-size: .96rem; font-weight: 600; margin-bottom: 4px; }
.news-item time { font-family: var(--font-mono); font-size: .7rem; color: var(--air); }

.news-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 100%; transition: var(--transition); }
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.news-card .thumb { height: 165px; object-fit: cover; width: 100%; display: block; }
.news-card .body { padding: 18px; }
.news-card .cat { font-family: var(--font-mono); font-size: .68rem; color: var(--tanah); letter-spacing: .04em; text-transform: uppercase; }
.news-card h3 { font-size: 1.06rem; margin: 6px 0 8px; }
.news-card p { color: var(--ink-soft); font-size: .89rem; }

.filter-pill { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 7px 16px; font-size: .85rem; }
.filter-pill.active, .filter-pill:hover { background: var(--sawah); border-color: var(--sawah); color: #fff; }

/* ── Service icon cards ─────────────────── */
.service-icon-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px; height: 100%; transition: var(--transition); }
.service-icon-card:hover { border-color: var(--sawah); box-shadow: var(--shadow); }
.service-icon-card .ic { width: 48px; height: 48px; border-radius: 50%; background: var(--parchment-raised); color: var(--tanah); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 14px; }
.service-icon-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.service-icon-card p { font-size: .89rem; color: var(--ink-soft); margin-bottom: 0; }

/* ── Step flow (prosedur) ───────────────── */
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; height: 100%; }
.step-card .num { font-family: var(--font-mono); font-size: 1.15rem; color: var(--air); font-weight: 600; }

/* ── Org chart (simple grouped cards) ───── */
.org-group-label { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--air); margin-bottom: 14px; }
.org-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.org-card .ring { width: 52px; height: 52px; border-radius: 50%; background: var(--parchment-raised); border: 2px solid var(--tanah-soft); margin: 0 auto 10px; }
.org-card .name { font-size: .92rem; font-weight: 600; display: block; }
.org-card .role { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-soft); }

/* ── Gallery grid (uniform) ─────────────── */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 700px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
.gallery-item { display: block; position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: var(--transition); }
.gallery-item .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px; color: #fff; font-size: .82rem; font-weight: 600; background: linear-gradient(180deg, transparent, rgba(0,0,0,.55)); }
.gallery-item[data-lightbox] { cursor: pointer; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item[data-lightbox] .cap { display: flex; align-items: center; gap: 8px; }
.gallery-item[data-lightbox] .cap i { opacity: .85; }

/* ── Galeri page (filterable grid) ──────── */
.gallery-page-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 860px) { .gallery-page-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .gallery-page-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Lightbox ────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 2000; padding: 40px;
  background: rgba(20, 31, 25, .92);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 90vw; max-height: 85vh; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
#lightboxClose {
  position: absolute; top: 20px; right: 28px;
  background: none; border: none; color: #fff; font-size: 2.2rem; line-height: 1;
  cursor: pointer; opacity: .8;
}
#lightboxClose:hover { opacity: 1; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  cursor: pointer; opacity: .85; transition: var(--transition);
}
.lightbox-nav:hover { opacity: 1; background: rgba(255,255,255,.22); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
@media (max-width: 600px) {
  .lightbox-nav { width: 38px; height: 38px; font-size: 1.1rem; }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
}

/* ── Map plate / contact ─────────────────── */
.map-plate { height: 100%; min-height: 240px; border-radius: var(--radius); background: repeating-linear-gradient(45deg, transparent 0 18px, rgba(47,75,60,.08) 18px 19px), var(--parchment-raised); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; }
.map-plate .pin { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; background: var(--tanah); transform: rotate(-45deg); }
.map-plate span { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-soft); }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--ink-soft); }
.info-row span:last-child { font-family: var(--font-mono); font-size: .86rem; text-align: right; }

.emergency-card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px; display: flex; align-items: center; gap: 14px; }
.emergency-card .ic { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--parchment-raised); color: var(--tanah); font-size: 1.2rem; flex-shrink: 0; }

/* ── Forms ───────────────────────────────── */
.form-control, .form-select { border-color: var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: .65rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--sawah); box-shadow: 0 0 0 .2rem rgba(47,75,60,.12); background: var(--surface); color: var(--ink); }
label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .35rem; }

/* ── Accordion (FAQ) ─────────────────────── */
.accordion-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) !important; margin-bottom: 10px; overflow: hidden; }
.accordion-button { background: var(--surface); color: var(--ink); font-weight: 600; font-family: var(--font-base); }
.accordion-button:not(.collapsed) { background: var(--parchment-raised); color: var(--sawah); box-shadow: none; }
.accordion-button:focus { box-shadow: none; }
.accordion-button::after { filter: sepia(60%) hue-rotate(50deg) saturate(200%); }

/* ── Detail / sidebar (berita-detail) ────── */
.article-body p { margin-bottom: 1.1rem; color: var(--ink-soft); }
.article-body h2, .article-body h3 { margin: 1.8rem 0 .8rem; }
.sidebar-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 22px; }
.sidebar-card h4 { font-size: .95rem; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-mono); color: var(--air); }
.tag-pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .78rem; color: var(--ink-soft); margin: 0 6px 6px 0; }

/* ── Pagination ──────────────────────────── */
.page-link { color: var(--ink); border-color: var(--line); background: var(--surface); }
.page-item.active .page-link { background: var(--sawah); border-color: var(--sawah); }
.page-link:hover { color: var(--sawah); background: var(--parchment-raised); }

/* ── Footer ──────────────────────────────── */
footer.site-footer { border-top: 1px solid var(--line); padding: 44px 0 26px; font-size: .88rem; color: var(--ink-soft); background: var(--parchment-raised); }
footer.site-footer .fmark { font-family: var(--font-display); color: var(--sawah); font-size: 1.15rem; }
footer.site-footer h5 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-mono); color: var(--air); margin-bottom: 14px; }
footer.site-footer a { color: var(--ink-soft); }
footer.site-footer a:hover { color: var(--tanah); }

/* ── Back to top ─────────────────────────── */
#backToTop { position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%; background: var(--sawah); color: #fff; border: none; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: var(--transition); z-index: 1020; }
#backToTop.show { opacity: 1; pointer-events: auto; }

/* ── Reduced motion ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
