/* ==========================================================================
   header.css: the dark top bar, the sticky header, logo, and navigation.
   ========================================================================== */

/* ---------- Top bar (service times, address, phone) ---------- */
.topbar {
  background: var(--crimson-night);
  color: rgba(255, 255, 255, 0.86);
  font-family: var(--f-label);
  letter-spacing: 0.08em;
  font-size: 0.92rem;
}
.topbar .wrap { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.45rem; flex-wrap: wrap; }
/* A taller tap area for thumbs, without making the bar any taller. */
.topbar a { display: inline-block; padding-block: 0.3rem; margin-block: -0.3rem; color: inherit; text-decoration: none; transition: color 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.25s ease; }
.topbar a:hover { color: var(--brass-light); }
.topbar span + span::before { content: "✦"; color: var(--brass); margin: 0 0.8em; font-size: 0.7em; vertical-align: 0.15em; }
@media (max-width: 720px) {
  .topbar .hide-sm { display: none; }
  .topbar .hide-sm + span::before { content: none; }
}
@media (max-width: 480px) {
  /* One line: worship time + phone. */
  .topbar .wrap { flex-wrap: nowrap; font-size: 0.85rem; letter-spacing: 0.04em; }
  .topbar .wrap > div { white-space: nowrap; }
  .topbar .wrap > div:first-child span:first-child { display: none; }
  /* A small brass cross before "Morning Worship". */
  .topbar .wrap > div:first-child span:nth-child(2) { display: inline-flex; align-items: center; gap: 0.5em; }
  .topbar .wrap > div:first-child span:nth-child(2)::before {
    content: ""; margin: 0; width: 9px; height: 12px; flex: none;
    background: var(--cross-brass) center / contain no-repeat;
  }
}

/* Arriving from a page that was left scrolled down: the top bar had scrolled
   away, so ease it in rather than snapping it back into view (see arrival.js). */
@keyframes banner-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.arrive-scrolled .topbar { animation: banner-in 0.6s var(--ease-out) both; }

/* ---------- Sticky header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 241, 232, 0.94);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; min-height: 78px; }

/* ---------- Logo: a crimson badge like the church's marquee sign ---------- */
.brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 44px; height: 56px; flex: none;
  background: var(--crimson);
  color: #fff;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid; place-items: center;
}
.brand-mark svg { width: 28px; height: 42px; overflow: visible; transition: color 0.5s ease, filter 0.5s ease; }
/* Gentle gold glow on hover. */
.brand:hover .brand-mark svg,
.brand:focus-visible .brand-mark svg,
.footer-brand:hover .brand-mark svg {
  color: #ffd23f;
  filter: drop-shadow(0 0 2px rgba(255, 210, 63, 0.45));
}
.brand-name { font-family: var(--f-display); font-size: 1.32rem; line-height: 1; display: block; }
.brand-sub { font-family: var(--f-label); text-transform: uppercase; letter-spacing: 0.15em; font-weight: 600; font-size: 0.8rem; color: var(--ink-soft); display: block; margin-top: 4px; }
/* The same brass star as the top bar, between "Missionary Baptist" and "Austin". */
.brand-star { color: var(--brass); margin: 0 0.75em; font-size: 0.75em; vertical-align: 0.12em; letter-spacing: 0; }
@media (max-width: 420px) { .brand-sub { display: none; } .brand-name { font-size: 1.15rem; } }

/* ---------- Navigation ---------- */
.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  font-family: var(--f-label); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; font-size: 1.02rem;
  color: var(--ink); text-decoration: none;
  padding: 0.55em 0.85em; border-radius: var(--radius);
  position: relative;
}
.nav a:not(.btn) { transition: color 0.22s ease; }
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0.85em; right: 0.85em; bottom: 0.25em; height: 2px;
  background: var(--crimson); transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease;
}
.nav a:not(.btn):hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--crimson); }
.nav .btn { margin-left: 0.6rem; padding: 0.7em 1.2em 0.65em; }
.nav a.btn, .nav a.btn:hover { color: #fff; }

.menu-toggle {
  display: none;
  background: none; border: 2px solid var(--ink); border-radius: var(--radius);
  font-family: var(--f-label); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; font-size: 0.9rem;
  padding: 0.5em 0.9em; color: var(--ink); cursor: pointer;
  transition: color 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.25s ease;
}
.menu-toggle:hover { background: var(--ink); color: var(--paper); }

/* ---------- Mobile menu ---------- */
@media (max-width: 960px) {
  .menu-toggle { display: inline-block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1.2rem;
    display: flex;
    box-shadow: 0 18px 30px -18px rgba(36, 22, 27, 0.35);
    /* Closed: rolled up behind the header. Opening unrolls it downward and fades it in. */
    opacity: 0; visibility: hidden;
    transform: translateY(-8px);
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.42s var(--ease-out), opacity 0.3s ease, transform 0.42s var(--ease-out), visibility 0s linear 0.42s;
  }
  .nav.open {
    opacity: 1; visibility: visible; transform: none;
    clip-path: inset(0 0 -40px 0);
    transition: clip-path 0.45s var(--ease-out), opacity 0.25s ease, transform 0.45s var(--ease-out), visibility 0s linear 0s;
  }
  /* Links settle in one after another as it opens. (ID selectors so the
     site-wide link transitions can't override these.) */
  #site-nav a { opacity: 0; transform: translateY(-6px); transition: opacity 0.25s ease, transform 0.3s ease, color 0.22s ease, background-color 0.22s ease; }
  #site-nav.open a { opacity: 1; transform: none; }
  #site-nav.open a:nth-child(1) { transition-delay: 0.05s; }
  #site-nav.open a:nth-child(2) { transition-delay: 0.09s; }
  #site-nav.open a:nth-child(3) { transition-delay: 0.13s; }
  #site-nav.open a:nth-child(4) { transition-delay: 0.17s; }
  #site-nav.open a:nth-child(5) { transition-delay: 0.21s; }
  #site-nav.open a:nth-child(6) { transition-delay: 0.25s; }
  .nav a { padding: 0.9em 0; border-bottom: 1px solid var(--line); font-size: 1.1rem; }
  .nav a::after { display: none; }
  .nav .btn { margin: 1rem 0 0; justify-content: center; border-bottom: 0; }
}
