/**
 * Global banner section — values from /specs/global-banner.spec.md only.
 * Scoped under .global-banner.
 */

.global-banner {
  --font-sans: "Geograph", system-ui, sans-serif;
  --spacing: 0.25rem;
  --color-black: #212121;
  --text-xs: 0.75rem;
  --tracking-wider: 0.05em;
  --z-global-banner: 85;
  --z-content: 10;
  --banner-fade-duration: 300ms;

  position: sticky;
  top: calc(var(--spacing) * 0);
  z-index: var(--z-global-banner);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  color: rgb(0, 0, 0);
}

.global-banner__inner {
  position: relative;
  color: rgb(255, 255, 255);
  background-color: #212121;
  /* Keep the dark bar painted even if slides briefly collapse during Swiper init */
  min-height: calc(var(--spacing) * 8);
}

/* Carousel shell — spec swiper utilities: relative, overflow hidden */
.global-banner__carousel {
  position: relative;
  z-index: 1;
  margin-inline: auto;
  overflow: hidden;
  background-color: #212121;
}

.global-banner__slides {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: calc(var(--spacing) * 8);
}

/* Shared slide layout (pre-Swiper, Swiper, and fallback) */
.global-banner__slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  padding-inline: calc(var(--spacing) * 8);
  padding-block: calc(var(--spacing) * 2);
}

/*
 * Pre-Swiper + pre-init only — once .swiper-initialized is set, Swiper owns
 * slide visibility. Bridging until init prevents the first message ghosting
 * and the dark bar collapsing when .swiper is added.
 */
.global-banner__carousel:not(.swiper-initialized) .global-banner__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--banner-fade-duration) ease;
}

.global-banner__carousel:not(.swiper-initialized) .global-banner__slide--active {
  position: relative;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Fallback carousel uses the same stacked layout */
.global-banner__slides--stacked .global-banner__slide {
  position: absolute;
  inset: 0;
  width: 100%;
}

.global-banner__slides--stacked .global-banner__slide--active {
  position: relative;
}

/* Message — spec: text-center, text-[10px], tracking-wider, md:text-xs, rgb(255,255,255) */
.global-banner__message {
  margin: 0;
  width: 100%;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 10px;
  line-height: 16px;
  letter-spacing: var(--tracking-wider);
  color: rgb(255, 255, 255);
}

@media (min-width: 48rem) {
  .global-banner__message {
    font-size: var(--text-xs);
    line-height: 16px;
  }
}

/* Nav buttons — spec: z-content, absolute, top-1/2, size-6, -translate-y-1/2, text-current */
.global-banner__nav {
  position: absolute;
  top: 50%;
  z-index: var(--z-content);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  transform: translateY(-50%);
  cursor: pointer;
}

.global-banner__nav--prev {
  left: calc(var(--spacing) * 0);
}

.global-banner__nav--next {
  right: calc(var(--spacing) * 0);
}

.global-banner__nav-icon {
  width: calc(var(--spacing) * 6);
  height: calc(var(--spacing) * 6);
  fill: currentColor;
}
