/*
 * announcement-bar-1529297.css
 * Owns: Sitewide sticky rotating promo bar (Task #1529297)
 * Does NOT own: nav/header styles, page content layout
 */

/* ── Custom property: bar height exposed for header offset ──────── */
:root {
  --anbar-height: 36px;
  --anbar-height-mobile: 40px;
  --anbar-bg-start: #FFFFFF;
  --anbar-bg-end: #F8FAFC;
  --anbar-z: 1100; /* above .hn-header z-index: 1000 */
}

/* ── Bar shell ──────────────────────────────────────────────────── */
#sr-announcement-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--anbar-z);
  height: var(--anbar-height);
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Smooth show/hide */
  transition: transform 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}

/* Hidden state (after dismiss) */
#sr-announcement-bar.sr-anbar-hidden {
  transform: translateY(-100%);
  pointer-events: none;
}

/* ── Offset the sticky header when bar is visible ────────────────── */
/* Added/removed by JS based on dismiss state */
body.sr-anbar-visible .hn-header {
  top: var(--anbar-height) !important;
}
body.sr-anbar-visible .hn-mobile-menu {
  top: calc(var(--anbar-height) + 60px) !important;
}
/* Bug #1536491: Offset trust bar below header when announcement bar visible */
body.sr-anbar-visible .sr-gtb {
  top: calc(var(--anbar-height) + 64px) !important;
}
/* Community/app bottom nav: no change needed (fixed bottom) */

/* ── Messages container ──────────────────────────────────────────── */
.sr-anbar-messages {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 40px 0 40px; /* space for dismiss btn */
}

/* ── Individual message ──────────────────────────────────────────── */
.sr-anbar-msg {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.sr-anbar-msg.sr-anbar-msg--active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Message text & link ────────────────────────────────────────── */
.sr-anbar-text {
  font-family: 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: #1F2937 !important;
  -webkit-text-fill-color: #1F2937 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sr-anbar-link {
  color: #059669 !important;
  -webkit-text-fill-color: #059669 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}
.sr-anbar-link:hover,
.sr-anbar-link:focus {
  opacity: 0.75;
  outline: 2px solid rgba(5, 150, 105, 0.4);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Dismiss button — 44px minimum tap target (WCAG 2.5.5) ──────── */
.sr-anbar-dismiss {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  /* Visible size 28px, padding expands tap area to 44px */
  width: 28px;
  height: 28px;
  padding: 8px;
  box-sizing: content-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6B7280 !important; /* WCAG AA: 4.54:1 on white (was #9CA3AF 2.54:1) */
  -webkit-text-fill-color: #6B7280 !important;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.sr-anbar-dismiss:hover {
  background: #F3F4F6;
  color: #374151 !important;
  -webkit-text-fill-color: #374151 !important;
}
.sr-anbar-dismiss:focus-visible {
  outline: 2px solid rgba(5, 150, 105, 0.4);
  outline-offset: 2px;
}
.sr-anbar-dismiss svg {
  pointer-events: none;
}

/* ── Progress dots ───────────────────────────────────────────────── */
/* Dots: dark dots on white background for contrast on white bar */
.sr-anbar-dots {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  align-items: center;
}
.sr-anbar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #D1D5DB !important;
  transition: background 0.3s ease, transform 0.3s ease;
}
.sr-anbar-dot.sr-anbar-dot--active {
  background: #059669 !important;
  transform: scale(1.3);
}

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  :root {
    --anbar-height: var(--anbar-height-mobile);
  }
  #sr-announcement-bar {
    height: var(--anbar-height-mobile);
  }
  body.sr-anbar-visible .hn-header {
    top: var(--anbar-height-mobile) !important;
  }
  body.sr-anbar-visible .hn-mobile-menu {
    top: calc(var(--anbar-height-mobile) + 60px) !important;
  }
  /* Bug #1536491: Mobile header is 60px not 64px */
  .sr-gtb {
    top: 60px !important;
  }
  body.sr-anbar-visible .sr-gtb {
    top: calc(var(--anbar-height-mobile) + 60px) !important;
  }
  .sr-anbar-text {
    font-size: 12.5px;
  }
  /* Dots hidden on mobile (too small) */
  .sr-anbar-dots {
    display: none;
  }
}

/* ── Very narrow: abbreviate ────────────────────────────────────── */
@media (max-width: 420px) {
  .sr-anbar-text {
    font-size: 12px;
  }
  /* Hide non-essential copy class — JS swaps in mobile-specific text */
  .sr-anbar-desktop-only {
    display: none;
  }
}
