/* ==========================================
   Signal Precision — polish (global)
   Page transitions, reassure, contact, light theme
   ========================================== */

/* ---------- Cross-document view transitions ----------
   The browser animates between two real documents on its own: Chrome and Edge
   from 126, Safari from 18.2. Everywhere else the navigation simply happens
   with no animation, so this is pure progressive enhancement. The JS overlay
   further down in animations.js stands aside wherever this is supported.

   Declared at the top level rather than inside a prefers-reduced-motion query,
   because the at-rule is newer than the engines that must honour it; the
   preference is respected by cancelling the animations instead. */
@view-transition {
  navigation: auto;
}

/* The header deliberately has no name of its own: naming an element makes it a
   backdrop root, and the glass in .nx-shell then stops blurring the page
   behind it. Nothing is lost, since the header renders identically on both
   documents and cross-fading it is a no-op. */

/* Landing point for a reception room plate. reception-engine.js hands the same
   name to whichever plate is on screen when you leave the lobby, so the room
   appears to open out into the service page. */
#campus-page-stage {
  view-transition-name: hall-stage;
}

::view-transition-group(hall-stage) {
  animation-duration: 560ms;
  animation-timing-function: var(--nx-ease-out);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: var(--nx-ease-out);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ---------- Page enter & transition ---------- */
body.has-nx-shell main {
  /* no `both`/`forwards` — leftover transform creates a fixed containing block
     and traps .chapter-nav / other position:fixed children inside main */
  animation: nx-page-in 520ms var(--nx-ease-out);
}
@keyframes nx-page-in {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

body.has-nx-shell.is-leaving main {
  animation: none;
}

body.has-nx-shell .page-transition__overlay {
  background: var(--nx-bg-void);
  overflow: hidden;
}
body.has-nx-shell .page-transition__overlay.is-active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(28, 36, 48, 0.12), transparent 55%);
  pointer-events: none;
}
body.has-nx-shell .page-transition__overlay.is-active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--nx-accent) 25%,
    var(--nx-accent) 75%,
    transparent 100%
  );
  transform: scaleX(0);
  animation: nx-trans-pulse 420ms var(--nx-ease-out) forwards;
  box-shadow: 0 0 24px var(--nx-tint);
}
@keyframes nx-trans-pulse {
  0% { transform: scaleX(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scaleX(1); opacity: 0.4; }
}

/* ---------- Section typography ---------- */
body.has-nx-shell .sec-title {
  font-family: var(--nx-font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
}
body.has-nx-shell .sec-title .highlight {
  color: var(--nx-accent);
  font-weight: 800;
}
body.has-nx-shell .section-desc {
  color: var(--text-secondary);
  line-height: 1.65;
}
body.has-nx-shell .link-inline {
  color: var(--nx-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 200ms;
}
body.has-nx-shell .link-inline:hover {
  color: var(--nx-accent);
}

/* ---------- Reassure ---------- */
body.has-nx-shell .nx-reassure.reassure-wrap::before {
  display: none;
}
body.has-nx-shell .reassure-grid {
  gap: 16px;
}
body.has-nx-shell .r-card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  transition: none;
  overflow: visible;
  box-shadow: none;
}
body.has-nx-shell .r-card::before {
  display: none;
}
body.has-nx-shell .r-card:hover {
  border-color: transparent;
  transform: none;
  box-shadow: none;
}
body.has-nx-shell .r-card:hover::before {
  transform: none;
}
body.has-nx-shell .r-num {
  font-family: var(--nx-font-mono);
  font-size: 10px;
  color: var(--nx-accent);
  letter-spacing: 0.1em;
}
body.has-nx-shell .r-icon {
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--nx-accent);
  padding: 0;
}
body.has-nx-shell .r-title {
  font-family: var(--nx-font-display);
  font-weight: 600;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
}
body.has-nx-shell .reassure-bottom {
  margin-top: var(--space-4);
  padding: var(--space-4) 0 0;
  background: none;
  border: none;
  border-top: 1px solid var(--nx-border);
  border-radius: 0;
}
body.has-nx-shell .reassure-bottom .mark {
  font-family: var(--nx-font-mono);
  color: var(--nx-accent);
}

/* ---------- Contact form & map ---------- */
body.has-nx-shell .nx-contact.form-panel {
  gap: 24px;
}
body.has-nx-shell .form-fields label {
  font-family: var(--nx-font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
body.has-nx-shell .form-fields .inp {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-sm);
  padding: 14px 16px;
  font-size: var(--fs-sm);
  transition: border-color 300ms, box-shadow 300ms;
}
body.has-nx-shell .form-fields .inp:focus {
  border-color: var(--nx-accent);
  box-shadow: 0 0 0 3px var(--nx-tint);
}
body.has-nx-shell .contact-side {
  background: var(--nx-bg-glass);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}
body.has-nx-shell .contact-side::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--nx-accent);
  opacity: 0.7;
}
body.has-nx-shell .contact-item .label {
  font-family: var(--nx-font-mono);
  color: var(--nx-accent);
  opacity: 0.85;
}
body.has-nx-shell .contact-item .val a {
  border-bottom-color: var(--nx-accent);
  transition: color 200ms, border-color 200ms;
}
body.has-nx-shell .contact-item .val a:hover {
  color: var(--nx-accent);
  border-bottom-color: var(--nx-accent);
}
body.has-nx-shell .contact-item.phone .val {
  font-family: var(--nx-font-mono);
  font-weight: 700;
  color: var(--nx-accent);
}

body.has-nx-shell .contact-map {
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-lg);
  background: var(--nx-bg-glass);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
body.has-nx-shell .contact-map__bar {
  background: rgba(0, 0, 0, 0.3);
  border-bottom-color: var(--nx-border);
  padding: 16px 20px;
}
body.has-nx-shell .contact-map__pin {
  font-family: var(--nx-font-mono);
  color: var(--nx-accent);
}
body.has-nx-shell .contact-map__open {
  font-family: var(--nx-font-mono);
  color: var(--text-primary);
  padding: 8px 14px;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-sm);
  text-decoration: none;
  transition: border-color 300ms, color 300ms, box-shadow 300ms;
}
body.has-nx-shell .contact-map__open:hover {
  color: var(--nx-accent);
  border-color: var(--nx-accent);
  box-shadow: 0 0 20px var(--nx-tint);
}
body.has-nx-shell .contact-map__veil-inner {
  font-family: var(--nx-font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ---------- Light theme pass ---------- */
[data-theme="light"] body.has-nx-shell .form-fields .inp {
  background: rgba(255, 255, 255, 0.9);
}
[data-theme="light"] body.has-nx-shell .r-card {
  box-shadow: none;
}
[data-theme="light"] body.has-nx-shell .r-card:hover {
  box-shadow: none;
}
[data-theme="light"] body.has-nx-shell .contact-map__bar {
  background: var(--nx-bg-deep);
}
[data-theme="light"] body.has-nx-shell .nx-deck {
  background: rgba(255, 255, 255, 0.78);
}
[data-theme="light"] body.has-nx-shell .nx-shell.is-scrolled .nx-deck {
  background: rgba(255, 255, 255, 0.9);
}
[data-theme="light"] body.has-nx-shell .nx-console__veil {
  background: rgba(255, 255, 255, 0.72);
}
[data-theme="light"] body.has-nx-shell .nx-console__wing {
  background: rgba(255, 255, 255, 0.55);
}
[data-theme="light"] body.has-nx-shell .nx-console__rail {
  background: rgba(255, 255, 255, 0.7);
}
[data-theme="light"] body.has-nx-shell .chapter-nav {
  background: color-mix(in srgb, rgba(255, 255, 255, 0.92) 70%, var(--campus-glass-strong));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 18px 48px rgba(10, 16, 24, 0.1);
}
[data-theme="light"] body.has-nx-shell .page-transition__overlay {
  background: var(--nx-bg-void);
}

@media (prefers-reduced-motion: reduce) {
  body.has-nx-shell main {
    animation: none;
  }
  body.has-nx-shell .page-transition__overlay.is-active::after {
    animation: none;
    transform: scaleX(1);
    opacity: 0.3;
  }
}
