/* Announcements and promotions.
 *
 * One stylesheet for both the public site and the client portal, because the
 * same announcement appears in both and two sets of rules would drift on the
 * first colour change.
 *
 * Every colour is a variable with a fallback, so the same markup inherits the
 * public site's palette on one and the portal's on the other without knowing
 * which it is in.
 */

.ann {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-wrap: wrap;
  padding: .85rem 1.1rem;
  border-radius: 10px;
  font-size: .85rem;
  line-height: 1.6;
  border: 1px solid var(--border-2, var(--a-border, rgba(0,0,0,.1)));
  background: var(--bg-card, var(--a-bg-card, #fff));
  color: var(--fg, var(--a-fg, inherit));
}

.ann-body { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: .15rem }
.ann-title { font-weight: 800 }
.ann-text  { color: var(--fg-muted, var(--a-fg-2, #64748b)) }

/* ── By type ──────────────────────────────────────────────────
 *
 * The type carries the colour so a maintenance notice cannot look like a
 * discount offer. An accent stripe on the leading edge rather than a tinted
 * background: a full wash competes with the page, and on a dark theme it
 * either glows or disappears.
 */
.ann-t-promotion    { border-inline-start: 3px solid var(--accent, #C98E1F) }
.ann-t-announcement { border-inline-start: 3px solid var(--info, #3b82f6) }
.ann-t-notice       { border-inline-start: 3px solid var(--fg-muted, #64748b) }
.ann-t-maintenance  { border-inline-start: 3px solid var(--warning, #f59e0b) }

/* ── By style ─────────────────────────────────────────────── */

/* A banner spans whatever it is put in and sits above the content. */
.ann-banner { width: 100%; margin-bottom: 1rem }

/* A card waits to be scrolled to. */
.ann-card {
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.05);
}

/* A modal interrupts, so it is centred and dims what is behind it.
 *
 * Reserved for something that genuinely cannot wait. Used for a promotion it
 * is the fastest way to teach somebody to close your announcements without
 * reading them. */
.ann-modal {
  position: fixed;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  max-width: 480px;
  width: calc(100% - 2rem);
  z-index: 10000;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.5rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
[dir="rtl"] .ann-modal { transform: translate(50%, -50%) }

/* A ticker scrolls. One line, no wrap, and it stops on hover so somebody can
   actually read it. */
.ann-ticker {
  padding: .5rem 1rem;
  border-radius: 0;
  border-inline-start: 0;
  border-inline-end: 0;
  overflow: hidden;
  white-space: nowrap;
}
.ann-ticker .ann-body { flex-direction: row; gap: .5rem; animation: ann-scroll 24s linear infinite }
.ann-ticker:hover .ann-body { animation-play-state: paused }

@keyframes ann-scroll {
  from { transform: translateX(100%) }
  to   { transform: translateX(-100%) }
}
[dir="rtl"] .ann-ticker .ann-body { animation-direction: reverse }

/* ── Controls ─────────────────────────────────────────────── */

.ann-cta {
  padding: .45rem .9rem;
  border-radius: 8px;
  background: var(--accent, #C98E1F);
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  text-decoration: none;
  white-space: nowrap;
  transition: filter .14s;
}
.ann-cta:hover { filter: brightness(1.07) }

.ann-x {
  background: none;
  border: 0;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg-muted, #64748b);
  padding: 0 .25rem;
  /* 44px is the touch target; the glyph is small, so the padding makes it. */
  min-width: 32px;
  min-height: 32px;
}
.ann-x:hover { color: var(--fg, inherit) }
.ann-x:focus-visible {
  outline: 2px solid var(--accent, #C98E1F);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .ann-ticker .ann-body { animation: none }
  .ann-cta { transition: none }
}

/* ── Media ────────────────────────────────────────────────────
 *
 * Added when an announcement carries an image or a video. The layout changes
 * shape rather than squeezing a picture into a row built for text: a banner
 * puts the media beside the words, a card stacks it above.
 */

.ann-media { flex-shrink: 0 }
.ann-media img,
.ann-media video { display: block; max-width: 100%; height: auto; border-radius: 8px }

.ann-banner.ann-has-media .ann-media { max-width: 180px }
.ann-card.ann-has-media,
.ann-modal.ann-has-media { flex-direction: column }
.ann-card.ann-has-media .ann-media,
.ann-modal.ann-has-media .ann-media { max-width: 100%; width: 100% }

/* An embed needs an aspect ratio or it collapses to nothing — an iframe has no
   intrinsic size, unlike an img. */
.ann-media-embed { width: 100%; aspect-ratio: 16 / 9 }
.ann-media-embed iframe { width: 100%; height: 100%; border: 0; border-radius: 8px }

/* A ticker scrolls one line; a picture in it would scroll too and be
   unreadable. */
.ann-ticker .ann-media { display: none }

/* ── The campaign colour ──────────────────────────────────────
 *
 * --ann-accent is set inline per announcement and falls back to the palette,
 * so a campaign can carry its own colour without repainting the card.
 */
.ann-cta { background: var(--ann-accent, var(--accent, #C98E1F)) }
.ann-t-promotion { border-inline-start-color: var(--ann-accent, var(--accent, #C98E1F)) }

/* ── The second link ──────────────────────────────────────── */
.ann-second {
  font-size: .76rem;
  color: var(--fg-muted, #64748b);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.ann-second:hover { color: var(--fg, inherit) }

/* ── The countdown ────────────────────────────────────────── */
.ann-countdown {
  font-size: .74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ann-accent, var(--accent, #C98E1F));
}
/* Empty until the script fills it, so a page with JavaScript off shows nothing
   rather than an empty box with a border. */
.ann-countdown:empty { display: none }

@media (max-width: 640px) {
  /* A banner on a phone stacks: 180px of picture beside two lines of text
     leaves neither readable. */
  .ann-banner.ann-has-media { flex-direction: column }
  .ann-banner.ann-has-media .ann-media { max-width: 100% }
}
