/*
  CORA notice bar (v1)
  Restyles the existing Notices markup (aside.notice) as a slim, static bar:
  photo tile on the left, label chip, headline, one short line, and a button.

  How the Notices fields map to the bar:
    Banner Image      -> photo tile (use a clean photo with no text on it)
    Title             -> headline
    Subtitle          -> label chip above the headline
    Description       -> one short line under the headline (first paragraph only)
    Link Button Text  -> button label
    Background Color  -> bar color (purple and teal are styled below)

  Always visible: the close button is hidden, and the bar is pinned under the nav as people scroll.
  On phones it becomes a compact strip (small photo tile, headline, orange button), so put the match wording in the Title.
  Hidden on the Donate form pages (body.page-ngp-multistep).
*/

aside.notice {
  --nb-bg: #362D7B;
  --nb-text: #FFFEF8;
  --nb-chip-bg: #84D5BB;
  --nb-chip-fg: #221D1B;
  --nb-sub: #E6E1F5;
  --nb-meter: #84D5BB;
  background: var(--nb-bg) !important;
  color: var(--nb-text) !important;
  min-height: 0 !important;
  padding: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  /* pinned just under the sticky nav (nav is 50px tall, z-index 1000) */
  position: sticky !important;
  top: 50px;
  z-index: 900 !important;
}
/* anchor links (for example /projects#Goltra) land below the nav and the bar */
html:has(aside.notice) { scroll-padding-top: 175px; }
aside.notice.teal {
  --nb-bg: #47A08D;
  --nb-text: #221D1B;
  --nb-chip-bg: #221D1B;
  --nb-chip-fg: #84D5BB;
  --nb-sub: #221D1B;
  --nb-meter: #FFFEF8;
}

/* four-color rule along the bottom edge: purple, teal, orange, ink at 4 : 3 : 1.6 : 3 */
aside.notice::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #B59FD6 0 34.48%, #47A08D 34.48% 60.34%, #E05F22 60.34% 74.14%, #221D1B 74.14% 100%);
}

aside.notice .container {
  display: grid !important;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  grid-template-areas:
    "img title cta"
    "img body  cta"
    "img gtn   cta";
  align-items: center;
  column-gap: 20px;
  row-gap: 2px;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 84px;
}

aside.notice .close { display: none !important; }

/* photo tile */
aside.notice .container > a:first-of-type {
  grid-area: img;
  align-self: stretch;
  display: block;
  height: 100%;
  min-height: 84px;
  overflow: hidden;
}
aside.notice .container > a:first-of-type img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
}

/* headline and label chip */
aside.notice h2 {
  grid-area: title;
  display: flex !important;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 5px;
  margin: 10px 0 0 !important;
  padding: 0 !important;
  font-family: 'Figtree', 'azo-sans-web', Arial, sans-serif !important;
  font-weight: 900 !important;
  font-size: 18px !important;
  line-height: 1.25 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  color: var(--nb-text) !important;
}
aside.notice h2 br,
aside.notice h2 .emdash { display: none !important; }
aside.notice h2 .date {
  display: inline-block !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: .18em !important;
  text-transform: uppercase !important;
  line-height: 1.3 !important;
  padding: 3px 8px !important;
  border-radius: 3px !important;
  background: var(--nb-chip-bg) !important;
  color: var(--nb-chip-fg) !important;
}

/* description: first paragraph (or the campaign text block) only */
aside.notice .notice-row { display: contents !important; }
aside.notice .notice-row > p:empty,
aside.notice .notice-row > p:has(> link),
aside.notice .notice-row > p ~ p { display: none !important; }
aside.notice .notice-row > p,
aside.notice .eoyn2 {
  grid-area: body;
  margin: 0 !important;
  padding: 0 !important;
  font-family: 'Figtree', 'azo-sans-web', Arial, sans-serif !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  text-align: left !important;
  color: var(--nb-text) !important;
}
aside.notice .eoyn2 .t {
  margin: 0 !important;
  font: inherit !important;
  color: inherit !important;
  text-align: left !important;
}
aside.notice .eoyn2 .m { display: none !important; }

/* "neighbors have given today" counter, kept as a slim line */
aside.notice .gtn {
  grid-area: gtn;
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px !important;
  padding: 0 !important;
}
aside.notice .gtn-line {
  margin: 0 !important;
  font-family: 'Figtree', 'azo-sans-web', Arial, sans-serif !important;
  font-size: 12px !important;
  color: var(--nb-sub) !important;
}
aside.notice .gtn-bar {
  flex: none;
  width: 110px !important;
  height: 6px !important;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, .25) !important;
}
aside.notice .gtn-line strong { color: var(--nb-meter) !important; }
aside.notice .gtn-fill { height: 100% !important; background: var(--nb-meter) !important; }
aside.notice.teal::after {
  background: linear-gradient(90deg, #362D7B 0 34.48%, #84D5BB 34.48% 60.34%, #E05F22 60.34% 74.14%, #221D1B 74.14% 100%);
}

/* button */
aside.notice a.btn-cta {
  grid-area: cta;
  margin: 0 20px 0 0 !important;
  padding: 9px 16px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: #FFFEF8 !important;
  color: #221D1B !important;
  font-family: 'Figtree', 'azo-sans-web', Arial, sans-serif !important;
  font-weight: 900 !important;
  font-size: 14px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
}
aside.notice a.btn-cta svg { color: #E05F22; }

/* phone: compact pinned strip with a small photo tile, headline, and an orange button.
   The Title carries the match wording (chip and description are hidden here). */
@media (max-width: 640px) {
  html:has(aside.notice) { scroll-padding-top: 140px; }
  aside.notice .container {
    grid-template-columns: 62px minmax(0, 1fr) auto !important;
    grid-template-areas: "img title cta" !important;
    column-gap: 12px !important;
    row-gap: 0 !important;
    padding: 0 12px 0 0 !important;
    min-height: 68px !important;
  }
  aside.notice .container > a:first-of-type {
    display: block !important;
    grid-area: img;
    align-self: stretch;
    height: 100% !important;
    min-height: 68px !important;
  }
  aside.notice .container > a:first-of-type img { object-position: 35% 62% !important; }
  aside.notice h2 { margin: 0 !important; padding: 9px 0 !important; font-size: 14.5px !important; line-height: 1.25 !important; }
  aside.notice h2 .date { display: none !important; }
  aside.notice .notice-row > p,
  aside.notice .eoyn2,
  aside.notice .gtn { display: none !important; }
  aside.notice a.btn-cta {
    margin: 0 !important;
    padding: 11px 14px !important;
    font-size: 14px !important;
    background: #E05F22 !important;
    color: #221D1B !important;
  }
  aside.notice a.btn-cta svg { color: #221D1B !important; }
}

/* very narrow phones: drop the photo tile so the headline keeps its width */
@media (max-width: 360px) {
  aside.notice .container { grid-template-columns: minmax(0, 1fr) auto !important; grid-template-areas: "title cta" !important; padding: 0 12px !important; }
  aside.notice .container > a:first-of-type { display: none !important; }
  aside.notice h2 { font-size: 14px !important; }
}

/* hide on the Donate form pages */
body.page-ngp-multistep aside.notice { display: none !important; }
