/* ─────────────────────────────────────────────────────────────
   CBMS Pagadian — Theme v2
   Palette: Philippine government navy + gold + emerald accents
   Dark-first, premium, matching EPI/Kael aesthetic direction.
   ───────────────────────────────────────────────────────────── */
:root {
  --bg:          #f7f8fa;
  --surface:     #ffffff;
  --surface-2:   #f1f3f7;
  --line:        #e2e5ec;
  --line-2:      #cbd1dc;
  --ink:         #0b0f18;
  --ink-2:       #4b5568;
  --ink-3:       #7a8398;

  --navy:        #1e3a8a;
  --navy-2:      #1e40af;
  --navy-3:      #3b5cde;
  --gold:        #f59e0b;
  --gold-2:      #fbbf24;
  --emerald:     #10b981;
  --emerald-2:   #059669;
  --rose:        #ef4444;
  --violet:      #8b5cf6;
  --sky:         #0ea5e9;

  color-scheme: light;
}
:root.dark, .dark {
  --bg:          #060a13;
  --surface:     #0d131f;
  --surface-2:   #0a0f19;
  --line:        #1b2232;
  --line-2:      #2a3244;
  --ink:         #e8ebf2;
  --ink-2:       #9aa3b8;
  --ink-3:       #6a7388;
  color-scheme: dark;
}

* { box-sizing: border-box; }
*, *::before, *::after { border-color: var(--line); }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding: 0;
  font-family: 'Inter var', Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Typography helpers ── */
.num, .num-display { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum','ss01'; letter-spacing: -0.01em; }
.num-display { font-weight: 800; font-size: clamp(2rem, 4vw, 3rem); line-height: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 40px;
  border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
  transition: all .2s cubic-bezier(.22,.61,.36,1);
  background: transparent; color: var(--ink);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--navy-2); color: #fff; box-shadow: 0 2px 6px rgba(30,64,175,0.25); }
.btn-primary:hover { background: var(--navy); box-shadow: 0 4px 12px rgba(30,64,175,0.4); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1a1a; box-shadow: 0 2px 6px rgba(245,158,11,.3); font-weight: 700; }
.btn-gold:hover { box-shadow: 0 4px 16px rgba(245,158,11,.5); }
.btn-outline { background: rgba(255,255,255,.05); color: #fff; border-color: rgba(255,255,255,.25); }
.btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-icon .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rose); position: absolute; transform: translate(8px,-8px); }

/* ── Public page header ── */
.pub-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(18px);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.pub-header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-seal {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fbbf24, #d97706 60%, #92400e 100%);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.25), 0 2px 8px rgba(245,158,11,.35);
  display: flex; align-items: center; justify-content: center;
  color: #5a3a00; font-weight: 800; font-family: Georgia, serif; font-size: 18px;
}
.brand-lines { display: flex; flex-direction: column; line-height: 1.2; }
.brand-lines strong { font-size: 14px; font-weight: 700; color: var(--ink); }
.brand-lines small { font-size: 11px; color: var(--ink-3); }
.pub-nav { display: none; }
@media (min-width: 900px) {
  .pub-nav { display: flex; gap: 24px; margin-left: auto; margin-right: auto; }
  .pub-nav a { font-size: 14px; font-weight: 500; color: var(--ink-2); }
  .pub-nav a:hover { color: var(--ink); }
}
.pub-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Hero ── */
.pub-hero {
  position: relative; overflow: hidden;
  color: #fff;
  padding: 96px 24px 80px;
  text-align: center;
}
.pub-hero.hero-sm { padding: 60px 24px 40px; }
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(at 22% 20%, rgba(245,158,11,.3) 0, transparent 45%),
    radial-gradient(at 80% 15%, rgba(99,102,241,.3) 0, transparent 45%),
    radial-gradient(at 50% 90%, rgba(236,72,153,.22) 0, transparent 55%),
    linear-gradient(180deg, #0a1022 0%, #0d1529 50%, #080d1c 100%);
  z-index: -2;
}
.hero-glow {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  filter: blur(90px); pointer-events: none; z-index: -1;
  animation: hero-float 22s ease-in-out infinite;
}
.hero-glow.g1 { background: rgba(251,191,36,.25); top: -140px; left: -80px; }
.hero-glow.g2 { background: rgba(30,64,175,.4); bottom: -200px; right: -100px; animation-direction: reverse; }
@keyframes hero-float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(60px, -50px) scale(1.1); }
  66%      { transform: translate(-40px, 40px) scale(0.9); }
}
.pub-hero-inner { position: relative; max-width: 860px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
}
.hero-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 var(--emerald);
  animation: pulse-dot 2s ease-out infinite;
}
@keyframes pulse-dot {
  0%  { box-shadow: 0 0 0 0 rgba(16,185,129,.7); }
  100%{ box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800;
  line-height: 1.05; letter-spacing: -0.03em;
  margin: 16px 0 12px;
  text-wrap: balance;
}
.txt-gold {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gold-shimmer 4s linear infinite;
}
@keyframes gold-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.hero-sub {
  font-size: 1.1rem; color: rgba(255,255,255,.85);
  max-width: 620px; margin: 0 auto 24px; line-height: 1.5;
  text-wrap: pretty;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }

/* ── Animated date strip ── */
.date-strip {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
  margin: 20px 0;
}
.date-label {
  font-size: 10px; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
}
.date-shimmer {
  position: relative;
  font-size: 14px; font-weight: 600;
  color: #fff;
  background: linear-gradient(
    100deg,
    rgba(255,255,255,.85) 0%,
    rgba(251,191,36,1) 30%,
    rgba(255,255,255,.85) 60%,
    rgba(16,185,129,1) 80%,
    rgba(255,255,255,.85) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: date-shimmer 5s linear infinite;
  font-variant-numeric: tabular-nums;
}
@keyframes date-shimmer {
  0%   { background-position: 250% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Hero stats ── */
.hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px; max-width: 720px; margin: 24px auto 0;
}
.hero-stats > div {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
}
.hero-stats .num-lg {
  font-size: 1.6rem; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums;
}
.hero-stats .num-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; color: rgba(255,255,255,.7); margin-top: 2px;
}

/* ── Public sections ── */
.pub-section { padding: 64px 24px; max-width: 1280px; margin: 0 auto; }
.pub-section-head { margin-bottom: 32px; }
.eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
.pub-section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700;
  letter-spacing: -0.02em; margin: 4px 0 6px;
  color: var(--ink);
}
.section-sub { color: var(--ink-2); font-size: 1rem; margin-bottom: 20px; }

/* ── Barangay portal grid ── */
.brgy-tools { margin-top: 20px; }
.search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 14px; height: 44px;
  max-width: 440px; margin-bottom: 16px;
  transition: all .15s;
}
.search-wrap:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(30,64,175,.15); }
.search-wrap svg { color: var(--ink-3); }
.search-wrap input {
  border: 0; outline: 0; background: transparent;
  flex: 1; font-size: 14px; color: var(--ink);
  font-family: inherit;
}
.brgy-filter {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px;
}
.brgy-filter button {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.brgy-filter button span { color: var(--ink-3); font-weight: 400; }
.brgy-filter button:hover { border-color: var(--line-2); color: var(--ink); }
.brgy-filter button.is-active {
  background: var(--navy-2); color: #fff; border-color: var(--navy-2);
}
.brgy-filter button.is-active span { color: rgba(255,255,255,.75); }

.brgy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.brgy-grid-compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.brgy-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 20px;
  transition: all .25s cubic-bezier(.22,.61,.36,1);
  animation: card-in .5s cubic-bezier(.22,.61,.36,1) both;
  display: flex; flex-direction: column; gap: 10px;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.brgy-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(400px at var(--mx,50%) var(--my,50%), rgba(30,64,175,.08), transparent 40%);
  opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
.brgy-card:hover {
  border-color: var(--navy-2);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -8px rgba(30,64,175,.25);
}
.brgy-card:hover::before { opacity: 1; }
.brgy-card:hover .brgy-arrow { color: var(--gold); transform: translateX(4px); }

.brgy-card-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
}
.brgy-num {
  background: var(--surface-2); color: var(--ink-3);
  padding: 2px 8px; border-radius: 999px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.brgy-class {
  padding: 2px 8px; border-radius: 999px; font-weight: 700; letter-spacing: .05em;
}
.tag-urban   { background: rgba(16,185,129,.1); color: #10b981; }
.tag-rural   { background: rgba(6,182,212,.1);  color: #06b6d4; }
.brgy-chip {
  padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 10px;
}
.chip-coastal { background: rgba(245,158,11,.12); color: #d97706; }
.chip-risk    { background: rgba(239,68,68,.12); color: #ef4444; }

.brgy-title {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink); margin: 4px 0 2px;
}
.brgy-captain {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 8px;
  border-top: 1px dashed var(--line);
}
.cap-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #2a1a00; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.15);
  flex-shrink: 0;
}
.brgy-captain > span:last-child {
  display: flex; flex-direction: column; line-height: 1.2;
  min-width: 0;
}
.brgy-captain small { font-size: 10px; color: var(--ink-3); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.brgy-captain strong {
  font-size: 13px; color: var(--ink); font-weight: 600;
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}

.brgy-meta {
  display: flex; gap: 6px; font-size: 12px; color: var(--ink-3);
  flex-wrap: wrap;
}
.dot-sep { color: var(--ink-3); }
.brgy-arrow {
  margin-top: 4px; font-size: 12px; font-weight: 600;
  color: var(--navy-2);
  transition: all .2s;
}
.dark .brgy-arrow { color: var(--gold-2); }

/* ── Panels (generic) ── */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
}

/* ── Detail page grid ── */
.detail-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(12, 1fr);
  margin-bottom: 32px;
}
.detail-grid > .panel { padding: 20px; }
.detail-captain { grid-column: span 12; }
@media (min-width: 900px) {
  .detail-captain { grid-column: span 7; }
  .detail-stats   { grid-column: span 5; }
  .detail-contact { grid-column: span 5; }
  .detail-map     { grid-column: span 7; }
  .detail-privacy { grid-column: span 12; }
}
@media (max-width: 899px) {
  .detail-stats, .detail-contact, .detail-map, .detail-privacy { grid-column: span 12; }
}

.captain-card {
  display: flex; align-items: center; gap: 20px;
  padding: 8px 0;
}
.captain-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fbbf24 0%, #d97706 60%, #78350f 100%);
  color: #2a1a00; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 30px; flex-shrink: 0;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.2), 0 4px 16px rgba(245,158,11,.35);
}
.captain-name {
  font-size: 22px; font-weight: 700; letter-spacing: -.01em;
  margin: 0 0 2px; color: var(--ink);
}
.captain-role { color: var(--ink-2); font-size: 14px; margin: 0; }
.captain-term { color: var(--ink-3); font-size: 12px; margin: 6px 0 0; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}
.stat-grid > div { padding: 8px 0; }
.stat-num {
  display: block; font-size: 20px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-lbl {
  display: block; font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .1em; margin-top: 2px;
}
.risk-emerald { color: var(--emerald); }
.risk-amber   { color: var(--gold); }
.risk-rose    { color: var(--rose); }

.contact-list { list-style: none; margin: 0 0 20px; padding: 0; }
.contact-list li {
  display: flex; justify-content: space-between; align-items: start; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.contact-list li:last-child { border-bottom: 0; }
.contact-list span { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.contact-list strong { font-size: 13px; color: var(--ink); font-weight: 600; text-align: right; }

.privacy-text {
  font-size: 13px; color: var(--ink-2); line-height: 1.6;
  background: color-mix(in srgb, var(--emerald) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--emerald) 20%, transparent);
  padding: 14px 16px; border-radius: 10px;
}
.privacy-text strong { color: var(--emerald-2); }

/* ── Nearby barangays ── */
.nearby-head { margin: 40px 0 20px; }
.nearby-head h3 { font-size: 1.3rem; font-weight: 700; margin: 0; color: var(--ink); }
.brgy-card-sm { padding: 14px 16px; }
.brgy-card-sm .brgy-title { font-size: 15px; }

/* ── Footer ── */
.pub-footer {
  background: #070a12; color: rgba(255,255,255,.75);
  margin-top: 80px;
}
.pub-footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 48px 24px;
  display: grid; gap: 32px;
  grid-template-columns: 2fr 1fr 1fr;
}
.pub-footer .brand-lines strong { color: #fff; }
.pub-footer .brand-lines small { color: rgba(255,255,255,.55); }
.pub-footer p { font-size: 13px; color: rgba(255,255,255,.6); line-height: 1.6; margin-top: 16px; }
.pub-footer ul { list-style: none; padding: 0; margin: 0; }
.pub-footer li, .pub-footer li a { font-size: 13px; color: rgba(255,255,255,.65); padding: 4px 0; }
.pub-footer a:hover { color: #fbbf24; }
.foot-head { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #fff; font-weight: 700; margin-bottom: 10px; }
.pub-foot-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: center; padding: 20px;
  font-size: 12px; color: rgba(255,255,255,.5);
}
@media (max-width: 768px) {
  .pub-footer-inner { grid-template-columns: 1fr; gap: 24px; }
}

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