/* =========================
   St. Paul's Anglican Church
   styles.css (CLEAN + MATCHED)
   - Mobile menu works with #siteNav + #menuBtn
   - Lightbox supports .active AND .is-open
   - Leader cards + gallery consistent
   - Dark mode via html[data-theme="dark"]
========================= */

/* ---------- Variables ---------- */
:root{
  /* Brand */
  --red:#c1121f;
  --red2:#8d0e16;
  --gold:#d4af37;

  /* Neutrals */
  --bg:#ffffff;
  --text:#111111;
  --muted:#555555;

  /* Surfaces */
  --card:#ffffff;
  --panel: var(--card);
  --soft:#fff6e6;

  /* Lines & shadow */
  --line: rgba(0,0,0,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.08);

  --white:#ffffff;
}

/* ---------- Base ---------- */
*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(212,175,55,.18), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(193,18,31,.12), transparent 55%),
    var(--bg);
}

a{ color:inherit; text-decoration:none; }
.container{ width:min(1100px, 92%); margin:0 auto; }

/* ---------- Header / Nav ---------- */
.site-header{
  position:sticky;
  top:0;
  z-index:10;
  background:rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}

.nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0;
  gap:14px;
}

.logo{
  font-weight:900;
  letter-spacing:.3px;
  color:var(--red);
  position:relative;
}
.logo::after{
  content:"";
  position:absolute;
  left:0;
  bottom:-6px;
  width:38px;
  height:3px;
  background:var(--gold);
  border-radius:999px;
}

/* Desktop nav (scoped to #siteNav so other navs don't break) */
#siteNav{
  display:flex;
  align-items:center;
  gap:10px;

  /* ✅ Keep links beside each other on desktop */
  flex-wrap:nowrap;
  white-space:nowrap;

  /* ✅ If there are many links, scroll horizontally instead of dropping under */
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;

  /* keeps layout stable */
  min-width:0;
}
#siteNav::-webkit-scrollbar{ height:8px; }
#siteNav::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,.15);
  border-radius: 999px;
}

/* Nav links */
#siteNav a{
  padding:8px 10px;
  border-radius:10px;
  color:var(--muted);
  display:inline-block;
  flex:0 0 auto; /* ✅ prevent shrinking/wrapping weirdness */
}
#siteNav a:hover{
  background:rgba(193,18,31,.08);
  color:var(--text);
}
#siteNav a.active{
  background:rgba(212,175,55,.22);
  border:1px solid rgba(212,175,55,.35);
  color:var(--text);
}

/* Theme toggle button */
.theme-toggle{
  border:1px solid var(--line);
  background: rgba(255,255,255,.7);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  box-shadow: var(--shadow);
}

/* Hamburger button (hidden on desktop) */
.menu-btn{
  display:none;
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.9);
  cursor:pointer;
  font-size:20px;
  line-height:1;
  box-shadow: var(--shadow);
}

/* ---------- Heroes ---------- */
.hero{ padding:64px 0; }
.hero-grid{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:28px;
  align-items:center;
}
.hero h1{
  font-size:clamp(2rem, 3.8vw, 3.2rem);
  line-height:1.05;
  margin:0 0 12px;
}
.hero p{
  margin:0 0 18px;
  color:var(--muted);
  font-size:1.05rem;
}

.page-hero{ padding:44px 0 18px; }
.page-hero h1{
  margin:0 0 10px;
  font-size:clamp(1.8rem, 3vw, 2.4rem);
}
.page-hero p{
  margin:0;
  color:var(--muted);
  max-width:70ch;
}

.hero-img{
  width:100%;
  height:360px;
  object-fit:cover;
  border-radius:22px;
  box-shadow: var(--shadow);
}

/* ---------- Buttons ---------- */
.buttons{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.btn{
  display:inline-block;
  padding:12px 16px;
  border-radius:14px;
  background:linear-gradient(135deg, var(--red), var(--gold));
  color:var(--white);
  font-weight:700;
  border:0;
  cursor:pointer;
  box-shadow: var(--shadow);
}
.btn:hover{ transform:translateY(-1px); }

.btn-outline{
  background:transparent;
  border:1px solid rgba(193,18,31,.25);
  color:var(--red);
  box-shadow:none;
}

/* ---------- Sections / Cards ---------- */
.section{ padding:56px 0; }
.section.alt{
  background:rgba(212,175,55,.10);
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
}
.section-title{ margin:0 0 18px; }

.grid-3{ display:grid; grid-template-columns:repeat(3, 1fr); gap:18px; }
.grid-2{ display:grid; grid-template-columns:repeat(2, 1fr); gap:18px; }

.feature, .event, .panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:18px;
  box-shadow: var(--shadow);
}

.feature h2{ margin:0 0 8px; font-size:1.25rem; }
.feature p, .event p, .panel p{ margin:0; color:var(--muted); }
.meta{ margin:10px 0 8px; color:rgba(85,85,85,.95); }
.text-link{ display:inline-block; margin-top:10px; color:var(--red); }

/* Badge */
.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(212,175,55,.22);
  border:1px solid rgba(193,18,31,.25);
  color:var(--text);
  font-size:.9rem;
}

/* Quick info cards */
.quick-info{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:12px;
  margin-top:18px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  box-shadow: var(--shadow);
}
.card h3{ margin:0 0 6px; font-size:1rem; }
.card p{ margin:0; color:var(--muted); }

/* Lists */
.list{
  margin:10px 0 0;
  padding:0 0 0 18px;
  color:var(--muted);
}
.list li{ margin:6px 0; }

/* Tables */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.02);
  box-shadow: var(--shadow);
}
.table th, .table td{
  padding:12px 12px;
  border-bottom:1px solid rgba(0,0,0,.08);
  text-align:left;
}
.table th{ color:rgba(17,17,17,.92); font-weight:800; }
.table td{ color:var(--muted); }
.table tr:last-child td{ border-bottom:0; }

/* Forms */
.form{ display:grid; gap:12px; }
.input{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.14);
  background:rgba(255,255,255,.9);
  color:var(--text);
  outline:none;
}
.input:focus{
  border-color: rgba(193,18,31,.35);
  box-shadow: 0 0 0 4px rgba(193,18,31,.10);
}
.input::placeholder{ color:rgba(85,85,85,.75); }
textarea.input{ min-height:140px; resize:vertical; }

/* Layout split */
.split{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:18px;
  align-items:start;
}

/* Honeypot */
.honeypot{
  position:absolute;
  left:-9999px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
}

/* ---------- Gallery ---------- */
.gallery-section{ margin-top:40px; }
.gallery-title{
  margin:0 0 14px;
  font-size:1.3rem;
  color:var(--red);
}
.gallery{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:14px;
}
.gallery img{
  width:100%;
  height:200px;
  object-fit:cover;
  border-radius:16px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  cursor:pointer;
  transition: transform .15s ease;
}
.gallery img:hover{ transform: translateY(-2px); }

/* ---------- Leaders / Youth Cards ---------- */
.leaders-controls{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:14px;
}
.leaders-search{ flex: 1 1 320px; }
.leaders-filter{ flex: 0 0 200px; max-width:240px; }
.leaders-count{ color:var(--muted); font-size:.95rem; }

.leaders-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.leader-photo { cursor: pointer; }

.leader-card{
  display:flex;
  flex-direction:column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow:hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .25s ease, transform .2s ease;
}
.leader-card:hover{
  box-shadow: 0 20px 40px rgba(193,18,31,.18);
  transform: translateY(-2px);
}

.leader-photo-wrap{
  position:relative;
  overflow:hidden;
}

.leader-photo{
  width:100%;
  height:260px;
  object-fit:cover;
  object-position:center;
  display:block;
  transition: transform .5s ease;
}
.leader-card:hover .leader-photo{ transform: scale(1.04); }

.leader-body{ padding:14px 14px 16px; }
.leader-name{ margin:0; font-size:1.05rem; color:var(--text); }
.leader-years{ margin:6px 0 10px; color:var(--muted); font-size:.95rem; }
.leader-bio{ margin:0; line-height:1.55; opacity:.95; color:var(--text); }

/* Optional overlay (only used if your HTML includes .leader-overlay)
   ✅ Always visible (not hover-only) */
.leader-overlay{
  position:absolute;
  inset:0;
  background:linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,.25), transparent);
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding:18px;
  color:#fff;
  opacity:1;
}
.leader-overlay h3{ margin:0; font-size:1.1rem; font-weight:700; }
.leader-overlay p{ margin:4px 0 0; font-size:.9rem; opacity:.9; }

/* ---------- Event flyer ---------- */
.event-flyer{
  width:100%;
  max-height:420px;
  object-fit:cover;
  border-radius:16px;
  margin-bottom:14px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- Modal (success popup) ---------- */
.modal{ position:fixed; inset:0; display:none; z-index:9999; }
.modal.show{ display:block; }
.modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.6); }
.modal-card{
  position:relative;
  width:min(520px, 92vw);
  margin:18vh auto 0;
  background: var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:18px;
  box-shadow: var(--shadow);
}

/* ---------- Lightbox ---------- */
/* ✅ Supports BOTH: .active (events/youth lightbox) AND .is-open (gallery.js) */
.lightbox{
  position:fixed;
  inset:0;
  display:none;
  z-index:9999;
}
.lightbox.active,
.lightbox.is-open{
  display:block;
}

.lightbox-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.75);
}

.lightbox-panel{
  position:relative;
  width:min(900px, 92vw);
  margin:5vh auto;
  background:var(--card);
  padding:10px;
  border-radius:18px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
}

.lightbox-close{
  position:absolute;
  top:8px;
  right:8px;
  width:36px;
  height:36px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.9);
  border-radius:10px;
  cursor:pointer;
  font-size:18px;
}

.lightbox-img{
  width:100%;
  max-height:80vh;
  object-fit:contain;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.02);
}

/* Lightbox bar (gallery prev/next) */
.lightbox-bar{
  display:flex;
  gap:10px;
  justify-content:center;
  align-items:center;
  margin-top:12px;
  flex-wrap:wrap;
}
.lightbox-btn{ min-width:120px; }
.lightbox-meta{
  margin:10px 0 0;
  text-align:center;
  color: var(--muted);
  font-size: .95rem;
}

/* ---------- Footer ---------- */
.site-footer{
  padding:34px 0 18px;
  background: var(--soft);
}
.footer-grid{
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap:18px;
  align-items:start;
  border-top:3px solid var(--red);
  padding-top:18px;
}
.site-footer h3, .site-footer h4{ margin:0 0 8px; }
.site-footer p{ margin:0 0 6px; color:var(--muted); }
.copyright{
  margin:14px 0 0;
  text-align:center;
  color:rgba(85,85,85,.9);
  font-size:.95rem;
}

/* ---------- Dark Mode ---------- */
html[data-theme="dark"]{
  --bg:#0b0f17;
  --text:#f3f4f6;
  --muted:#b6bcc8;

  --card:#101827;
  --panel: var(--card);
  --soft: rgba(255,255,255,.05);
  --line: rgba(255,255,255,.14);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

/* Header background in dark */
html[data-theme="dark"] .site-header{
  background: rgba(16,24,39,.85);
}
html[data-theme="dark"] .theme-toggle{
  background: rgba(16,24,39,.8);
}
html[data-theme="dark"] .menu-btn{
  background: rgba(17,24,39,.85);
}

/* ---------- Responsive ---------- */
@media (max-width: 980px){
  .leaders-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px){
  .hero-grid{ grid-template-columns:1fr; }
  .quick-info{ grid-template-columns:1fr; }
  .grid-3{ grid-template-columns:1fr; }
  .grid-2{ grid-template-columns:1fr; }
  .split{ grid-template-columns:1fr; }
  .footer-grid{ grid-template-columns:1fr; }

  /* Gallery */
  .gallery{ grid-template-columns: repeat(2, 1fr); }
  .gallery img{ height:180px; }

  /* Mobile menu behavior */
  #siteNav{ display:none; } /* hide nav links */
  #siteNav.open{
    display:flex;
    flex-direction:column;
    gap:10px;
    width:100%;
    padding:12px;
    margin-top:10px;
    border:1px solid var(--line);
    border-radius:16px;
    background: var(--card);
    box-shadow: var(--shadow);
  }
  #siteNav a{
    padding:12px 12px;
    border-radius:12px;
    border:1px solid var(--line);
    background: rgba(0,0,0,.02);
    font-weight:700;
    color:var(--text);
  }
  #siteNav a:hover{
    background: rgba(193,18,31,.08);
    border-color: rgba(193,18,31,.25);
  }

  /* Show hamburger */
  .menu-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }

  /* Let logo take space */
  .logo{ flex:1; }
}

@media (max-width: 640px){
  .leaders-grid{ grid-template-columns: 1fr; }
  .leaders-filter{ flex: 1 1 200px; }
}

@media (max-width: 520px){
  .gallery{ grid-template-columns: 1fr; }
  .gallery img{ height:240px; }
}

/* Priest contact styling */
.priest-actions {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.priest-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: 0.2s ease;
}

/* Phone style */
.call-link {
  color: #444;
}

.call-link i {
  font-size: 16px;
}

/* WhatsApp official green */
.whatsapp-link {
  color: #25D366;
}

.whatsapp-link i {
  font-size: 18px;
}

/* Hover effects */
.call-link:hover {
  color: var(--red);
}

.whatsapp-link:hover {
  opacity: 0.8;
}

/* Footer bottom area */
.footer-bottom{
  padding-top: 10px;
}

.footer-social{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:18px;
  margin-top:10px;
  margin-bottom:10px;
}

.footer-social a{
  font-size:22px;
  transition: transform .2s ease, opacity .2s ease;
}

/* Brand colors */
.footer-social .facebook{ color:#1877F2; }
.footer-social .youtube{ color:#FF0000; }
.footer-social .tiktok{ color:#000000; }

html[data-theme="dark"] .footer-social .tiktok{
  color:#ffffff; /* TikTok visible in dark mode */
}

.footer-social a:hover{
  transform: scale(1.15);
  opacity: .9;
}

/* Make copyright centered */
.site-footer .copyright{
  margin: 0;
  text-align:center;
}
