/* =========================================================================
   BARANGAY MASAPLOD SUR — THEME
   Palette drawn from the barangay seal:
     seal blue   #0B4C96   deep navy   #052A54
     sky blue    #2E86D9   sun gold    #F0B429
     leaf green  #3E7D44   heart red   #E0483D
     sand        #E7CFA6   paper       #FBF9F4
   ========================================================================= */

:root{
  --seal-blue: #0B4C96;
  --seal-blue-2: #123E77;
  --navy: #052A54;
  --sky: #2E86D9;
  --gold: #F0B429;
  --gold-deep: #C6900F;
  --green: #3E7D44;
  --red: #E0483D;
  --sand: #E7CFA6;
  --paper: #FBF9F4;

  --bg: #EFF2F6;
  --bg-elev: #FFFFFF;
  --ink: #12203A;
  --ink-soft: #5B6B84;
  --ink-faint: #93A1B5;
  --hairline: rgba(18,32,58,0.09);

  --glass-bg: rgba(255,255,255,0.55);
  --glass-bg-strong: rgba(255,255,255,0.68);
  --glass-border: rgba(255,255,255,0.6);
  --glass-shadow: 0 8px 32px rgba(11,44,84,0.14);

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea{ font-family: inherit; }
h1,h2,h3,p{ margin:0; }
a{ color: inherit; text-decoration: none; }

/* Ambient background: soft radial wash of seal blue + gold, iOS-style */
body::before{
  content:"";
  position: fixed; inset:0; z-index:-1;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(46,134,217,0.16), transparent 60%),
    radial-gradient(700px 480px at 110% 10%, rgba(240,180,41,0.14), transparent 55%),
    var(--bg);
}

/* ---------------------------- Splash ---------------------------- */
.splash{
  position: fixed; inset:0; z-index: 999;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  background: linear-gradient(180deg, var(--seal-blue) 0%, var(--seal-blue-2) 55%, var(--navy) 100%);
  color:#fff;
  animation: splash-out 0.5s ease 1.1s forwards;
}
.splash-seal{ width:104px; height:104px; border-radius:50%; box-shadow: 0 12px 40px rgba(0,0,0,0.35); animation: splash-pop 0.7s cubic-bezier(.2,.9,.25,1); }
.splash-name{ font-family: var(--font-display); font-weight:600; font-size:22px; letter-spacing:0.2px; }
.splash-sub{ font-size:13px; opacity:0.75; margin-top:-8px; }
@keyframes splash-pop{ from{ transform: scale(0.75); opacity:0 } to{ transform:scale(1); opacity:1 } }
@keyframes splash-out{ to{ opacity:0; visibility:hidden; pointer-events:none; } }

/* ---------------------------- App shell ---------------------------- */
.app{ max-width: 640px; margin: 0 auto; min-height: 100vh; position:relative; }

.page{ min-height:100vh; padding-top: var(--safe-top); }
.page-scroll{ padding: 4px 18px 0; }

.topbar{
  position: sticky; top:0; z-index:5;
  padding: calc(var(--safe-top) + 14px) 18px 14px;
  background: linear-gradient(180deg, rgba(239,242,246,0.92), rgba(239,242,246,0.75));
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--hairline);
}
.topbar-id{ display:flex; align-items:center; gap:12px; }
.topbar-seal{ width:40px; height:40px; border-radius:50%; box-shadow: 0 2px 8px rgba(11,44,84,0.25); }
.topbar-eyebrow{ font-size:11.5px; color: var(--ink-soft); font-weight:600; }
.topbar-title{ font-family: var(--font-display); font-weight:600; font-size:22px; color: var(--navy); }
.topbar-title-large{ font-family: var(--font-display); font-weight:600; font-size:30px; color: var(--navy); }

/* ---------------------------- Glass surfaces ---------------------------- */
.glass{
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.glass-strong{
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
}

/* ---------------------------- Home: hero ---------------------------- */
.hero-card{
  margin-top:14px; padding:22px 22px 24px;
  position:relative; overflow:hidden;
}
.hero-card::after{
  content:""; position:absolute; inset:0; z-index:-1;
  background: linear-gradient(135deg, rgba(11,76,150,0.10), rgba(240,180,41,0.10));
}
.hero-kicker{ font-size:12.5px; font-weight:700; color: var(--seal-blue); letter-spacing:0.2px; }
.hero-title{ font-family: var(--font-display); font-size:26px; line-height:1.25; font-weight:600; color: var(--navy); margin-top:6px; }
.hero-text{ font-size:14.5px; color: var(--ink-soft); margin-top:10px; line-height:1.5; }

.quick-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; margin-top:16px; }
.quick-tile{
  display:flex; flex-direction:column; align-items:flex-start; gap:12px;
  padding:16px; border:1px solid var(--hairline); border-radius: var(--radius-md);
  background: var(--bg-elev); cursor:pointer; text-align:left;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(11,44,84,0.05);
}
.quick-tile:active{ transform: scale(0.97); }
.quick-icon{ width:42px; height:42px; border-radius:13px; display:flex; align-items:center; justify-content:center; }
.quick-icon svg{ width:22px; height:22px; }
.quick-label{ font-size:14px; font-weight:600; color: var(--ink); }

.fb-banner{
  display:flex; align-items:center; gap:12px; margin-top:14px; padding:14px 16px;
}
.fb-banner-icon{
  width:38px; height:38px; border-radius:11px; background:#1877F2; color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:19px; flex:none;
}
.fb-banner-copy{ display:flex; flex-direction:column; gap:2px; flex:1; }
.fb-banner-copy strong{ font-size:14.5px; color: var(--ink); }
.fb-banner-copy span{ font-size:12.5px; color: var(--ink-soft); }
.fb-banner-chev{ font-size:20px; color: var(--ink-faint); }

.info-strip{ margin-top:14px; padding:16px; }
.info-strip-title{ font-size:12.5px; font-weight:700; color: var(--seal-blue); text-transform: none; }
.info-strip-line{ font-size:13.5px; color: var(--ink-soft); margin-top:4px; }

.tab-spacer{ height: 118px; }

.section-lead{ font-size:14px; color: var(--ink-soft); margin: 14px 2px 16px; line-height:1.5; }

/* ---------------------------- Officials ---------------------------- */
.officials-list{ display:flex; flex-direction:column; gap:10px; }
.official-card{
  display:flex; align-items:center; gap:14px; padding:14px 16px;
  background: var(--bg-elev); border:1px solid var(--hairline); border-radius: var(--radius-md);
}
.official-avatar{
  width:48px; height:48px; border-radius:50%; flex:none;
  background: linear-gradient(135deg, var(--seal-blue), var(--sky));
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:15px;
}
.official-name{ font-size:15px; font-weight:600; color: var(--ink); }
.official-position{ font-size:13px; color: var(--seal-blue); font-weight:600; margin-top:1px; }
.official-committee{ font-size:12.5px; color: var(--ink-soft); margin-top:1px; }

/* ---------------------------- Forms ---------------------------- */
.glass-form{
  background: var(--bg-elev); border:1px solid var(--hairline); border-radius: var(--radius-md);
  padding:18px; display:flex; flex-direction:column; gap:16px;
}
.field{ display:flex; flex-direction:column; gap:7px; }
.field label{ font-size:13px; font-weight:600; color: var(--ink); }
.field-hint{ font-size:12px; color: var(--ink-faint); }
.field input[type=text], .field input[type=number], .field input[type=tel], .field select, .field textarea{
  border:1px solid var(--hairline); background:#F6F8FA; border-radius: var(--radius-sm);
  padding:12px 14px; font-size:15px; color: var(--ink); outline:none;
  transition: border-color .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus{
  border-color: var(--seal-blue); background:#fff;
}
.field textarea{ resize: vertical; font-family: inherit; }

.toggle-field{ flex-direction:row; align-items:center; justify-content:space-between; gap:12px; }
.switch{ position:relative; display:inline-block; width:50px; height:30px; flex:none; }
.switch input{ opacity:0; width:0; height:0; }
.switch-track{
  position:absolute; inset:0; background:#D8DEE6; border-radius:999px; transition: background .2s ease;
}
.switch-thumb{
  position:absolute; top:3px; left:3px; width:24px; height:24px; border-radius:50%;
  background:#fff; box-shadow: 0 2px 5px rgba(0,0,0,0.25); transition: transform .2s ease;
}
.switch input:checked + .switch-track{ background: var(--green); }
.switch input:checked + .switch-track .switch-thumb{ transform: translateX(20px); }

.btn{
  border:none; border-radius: var(--radius-sm); padding:14px 18px; font-size:15.5px; font-weight:600;
  cursor:pointer; transition: transform .12s ease, opacity .12s ease;
}
.btn:active{ transform: scale(0.97); }
.btn-block{ width:100%; }
.btn-primary{ background: var(--seal-blue); color:#fff; }
.btn-secondary{ background:#E8EEF5; color: var(--seal-blue); }

.back-link{
  background:none; border:none; color: var(--seal-blue); font-size:14px; font-weight:600;
  padding:6px 0 12px; cursor:pointer;
}

/* ---------------------------- Certificates ---------------------------- */
.cert-type-list{ display:flex; flex-direction:column; gap:10px; }
.cert-type-card{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:16px; background: var(--bg-elev); border:1px solid var(--hairline); border-radius: var(--radius-md);
  cursor:pointer; text-align:left; width:100%;
}
.cert-type-card:active{ transform: scale(0.98); }
.cert-type-name{ font-size:15px; font-weight:600; color: var(--ink); }
.cert-type-desc{ font-size:12.5px; color: var(--ink-soft); margin-top:3px; line-height:1.4; }
.cert-type-chev{ font-size:20px; color: var(--ink-faint); flex:none; }

.form-title{ font-family: var(--font-display); font-size:22px; font-weight:600; color: var(--navy); margin-bottom:14px; }

.cert-paper{
  background: var(--paper); border-radius:6px; padding:34px 30px; margin-top:6px;
  box-shadow: 0 10px 30px rgba(11,44,84,0.18); border:1px solid rgba(11,44,84,0.08);
  font-family: Georgia, "Times New Roman", serif; color:#1a1a1a;
}
.cert-head{ display:flex; align-items:center; gap:14px; border-bottom:2px solid var(--seal-blue); padding-bottom:14px; margin-bottom:18px; }
.cert-head img{ width:56px; height:56px; border-radius:50%; }
.cert-head-text p{ margin:0; line-height:1.35; }
.cert-head-text .l1{ font-size:11px; letter-spacing:0.4px; }
.cert-head-text .l2{ font-size:11px; letter-spacing:0.4px; }
.cert-head-text .l3{ font-size:14px; font-weight:700; margin-top:2px; }
.cert-doc-title{ text-align:center; font-size:20px; font-weight:700; letter-spacing:1.5px; margin:10px 0 20px; }
.cert-body-text{ font-size:14.5px; line-height:1.9; text-align:justify; }
.cert-meta{ display:flex; justify-content:space-between; margin-top:26px; font-size:12.5px; }
.cert-sign{ margin-top:46px; display:flex; justify-content:flex-end; }
.cert-sign-block{ text-align:center; }
.cert-sign-name{ font-weight:700; border-top:1px solid #333; padding-top:4px; min-width:220px; font-size:13.5px; }
.cert-sign-role{ font-size:11.5px; margin-top:2px; }

.cert-actions{ display:flex; gap:10px; margin-top:16px; }
.cert-actions .btn{ flex:1; }

/* ---------------------------- Hotlines ---------------------------- */
.hotline-group{ margin-bottom:20px; }
.hotline-group-title{ font-size:12.5px; font-weight:700; color: var(--seal-blue); margin: 0 2px 8px; }
.hotline-card{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:14px 16px; background: var(--bg-elev); border:1px solid var(--hairline);
  border-radius: var(--radius-md); margin-bottom:8px;
}
.hotline-label{ font-size:14px; font-weight:600; color: var(--ink); }
.hotline-number{ font-size:12.5px; color: var(--ink-soft); margin-top:2px; }
.hotline-call{
  width:38px; height:38px; border-radius:50%; background: var(--green); color:#fff; flex:none;
  display:flex; align-items:center; justify-content:center;
}
.hotline-call svg{ width:17px; height:17px; }

/* ---------------------------- Bottom tab bar (liquid glass) ---------------------------- */
.tabbar-wrap{
  position: fixed; left:0; right:0; bottom:0; z-index:20;
  display:flex; justify-content:center;
  padding: 0 16px calc(var(--safe-bottom) + 14px);
  pointer-events:none;
}
.tabbar{
  pointer-events:auto;
  width:100%; max-width: 560px;
  display:flex; justify-content:space-between; gap:2px;
  padding: 9px 10px;
  border-radius: 30px;
  box-shadow: 0 14px 40px rgba(11,44,84,0.22), inset 0 1px 0 rgba(255,255,255,0.7);
  position: relative;
}
.tabbar::before{
  content:""; position:absolute; inset:0; border-radius:30px; padding:1px;
  background: linear-gradient(155deg, rgba(255,255,255,0.85), rgba(255,255,255,0.15));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events:none;
}
.tab-btn{
  flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
  background:none; border:none; padding:7px 4px; border-radius:20px;
  color: var(--ink-faint); cursor:pointer; position:relative;
}
.tab-icon{ width:23px; height:23px; }
.tab-btn span{ font-size:10.5px; font-weight:600; }
.tab-btn.is-active{ color: var(--seal-blue); }
.tab-btn.is-active::before{
  content:""; position:absolute; inset:-2px 6px; top:-3px; bottom:auto; height:26px;
  background: rgba(11,76,150,0.12); border-radius:14px; z-index:-1;
}

/* ---------------------------- Utility / misc ---------------------------- */
[hidden]{ display:none !important; }

@media (min-width: 720px){
  .app{ max-width: 760px; }
  .quick-grid{ grid-template-columns: repeat(4,1fr); }
  .tabbar{ max-width: 620px; }
}

@media (prefers-reduced-motion: reduce){
  .splash, .splash-seal, .quick-tile, .btn{ animation:none !important; transition:none !important; }
}
