/* NIGHT BELL — hanging booth pager. Not in the nav. Overlay only. */
:root {
  --nb-pink: #ff2d95;
  --nb-cyan: #00f0ff;
  --nb-purple: #9b30ff;
  --nb-gold: #ffd166;
}

#nightbell-root {
  position: fixed;
  top: calc(var(--gl-nav-h, 3.35rem) + env(safe-area-inset-top, 0px) * 0);
  right: 0;
  left: 0;
  z-index: 10040;
  pointer-events: none;
  font-family: "Syne", "Exo 2", system-ui, sans-serif;
}

#nightbell-root *,
#nightbell-root *::before,
#nightbell-root *::after { box-sizing: border-box; }

/* Collapsed pager tab — always visible, top-right, obvious, not in the menu */
.nb-tab {
  pointer-events: auto;
  position: absolute;
  top: 0.7rem;
  right: max(0.7rem, env(safe-area-inset-right, 0px));
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.7rem;
  padding: 0.35rem 0.9rem 0.35rem 0.4rem;
  border: 1px solid rgba(255, 209, 102, 0.55);
  background:
    linear-gradient(180deg, rgba(28, 12, 8, 0.94), rgba(8, 2, 14, 0.94));
  color: #fff8e7;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 92% 100%, 0 100%);
  box-shadow:
    0 0 0 1px rgba(255, 45, 149, 0.25),
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(255, 209, 102, 0.28);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  font-size: 0.68rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.nb-tab:hover,
.nb-tab:focus-visible {
  transform: translateY(2px);
  filter: brightness(1.08);
  box-shadow:
    0 0 0 1px rgba(0, 240, 255, 0.45),
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 36px rgba(255, 209, 102, 0.45);
  outline: none;
}
.nb-tab-bell {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #c9922a 55%, #6a3d08);
  color: #2a1400;
  font-size: 1rem;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.35), 0 0 12px rgba(255, 209, 102, 0.55);
  animation: nb-wobble 2.8s ease-in-out infinite;
}
.nb-tab-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.nb-tab-copy small {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  color: var(--nb-gold);
  font-weight: 500;
}
#nightbell-root.is-open .nb-tab { opacity: 0; pointer-events: none; transform: translateY(-8px); }

@keyframes nb-wobble {
  0%, 86%, 100% { transform: rotate(0); }
  88% { transform: rotate(-18deg); }
  92% { transform: rotate(16deg); }
  96% { transform: rotate(-8deg); }
}

/* Dim the stage while the booth pager is down — does not live in the nav */
.nb-veil {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.28) 42%, transparent 70%);
  opacity: 0;
  transition: opacity 0.28s ease;
}
#nightbell-root.is-open .nb-veil { opacity: 1; pointer-events: auto; }

.nb-panel {
  pointer-events: auto;
  position: relative;
  margin: 0.55rem auto 0;
  width: min(28.5rem, calc(100% - 1.2rem));
  transform: translateY(-120%);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
  background:
    linear-gradient(165deg, rgba(22, 8, 6, 0.97), rgba(7, 2, 16, 0.96) 55%, rgba(4, 10, 14, 0.96));
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-top: 3px solid var(--nb-gold);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(255, 45, 149, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
#nightbell-root.is-open .nb-panel {
  transform: translateY(0);
  opacity: 1;
}

.nb-cord {
  height: 0.85rem;
  background: repeating-linear-gradient(
    90deg,
    #3a2410 0 8px,
    #6a4a1e 8px 16px
  );
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.nb-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem 1rem 0.7rem;
}
.nb-emblem {
  width: 3.1rem;
  height: 3.1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff3c4, #e2b341 42%, #8a5a12 78%);
  color: #2a1400;
  font-size: 1.45rem;
  box-shadow:
    0 0 0 3px rgba(255, 209, 102, 0.25),
    0 0 24px rgba(255, 209, 102, 0.45);
}
#nightbell-root.is-ringing .nb-emblem { animation: nb-ring 0.18s linear 8; }
@keyframes nb-ring {
  0% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-16deg) scale(1.06); }
  75% { transform: rotate(16deg) scale(1.06); }
  100% { transform: rotate(0) scale(1); }
}
.nb-titles h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff8e7;
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.35);
}
.nb-titles p {
  margin: 0.2rem 0 0;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 236, 200, 0.72);
}
.nb-x {
  width: 2.6rem;
  height: 2.6rem;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 45, 149, 0.35);
  background: rgba(255, 45, 149, 0.08);
  color: #ffb7d8;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
.nb-x:hover, .nb-x:focus-visible { background: rgba(255, 45, 149, 0.2); color: #fff; outline: none; }

.nb-lede {
  margin: 0 1rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(255, 240, 230, 0.78);
}
.nb-lede em {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  color: var(--nb-gold);
}

.nb-form { padding: 0 1rem 1.05rem; display: grid; gap: 0.55rem; }
.nb-form label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nb-cyan);
}
.nb-form input,
.nb-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 209, 102, 0.4);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 0.85rem 0.9rem;
  min-height: 48px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 16px; /* kill iOS zoom */
  border-radius: 0;
}
.nb-form input:focus,
.nb-form textarea:focus {
  outline: none;
  border-color: var(--nb-cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.18);
}
.nb-form textarea { min-height: 5.5rem; resize: vertical; }

.nb-send {
  min-height: 3.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #1a0e00;
  background: linear-gradient(90deg, #ffe08a, #ffd166 40%, #ff2d95);
  border: 0;
  cursor: pointer;
  box-shadow: 0 0 28px rgba(255, 209, 102, 0.35);
  transition: filter 0.15s ease, transform 0.15s ease;
  touch-action: manipulation;
}
.nb-send:hover, .nb-send:focus-visible { filter: brightness(1.08); transform: translateY(-1px); outline: none; }
.nb-send:active { transform: translateY(0) scale(0.99); }
.nb-send:disabled { opacity: 0.55; cursor: wait; transform: none; }

.nb-status {
  min-height: 1.2rem;
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 236, 200, 0.65);
}
.nb-status.ok { color: #3dffb5; }
.nb-status.err { color: #ff6b8a; }

.nb-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 1rem 0.85rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 236, 200, 0.4);
  border-top: 1px solid rgba(255, 209, 102, 0.15);
}

@media (max-width: 640px) {
  .nb-tab {
    right: max(0.45rem, env(safe-area-inset-right));
    top: 0.45rem;
    min-height: 3rem;
    padding: 0.4rem 0.95rem 0.4rem 0.4rem;
  }
  .nb-panel {
    width: calc(100% - 0.7rem);
    margin-top: 0.25rem;
    max-height: min(88dvh, 42rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nb-titles h2 { font-size: 0.92rem; }
  .nb-lede { font-size: 0.92rem; margin: 0 0.9rem 0.85rem; }
  .nb-form { padding: 0 0.9rem 1.1rem; gap: 0.65rem; }
  .nb-form label { font-size: 0.68rem; }
  .nb-form textarea { min-height: 6.5rem; }
  .nb-send { width: 100%; min-height: 3.4rem; font-size: 0.82rem; }
  .nb-foot { flex-wrap: wrap; padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .nb-tab-bell, #nightbell-root.is-ringing .nb-emblem { animation: none !important; }
  .nb-panel, .nb-tab, .nb-veil { transition: none !important; }
}
