/* ==========================================================================
   SITE-WIDE ANNOUNCEMENT POPUP (owner, 30 Nov 2026) - _AnnouncementPopup.cshtml
   Shared public layer: every colour is a theme variable from the site (home-v4.css :root plus the
   CMS palette override), with the original values only as fallbacks, so the card follows whatever
   colours DMA sets. Dark mode follows the site's own :root[data-theme="dark"] variables.
   Prefix .ann on purpose: nothing else on the site uses it, and the dialog lives in the top layer
   (outside .dma3d), so the V4 reset and page styles cannot reach it.
   ========================================================================== */

/* Heavy Playfair for the name (owner, 30 Nov 2026 - "same sizing as version 2"). The site's own
   self-hosted Playfair file is a VARIABLE font (one file serves 600 and 700), so this face just
   unlocks its heavier weights - nothing extra is downloaded and nothing loads from Google. */
@font-face {
  font-family: 'DMA Playfair Heavy';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(../../fonts/g/playfair-display-61a963590a.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.ann {
  --ann-c1: var(--saffron, #0D9488);          /* live: teal  */
  --ann-c2: var(--green, #0E7490);            /* live: ocean */
  --ann-c3: var(--brand-red, #C0392B);        /* live: rose  */
  --ann-c4: var(--gold, #F59E0B);             /* amber       */
  --ann-card: var(--surface, #fff);
  --ann-ink: var(--text, #0b1f24);
  --ann-line: var(--border, #d5e7e8);
  --ann-edge: color-mix(in srgb, var(--ann-c2), #000 45%);
  --ann-head-font: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --ann-body-font: 'Libre Franklin', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  box-sizing: border-box;
  width: min(var(--ann-width, 660px), calc(100vw - 24px));
  max-width: none;
  max-height: var(--ann-max-height, 86vh);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--ann-card);
  color: var(--ann-ink);
  box-shadow: 7px 11px 0 var(--ann-edge), 0 24px 60px rgba(4, 30, 36, .35);
  overflow: visible;                          /* the X sits half outside the top-right corner */
  font-family: var(--ann-body-font);
}
.ann *, .ann *::before, .ann *::after { box-sizing: border-box; }
/* CMS "Card position" = Top (owner, 30 Nov 2026): the card sits near the top of the screen instead of
   the middle. Room is kept above it for the corner X (which sticks out 14px). Centre = the default. */
.ann.ann--top { margin-top: clamp(28px, 7vh, 72px); margin-bottom: auto; }
.ann[open] { display: flex; flex-direction: column; }
.ann::backdrop { background: rgba(6, 22, 27, .8); }

/* ---- brand header (letterhead) ---- */
.ann__head {
  position: relative;
  flex: none;
  overflow: hidden;
  container-type: inline-size;              /* the name scales with the card width (cqi) */
  border-radius: 18px 18px 0 0;             /* the card no longer clips its children (corner X) */
  /* Logo IMAGE edges line up with the text edges (body gutter 40px minus each tile's own padding). */
  padding: 22px 33px 22px 31px;
  /* No background behind the header (owner, 30 Nov 2026 - like the approved all-white version 2):
     logos and the red name sit on the white card. */
  background: transparent;
}
.ann__head--bare { padding: 0; min-height: 56px; }
.ann__head::before, .ann__head::after {   /* soft rings, like the site's patterned banners */
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.ann__head::before, .ann__head::after { display: none; }   /* the rings belonged to the teal band */

/* Letterhead (owner, 30 Nov 2026): DMA logo LEFT, anniversary badge RIGHT, the name between them on
   ONE line. The script sizes the name to the largest that fits (max 30px) - see fitName() in
   announcement-popup.js. On a narrow card the logos stay left/right and the name takes its own row
   underneath (still one line), because there is no readable room between them. */
.ann__brand {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
}
.ann__logo--dma { grid-column: 1; justify-self: start; }
.ann__logo--anniv { grid-column: 3; justify-self: end; }
/* Narrow card: logos stay left/right, the name takes the full row underneath. The .ann__brand prefix
   outranks the base .ann__org rule further down (same file, later = would otherwise win). */
@container (max-width: 520px) {
  .ann__brand { row-gap: 14px; }
  .ann__brand .ann__org { grid-column: 1 / -1; grid-row: 2; }
}
.ann__logo {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;                          /* logos are artwork on white, in both themes */
  box-shadow: none;                          /* no tile edge on the white card */
  align-self: stretch;                       /* both tiles + the name plate share one height */
}
.ann__logo--dma { padding: 6px 9px; }
.ann__logo--dma img { display: block; height: 44px; width: auto; }       /* +6% (owner, 30 Nov 2026) */
.ann__logo--anniv { padding: 5px 7px; }
.ann__logo--anniv img { display: block; height: 48px; width: auto; }
/* The name - same sizing as version 2 (owner, 30 Nov 2026): Playfair (the site heading's font) in its
   heaviest weight, letters about as tall as the logos, narrowed horizontally just enough to stay on
   ONE line, then optically centred on the logos. The script (fitName) sets --sx (narrowing), --dy
   (centring) and the size; these are the starting values before it runs. */
.ann__org {
  grid-column: 2;
  min-width: 0;
  margin: 0;
  align-self: stretch;
  align-items: center;
  display: flex;
  justify-content: center;
  color: #D81A1F;                            /* the website header-title red (5.1:1 on white) */
  line-height: 1;
  white-space: nowrap;                      /* one line only */
  overflow: hidden;                         /* never spills even before the script has run */
}
.ann__org > span {
  flex: none;
  display: inline-block;
  transform-origin: center;
  font: 900 30px/1 'DMA Playfair Heavy', var(--ann-head-font);
  letter-spacing: 0;
  transform: translateY(var(--dy, 0px)) scaleX(var(--sx, .7));
}

.ann__close {
  /* On the card's top-right corner, half outside it, so it takes no room from the header (owner). */
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--ann-c2);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.ann__close:hover { background: #fff; color: var(--ann-c2); border-color: var(--ann-c2); }
.ann__close:focus-visible { outline: 3px solid var(--ann-c4); outline-offset: 2px; }
.ann__close svg { width: 16px; height: 16px; }

/* ---- four-colour strip (the homepage stat-band colours) ---- */
.ann__strip { flex: none; display: flex; height: 5px; }
.ann__strip span { flex: 1; }
.ann__strip span:nth-child(1) { background: var(--ann-c1); }
.ann__strip span:nth-child(2) { background: var(--ann-c2); }
.ann__strip span:nth-child(3) { background: var(--ann-c3); }
.ann__strip span:nth-child(4) { background: var(--ann-c4); }

/* ---- the notice ---- */
.ann__body {
  min-height: 0;                            /* lets the body scroll inside the max height */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px 40px 38px;
  overscroll-behavior: contain;
}
.ann__title {
  margin: 0;
  text-align: left;                       /* with the text and the date (owner) */
  color: var(--ann-ink);
  font: 700 30px/1.28 var(--ann-head-font);
  overflow-wrap: anywhere;
  hyphens: auto;
}
.ann__meta { margin: 14px 0 0; text-align: left; }
.ann__title + .ann__text, .ann__meta + .ann__text { margin-top: 26px; }
.ann__date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ann-c1) 11%, var(--ann-card));
  border: 1px solid color-mix(in srgb, var(--ann-c1) 30%, var(--ann-card));
  color: color-mix(in srgb, var(--ann-c2), #000 22%);
  font: 600 16px/1.3 var(--ann-body-font);
}
.ann__date svg { width: 18px; height: 18px; flex: none; color: color-mix(in srgb, var(--ann-c4), #000 8%); }
.ann__text {
  color: var(--ann-ink);
  font: 500 18px/1.75 var(--ann-body-font);
  overflow-wrap: anywhere;
}
.ann__text > :first-child { margin-top: 0; }
.ann__text > :last-child { margin-bottom: 0; }
.ann__text p { margin: 0 0 14px; }
.ann__text a { color: color-mix(in srgb, var(--ann-c2), #000 15%); text-decoration: underline; text-underline-offset: 2px; }
.ann__text ul, .ann__text ol { margin: 0 0 14px; padding-left: 1.3em; }
.ann__text img { max-width: 100%; height: auto; border-radius: 10px; }
.ann__text table { max-width: 100%; border-collapse: collapse; }

/* ---- dark theme: text colours follow the site variables; the date tag needs a lighter ink ---- */
:root[data-theme="dark"] .ann__date { color: color-mix(in srgb, var(--ann-c1), #fff 35%); }
:root[data-theme="dark"] .ann__text a { color: color-mix(in srgb, var(--ann-c1), #fff 30%); }

/* No opening animation (owner, 30 Nov 2026): the card simply appears. */

/* ---- tablet + narrow (owner, 30 Nov 2026): below 852px the gap between the logos and the name
   tightens, and the logos shrink with the header width (cqi of .ann__head) until the layout switches
   to logos-on-top (container <= 520px, below). The name refits itself to the logo height (script). ---- */
@media (max-width: 852px) {
  .ann__brand { column-gap: 10px; }
  .ann__logo--dma img { height: clamp(30px, 6.2cqi, 44px); }
  .ann__logo--anniv img { height: clamp(33px, calc(6.2cqi + 4px), 48px); }
}
@container (max-width: 520px) {
  /* logos on top again: back to the phone size (the name has the full row below) */
  .ann__logo--dma img { height: 37px; }
  .ann__logo--anniv img { height: 41px; }
}

/* ---- phones ---- */
/* Below 560px the content shrinks SMOOTHLY with the screen (owner, 30 Nov 2026) and stops at a size
   that is still comfortable to read - title 19px, text 15px, date 13px - never smaller. One gutter
   (--ann-gut) drives the body padding AND the header padding, so the logo edges stay on the text edges
   (header side = gutter minus each logo tile's own padding: 9px left, 7px right). */
@media (max-width: 560px) {
  .ann { --ann-gut: clamp(14px, 5.3vw, 20px);
         width: calc(100vw - 32px); border-radius: 16px; box-shadow: 4px 7px 0 var(--ann-edge); }
  .ann__head { padding: 26px calc(var(--ann-gut) - 7px) 18px calc(var(--ann-gut) - 9px); border-radius: 16px 16px 0 0; }
  .ann__close { top: -12px; right: -12px; width: 34px; height: 34px; }
  .ann__logo--dma img { height: 37px; }
  .ann__logo--anniv img { height: 41px; }
  .ann__body { padding: clamp(16px, 5.5vw, 22px) var(--ann-gut) clamp(20px, 6.5vw, 26px); }
  .ann__title { font-size: clamp(19px, calc(4.6vw + 3px), 23px); }
  .ann__date { font-size: clamp(13px, calc(2.6vw + 4px), 14.5px); padding: 5px clamp(10px, 3.5vw, 14px); }
  .ann__date svg { width: clamp(15px, 4.4vw, 18px); height: clamp(15px, 4.4vw, 18px); }
  .ann__text { font-size: clamp(15px, calc(1.6vw + 10px), 16.5px); }
  .ann__title + .ann__text, .ann__meta + .ann__text { margin-top: clamp(16px, 5vw, 20px); }
}
