/* The banner at the top of every page (app/banner-markup.js, app/banner.js): staff's words from the admin panel, and
   the parts of the site that are paused. One tinted strip above the top bar, its words in the pages' contained width,
   a close button at its end. It scrolls away with the page; the top bar stays.

   Colours are the site's notes' (pop.css): words 4.8:1 or more on their tint, the icon in the tone's own colour.
     info  blue: news            good  green: good news            warn  yellow: a heads-up (and what is paused)
   Sizes: one line on a computer, centred, the close button at the content's end; under 600px the words read from the
   left, next to the icon, and wrap. The sizes are the banner's own width (a container), so the admin panel's preview
   draws the same markup with this file at a computer's width and a phone's. */

.f-banner {
  --b-bg: var(--note-info-bg);
  --b-line: var(--note-info-line);
  --b-fg: var(--note-info-fg);
  --b-ic: var(--color-macaw);
  position: relative; z-index: 301;
  container: f-banner / inline-size;          /* its layout follows its own width: the site's screen, or the admin's preview */
  background: var(--b-bg); color: var(--b-fg);
  box-shadow: inset 0 -2px 0 var(--b-line);   /* its edge inside it: the top bar starts where the banner ends */
}
.f-banner--good { --b-bg: var(--color-sea-sponge); --b-line: var(--color-turtle); --b-fg: var(--color-up); --b-ic: var(--color-tree-frog); }
.f-banner--warn { --b-bg: var(--note-bg); --b-line: var(--note-line); --b-fg: var(--note-fg); --b-ic: var(--color-guinea-pig); }
.f-banner[hidden] { display: none; }

/* the words (their icon first) centred, the close button at the end: the outer columns are as wide as each other, so
   the words sit in the middle of the page whatever their length; two lines are balanced, the icon starting the first */
.f-banner__in {
  display: grid; grid-template-columns: minmax(36px, 1fr) minmax(0, auto) minmax(36px, 1fr); align-items: start;
  column-gap: 8px;
  max-width: calc(var(--page-w) + 2 * var(--f-gutter)); margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(var(--f-gutter), env(safe-area-inset-right, 0px)) 14px max(var(--f-gutter), env(safe-area-inset-left, 0px));
}
.f-banner__text {
  grid-column: 2; min-width: 0; margin: 0;
  font: 700 15px/20px var(--font); text-align: center; text-wrap: balance; overflow-wrap: anywhere;
}
.f-banner__ic { display: inline-flex; vertical-align: top; margin-right: 8px; color: var(--b-ic); }
.f-banner__ic > svg { width: 20px; height: 20px; }
/* the link after the words: underlined like a link, never split from its arrow */
.f-banner__link {
  display: inline-flex; align-items: center; gap: 1px; color: inherit; white-space: nowrap;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  border-radius: 4px; transition: text-decoration-color var(--m-fast);
}
.f-banner__link > svg { width: 16px; height: 16px; flex: none; }
@media (hover: hover) { .f-banner__link:hover { text-decoration-color: currentColor; } }
.f-banner__link:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: 2px; }

/* close: a 36px button on the words' first line, its tap 44px */
.f-banner__x {
  grid-column: 3; justify-self: end; position: relative;
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: -8px -12px -8px 0;   /* the cross's ink on the content's edge, under the bar's last button */
  padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--b-fg); cursor: pointer;
  transition: background-color var(--m-fast), transform var(--m-fast);
  -webkit-tap-highlight-color: transparent;
}
.f-banner__x::before { content: ""; position: absolute; inset: -4px; }
.f-banner__x > svg { width: 18px; height: 18px; }
@media (hover: hover) { .f-banner__x:hover { background: color-mix(in srgb, var(--b-line) 55%, transparent); } }
.f-banner__x:active { background: color-mix(in srgb, var(--b-line) 80%, transparent); transform: scale(.94); }
.f-banner__x:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: -2px; }

/* phones (a banner under 600px wide): the words from the left, the icon hanging in front of them as a note reads */
@container f-banner (max-width: 599px) {
  .f-banner__in { grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; }
  .f-banner__text { grid-column: 1; display: flex; align-items: flex-start; gap: 10px; text-align: left; text-wrap: pretty; }
  .f-banner__ic { flex: none; margin-right: 0; }
  .f-banner__words { min-width: 0; }
  .f-banner__x { grid-column: 2; }
}
