/* galaxy.css — HawkinsOps unified visual system
   Loaded LAST after coherence.css on all pages.
   Implements: starfield background, glass card system, interaction
   affordances, motion, proof-page enhancement.
   v1 — 03-25-2026 */


/* ============================================
   S0  CUSTOM PROPERTIES
   ============================================ */

:root {
  --glow-brand: rgba(122, 184, 255, 0.18);
  --glow-brand-strong: rgba(122, 184, 255, 0.30);
  --glass-bg: rgba(10, 14, 22, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-hover: rgba(122, 184, 255, 0.28);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 0.28s var(--ease-out-expo);
  --starfield-opacity: 1;
}


/* ============================================
   S1  STARFIELD BACKGROUND
   Uses tiled radial-gradient dots at prime-number
   tile sizes for organic, non-gridded scatter.
   Two layers for parallax-like depth.
   ============================================ */

html body {
  background:
    radial-gradient(ellipse 90% 60% at 50% 15%, rgba(59, 143, 217, 0.06), transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(100, 60, 180, 0.03), transparent 60%),
    #030508 !important;
}

/* Layer 1: Dense small stars (white + cool white) — near field */
html body::before {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(1.2px 1.2px at 50% 50%, rgba(255,255,255,0.7), transparent 70%),
    radial-gradient(1px 1px at 50% 50%, rgba(220,235,255,0.55), transparent 70%),
    radial-gradient(1.5px 1.5px at 50% 50%, rgba(180,210,255,0.65), transparent 70%),
    radial-gradient(0.8px 0.8px at 50% 50%, rgba(255,255,255,0.4), transparent 70%),
    radial-gradient(1px 1px at 50% 50%, rgba(200,225,255,0.5), transparent 70%) !important;
  background-size:
    173px 157px,
    229px 199px,
    337px 283px,
    127px 113px,
    293px 251px !important;
  background-position:
    0 0,
    43px 67px,
    91px 37px,
    11px 23px,
    67px 131px !important;
  opacity: var(--starfield-opacity) !important;
  animation: starfield-drift 180s linear infinite !important;
  will-change: transform;
}

/* Layer 2: Sparse bright stars (blue-white) — far field, slower */
html body::after {
  content: '' !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  background:
    radial-gradient(2px 2px at 50% 50%, rgba(180,215,255,0.8), transparent 70%),
    radial-gradient(2.5px 2.5px at 50% 50%, rgba(140,190,255,0.5), transparent 70%),
    radial-gradient(1.5px 1.5px at 50% 50%, rgba(220,240,255,0.6), transparent 70%) !important;
  background-size:
    409px 367px,
    601px 509px,
    503px 443px !important;
  background-position:
    61px 47px,
    149px 97px,
    211px 173px !important;
  opacity: 0.55 !important;
  animation: starfield-drift-deep 300s linear infinite !important;
  will-change: transform;
}

@keyframes starfield-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-43px, -157px, 0); }
}

@keyframes starfield-drift-deep {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-61px, -367px, 0); }
}

/* Content above starfield */
body > *:not(script):not(link):not(style) {
  position: relative;
  z-index: 1;
}


/* ============================================
   S2  GLASS CARD SYSTEM
   Backdrop-blur glass with glow hover and
   click-press feedback.
   ============================================ */

.sf-card,
.m-card,
.card,
.lane-card,
article.sf-metric {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--glass-border) !important;
  border-radius: 16px !important;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}

.sf-card:hover,
.m-card:hover,
.card:hover,
.lane-card:hover,
article.sf-metric:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-hover) !important;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.4),
    0 0 30px var(--glow-brand),
    0 0 60px rgba(59, 143, 217, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sf-card:active,
.m-card:active,
.card:active,
.lane-card:active,
article.sf-metric:active {
  transform: translateY(-1px);
  transition-duration: 0.08s;
}

/* Route cards (already <a>) */
.sf-route-card {
  border-radius: 16px !important;
}

.sf-route-card:hover h3 {
  color: #fff;
}


/* ============================================
   S3  CLICK AFFORDANCE INDICATORS
   Visible cue that a card opens detail.
   ============================================ */

[data-modal] {
  cursor: pointer;
  position: relative;
}

[data-modal]::after {
  content: '\2197';
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 0.8rem;
  line-height: 1;
  color: rgba(122, 184, 255, 0.35);
  transition: color var(--transition-base), transform var(--transition-base);
  pointer-events: none;
}

[data-modal]:hover::after {
  color: rgba(122, 184, 255, 0.8);
  transform: translate(2px, -2px);
}


/* ============================================
   S4  METRIC CARD ENHANCEMENTS
   ============================================ */

article.sf-metric {
  overflow: hidden;
}

article.sf-metric:hover .sf-metric-value {
  color: #fff;
  text-shadow: 0 0 24px rgba(122, 184, 255, 0.2);
}

/* Status color tokens (applied by app.js applyStatusState) */
[data-status="success"] { color: #4ade80 !important; }
[data-status="fail"]    { color: #f87171 !important; }
[data-status="warn"]    { color: #fbbf24 !important; }


/* ============================================
   S5  BUTTONS
   ============================================ */

.sf-button,
.m-btn,
.btn,
.btn-p {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    background 0.2s ease;
  border-radius: 10px;
}

.sf-button:hover,
.m-btn:hover,
.btn:hover,
.btn-p:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 143, 217, 0.2);
}

.sf-button:active,
.m-btn:active,
.btn:active {
  transform: translateY(0);
}


/* ============================================
   S6  MODAL GLASS
   ============================================ */

.modal-backdrop.open {
  background: rgba(4, 6, 10, 0.82);
  backdrop-filter: blur(6px);
}

.modal {
  background: rgba(11, 16, 24, 0.96) !important;
  backdrop-filter: blur(24px);
  border: 1px solid rgba(122, 184, 255, 0.1) !important;
  border-radius: 20px !important;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(59, 143, 217, 0.04);
}

.modal-h {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.modal-detail {
  display: grid;
  gap: 18px;
  line-height: 1.65;
}

.modal-detail p {
  margin: 0;
}

.modal-detail code {
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(122, 184, 255, 0.08);
  color: #7ab8ff;
}

.modal-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.modal-detail th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #9eb4d8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-detail td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-detail .detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #9eb4d8);
  margin-bottom: 4px;
}


/* ============================================
   S7  NAV + FOOTER GLASS
   ============================================ */

nav,
.m-nav {
  background: rgba(4, 6, 10, 0.7) !important;
  backdrop-filter: blur(20px) saturate(1.3) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.3) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

footer {
  background: rgba(4, 6, 10, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}


/* ============================================
   S8  SECTION ENTRANCE ANIMATION
   ============================================ */

.sf-section,
.m-section,
main > section {
  animation: section-rise 0.5s ease both;
}

main > section:nth-child(2) { animation-delay: 0.08s; }
main > section:nth-child(3) { animation-delay: 0.16s; }
main > section:nth-child(4) { animation-delay: 0.24s; }
main > section:nth-child(5) { animation-delay: 0.32s; }

@keyframes section-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================
   S9  PROOF PAGE STRONGER TREATMENT
   ============================================ */

body.proof-page .m-card,
body.proof-page .sf-card {
  border-color: rgba(122, 184, 255, 0.10) !important;
  box-shadow:
    0 6px 28px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body.proof-page .m-card:hover,
body.proof-page .sf-card:hover {
  border-color: rgba(122, 184, 255, 0.28) !important;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.4),
    0 0 36px var(--glow-brand),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Proof KPI values larger */
body.proof-page .sf-metric-value {
  font-size: 2rem;
}

/* Proof integrity badges: glass treatment */
.proof-integrity-badge {
  backdrop-filter: blur(8px);
  transition: border-color var(--transition-base), background var(--transition-base);
}

.proof-integrity-badge:hover {
  border-color: rgba(122, 184, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

/* Proof hero: stronger contrast */
body.proof-page .m-title {
  color: #fff;
  text-shadow: 0 0 60px rgba(122, 184, 255, 0.08);
}


/* ============================================
   S10  RESUME SHEET GLASS
   ============================================ */

.resume-sheet {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 18px !important;
}


/* ============================================
   S11  PIPELINE DIAGRAM
   ============================================ */

.sf-pipeline {
  background: rgba(10, 16, 28, 0.8) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(122, 184, 255, 0.06) !important;
  border-radius: 16px !important;
  transition: border-color var(--transition-base);
}

.sf-pipeline:hover {
  border-color: rgba(122, 184, 255, 0.14) !important;
}


/* ============================================
   S12  LINK HOVER GLOW
   ============================================ */

.sf-inline-link:hover,
a:not(.sf-button):not(.btn):not(.btn-p):not([class*="nav"]):not(.logo):hover {
  text-shadow: 0 0 14px rgba(122, 184, 255, 0.15);
}


/* ============================================
   S13  PROOF STRIP + EYEBROW POLISH
   ============================================ */

.m-proof-strip {
  backdrop-filter: blur(8px);
  border-radius: 12px;
}

.m-proof-inline {
  transition: border-color var(--transition-base);
}

.m-proof-inline:hover {
  border-color: rgba(122, 184, 255, 0.18);
}

.sf-eyebrow,
.m-eyebrow {
  border-radius: 999px;
  transition: background var(--transition-base);
}


/* ============================================
   S14  REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  html body::before,
  html body::after {
    animation: none !important;
  }

  .sf-section,
  .m-section,
  main > section {
    animation: none !important;
  }

  .sf-card,
  .m-card,
  .card,
  .lane-card,
  article.sf-metric,
  .sf-button,
  .m-btn,
  .btn {
    transition: none !important;
  }
}


/* ============================================
   S15  TOUCH DEVICE ADJUSTMENTS
   ============================================ */

/* ============================================
   S15  GAUGE + BAR ANIMATIONS
   SVG gauge rings animate in on load.
   Progress bars slide in from left.
   ============================================ */

/* SVG gauge fill animation */
svg circle[stroke-dasharray] {
  animation: gauge-fill 1.4s ease-out both;
}

@keyframes gauge-fill {
  from { stroke-dasharray: 0 600; }
}

/* Progress bar fill animation */
[style*="width:"][style*="background:linear-gradient"] {
  animation: bar-slide 1s ease-out both;
}

@keyframes bar-slide {
  from { transform: scaleX(0); transform-origin: left; }
  to   { transform: scaleX(1); transform-origin: left; }
}

/* Stagger bars */
[style*="margin-bottom:14px"]:nth-child(2) [style*="background:linear-gradient"] { animation-delay: 0.1s; }
[style*="margin-bottom:14px"]:nth-child(3) [style*="background:linear-gradient"] { animation-delay: 0.2s; }
[style*="margin-bottom:14px"]:nth-child(4) [style*="background:linear-gradient"] { animation-delay: 0.3s; }

/* KPI value glow pulse on load */
.sf-metric-value,
.proof-kpi-value,
.m-kpi-value {
  animation: value-glow 2s ease both;
}

@keyframes value-glow {
  0%   { opacity: 0; text-shadow: 0 0 0 transparent; }
  40%  { opacity: 1; text-shadow: 0 0 30px rgba(122, 184, 255, 0.3); }
  100% { opacity: 1; text-shadow: none; }
}

/* Status dot pulse for host coverage grid */
[style*="border-radius:50%"][style*="background:#71c7b8"] {
  animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(113, 199, 184, 0.4); }
  50%      { box-shadow: 0 0 14px rgba(113, 199, 184, 0.6); }
}

/* Timeline dot entrance */
[style*="border-radius:50%"][style*="box-shadow:0 0 6px"] {
  animation: timeline-dot 0.5s ease both;
}


/* ============================================
   S16  MOBILE RESPONSIVENESS
   Collapse multi-column grids on small screens.
   ============================================ */

@media (max-width: 768px) {
  /* All inline grid layouts collapse to single column */
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(7"],
  [style*="grid-template-columns:repeat(7"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns:repeat(5"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [style*="grid-template-columns:280px"],
  [style*="grid-template-columns: 280px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr auto 1fr"],
  [style*="grid-template-columns: 1fr auto 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* KPI metrics grid */
  .sf-metrics[style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Pipeline stage grid: 7 cols → 4 cols on tablet, handled below */
  /* Funnel SVG: make scrollable */
  .sf-panel svg[viewBox] {
    min-width: 600px;
  }

  .sf-panel {
    overflow-x: auto;
  }

  /* Resume grid */
  .resume-grid {
    grid-template-columns: 1fr !important;
  }

  /* Proof hero */
  .proof-hero-inner {
    padding: 0 1rem;
  }

  .proof-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  /* Single column everything on phone */
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns:repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  .sf-metrics[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .proof-kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .sf-route-grid {
    grid-template-columns: 1fr !important;
  }

  /* Smaller hero text */
  .sf-home h1 {
    font-size: 1.6rem !important;
  }

  /* Pipeline stages: 2 columns */
  [style*="grid-template-columns:repeat(7"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}


/* ============================================
   S17  TOUCH DEVICE ADJUSTMENTS
   ============================================ */

@media (hover: none) {
  /* No hover lift on touch — tap goes straight to action */
  .sf-card:hover,
  .m-card:hover,
  .card:hover,
  article.sf-metric:hover {
    transform: none;
  }

  /* Keep border glow on focus for accessibility */
  .sf-card:focus-within,
  .m-card:focus-within,
  article.sf-metric:focus-within {
    border-color: var(--glass-border-hover) !important;
    box-shadow: 0 0 20px var(--glow-brand);
  }
}


/* ============================================
   S18  TSPARTICLES CONTAINER
   Interactive particle layer above CSS starfield.
   ============================================ */

#tsparticles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Allow grab interaction on non-touch devices */
@media (hover: hover) {
  #tsparticles { pointer-events: auto; }
}


/* ============================================
   S19  SUCCESS / STATUS GLOW
   Subtle glow on pass/success indicators.
   ============================================ */

.sdot,
[data-ops-status] {
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.sf-metric-value {
  text-shadow: 0 0 12px var(--glow-brand);
}

.m-kpi-value {
  text-shadow: 0 0 10px var(--glow-brand);
}
