/* John-Portal polish pass — subtle neon/energy layer (optional via JP_POLISH_CONFIG) */

:root {
  --jp-polish-glow: calc(1 * var(--jp-polish-glow-strength, 1));
  --jp-polish-dur: calc(1 * var(--jp-polish-motion-scale, 1));
}

body.jp-polish-on {
  --jp-polish-glow-strength: 1;
  --jp-polish-motion-scale: 1;
}

/* Soft glow behind homepage hero (overridden by jp-home-simple-bg.css when enabled) */
body.jp-polish-home-hero.jp-home-page::before {
  content: "";
  position: fixed;
  top: clamp(6rem, 22vh, 12rem);
  left: 50%;
  width: min(92vw, 26rem);
  height: min(92vw, 26rem);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    circle,
    rgba(0, 255, 65, calc(0.1 * var(--jp-polish-glow))) 0%,
    rgba(0, 255, 65, calc(0.03 * var(--jp-polish-glow))) 45%,
    transparent 72%
  );
}

body.jp-polish-on.jp-home-page .hero-logo-frame {
  box-shadow:
    0 0 calc(22px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.35),
    0 0 calc(48px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.12),
    inset 0 0 0 1px rgba(0, 255, 65, 0.2);
}

/* Homepage copy: quick staggered reveal (runs each load) */
.jp-home-reveal {
  opacity: 0;
  transform: translateY(12px);
}

body.jp-home-reveal-ready:not(.jp-home-reveal-skip) .jp-home-reveal {
  animation: jp-home-reveal-in calc(0.5s * var(--jp-polish-dur)) ease-out forwards;
}

body.jp-home-reveal-ready.jp-home-reveal-skip .jp-home-reveal {
  opacity: 1;
  transform: none;
}

body.jp-home-reveal-ready .hero__name.jp-home-reveal {
  animation-delay: calc(0.05s * var(--jp-polish-dur));
}

body.jp-home-reveal-ready .hero__about-label.jp-home-reveal {
  animation-delay: calc(0.12s * var(--jp-polish-dur));
}

body.jp-home-reveal-ready .hero__about-text.jp-home-reveal {
  animation-delay: calc(0.2s * var(--jp-polish-dur));
}

body.jp-home-reveal-ready .hero__actions.jp-home-reveal {
  animation-delay: calc(0.28s * var(--jp-polish-dur));
}

@keyframes jp-home-reveal-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.jp-polish-on .profile-ring--menu-trigger.jp-hero-intro-pulse .hero-logo-frame {
  animation: jp-hero-intro-pulse calc(1.1s * var(--jp-polish-dur)) ease-out 1;
}

@keyframes jp-hero-intro-pulse {
  0% {
    box-shadow: 0 0 0 rgba(0, 255, 65, 0);
  }
  40% {
    box-shadow:
      0 0 calc(32px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.45),
      inset 0 0 0 1px rgba(0, 255, 65, 0.35);
  }
  100% {
    box-shadow:
      0 0 calc(22px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.35),
      inset 0 0 0 1px rgba(0, 255, 65, 0.2);
  }
}

/* --- Subtle vignette (black stays dominant) --- */
body.jp-polish-vignette::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse 85% 70% at 50% 45%,
    transparent 55%,
    rgba(0, 0, 0, 0.35) 100%
  );
  opacity: calc(0.45 * var(--jp-polish-glow));
}

.site-wrapper {
  position: relative;
  z-index: 1;
}

/* --- Unified hover language (buttons & quiet actions) --- */
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover,
  .btn:not(:disabled):focus-visible {
    border-color: var(--color-green-dim);
    box-shadow: 0 0 calc(14px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.18);
  }

  .btn:not(:disabled):active {
    transform: scale(0.98);
    box-shadow: 0 0 calc(8px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.12);
  }

  .bot-card__btn:hover,
  .bot-card__btn:focus-visible {
    box-shadow: 0 0 calc(12px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.15);
  }

  .public-nav__link:hover,
  .public-nav__link:focus-visible,
  .public-nav__link--action:hover,
  .public-nav__link--action:focus-visible {
    text-shadow: 0 0 calc(10px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.35);
  }
}

.btn:disabled,
.owner-section-toolbar .btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

/* --- Center menu: energy accent on open (no extra delay) --- */
body.jp-polish-on .public-nav-drawer.is-open::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(0, 255, 65, 0.85),
    transparent
  );
  box-shadow: 0 0 calc(12px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.4);
  opacity: 0.9;
  pointer-events: none;
}

body.jp-polish-on .profile-ring--menu-trigger[aria-expanded="true"] .hero-logo-frame,
body.jp-polish-on .profile-ring--menu-trigger[aria-expanded="true"] .profile-ring__inner {
  box-shadow:
    0 0 calc(22px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.2),
    inset 0 0 0 1px rgba(0, 255, 65, 0.12);
}

/* --- Hero video frame: soft idle glow + fade-in when media ready --- */
body.jp-polish-on.jp-home-page .hero-logo-frame {
  transition: box-shadow 0.35s ease, opacity 0.4s ease;
}

body.jp-polish-hero-glow.jp-home-page .hero-logo-frame.jp-hero-media-ready {
  animation: jp-hero-frame-glow calc(4s * var(--jp-polish-dur)) ease-in-out infinite;
}

@keyframes jp-hero-frame-glow {
  0%,
  100% {
    box-shadow:
      0 0 calc(18px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.22),
      0 0 calc(36px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.08),
      inset 0 0 0 1px rgba(0, 255, 65, 0.06);
  }
  50% {
    box-shadow:
      0 0 calc(24px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.28),
      0 0 calc(44px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.1),
      inset 0 0 0 1px rgba(0, 255, 65, 0.1);
  }
}

body.jp-polish-on .profile-ring__inner--hero-media:not(.jp-hero-media-ready) {
  opacity: 0.92;
}

body.jp-polish-on .profile-ring__inner--hero-media.jp-hero-media-ready {
  opacity: 1;
}

/* --- Scroll / content reveal --- */
.jp-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity calc(0.45s * var(--jp-polish-dur)) ease,
    transform calc(0.45s * var(--jp-polish-dur)) ease;
  transition-delay: calc(var(--jp-reveal-index, 0) * 60ms);
}

.jp-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- Bot cards: title glow on hover (desktop) --- */
@media (hover: hover) and (pointer: fine) {
  .bot-card:hover .bot-card__name {
    text-shadow: 0 0 calc(12px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.25);
  }

  .bot-card:hover .bot-card__media::after {
    opacity: 1;
  }
}

.bot-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(0, 255, 65, 0.06) 100%
  );
}

.bot-card__media {
  position: relative;
}

/* --- Modals: enter polish --- */
.bot-view-modal:not([hidden]) .bot-view-modal__card {
  animation: jp-modal-in calc(0.28s * var(--jp-polish-dur)) ease-out both;
}

.owner-modal:not([hidden]) .owner-modal__card {
  animation: jp-modal-in calc(0.24s * var(--jp-polish-dur)) ease-out both;
}

@keyframes jp-modal-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- Owner save processing: subtle JP pulse on card --- */
.owner-processing__card {
  box-shadow: 0 0 calc(20px * var(--jp-polish-glow)) rgba(0, 255, 65, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  body.jp-polish-home-hero.jp-home-page::before {
    display: none;
  }

  .jp-home-reveal {
    opacity: 1;
    transform: none;
    animation: none !important;
  }

  body.jp-polish-vignette::after {
    display: none;
  }

  body.jp-polish-hero-glow.jp-home-page .hero-logo-frame.jp-hero-media-ready {
    animation: none;
  }

  .jp-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .bot-view-modal:not([hidden]) .bot-view-modal__card,
  .owner-modal:not([hidden]) .owner-modal__card {
    animation: none;
  }

  .btn:not(:disabled):active {
    transform: none;
  }
}
