/*
 * Site-wide announcement banner (views/partials/announcementWeb.ejs).
 * Each theme sets a handful of variables; the custom theme gets --ann-bg and
 * --ann-fg inline and derives the rest with color-mix().
 * Also loaded by the announcement editor for its live preview.
 */
.announcementWebBanner {
  --ann-bg: #e8f0fe;
  --ann-fg: #12305f;
  --ann-edge: #2f508c;
  --ann-chip: rgba(47, 80, 140, 0.12);
  --ann-cta-bg: #2f508c;
  --ann-cta-fg: #ffffff;

  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ann-bg);
  color: var(--ann-fg);
  border-bottom: 3px solid var(--ann-edge);
  font-size: 0.95rem;
  line-height: 1.45;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.announcementWebBanner.is-closing {
  opacity: 0;
  transform: translateY(-6px);
}

.announcementWebBanner-inner {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  max-width: 1140px;
  margin: 0 auto;
  min-width: 0;
}

.announcementWebBanner-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ann-chip);
  color: var(--ann-edge);
  font-size: 1rem;
}

.announcementWebBanner-body {
  min-width: 0;
  text-align: left;
}

.announcementWebBanner-title {
  font-weight: 700;
  margin-right: 6px;
}

.announcementWebBanner-text {
  overflow-wrap: anywhere;
}

.announcementWebBanner-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ann-cta-bg);
  color: var(--ann-cta-fg);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.15s ease;
}

/* The whole message is a click target, without nesting it inside the link. */
.announcementWebBanner-cta::after {
  content: "";
  position: absolute;
  inset: 0;
}

.announcementWebBanner-cta:hover,
.announcementWebBanner-cta:focus-visible {
  color: var(--ann-cta-fg);
  filter: brightness(1.1);
}

.announcementWebBanner-cta:hover i {
  transform: translateX(2px);
}

.announcementWebBanner-cta i {
  font-size: 0.8em;
  transition: transform 0.15s ease;
}

.announcementWebBanner-cta:focus-visible {
  outline: 3px solid var(--ann-edge);
  outline-offset: 2px;
}

.announcementWebBanner-dismiss {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.announcementWebBanner-dismiss:hover,
.announcementWebBanner-dismiss:focus-visible {
  opacity: 1;
  background: var(--ann-chip);
}

/* ---- Themes ------------------------------------------------------------- */

.announcementWebBanner--brand {
  --ann-bg: #2f508c;
  --ann-fg: #ffffff;
  --ann-edge: #f4c542;
  --ann-chip: rgba(255, 255, 255, 0.16);
  --ann-cta-bg: #f4c542;
  --ann-cta-fg: #1d2b45;
}
.announcementWebBanner--brand .announcementWebBanner-icon { color: #f4c542; }

.announcementWebBanner--success {
  --ann-bg: #e7f6ec;
  --ann-fg: #14532d;
  --ann-edge: #1e8e4e;
  --ann-chip: rgba(30, 142, 78, 0.14);
  --ann-cta-bg: #1e7a45;
}

.announcementWebBanner--warning {
  --ann-bg: #fff6dc;
  --ann-fg: #5c3d00;
  --ann-edge: #e0a100;
  --ann-chip: rgba(224, 161, 0, 0.18);
  --ann-cta-bg: #8a5a00;
}

.announcementWebBanner--danger {
  --ann-bg: #b4232f;
  --ann-fg: #ffffff;
  --ann-edge: #7d1520;
  --ann-chip: rgba(255, 255, 255, 0.18);
  --ann-cta-bg: #ffffff;
  --ann-cta-fg: #9b1c27;
}
.announcementWebBanner--danger .announcementWebBanner-icon { color: #ffffff; }

.announcementWebBanner--festive {
  --ann-bg: #b3202c;
  --ann-fg: #ffffff;
  --ann-edge: #1f6b3a;
  --ann-chip: rgba(255, 255, 255, 0.18);
  --ann-cta-bg: #1f6b3a;
  --ann-cta-fg: #ffffff;
  background-image:
    radial-gradient(circle at 12% 30%, rgba(255, 255, 255, 0.18) 0 2px, transparent 3px),
    radial-gradient(circle at 38% 75%, rgba(255, 255, 255, 0.14) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 63% 22%, rgba(255, 255, 255, 0.16) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 68%, rgba(255, 255, 255, 0.14) 0 1.5px, transparent 2.5px);
  background-size: 220px 60px;
  border-bottom: 4px solid transparent;
  border-image: repeating-linear-gradient(135deg, #1f6b3a 0 10px, #ffffff 10px 20px, #b3202c 20px 30px, #ffffff 30px 40px) 4;
}
.announcementWebBanner--festive .announcementWebBanner-icon { color: #ffe08a; }

.announcementWebBanner--dark {
  --ann-bg: #1d2230;
  --ann-fg: #f1f3f8;
  --ann-edge: #5b8def;
  --ann-chip: rgba(255, 255, 255, 0.1);
  --ann-cta-bg: #5b8def;
  --ann-cta-fg: #ffffff;
}
.announcementWebBanner--dark .announcementWebBanner-icon { color: #9dbbf7; }

/* --ann-bg and --ann-fg arrive inline from the editor's colour pickers. */
.announcementWebBanner--custom {
  --ann-edge: color-mix(in srgb, var(--ann-bg) 70%, #000000);
  --ann-chip: color-mix(in srgb, var(--ann-fg) 16%, transparent);
  --ann-cta-bg: var(--ann-fg);
  --ann-cta-fg: var(--ann-bg);
}
.announcementWebBanner--custom .announcementWebBanner-icon { color: var(--ann-fg); }

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 767px) {
  .announcementWebBanner {
    padding: 10px 12px;
    align-items: flex-start;
  }
  .announcementWebBanner-inner {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
  }
  .announcementWebBanner-icon {
    width: 30px;
    height: 30px;
    font-size: 0.875rem;
  }
  /* Wide enough basis that the button wraps onto its own line below. */
  .announcementWebBanner-body {
    flex: 1 1 220px;
  }
  .announcementWebBanner-icon ~ .announcementWebBanner-cta {
    margin-left: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .announcementWebBanner,
  .announcementWebBanner-cta,
  .announcementWebBanner-cta i {
    transition: none;
  }
}
