/* ==========================================================================
   NODEWAVE PREMIUM POLISH LAYER
   Additive refinement pass — loaded AFTER styles.css.
   Ruleset philosophy: only ENHANCE existing themed components (depth,
   light, motion, focus). No layout changes, no color-theme changes,
   no functional selectors are altered. Every rule here can be removed
   without affecting the base design.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. DESIGN TOKENS (polish-scoped, extends the official palette)
   -------------------------------------------------------------------------- */

:root {
  --polish-peach-glow: rgba(239, 173, 130, 0.16);
  --polish-peach-line: rgba(239, 173, 130, 0.38);
  --polish-card-lift: 0 24px 70px rgba(0, 0, 0, 0.5), 0 6px 22px rgba(0, 0, 0, 0.35);
  --polish-edge-light: rgba(255, 255, 255, 0.07);
  --polish-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   1. GLOBAL FOCUS VISIBLE (premium accessibility ring)
   -------------------------------------------------------------------------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--polish-peach-line);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   2. SITE HEADER — hairline glow seam under the header
   -------------------------------------------------------------------------- */

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(239, 173, 130, 0.35) 18%,
      rgba(239, 173, 130, 0.55) 50%,
      rgba(239, 173, 130, 0.35) 82%,
      transparent 100%);
  opacity: 0.55;
  pointer-events: none;
}

/* Nav active underline: crisp gradient indicator pinned to the header seam */
.nav-feature-link.active::after {
  bottom: -19px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--peach) 26%, var(--peach-hover) 74%, transparent);
}

/* Brand mark — gentle hover breathe */
.brand-symbol svg {
  transition: transform 0.45s var(--polish-ease), filter 0.45s var(--polish-ease);
}

.site-brand:hover .brand-symbol svg {
  transform: translateY(-1px) scale(1.04);
  filter: drop-shadow(0 4px 14px rgba(239, 173, 130, 0.35));
}

/* Tool badge — soft inner light on hover */
.tool-badge {
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.tool-badge:hover {
  border-color: rgba(239, 173, 130, 0.45);
  background: rgba(239, 173, 130, 0.13);
  box-shadow: 0 0 18px rgba(239, 173, 130, 0.12);
}

/* --------------------------------------------------------------------------
   3. BUTTONS — dimensional gradient core, inner highlight, press physics
   -------------------------------------------------------------------------- */

.button {
  transition: transform 0.18s var(--polish-ease),
    box-shadow 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    filter 0.2s ease;
  position: relative;
  overflow: hidden;
}

/* Satin sheen that sweeps across on hover (purely decorative) */
.button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-20deg);
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) {
  .button:hover::after {
    animation: polishSheen 0.7s ease forwards;
  }
}

@keyframes polishSheen {
  from { left: -70%; opacity: 0; }
  20%  { opacity: 1; }
  to   { left: 130%; opacity: 0; }
}

.button-orange {
  background: linear-gradient(180deg, #f7bd93 0%, var(--peach) 55%, #e29a6d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(120, 60, 20, 0.25),
    0 4px 14px rgba(239, 173, 130, 0.22),
    0 8px 26px rgba(239, 173, 130, 0.14);
}

.button-orange:hover {
  background: linear-gradient(180deg, #ffc9a4 0%, var(--peach-hover) 55%, #eda67b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(120, 60, 20, 0.22),
    0 6px 18px rgba(250, 192, 155, 0.32),
    0 12px 34px rgba(239, 173, 130, 0.22);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 0.08s;
}

.button-outline {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: #e6ebf0;
}

.button-outline:hover {
  background: linear-gradient(180deg, rgba(239, 173, 130, 0.12), rgba(255, 255, 255, 0.045));
  border-color: rgba(239, 173, 130, 0.5);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(239, 173, 130, 0.14),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   4. HERO — ambient light field + faint technical grid (no DOM changes)
   -------------------------------------------------------------------------- */

.hero-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(46% 34% at 62% -6%, rgba(239, 173, 130, 0.13), transparent 68%),
    radial-gradient(30% 26% at 10% -4%, rgba(56, 189, 248, 0.05), transparent 70%),
    radial-gradient(55% 45% at 50% 120%, rgba(239, 173, 130, 0.045), transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.hero-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 62% at 58% 18%, #000 0%, transparent 76%);
  mask-image: radial-gradient(ellipse 70% 62% at 58% 18%, #000 0%, transparent 76%);
  pointer-events: none;
  z-index: 0;
}

/* Keep hero content above the ambient layers */
.hero-stage .section-shell {
  position: relative;
  z-index: 1;
}

/* Headline: whisper of depth on the accent line */
.hero-title em {
  text-shadow: 0 0 34px rgba(239, 173, 130, 0.28);
}

/* Eyebrow: extended runway line */
.eyebrow::after {
  content: "";
  display: inline-block;
  width: 34px;
  height: 1px;
  margin-left: 6px;
  background: linear-gradient(90deg, rgba(239, 173, 130, 0.55), transparent);
  align-self: center;
}

/* Hero note: brighter, more confident meta strip */
.hero-stage .hero-note {
  color: #9aa2ab;
}

/* --------------------------------------------------------------------------
   5. SURFACE CARDS — layered elevation + top edge-light
   Applies to the major surfaces only; nothing structural changes.
   -------------------------------------------------------------------------- */

.diagnostic-card,
.terminal-window,
.isp-testing-card,
.matrix-card,
.as-path-card,
.fivem-hub-card,
.speedtest-card {
  box-shadow:
    inset 0 1px 0 var(--polish-edge-light),
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 18px 48px rgba(0, 0, 0, 0.48),
    0 42px 110px rgba(0, 0, 0, 0.42);
}

/* Faint peach aura behind the two hero-level consoles */
.diagnostic-card,
.terminal-window {
  position: relative;
}

.diagnostic-card::before,
.terminal-window::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg,
      rgba(239, 173, 130, 0.3),
      rgba(255, 255, 255, 0.08) 34%,
      transparent 62%,
      rgba(239, 173, 130, 0.14));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.9;
}

/* Diagnostic header — subtle luminous strip */
.diagnostic-card-header {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012));
}

/* Terminal bar — mac-console depth */
.terminal-bar {
  background: linear-gradient(180deg, #172029, #131a21);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.terminal-dots .dot {
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.45);
}

.terminal-dots .dot:first-child {
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35), 0 0 8px rgba(239, 173, 130, 0.55);
}

/* Terminal screen — barely-there vignette for OLED depth */
.terminal-body {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.016), transparent 55%),
    #0d1217;
}

/* Progress bar — glowing sweep */
.terminal-progress-bar {
  background: linear-gradient(90deg, #d98d5f, var(--peach-hover));
  box-shadow: 0 0 12px rgba(239, 173, 130, 0.6);
}

/* Terminal action buttons — tactile press */
.term-action-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.term-action-btn:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.term-action-btn:active {
  transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   6. DIAGNOSTIC FORM CONTROLS — refined active/selected states
   -------------------------------------------------------------------------- */

.command-pill {
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.22s ease, transform 0.18s var(--polish-ease);
}

.command-pill:hover {
  transform: translateY(-1px);
}

.command-pill.active {
  background: linear-gradient(180deg, #2a3641, #22303a);
  border-color: rgba(239, 173, 130, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 3px 10px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(239, 173, 130, 0.08),
    0 0 18px rgba(239, 173, 130, 0.07);
}

.command-pill.active .pill-code {
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.25);
}

/* Selects & inputs — depth and focus glow */
.nw-select,
.nw-input {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.22);
}

.nw-select:hover,
.target-input-container:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.nw-select:focus {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.22), 0 0 0 3px rgba(239, 173, 130, 0.12);
}

.target-input-container:focus-within {
  box-shadow: 0 0 0 3px rgba(239, 173, 130, 0.14), 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Preset pills — springy */
.preset-pill {
  transition: all 0.16s var(--polish-ease);
}

.preset-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.preset-pill:active {
  transform: translateY(0) scale(0.97);
}

/* Advanced params accordion — smoother disclosure */
.advanced-params summary {
  cursor: pointer;
  transition: color 0.2s ease;
  list-style: none;
}

.advanced-params summary::-webkit-details-marker {
  display: none;
}

.advanced-params[open] .accordion-icon {
  transform: rotate(45deg);
}

.accordion-icon {
  transition: transform 0.25s var(--polish-ease);
  display: inline-block;
}

/* Node meta badge strip — hairline separation between metrics */
.active-node-badge {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.005)),
    #141b22;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

/* --------------------------------------------------------------------------
   7. GUIDE CARDS — elevation on hover + index glow
   -------------------------------------------------------------------------- */

.guide-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.28s var(--polish-ease), border-color 0.25s ease, box-shadow 0.28s ease;
  position: relative;
  overflow: hidden;
}

.guide-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(239, 173, 130, 0.35), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.guide-card:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 22px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(239, 173, 130, 0.06),
    0 0 26px rgba(239, 173, 130, 0.06);
}

.guide-card:hover::after {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   8. FIVEM TRACKER SURFACES — light & lift
   -------------------------------------------------------------------------- */

.fivem-stat-card,
.flow-promo-box,
.fivem-logs-panel,
.fivem-flow-panel,
.gp-control-bar,
.server-hero-strip {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.fivem-example-chip,
.fivem-filter-btn,
.gp-preset-chip,
.log-tab-btn,
.range-btn {
  transition: all 0.16s var(--polish-ease);
}

.fivem-example-chip:hover,
.fivem-filter-btn:hover,
.gp-preset-chip:hover {
  transform: translateY(-1px);
}

/* File buttons (speed test page) — tactile download tiles */
.file-btn {
  transition: transform 0.18s var(--polish-ease), border-color 0.2s ease, box-shadow 0.22s ease, background 0.2s ease;
}

.file-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(239, 173, 130, 0.1);
}

.file-btn:active {
  transform: translateY(0) scale(0.98);
}

/* --------------------------------------------------------------------------
   9. PROOF STRIP & CLOSING — quiet confidence
   -------------------------------------------------------------------------- */

.proof-strip {
  position: relative;
}

.proof-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(239, 173, 130, 0.03), transparent);
  pointer-events: none;
}

.proof-strip strong {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* Footer links — animated underline reveal */
.footer-main a:not(.site-brand) {
  position: relative;
  width: max-content;
}

.footer-main a:not(.site-brand)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--peach-soft);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--polish-ease);
  pointer-events: none;
}

.footer-main a:not(.site-brand):hover::after {
  transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   10. SCROLL-REVEAL (progressive enhancement)
   Elements are ONLY pre-hidden when JS marks <html> with .polish-js,
   so a failed/blocked script leaves the page fully visible.
   -------------------------------------------------------------------------- */

.polish-js .polish-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.65s var(--polish-ease);
  will-change: opacity, transform;
}

.polish-js .polish-reveal.polish-in {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   11. MOTION SAFETY — honor reduced-motion everywhere in this layer
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .polish-js .polish-reveal,
  .polish-js .polish-reveal.polish-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .button,
  .button::after,
  .guide-card,
  .command-pill,
  .file-btn,
  .preset-pill,
  .brand-symbol svg {
    transition: none !important;
    animation: none !important;
  }

  .guide-card:hover,
  .command-pill:hover,
  .file-btn:hover,
  .preset-pill:hover,
  .button-orange:hover,
  .button-outline:hover {
    transform: none !important;
  }
}
