/* SCRIPTNIGHT // PUBLIC SITE NOTICES */

.site-notice-banner,
.site-notice-launcher,
.site-notice-drawer-shell {
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.site-notice-banner[hidden],
.site-notice-launcher[hidden],
.site-notice-drawer-shell[hidden] {
  display: none !important;
}

/* Header placement: notices live beside the site's existing top-level tools. */
.site-header-actions,
.privacy-header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.site-notice-launcher {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid rgba(0, 255, 157, 0.18);
  border-radius: 999px;
  color: rgba(220, 255, 244, 0.7);
  background: rgba(0, 255, 157, 0.035);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.site-notice-launcher svg {
  width: 17px;
  height: 17px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-notice-launcher:hover,
.site-notice-launcher:focus-visible,
.site-notice-launcher[data-unread="true"] {
  color: #62ffd0;
  border-color: rgba(0, 255, 157, 0.48);
  background: rgba(0, 255, 157, 0.065);
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.07);
}

.site-notice-launcher:hover,
.site-notice-launcher:focus-visible {
  transform: translateY(-1px);
}

.site-notice-launcher i {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid #000706;
  border-radius: 999px;
  color: #00100b;
  background: #00ff9d;
  box-shadow: 0 0 10px rgba(0, 255, 157, 0.36);
  font-style: normal;
  font-size: 0.5625rem;
  font-weight: 800;
  line-height: 1;
}

/* Author styles must not override the badge's zero-unread hidden state. */
.site-notice-launcher i[hidden] {
  display: none !important;
}

.site-notice-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Rare fallback for a page that loads notices without a known header slot. */
.site-notice-launcher--fallback {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 9100;
  background: rgba(0, 10, 8, 0.96);
}

/* Current announcement: intentionally mirrors the established PWA update notice. */
.site-notice-banner {
  position: fixed;
  top: calc(var(--header-height, var(--privacy-header-height, 68px)) + env(safe-area-inset-top) + 14px);
  right: max(18px, env(safe-area-inset-right));
  z-index: 9190;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  width: min(410px, calc(100vw - 36px));
  min-height: 58px;
  padding: 11px 12px 11px 15px;
  border: 1px solid rgba(0, 255, 157, 0.3);
  border-radius: 10px;
  color: #dcfff4;
  background: rgba(0, 10, 8, 0.97);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.56), 0 0 26px rgba(0, 255, 157, 0.07);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(16px);
  transition: opacity 260ms ease, visibility 0s linear 260ms;
}

.site-notice-banner.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms ease, visibility 0s linear 0s;
}

.site-notice-signal {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #00ff9d;
  box-shadow: 0 0 11px rgba(0, 255, 157, 0.8);
}

.site-notice-copy { min-width: 0; }

.site-notice-copy strong {
  display: block;
  color: #62ffd0;
  font-size: var(--sn-text-micro, 0.625rem);
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-notice-copy p {
  margin: 6px 0 0;
  color: rgba(220, 255, 244, 0.76);
  font-size: var(--sn-text-label, 0.6875rem);
  line-height: 1.5;
  letter-spacing: 0.035em;
}

.site-notice-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.site-notice-actions a,
.site-notice-actions button,
.site-notice-history-item a {
  border: 1px solid rgba(0, 255, 157, 0.22);
  color: #62ffd0;
  background: rgba(0, 255, 157, 0.04);
  font: 700 var(--sn-text-micro, 0.625rem)/1 "Roboto Mono", ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
}

.site-notice-actions a,
.site-notice-actions button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 7px 10px;
}

.site-notice-actions a:hover,
.site-notice-actions a:focus-visible,
.site-notice-actions button:hover,
.site-notice-actions button:focus-visible,
.site-notice-history-item a:hover,
.site-notice-history-item a:focus-visible {
  border-color: rgba(0, 255, 249, 0.48);
  color: #00fff9;
}

.site-notice-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(0, 3, 2, 0.48);
  backdrop-filter: blur(4px);
  transition: opacity 240ms ease, visibility 0s linear 330ms;
}

.site-notice-drawer-shell.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.site-notice-drawer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(410px, 92vw);
  height: 100%;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
  border-left: 1px solid rgba(0, 255, 157, 0.22);
  color: #dcfff4;
  background: radial-gradient(circle at 90% 10%, rgba(0, 255, 249, 0.055), transparent 22rem), #020c09;
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.6);
  transform: translate3d(102%, 0, 0);
  will-change: transform;
  transition: transform 330ms cubic-bezier(.22,.72,.22,1);
}

.site-notice-drawer-shell.is-open .site-notice-drawer {
  transform: translate3d(0, 0, 0);
}

.site-notice-drawer > header {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(0, 255, 157, 0.13);
}

.site-notice-drawer header span {
  color: rgba(98, 255, 208, 0.58);
  font-size: var(--sn-text-micro, 0.625rem);
  letter-spacing: 0.11em;
}

.site-notice-drawer h2 {
  margin: 6px 0 0;
  color: #dcfff4;
  font: 700 1rem/1.2 "Orbitron", "Roboto Mono", monospace;
  letter-spacing: 0.06em;
}

.site-notice-drawer-intro,
.site-notice-drawer > footer {
  margin: 0;
  padding: 12px 18px;
  color: rgba(220, 255, 244, 0.43);
  font-size: var(--sn-text-micro, 0.625rem);
  line-height: 1.55;
  letter-spacing: 0.07em;
}

.site-notice-drawer-intro {
  grid-column: 1;
  grid-row: 2;
  border-bottom: 1px solid rgba(0, 255, 157, 0.08);
}

.site-notice-drawer > footer {
  grid-column: 1;
  grid-row: 4;
  border-top: 1px solid rgba(0, 255, 157, 0.08);
}

.site-notice-drawer > footer[hidden] { display: none !important; }

.site-notice-history {
  grid-column: 1;
  grid-row: 3;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.site-notice-history-item {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0, 255, 157, 0.08);
}

.site-notice-history-item[data-current="true"] {
  background: linear-gradient(90deg, rgba(0, 255, 157, 0.06), transparent);
}

.site-notice-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #62ffd0;
  font-size: var(--sn-text-micro, 0.625rem);
  letter-spacing: 0.08em;
}

.site-notice-history-meta small {
  color: rgba(220, 255, 244, 0.35);
  font-size: 0.5625rem;
}

.site-notice-history-item h3 {
  margin: 9px 0 7px;
  color: rgba(220, 255, 244, 0.9);
  font: 600 0.72rem/1.4 "Roboto Mono", monospace;
}

.site-notice-history-item p {
  margin: 0;
  color: rgba(220, 255, 244, 0.58);
  font-size: var(--sn-text-label, 0.6875rem);
  line-height: 1.65;
}

.site-notice-history-item a {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  margin-top: 12px;
  padding: 7px 10px;
}

.site-notice-history-empty {
  z-index: 1;
  display: grid;
  grid-column: 1;
  grid-row: 3;
  align-self: start;
  gap: 7px;
  margin: 18px;
  padding: 16px;
  border: 1px solid rgba(0, 255, 157, 0.12);
  border-radius: 10px;
  color: rgba(220, 255, 244, 0.56);
  background: linear-gradient(135deg, rgba(0, 255, 157, 0.035), rgba(0, 255, 249, 0.012));
  font-size: var(--sn-text-micro, 0.625rem);
  letter-spacing: 0.06em;
  pointer-events: none;
}

.site-notice-history-empty[hidden] { display: none !important; }

.site-notice-history-empty > span {
  width: 7px;
  height: 7px;
  margin-bottom: 3px;
  border-radius: 50%;
  background: #00ff9d;
  box-shadow: 0 0 10px rgba(0, 255, 157, 0.58);
}

.site-notice-history-empty strong {
  color: rgba(220, 255, 244, 0.88);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.site-notice-history-empty p {
  margin: 0;
  color: rgba(220, 255, 244, 0.5);
  line-height: 1.6;
}

body.site-notice-history-open { overflow: hidden !important; }

.channel-open .site-notice-banner,
.system-maintenance-active .site-notice-banner,
.system-maintenance-active .site-notice-launcher {
  display: none !important;
}

@media (max-width: 680px) {
  .site-header-actions,
  .privacy-header-actions { gap: 6px; }

  .site-notice-launcher {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .site-notice-banner {
    top: calc(var(--header-height, var(--privacy-header-height, 68px)) + env(safe-area-inset-top) + 10px);
    right: max(16px, env(safe-area-inset-right));
    left: max(16px, env(safe-area-inset-left));
    width: auto;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .site-notice-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .site-notice-drawer { width: min(100%, 410px); }
}

@media (prefers-reduced-motion: reduce) {
  .site-notice-banner,
  .site-notice-launcher,
  .site-notice-drawer-shell,
  .site-notice-drawer { transition: none; }
}

/* A live publication arriving while another banner is visible gets a quiet crossfade cue. */
.site-notice-banner.is-fresh {
  animation: site-notice-fade-in 320ms ease both;
}

@keyframes site-notice-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .site-notice-banner.is-fresh { animation: none; }
}

/* UX + ACCESSIBILITY POLISH */
.site-notice-drawer-intro,
.site-notice-drawer > footer {
  color: rgba(220, 255, 244, 0.58);
}

@media (hover: none), (pointer: coarse) {
  .site-notice-launcher,
  .site-notice-actions a,
  .site-notice-actions button,
  .site-notice-history-item a {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (forced-colors: active) {
  .site-notice-launcher,
  .site-notice-actions a,
  .site-notice-actions button,
  .site-notice-history-item,
  .site-notice-history-item a,
  .site-notice-drawer {
    border-color: CanvasText;
  }
}
