/* Local overrides: sticky desktop navbar + in-page modal (PC/H5). */

:root {
  --nav-blur-bg: rgba(17, 55, 202, 0.35);
  --nav-blur-bg-strong: rgba(17, 55, 202, 0.72);
  --hud-cyan: #72f6ff;
  --hud-magenta: #ff4fd8;
  --hud-cyan-glow: rgba(114, 246, 255, 0.55);
  --hud-magenta-glow: rgba(255, 79, 216, 0.35);
  --modal-backdrop: rgba(4, 8, 18, 0.72);
  --modal-border: rgba(255, 255, 255, 0.14);
  --modal-text: rgba(255, 255, 255, 0.82);
  --modal-text-muted: rgba(255, 255, 255, 0.65);
  --modal-glow: rgba(10, 60, 206, 0.55);
  --crt-bezel: rgba(10, 10, 12, 0.94);
  --crt-screen: rgba(0, 0, 0, 0.92);
  --crt-screen-border: rgba(255, 255, 255, 0.12);
}

/* Persistent navbar on desktop (mobile is already fixed in h5.css). */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100000;
  background: var(--nav-blur-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 250ms ease, box-shadow 250ms ease;
}

.navbar.navbar--solid {
  background: var(--nav-blur-bg-strong);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
}

/* Prevent the hidden mobile menu panel from blocking clicks (even when scaled down). */
.navbar__navItems {
  pointer-events: none;
}

.navbar__navItems.visible {
  pointer-events: auto;
}

/* Background videos should not steal clicks from overlay content. */
#page1 > video,
#page8 > video {
  pointer-events: none;
}

.hero {
  z-index: 2;
}

/* Prevent background scroll when modal opens (JS toggles this class). */
body.is-modal-open {
  overflow: hidden;
  touch-action: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1.25rem + env(safe-area-inset-top)) 1.25rem
    calc(1.25rem + env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 200000;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal__flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    circle at 30% 18%,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(114, 246, 255, 0.5) 26%,
    rgba(255, 79, 216, 0.22) 48%,
    transparent 68%
  );
  mix-blend-mode: screen;
}

.modal__panel {
  position: relative;
  width: min(92vw, 980px);
  max-height: min(86vh, 780px);
  border-radius: clamp(18px, 3vw, 28px);
  padding: clamp(12px, 2.2vw, 18px);
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(40, 40, 44, 0.96), rgba(8, 8, 10, 0.98)) padding-box,
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(114, 246, 255, 0.22), rgba(255, 79, 216, 0.16))
      border-box;
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.76),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transform: translateZ(0);
  isolation: isolate;
  display: flex;
}

.modal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.16), transparent 62%),
    radial-gradient(90% 70% at 10% 20%, rgba(114, 246, 255, 0.12), transparent 60%),
    radial-gradient(90% 70% at 90% 40%, rgba(255, 79, 216, 0.08), transparent 62%);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.modal__panel::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(114, 246, 255, 0.55),
    rgba(255, 255, 255, 0.04),
    rgba(255, 79, 216, 0.22),
    rgba(10, 60, 206, 0.25)
  );
  opacity: 0.22;
  filter: blur(14px);
  pointer-events: none;
  z-index: 0;
}

/* CRT screen area inside the bezel. */
.modal__screen {
  position: relative;
  width: 100%;
  border-radius: clamp(14px, 2.6vw, 22px);
  border: 1px solid var(--crt-screen-border);
  background:
    radial-gradient(90% 80% at 18% 18%, rgba(114, 246, 255, 0.16) 0%, transparent 60%),
    radial-gradient(90% 80% at 88% 72%, rgba(255, 79, 216, 0.1) 0%, transparent 62%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 14px
    ),
    var(--crt-screen);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.85),
    inset 0 -30px 60px rgba(0, 0, 0, 0.72),
    0 0 30px rgba(114, 246, 255, 0.06);
  overflow: hidden;
  transform: translateZ(0);
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal__screen::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 62%),
    radial-gradient(140% 120% at 50% 110%, rgba(0, 0, 0, 0.92), transparent 55%);
  opacity: 0.45;
  pointer-events: none;
}

.modal__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.26;
  pointer-events: none;
  mix-blend-mode: overlay;
  animation: crt-scanlines 9s linear infinite;
}

@keyframes crt-scanlines {
  0% {
    transform: translate3d(0, -1.5%, 0);
  }
  100% {
    transform: translate3d(0, 1.5%, 0);
  }
}

.modal.is-open .modal__screen {
  animation: crt-screen-flicker 7.2s linear infinite;
}

@keyframes crt-screen-flicker {
  0%,
  90%,
  100% {
    filter: brightness(1) contrast(1) saturate(1);
  }
  91% {
    filter: brightness(1.14) contrast(1.12) saturate(1.15);
  }
  92% {
    filter: brightness(0.96) contrast(0.98) saturate(0.92);
  }
  93% {
    filter: brightness(1.2) contrast(1.14) saturate(1.18);
  }
  94% {
    filter: brightness(1) contrast(1) saturate(1);
  }
}

.modal__scan {
  position: absolute;
  left: -30%;
  right: -30%;
  top: -40%;
  height: 28%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.09),
    rgba(10, 60, 206, 0.35),
    transparent
  );
  transform: translate3d(0, 0, 0) rotate(-8deg);
  opacity: 0.55;
  pointer-events: none;
  mix-blend-mode: screen;
  border-radius: inherit;
  z-index: 3;
  animation: modal-scan 3.2s linear infinite;
  animation-play-state: paused;
}

.modal.is-open .modal__scan {
  animation-play-state: running;
}

@keyframes modal-scan {
  0% {
    transform: translate3d(0, -140%, 0) rotate(-8deg);
  }
  100% {
    transform: translate3d(0, 340%, 0) rotate(-8deg);
  }
}

.modal__hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.85;
  mix-blend-mode: screen;
  border-radius: inherit;
  z-index: 2;
  background:
    linear-gradient(var(--hud-cyan) 0 0) left 18px top 18px / 28px 2px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) left 18px top 18px / 2px 28px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) right 18px top 18px / 28px 2px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) right 18px top 18px / 2px 28px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) left 18px bottom 18px / 28px 2px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) left 18px bottom 18px / 2px 28px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) right 18px bottom 18px / 28px 2px no-repeat,
    linear-gradient(var(--hud-cyan) 0 0) right 18px bottom 18px / 2px 28px no-repeat,
    linear-gradient(
        90deg,
        rgba(114, 246, 255, 0.24),
        transparent 55%,
        rgba(255, 79, 216, 0.16)
      )
      top / 100% 1px no-repeat,
    linear-gradient(
        90deg,
        rgba(255, 79, 216, 0.14),
        transparent 55%,
        rgba(114, 246, 255, 0.2)
      )
      bottom / 100% 1px no-repeat;
  filter: drop-shadow(0 0 10px var(--hud-cyan-glow));
}

.modal__flash {
  z-index: 4;
}

.modal__header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal__kicker {
  font-size: 0.875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.25rem;
}

.modal__title {
  font-weight: 100;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
  text-shadow:
    0 0 20px rgba(114, 246, 255, 0.2),
    0 0 32px rgba(10, 60, 206, 0.18);
}

.modal.is-open .modal__title {
  animation: modal-title-glitch 5.6s infinite steps(1, end);
}

@keyframes modal-title-glitch {
  0%,
  92%,
  100% {
    transform: translate3d(0, 0, 0);
    text-shadow:
      0 0 20px rgba(114, 246, 255, 0.2),
      0 0 32px rgba(10, 60, 206, 0.18);
  }
  93% {
    transform: translate3d(-1px, 0, 0);
    text-shadow:
      2px 0 rgba(114, 246, 255, 0.55),
      -2px 0 rgba(255, 79, 216, 0.4),
      0 0 22px rgba(114, 246, 255, 0.25);
  }
  94% {
    transform: translate3d(1px, 0, 0);
    text-shadow:
      -2px 0 rgba(114, 246, 255, 0.55),
      2px 0 rgba(255, 79, 216, 0.38),
      0 0 22px rgba(114, 246, 255, 0.22);
  }
  95% {
    transform: translate3d(0, 0, 0);
  }
}

.modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.modal__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(114, 246, 255, 0.26);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.7rem;
  line-height: 1.2;
}

.modal__subtitle {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: var(--modal-text-muted);
  line-height: 1.4;
}

.modal__close {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.modal__close:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.38);
}

.modal__closeIcon {
  position: relative;
  width: 1.1rem;
  height: 1.1rem;
}

.modal__closeIcon::before,
.modal__closeIcon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.25rem;
  height: 2px;
  background: rgba(255, 255, 255, 0.9);
  transform-origin: center;
}

.modal__closeIcon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal__closeIcon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.modal__content {
  position: relative;
  padding: 0 1.5rem 1.25rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.modal__section {
  padding: 1rem 0;
}

.modal__readout {
  position: relative;
  display: grid;
  gap: 0.45rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(114, 246, 255, 0.18);
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
}

.modal__readout::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(114, 246, 255, 0.14),
    transparent 60%,
    rgba(255, 79, 216, 0.08)
  );
  opacity: 0.9;
  pointer-events: none;
}

.modal__readoutRow {
  position: relative;
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
}

.modal__readoutKey {
  min-width: 3.75rem;
  color: rgba(114, 246, 255, 0.92);
  letter-spacing: 0.16em;
}

.modal__readoutValue {
  color: rgba(255, 255, 255, 0.85);
}

.modal__sectionTitle {
  font-size: 1.125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 0.75rem;
  position: relative;
  padding-left: 0.85rem;
}

.modal__sectionTitle::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.38em;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--hud-cyan), var(--hud-magenta));
  box-shadow: 0 0 14px var(--hud-cyan-glow);
}

.modal__text {
  color: var(--modal-text);
  line-height: 1.65;
  font-size: 1rem;
}

.modal__list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

.modal__list li {
  list-style: none;
  display: flex;
  gap: 0.75rem;
  color: var(--modal-text);
  line-height: 1.55;
}

.modal__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex: 0 0 0.6rem;
  background: radial-gradient(circle at 30% 30%, #fff 0%, var(--hud-cyan-glow) 50%, rgba(114, 246, 255, 0) 72%);
  box-shadow:
    0 0 14px rgba(114, 246, 255, 0.45),
    0 0 18px rgba(10, 60, 206, 0.35);
}

.modal__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.modal__card {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(114, 246, 255, 0.18);
  background: rgba(0, 0, 0, 0.32);
  padding: 1.05rem 1rem;
  overflow: hidden;
}

.modal__card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 0% 0%, rgba(114, 246, 255, 0.22) 0%, transparent 65%);
  opacity: 0.9;
  pointer-events: none;
}

.modal__cardTag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
}

.modal__cardTitle {
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.modal__cardText {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--modal-text-muted);
}

.modal__footer {
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.modal__primary.cta {
  border: none;
  box-shadow: 0 12px 36px rgba(255, 255, 255, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.modal__primary.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 46px rgba(255, 255, 255, 0.18);
}

.modal__secondary {
  border-radius: 999px;
  border: 1px solid rgba(114, 246, 255, 0.32);
  background: rgba(114, 246, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.modal__secondary:hover {
  transform: translateY(-1px);
  background: rgba(114, 246, 255, 0.1);
  border-color: rgba(114, 246, 255, 0.56);
  box-shadow: 0 0 22px rgba(114, 246, 255, 0.18);
}

.modal__ghost {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.modal__ghost:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.38);
}

@media (max-width: 56.25em) {
  .modal {
    align-items: flex-end;
    padding: calc(0.75rem + env(safe-area-inset-top)) 0.75rem
      calc(0.75rem + env(safe-area-inset-bottom));
  }

  .modal__panel {
    width: 100%;
    max-height: min(calc(var(--vh, 1vh) * 92), 92vh);
    border-radius: 22px;
    padding: 12px;
  }

  .modal__screen {
    border-radius: 18px;
  }

  .modal__cards {
    grid-template-columns: 1fr;
  }

  .modal__footer {
    justify-content: center;
    flex-direction: column;
  }

  .modal__primary.cta {
    width: 100%;
  }

  .modal__secondary {
    width: 100%;
  }

  .modal__ghost {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__scan,
  .modal__screen::after,
  .modal.is-open .modal__screen,
  .modal.is-open .modal__title {
    animation: none !important;
  }
}
