/* ============================================================
   AIWhy Next Event Bar — production styles
   Relies on theme.css design tokens (--c-page, --c-text, etc.)
   and the [data-accent="..."] palette declarations.

   The bar sits below the sticky navbar as a normal block (NOT
   sticky itself — avoids stacking two sticky elements). When
   the user scrolls, the navbar stays, the bar scrolls away.
   ============================================================ */

.aewb-bar {
  --aewb-page:      var(--c-page);
  --aewb-page-2:    var(--c-page-2);
  --aewb-page-glow: var(--c-page-glow);

  display: none;                  /* shown by JS only when an upcoming event is found */
  position: relative;             /* establishes a positioning context for ::before */
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--aewb-page) 18%, transparent) 0%,
      color-mix(in srgb, var(--aewb-page) 6%, transparent) 28%,
      transparent 60%),
    rgba(0, 7, 14, .92);
  color: var(--c-text);
  text-decoration: none;
  font-family: var(--f-sans, "Inter", system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.3;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.aewb-bar.is-visible { display: flex; }

/* Top-edge accent: 2px gradient hairline */
.aewb-bar::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--aewb-page) 18%,
    var(--aewb-page-2) 82%,
    transparent);
  opacity: .85;
  pointer-events: none;
}

.aewb-bar:hover {
  border-bottom-color: var(--aewb-page);
  box-shadow: 0 14px 30px -22px var(--aewb-page-glow);
}
.aewb-bar:focus-visible {
  outline: 3px solid var(--aewb-page);
  outline-offset: -3px;
}

/* LEFT: pill label "Next Event" with a pulsing dot */
.aewb-label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--aewb-page) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--aewb-page) 40%, transparent);
  color: var(--aewb-page);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.aewb-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--aewb-page);
  box-shadow: 0 0 0 0 var(--aewb-page-glow);
  animation: aewb-pulse 2.2s ease-out infinite;
  flex: none;
}
@keyframes aewb-pulse {
  0%   { box-shadow: 0 0 0 0 var(--aewb-page-glow); }
  70%  { box-shadow: 0 0 0 8px rgba(0,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* Calendar icon — only on phone, replaces the label pill */
.aewb-icon {
  display: none;
  flex: 0 0 auto;
  color: var(--aewb-page);
  line-height: 0;
}
.aewb-icon svg { width: 22px; height: 22px; display: block; }

/* MIDDLE: title stacked above when (always — never inline) */
.aewb-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.aewb-title {
  color: var(--c-text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.aewb-sep { display: none; }
.aewb-when {
  color: var(--c-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: none;
}

/* RIGHT: CTA pill */
.aewb-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--aewb-page), var(--aewb-page-2));
  color: #00121f;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 6px 18px -8px var(--aewb-page-glow);
  transition: transform .2s ease, box-shadow .2s ease;
  white-space: nowrap;
}
.aewb-button svg {
  width: 14px; height: 14px;
  transition: transform .25s ease;
}
.aewb-bar:hover .aewb-button {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px -8px var(--aewb-page-glow);
}
.aewb-bar:hover .aewb-button svg { transform: translateX(2px); }

/* Tablet: title wraps to 2 lines */
@media (max-width: 860px) {
  .aewb-bar { padding: 11px 18px; gap: 14px; }
  .aewb-title {
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.25;
  }
  .aewb-when { font-size: 12px; }
}

/* Phone: replace label pill with calendar icon, shorten button */
@media (max-width: 520px) {
  .aewb-bar { padding: 10px 12px; gap: 10px; }
  .aewb-label { display: none; }
  .aewb-icon  { display: inline-flex; }
  .aewb-icon svg { width: 30px; height: 30px; }
  .aewb-title { font-size: 13.5px; }
  .aewb-when  { font-size: 11.5px; }
  .aewb-button { padding: 7px 12px; font-size: 12px; }
  .aewb-button-text-long { display: none; }
  .aewb-button-text-short { display: inline !important; }
}

/* Very narrow: drop the time line */
@media (max-width: 380px) {
  .aewb-when { display: none; }
  .aewb-button { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .aewb-dot { animation: none; }
  .aewb-bar, .aewb-button, .aewb-button svg { transition: none; }
}
