/* ==========================================================================
   Global promo banner — sticky top bar advertising active discount codes.
   Self-contained tokens (pb-*) so this file works unmodified on every page,
   regardless of which token set (style.css vs toeic-results.css) is loaded.
   ========================================================================== */

.promo-banner {
  --pb-navy: #175984;
  --pb-navy-dark: #0E3A56;
  --pb-orange: #FD9902;
  --pb-orange-dark: #A95100;

  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, var(--pb-navy-dark), var(--pb-navy));
  color: #fff;
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.promo-banner[hidden] {
  display: none;
}

.promo-banner--dismissed {
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity .2s ease, transform .2s ease;
}

.promo-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 48px 10px 16px;
  position: relative;
  min-height: 44px;
}

.promo-banner__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.promo-banner__text strong {
  color: var(--pb-orange);
  font-weight: 700;
}

.promo-banner__code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-family: 'DM Sans', monospace;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.promo-banner__code::after {
  content: '';
  flex: none;
  width: 13px;
  height: 13px;
  background: currentColor;
  opacity: 0.85;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") center / contain no-repeat;
}

.promo-banner__code:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: #fff;
}

.promo-banner__code:active {
  transform: scale(0.97);
}

.promo-banner__code.is-copied {
  background: var(--pb-orange);
  border-color: var(--pb-orange);
  color: var(--pb-navy-dark);
}

.promo-banner__code.is-copied::after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E3A56' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E3A56' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.promo-banner__code.is-error {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.55);
}

.promo-banner__close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease;
}

.promo-banner__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.promo-banner__close svg {
  width: 16px;
  height: 16px;
}

.promo-banner__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.promo-banner :focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 680px) {
  .promo-banner__inner {
    padding: 10px 44px 10px 14px;
  }

  .promo-banner__text {
    font-size: 13px;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .promo-banner--dismissed {
    transition: none;
  }
}
