/* ================================================================
   Public Announcements Carousel & Detail Modal

   Shared by church_website.html and district_website.html, which both
   render the same #announcements section markup (see the "Auto-Advancing
   Carousel Container" block in each) and are driven by the single
   setupPublicAnnouncements() implementation in scripts/utils.js. Keeping
   the styling here too means there's exactly one place to change the
   carousel's look, instead of two copies drifting apart.
   ================================================================ */
.ann-filter-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.ann-pill {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ann-pill:hover {
  background: #f1f5f9;
  color: #1d4261;
}

.ann-pill.active {
  background: #1d4261;
  color: #fff;
  border-color: #1d4261;
  box-shadow: 0 2px 4px rgba(29, 66, 97, 0.2);
}

/* Plain layout container now — the card look (background/shadow/radius)
   lives on .ann-slide-card itself, since that's the piece that slides. */
.ann-carousel-wrapper {
  position: relative;
  margin: 0 auto;
  max-width: 900px;
}

.ann-progress-bar {
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
  width: 100%;
  margin-top: 10px;
}

.ann-progress-fill {
  height: 100%;
  width: 0%;
  background: #c9a227;
  transition: width 0.1s linear;
}

.ann-carousel-stage {
  height: 320px;
  position: relative;
  overflow: hidden;
  /* Vertical breathing room so the card's own box-shadow isn't clipped flush
     against the stage's clipping edge. */
  padding: 6px 0;
}

/* Holds the outgoing + incoming card side by side (200% wide, two 50% panes)
   and is what actually gets translated during a next/prev transition — so
   the whole card (background, shadow, rounded corners and all) travels the
   full width of the stage, and the next/previous card is visibly dragged in
   alongside it, instead of just its text content nudging into a static frame. */
.ann-slide-track {
  display: flex;
  width: 200%;
  /* .ann-slide-track-item and .ann-slide-card below both rely on
     `height: 100%` to fill the stage's fixed 320px. A percentage height
     only resolves against a definite ancestor height — without this,
     the track's own height was `auto`, so that chain fell through to
     `auto` at every level and each card sized itself to its own content
     instead. Visually: cards visibly grew/shrank between slides
     depending on how much text each one held, instead of sharing one
     fixed footprint. */
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ann-slide-track-item {
  width: 50%;
  flex: 0 0 50%;
  height: 100%;
  box-sizing: border-box;
  /* Small gutter so consecutive cards don't visually touch mid-swipe. */
  padding: 0 8px;
}

/* Fixed height + flex column so every card — regardless of how much title,
   content or meta it holds — occupies the same footprint in the stage.
   The tap hint is pinned to the bottom via margin-top: auto, and the
   content/meta area is left to clip (line-clamp on .ann-slide-content,
   overflow hidden here) rather than push the card taller. */
.ann-slide-card {
  cursor: pointer;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.03);
  padding: 32px 36px;
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.ann-slide-card:hover {
  transform: translateY(-2px);
}

.ann-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ann-theme-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-navy     { background: #163047; color: #fff; }
.theme-gold     { background: #d97706; color: #fff; }
.theme-emerald  { background: #059669; color: #fff; }
.theme-burgundy { background: #9f1239; color: #fff; }
.theme-slate    { background: #475569; color: #fff; }
.theme-crimson  { background: #dc2626; color: #fff; }

.ann-pinned-tag {
  background: #fef3c7;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}

.ann-slide-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
  line-height: 1.3;
  /* Clamped like .ann-slide-content so a long title can't blow past the
     fixed card height and push the tap hint out of view. flex-shrink: 0
     keeps that reserved 2-line box intact — see the note on
     .ann-slide-content below for why that matters. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}

.ann-slide-content {
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
  /* Without this, flexbox is free to shrink this box below the height its
     own -webkit-line-clamp:3 needs whenever the rest of the card (header,
     meta) needs more room than it has on narrower viewports — the
     "automatic minimum size" of a flex item collapses to 0 the moment it
     has overflow:hidden, which this box does. The clamp then still lays
     out 3 lines of text, but the box clipping it is shorter than that, so
     the last line gets sliced through mid-glyph instead of omitted
     cleanly. Pinning flex-shrink: 0 keeps the full 3-line box reserved so
     the clamp always cuts at a line boundary. */
  flex-shrink: 0;
}

.ann-slide-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.ann-slide-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  /* Truncate rather than wrap: a long venue address wrapping to 2 lines is
     what was stealing the vertical room .ann-slide-content needed on
     mobile in the first place (see comment above). min-width: 0 lets this
     flex item actually shrink to the row's width instead of forcing it
     wide enough to fit its text. */
  min-width: 0;
  max-width: 100%;
}

.ann-slide-meta-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ann-tap-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* Pinned to the bottom of the fixed-height card, regardless of how much
     room the title/content/meta above it actually use. */
  margin-top: auto;
  padding-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #1d4261;
}

/* Detached from .ann-carousel-wrapper so the indicator dots & prev/next/pause
   buttons read as their own control bar, not part of the announcement card. */
.ann-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px auto 0;
  max-width: 900px;
}

.ann-arrow-btn, .ann-pause-btn {
  background: #fff;
  border: 1px solid #cbd5e1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ann-arrow-btn:hover, .ann-pause-btn:hover {
  background: #1d4261;
  color: #fff;
  border-color: #1d4261;
}

.ann-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ann-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ann-dot.active {
  width: 20px;
  border-radius: 10px;
  background: #1d4261;
}

/* Detail Modal */
.ann-detail-modal {
  padding: 0;
  border: none;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  /* Cap height so the dialog itself never grows taller than the viewport —
     otherwise the browser's default dialog UA style scrolls the dialog box
     directly, and that native scrollbar cuts across the rounded corners. */
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  /* Native <dialog> centers itself via the UA stylesheet's `margin: auto`
     (paired with inset: 0), but church_website.css / district_website.css
     both reset every element to `margin: 0`, and author styles always beat
     the UA stylesheet regardless of specificity — so that reset silently
     pins the dialog to the top-left corner instead of centering it. Center
     explicitly with fixed positioning + transform so it doesn't depend on
     the UA default or on no ancestor page ever resetting margin. */
  position: fixed;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

.ann-detail-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.ann-modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
}

.ann-modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 10;
  transition: background 0.15s;
}

.ann-modal-close:hover {
  background: rgba(255,255,255,0.35);
}

.ann-modal-header {
  flex-shrink: 0;
  padding: 28px 24px 20px;
  color: #fff;
  background: #163047;
}

.ann-modal-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255,255,255,0.2);
  color: #fff;
  margin-bottom: 8px;
}

.ann-modal-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
  /* Explicit rather than inherited from .ann-modal-header: pages like the
     dashboard also load shared.css, whose generic `dialog h3` rule (for
     unrelated confirmation dialogs) would otherwise win over inheritance
     and paint this title navy instead of white. */
  color: #fff;
}

.ann-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.ann-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #475569;
}

.ann-modal-content {
  font-size: 15px;
  line-height: 1.7;
  color: #334155;
  white-space: pre-wrap;
  margin-bottom: 24px;
}

.ann-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.ann-cta-btn {
  background: #1d4261;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.ann-cta-btn:hover { background: #15334a; }

.ann-share-btn {
  background: transparent;
  color: #1d4261;
  border: 2px solid #1d4261;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ann-share-btn:hover { background: #1d4261; color: #fff; }

/* Mobile: trim the card's own padding and give the stage a little extra
   height. The card's content (title/content boxes) now holds a fixed
   footprint via flex-shrink: 0 above, so on a narrow viewport — where the
   header badges and meta row are more likely to each need their own
   line — that fixed footprint plus everything else can otherwise exceed
   the stage height and get clipped by .ann-slide-card's overflow: hidden.
   A slightly taller stage keeps the tap hint from being cut off. */
@media (max-width: 640px) {
  .ann-carousel-stage {
    height: 360px;
  }

  .ann-slide-card {
    padding: 24px 20px;
  }

  /* CTA + Share can now both be present (review) — center rather than
     flex-end once they wrap to their own lines on a narrow modal. */
  .ann-modal-actions {
    justify-content: center;
  }
}
