/* =========================================================================
   NOME HELPER WIDGET — styles
   A floating, dependency-free guide that shows the REAL animated NOME mascot
   bottom-right, and opens a panel of page-specific Q&A above it.

   Pair with nome-helper.js. See the comment block in that file for the
   window.NOME_HELP page-config API.

   Theming inherits the NOME Buckets variables from nome-buckets.css when
   present; safe fallbacks are provided so the widget also works standalone.
   ========================================================================= */

.nome-helper {
  /* local fallbacks (overridden by :root from nome-buckets.css if loaded) */
  --nh-bg:        var(--nb-bg-deep, #0d1a2a);
  --nh-panel:     rgba(13, 26, 42, .96);
  --nh-line:      var(--nb-line, rgba(255,255,255,.14));
  --nh-line-2:    var(--nb-line-strong, rgba(255,255,255,.24));
  --nh-emerald:   var(--nb-emerald, #2ECC71);
  --nh-emerald-2: var(--nb-emerald-2, #3BE07A);
  --nh-gold:      var(--nb-gold, #F4C430);
  --nh-text:      var(--nb-text, #F5F7FA);
  --nh-text-soft: var(--nb-text-soft, #c3cede);
  --nh-font:      var(--nb-font, 'Inter', system-ui, sans-serif);
  --nh-mono:      var(--nb-font-mono, 'JetBrains Mono', ui-monospace, monospace);

  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  font-family: var(--nh-font);
  -webkit-font-smoothing: antialiased;
}

.nome-helper[hidden] { display: none; }

/* ----------------------------------------------------------- the button */
.nome-helper__btn {
  position: relative;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 30%, rgba(46,204,113,.32), transparent 62%),
    var(--nh-bg);
  box-shadow:
    0 0 0 1px var(--nh-line-2),
    0 14px 40px rgba(0, 0, 0, .5),
    0 0 30px rgba(46, 204, 113, .22);
  display: grid;
  place-items: center;
  overflow: visible;
  transition: transform .16s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.nome-helper__btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 0 0 1px var(--nh-emerald), 0 18px 50px rgba(0,0,0,.55), 0 0 38px rgba(46,204,113,.4); }
.nome-helper__btn:active { transform: translateY(-1px) scale(.99); }
.nome-helper__btn:focus-visible { outline: 2px solid var(--nh-emerald-2); outline-offset: 4px; }

/* the mascot svg sits inside, slightly oversized & cropped by the circle */
.nome-helper__btn .nome-mascot {
  width: 132%;
  height: 132%;
  pointer-events: none;
  transform: translateY(6%);
}

/* small "?" affordance badge on the button */
.nome-helper__hint {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFD23F, var(--nh-gold));
  color: #2a1c00;
  font-weight: 900;
  font-size: 15px;
  line-height: 26px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4), 0 0 0 2px var(--nh-bg);
  pointer-events: none;
  transition: opacity .2s ease;
}
.nome-helper.is-open .nome-helper__hint { opacity: 0; }

/* gentle attention nudge until the user has opened it once */
.nome-helper:not(.is-open):not(.is-seen) .nome-helper__btn {
  animation: nhNudge 4.5s ease-in-out 2s infinite;
}
@keyframes nhNudge {
  0%, 88%, 100% { transform: translateY(0); }
  92%           { transform: translateY(-6px); }
  96%           { transform: translateY(-2px); }
}

/* --------------------------------------------------------------- panel */
.nome-helper__panel {
  position: absolute;
  right: 0;
  bottom: calc(84px + 16px);
  width: min(340px, calc(100vw - 36px));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--nh-panel);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid var(--nh-line-2);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0,0,0,.2);
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(10px) scale(.96);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s cubic-bezier(.2,.8,.3,1);
}
.nome-helper.is-open .nome-helper__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.nome-helper__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--nh-line);
}
.nome-helper__head .nh-mark {
  font-family: var(--nh-font);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .02em;
  text-transform: uppercase;
  display: inline-flex;
  gap: .3em;
}
.nome-helper__head .nh-mark .g {
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  background-image: linear-gradient(180deg, #FFE587, var(--nh-gold));
}
.nome-helper__head .nh-mark .e {
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  background-image: linear-gradient(180deg, var(--nh-emerald-2), var(--nh-emerald));
}
.nome-helper__title {
  margin: 0;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-family: var(--nh-mono);
  color: var(--nh-text-soft);
  margin-left: auto;
}
.nome-helper__close {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--nh-line);
  background: rgba(255,255,255,.05);
  color: var(--nh-text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s ease, border-color .15s ease;
}
.nome-helper__close:hover { background: rgba(255,255,255,.12); border-color: var(--nh-line-2); }
.nome-helper__close:focus-visible { outline: 2px solid var(--nh-emerald-2); outline-offset: 2px; }

.nome-helper__intro {
  padding: 13px 16px 4px;
  color: var(--nh-text-soft);
  font-size: 13.5px;
  line-height: 1.5;
}
.nome-helper__intro strong { color: var(--nh-text); }

/* scroll body holding the Q&A items */
.nome-helper__body {
  padding: 8px 12px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* each Q&A is a disclosure */
.nome-helper__item {
  border: 1px solid var(--nh-line);
  border-radius: 12px;
  margin: 7px 4px;
  background: rgba(255,255,255,.035);
  overflow: hidden;
}
.nome-helper__q {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  background: none;
  border: 0;
  color: var(--nh-text);
  font-family: var(--nh-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.nome-helper__q:focus-visible { outline: 2px solid var(--nh-emerald-2); outline-offset: -2px; border-radius: 12px; }
.nome-helper__q .chev {
  margin-left: auto;
  flex: 0 0 auto;
  transition: transform .2s ease;
  color: var(--nh-emerald-2);
  font-size: 13px;
}
.nome-helper__item.is-open .nome-helper__q .chev { transform: rotate(90deg); }

.nome-helper__a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .26s ease;
}
.nome-helper__a-inner {
  padding: 0 13px 13px 35px;
  color: var(--nh-text-soft);
  font-size: 13.5px;
  line-height: 1.55;
}
.nome-helper__a-inner code {
  font-family: var(--nh-mono);
  background: rgba(0,0,0,.4);
  border: 1px solid var(--nh-line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
  color: var(--nh-text);
  overflow-wrap: anywhere;
}
.nome-helper__a-inner a { color: var(--nh-emerald-2); }

/* numbered chip in front of each question */
.nome-helper__q .num {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--nh-mono);
  font-size: 11px;
  color: var(--nh-gold);
  background: rgba(244,196,48,.12);
  border: 1px solid rgba(244,196,48,.3);
}

/* footer (optional CTAs / dismiss-for-session) */
.nome-helper__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid var(--nh-line);
}
.nome-helper__cta {
  flex: 1 1 auto;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: #06251a;
  background: linear-gradient(180deg, var(--nh-emerald-2), var(--nh-emerald));
}
.nome-helper__cta:hover { filter: brightness(1.05); text-decoration: none; }
.nome-helper__dismiss {
  flex: 0 0 auto;
  background: none;
  border: 0;
  color: var(--nh-text-soft);
  font-family: var(--nh-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.nome-helper__dismiss:hover { color: var(--nh-text); }

/* tiny "bring me back" tab once the user has tucked the mascot away */
.nome-helper-recall {
  position: fixed;
  right: 0;
  bottom: 90px;
  z-index: 2147483000;
  transform: translateX(calc(100% - 30px));
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px 9px 11px;
  border: 1px solid var(--nb-line-strong, rgba(255,255,255,.24));
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: var(--nb-bg-deep, #0d1a2a);
  color: var(--nb-text, #F5F7FA);
  font-family: var(--nb-font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: -6px 8px 24px rgba(0,0,0,.4);
  transition: transform .22s cubic-bezier(.2,.8,.3,1);
}
.nome-helper-recall:hover,
.nome-helper-recall:focus-visible { transform: translateX(0); outline: none; }
.nome-helper-recall .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--nb-emerald-2, #3BE07A);
  box-shadow: 0 0 10px var(--nb-emerald-2, #3BE07A);
}
.nome-helper-recall[hidden] { display: none; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 520px) {
  .nome-helper { right: 14px; bottom: 14px; }
  .nome-helper__btn { width: 70px; height: 70px; }
  .nome-helper__panel { bottom: calc(70px + 14px); width: calc(100vw - 28px); }
}

@media (prefers-reduced-motion: reduce) {
  .nome-helper__btn,
  .nome-helper__panel,
  .nome-helper__a,
  .nome-helper-recall { transition: none !important; }
  .nome-helper:not(.is-open):not(.is-seen) .nome-helper__btn { animation: none; }
}
