/* SiteNotice public frontend — scoped under #snt-root */

#snt-root.snt-root {
  position: relative;
  z-index: 2147483000;
  pointer-events: none;
  box-sizing: border-box;
}

#snt-root.snt-root * {
  box-sizing: border-box;
}

#snt-root .snt-priv,
#snt-root .snt-ann {
  pointer-events: auto;
}

/* —— Privacy (matches stable 1.22 shadow layout / timing / button styling) —— */
#snt-root .snt-priv {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
}

#snt-root .snt-priv__box {
  position: fixed;
  left: 50%;
  bottom: var(--snt-priv-bottom-desk, 20px);
  transform: translate(-50%, 140%);
  opacity: 0;
  pointer-events: none;
  z-index: 2147483646;
  line-height: 1.4;
  color: #111;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
  width: fit-content;
  max-width: min(calc(100% - 24px), 820px);
  text-align: center;
  transition: transform 0.35s ease, opacity 0.35s ease;
  letter-spacing: normal;
  word-spacing: normal;
}

#snt-root .snt-priv__box--show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

#snt-root .snt-priv__desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  max-width: 100%;
}

#snt-root .snt-priv__desktop .snt-priv__text {
  display: inline;
  white-space: nowrap;
}

#snt-root .snt-priv__mobile {
  display: none;
}

#snt-root .snt-priv__text {
  color: #111;
  text-align: center;
  white-space: normal;
  margin: 0;
}

#snt-root .snt-priv__plink {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
}

#snt-root .snt-priv__pbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.6);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  color: #111;
  text-decoration: none;
  font-family: inherit;
}

@media (max-width: 480px) {
  #snt-root .snt-priv__box {
    bottom: var(--snt-priv-bottom-mob, 20px);
    width: auto;
    max-width: calc(100% - 24px);
    min-width: min(280px, calc(100% - 24px));
  }

  #snt-root .snt-priv__box--show {
    transform: translate(-50%, 0);
  }

  #snt-root .snt-priv__desktop {
    display: none;
  }

  #snt-root .snt-priv__mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-align: center;
  }

  #snt-root .snt-priv__mobile .snt-priv__text {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
  }

  #snt-root .snt-priv__actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    margin: 0 auto;
    text-align: center;
  }
}

/* —— Announcement —— */
#snt-root .snt-ann {
  --snt-gap: 8px;
  --snt-di: 12px;
  --snt-mi: 12px;
  --snt-maxw: 1100px;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  min-width: 240px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  padding: 12px 16px;
  padding-inline-end: 28px;
  z-index: 99998;
}

#snt-root .snt-ann--visible {
  display: flex;
}

#snt-root .snt-ann--overlay.snt-ann--top,
#snt-root .snt-ann--overlay.snt-ann--bottom {
  position: fixed;
  left: 50%;
}

#snt-root .snt-ann--overlay.snt-ann--width-full {
  width: calc(100% - max(24px, calc(var(--snt-di) * 2)));
}

#snt-root .snt-ann--overlay.snt-ann--width-max {
  width: min(calc(100% - max(24px, calc(var(--snt-di) * 2))), var(--snt-maxw));
}

#snt-root .snt-ann--overlay.snt-ann--width-auto {
  width: max-content;
  max-width: calc(100% - max(24px, calc(var(--snt-di) * 2)));
  padding-inline-start: 22px;
  padding-inline-end: 34px;
}

/* Desktop auto-width: prevent inner flex wrapping so bar expands to content width */
@media (min-width: 481px) {
  #snt-root .snt-ann--overlay.snt-ann--width-auto .snt-ann__flow,
  #snt-root .snt-ann--overlay.snt-ann--width-auto .snt-ann__copy {
    flex-wrap: nowrap;
  }
}

#snt-root .snt-ann--push {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  left: auto;
  right: auto;
  transform: none; /* JS overrides during animation */
}

/* Push width-mode variants */
#snt-root .snt-ann--push.snt-ann--width-max {
  max-width: var(--snt-maxw, 1100px);
  margin-inline: auto;
  border-radius: 0 0 12px 12px;
}
#snt-root .snt-ann--push.snt-ann--width-auto {
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  border-radius: 0 0 12px 12px;
  padding-inline-start: 22px;
  padding-inline-end: 34px;
}

/* Inline mode – normal flow, no fixed/absolute positioning */
#snt-root .snt-ann--inline {
  position: relative;
  margin-inline: auto;
  left: auto;
  right: auto;
}
#snt-root .snt-ann--inline.snt-ann--width-full {
  width: calc(100% - max(24px, calc(var(--snt-di) * 2)));
}
#snt-root .snt-ann--inline.snt-ann--width-max {
  width: min(calc(100% - max(24px, calc(var(--snt-di) * 2))), var(--snt-maxw));
}
#snt-root .snt-ann--inline.snt-ann--width-auto {
  width: max-content;
  max-width: calc(100% - max(24px, calc(var(--snt-di) * 2)));
  padding-inline-start: 22px;
  padding-inline-end: 34px;
}
@media (min-width: 481px) {
  #snt-root .snt-ann--inline.snt-ann--width-auto .snt-ann__flow,
  #snt-root .snt-ann--inline.snt-ann--width-auto .snt-ann__copy {
    flex-wrap: nowrap;
  }
}

/* ── Push & Inline: minimal strip — no card / box appearance ── *
 * Overlay keeps the frosted-glass card; push/inline render as a
 * clean transparent strip so the bar feels part of the page.       */
#snt-root .snt-ann--push,
#snt-root .snt-ann--inline {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-width: 0;
}

#snt-root .snt-dismiss {
  appearance: none;
  margin: 0;
  padding: 1px 3px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #111;
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  inset-inline-start: auto;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

#snt-root .snt-dismiss:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 1px;
}

#snt-root .snt-ann__flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--snt-gap, 8px);
  min-width: 0;
  max-width: 100%;
}

#snt-root .snt-ann__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: max(0px, calc(var(--snt-gap, 8px) - 2px));
  min-width: 0;
  max-width: 100%;
}

#snt-root .snt-ann__emoji {
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}

#snt-root .snt-ann__msg {
  color: #111;
  min-width: 0;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#snt-root .snt-ann__link {
  color: #111 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  flex: 0 0 auto;
}

#snt-root .snt-ann__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.65);
  color: #111;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  line-height: 1;
}

/* Actions group: always an inline-flex container.
   On desktop it participates in the flow as a natural single flex item —
   the LTR gap/margin rules on link and btn still apply inside it.
   On mobile compact the JS in show() sets margin-inline-start and gap
   directly as inline styles, ensuring the spacing works in all
   directions (LTR and RTL) regardless of CSS cascade. */
#snt-root .snt-ann__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--snt-gap, 8px);
  flex: 0 0 auto;
}

#snt-root .snt-ann__flow[dir="ltr"],
#snt-root .snt-ann__copy,
#snt-root .snt-ann__msg,
#snt-root .snt-ann__link,
#snt-root .snt-ann__btn {
  unicode-bidi: isolate;
}

#snt-root .snt-ann__flow[dir="ltr"] .snt-ann__btn {
  margin-inline-start: 6px !important;
}

#snt-root .snt-ann__flow[dir="ltr"] {
  gap: 10px;
}

#snt-root .snt-ann__flow[dir="ltr"] .snt-ann__copy {
  margin-inline-end: 4px;
}

#snt-root .snt-ann__flow[dir="ltr"] .snt-ann__link {
  margin-inline-start: 8px !important;
}

#snt-root .snt-ann__flow[dir="ltr"] .snt-ann__btn {
  margin-inline-start: 10px !important;
}

@media (max-width: 480px) {
  #snt-root .snt-ann--overlay.snt-ann--width-full {
    width: calc(100% - max(24px, calc(var(--snt-mi) * 2))) !important;
    left: var(--snt-mi);
    right: var(--snt-mi);
    transform: none;
  }

  #snt-root .snt-ann--overlay.snt-ann--width-max {
    width: min(
        calc(100% - max(24px, calc(var(--snt-mi) * 2))),
        var(--snt-maxw)
      ) !important;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  #snt-root .snt-ann--overlay.snt-ann--width-auto {
    width: fit-content !important;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100% - max(0px, calc(var(--snt-mi) * 2))) !important;
  }

  #snt-root .snt-ann {
    min-width: 0;
    padding: 10px 12px;
    padding-inline-end: 24px;
    justify-content: center;
  }

  #snt-root .snt-ann--overlay.snt-ann--top {
    text-align: center;
  }

  /* Push mode on mobile: always full width, no border-radius */
  #snt-root .snt-ann--push {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    left: auto !important;
    right: auto !important;
    transform: none; /* JS still handles slide/fade */
  }

  /* Inline mode on mobile: centered, max usable width */
  #snt-root .snt-ann--inline {
    width: calc(100% - max(24px, calc(var(--snt-mi) * 2))) !important;
    max-width: 100% !important;
    margin-inline: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none;
  }

  #snt-root .snt-ann__btn {
    padding: 5px 10px;
    flex: 0 0 auto;
    margin-inline-start: 10px;
  }

  #snt-root .snt-ann--mobile-compact .snt-ann__flow {
    flex-wrap: nowrap;
    gap: 0;
  }

  /* Compact message block: single nowrap row, 4 px between emoji and text.
     padding-inline-end creates the guaranteed gap between the message text
     and the start of the actions block.  Container padding is always
     honoured — unlike a flex-item margin-inline-end on .snt-ann__msg which
     can be dropped by mobile browser reflow optimisations. */
  #snt-root .snt-ann--mobile-compact .snt-ann__copy {
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding-inline-end: 22px;
  }

  #snt-root .snt-ann--mobile-compact .snt-ann__msg {
    white-space: nowrap;
  }

  #snt-root .snt-ann--mobile-compact {
    min-width: 0;
    max-width: calc(100% - max(0px, calc(var(--snt-mi) * 2))) !important;
  }

  /* Compact: neutralise the LTR desktop copy end-margin (4 px no-important)
     so the JS-controlled margin-inline-start on the actions group is the
     sole gap between the message block and the actions block.
     The JS in show() sets that margin, gap, and inner link/btn margins as
     inline styles after compact detection, which overrides all CSS cascade. */
  #snt-root .snt-ann.snt-ann--mobile-compact .snt-ann__flow .snt-ann__copy {
    margin-inline-end: 0 !important;
  }

  /* Non-compact overlay auto-width: override the base fit-content rule so
     the bar expands to the full usable mobile width. Without this, the
     browser shrinks the bar to its min-content, compressing medium text. */
  #snt-root .snt-ann--overlay.snt-ann--width-auto:not(.snt-ann--mobile-compact) {
    width: calc(100% - max(24px, calc(var(--snt-mi) * 2))) !important;
  }

  /* Non-compact: wrapping, centering, and breathing room for medium/long text. */
  #snt-root .snt-ann:not(.snt-ann--mobile-compact) {
    max-width: calc(100% - max(24px, calc(var(--snt-mi) * 2))) !important;
    padding-inline: 8px !important;
    padding-inline-end: 22px !important;
    margin-inline: auto;
    text-align: center;
  }

  /* Flow wraps and centers all rows, including orphaned link/button rows. */
  #snt-root .snt-ann:not(.snt-ann--mobile-compact) .snt-ann__flow {
    flex-wrap: wrap;
    justify-content: center;
    gap: max(6px, var(--snt-gap, 8px)) !important;
  }

  /* Copy does NOT force full width — letting medium-length text stay on the
     same row as a short link/button avoids an unnecessary extra line break.
     For genuinely long text the copy's natural max-content still fills the
     bar, so wrapping still happens at the right point. */
  #snt-root .snt-ann:not(.snt-ann--mobile-compact) .snt-ann__copy {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100% !important;
    gap: max(4px, calc(var(--snt-gap, 8px) - 2px)) !important;
  }

  #snt-root .snt-ann:not(.snt-ann--mobile-compact) .snt-ann__msg {
    max-width: 100% !important;
    white-space: normal;
    word-break: break-word;
    text-align: center;
  }

  /* Link and button must not shrink on a wrapped row. */
  #snt-root .snt-ann:not(.snt-ann--mobile-compact) .snt-ann__link,
  #snt-root .snt-ann:not(.snt-ann--mobile-compact) .snt-ann__btn {
    flex: 0 0 auto;
  }
}
