:root {
  --primary: #2aace2;
  --secondary: #8062aa;
  --accent: #4555a5;
  --orange: #f36e24;
  --light: #e4e9ec;
  --dark: #0d152c;
  --panel: rgba(13, 21, 44, 0.72);
  --panel-border: rgba(228, 233, 236, 0.12);
  --text: #f7fbff;
  --muted: rgba(228, 233, 236, 0.74);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(42, 172, 226, 0.24), transparent 28%),
    radial-gradient(circle at bottom left, rgba(128, 98, 170, 0.24), transparent 26%),
    linear-gradient(145deg, #060d1a 0%, #0d152c 40%, #13275f 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    repeating-linear-gradient(90deg, rgba(228, 233, 236, 0.02) 0 1px, transparent 1px 54px);
  opacity: 0.6;
}

body::after {
  content: none;
}

.portal-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
  position: relative;
  z-index: 2;
}

.hero,
.panel,
.card,
.stat-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  justify-content: stretch;
  flex-direction: column;
  gap: 1.5rem;
  align-items: end;
  padding: 2rem;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(228, 233, 236, 0.04), rgba(228, 233, 236, 0.02));
  box-shadow: var(--shadow);
}

.hero h1,
.panel h2 {
  margin: 0;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}

.hero p,
.results-meta,
.meta-line,
.card p {
  color: var(--muted);
}

.hero p {
  margin: 1rem 0 0;
  max-width: 60ch;
  line-height: 1.65;
}

.hero code {
  color: var(--light);
}

.hero-stats {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
}

.stat-card,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
}

.stat-card {
  padding: 1.15rem 1.25rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.stat-label,
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
}

.eyebrow {
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.panel {
  margin-top: 1.5rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding-bottom: 32px;
}

.panel h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.control-span-2 {
  grid-column: span 2;
}

.search-field input,
.select-field select {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(228, 233, 236, 0.16);
  border-radius: 18px;
  background: rgba(228, 233, 236, 0.06);
  background-color: rgba(13, 21, 44, 0.92);
  color: var(--text);
  padding: 0.9rem 1rem;
  font: inherit;
  outline: none;
  transition: border-color 180ms ease, transform 180ms ease;
}

.search-field input:focus,
.select-field select:focus {
  border-color: rgba(42, 172, 226, 0.65);
  transform: translateY(-1px);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 1.25rem;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(42, 172, 226, 0.08), transparent 46%, rgba(128, 98, 170, 0.12));
  opacity: 0;
  transition: opacity 180ms ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(42, 172, 226, 0.36);
}

.card:hover::before {
  opacity: 1;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
}

.card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.card p {
  margin: 0.9rem 0 1rem;
  line-height: 1.55;
  flex: 1;
}

.badge-row,
.meta-line,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.meta-line {
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(228, 233, 236, 0.14);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill--primary {
  background: rgba(42, 172, 226, 0.14);
  color: #98e8ff;
}

.pill--accent {
  background: rgba(243, 110, 36, 0.14);
  color: #ffc2a0;
}

.pill--latest {
  background: rgba(19, 188, 212, 0.14);
  color: #bffbff;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button-link:hover {
  transform: translateY(-1px);
}

.button-link--primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.button-link--ghost {
  border-color: rgba(228, 233, 236, 0.18);
  background: rgba(228, 233, 236, 0.05);
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(228, 233, 236, 0.16);
  border-radius: 24px;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 500ms ease, transform 500ms ease;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes drift {
  from {
    transform: translateY(-5rem);
  }
  to {
    transform: translateY(5rem);
  }
}

@media (max-width: 980px) {
  .hero,
  .panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding-bottom: 32px;
}
}

@media (max-width: 640px) {
  .portal-shell {
    width: min(100% - 1rem, 1200px);
    padding-top: 1rem;
  }

  .hero,
  .panel,
  .card,
  .stat-card {
    border-radius: 20px;
  }

  .hero,
  .panel {
    padding: 1.2rem;
  }

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

  .control-span-2 {
    grid-column: span 1;
  }
}

.select-field select option,
.select-field select optgroup {
  background: var(--dark);
  background-color: var(--dark);
  color: var(--text);
}


/* ════════════════════════════════════════════════════════════════════════════
   ORB BACKGROUND CANVAS
   Fixed full-viewport canvas injected by orb-bg.js as the page background.
   Portal shell (and all content) sits at z-index: 2, above this layer (z:1).
   ════════════════════════════════════════════════════════════════════════════ */

#orb-bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  display: block;
}


/* ════════════════════════════════════════════════════════════════════════════
   LIQUID GLASS
   Apple-inspired frosted glass: injected DOM layers, caustic canvas,
   SVG refraction + spring-physics specular highlight & iridescent border.
   Trigger: add class="liquid-glass" to .hero or .panel elements.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Container — remove conflicting background & blur from hosting element ── */
.liquid-glass {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* border-radius intentionally omitted — inherits from .hero / .panel / .stat-card */
}

/* Strip backdrop-filter + opaque background so the lg-surface layer takes over */
.hero.liquid-glass,
.panel.liquid-glass {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ── LAYER 1 — Glass Surface (frosted backdrop blur + tint) ─────────────── */
.liquid-glass .lg-surface {
  position:       absolute !important;
  inset:          0 !important;
  z-index:        0 !important;
  border-radius:  inherit !important;
  pointer-events: none !important;
  margin:         0 !important;

  backdrop-filter:         blur(16px) saturate(1.9) brightness(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.9) brightness(1.08);
  background: rgba(255, 255, 255, 0.07);

  box-shadow:
    inset 0  1px 0   rgba(255, 255, 255, 0.22),
    inset 0 -1px 0   rgba(0,   0,   0,   0.06),
    inset 1px 0  0   rgba(255, 255, 255, 0.12),
    inset -1px 0 0   rgba(0,   0,   0,   0.04);

  animation: lg-breathe 7s ease-in-out infinite;
}

@keyframes lg-breathe {
  0%, 100% { transform: scale(1);      }
  50%       { transform: scale(1.004); }
}

/* ── LAYER 2 — Caustic Light Canvas ────────────────────────────────────── */
.liquid-glass .lg-canvas {
  position:       absolute !important;
  inset:          0 !important;
  z-index:        1 !important;
  width:          100% !important;
  height:         100% !important;
  border-radius:  inherit !important;
  pointer-events: none !important;
  display:        block !important;
  margin:         0 !important;
  padding:        0 !important;
  mix-blend-mode: screen;
}

/* ── LAYER 3 — Refraction Shimmer (SVG displacement applied by JS) ──────── */
.liquid-glass .lg-refract {
  position:       absolute !important;
  inset:          0 !important;
  z-index:        2 !important;
  border-radius:  inherit !important;
  pointer-events: none !important;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.10)  0%,
    rgba(255, 255, 255, 0.00) 40%,
    rgba(200, 235, 255, 0.06) 70%,
    rgba(255, 255, 255, 0.08) 100%
  );
}

/* ── LAYER 4 — Specular Highlight (follows mouse via CSS custom properties) */
.liquid-glass .lg-highlight {
  position:       absolute !important;
  inset:          0 !important;
  z-index:        3 !important;
  border-radius:  inherit !important;
  pointer-events: none !important;
  background: radial-gradient(
    ellipse 55% 45% at var(--lg-hx, 35%) var(--lg-hy, 25%),
    rgba(255, 255, 255, 0.36)  0%,
    rgba(210, 240, 255, 0.16) 35%,
    rgba(180, 220, 255, 0.06) 60%,
    transparent 80%
  );
  opacity: var(--lg-highlight-op, 0.08);
  transition: opacity 0.05s linear;
}

/* ── LAYER 5 — Iridescent Edge Border ───────────────────────────────────── */
.liquid-glass .lg-edge {
  position:       absolute !important;
  inset:          0 !important;
  z-index:        4 !important;
  border-radius:  inherit !important;
  pointer-events: none !important;
  padding: 1px;
  background: linear-gradient(
    var(--lg-edge-angle, 45deg),
    rgba(243, 110,  36, 0.80)   0%,
    rgba(239,  70, 129, 0.70)  25%,
    rgba(128,  98, 170, 0.70)  50%,
    rgba( 19, 188, 212, 0.80)  75%,
    rgba( 42, 172, 226, 0.75) 100%
  );
  -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;
  opacity: calc(0.20 + var(--lg-prox, 0) * 0.80);
  transition: opacity 0.05s linear;
}

/* Outer glow ring */
.liquid-glass .lg-edge::after {
  content: '';
  position:      absolute;
  inset:         -3px;
  border-radius: inherit;
  padding:       3px;
  background: linear-gradient(
    var(--lg-edge-angle, 45deg),
    rgba(243, 110,  36, 0.30),
    rgba( 19, 188, 212, 0.30),
    rgba(128,  98, 170, 0.25)
  );
  -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;
  filter: blur(4px);
  opacity: calc(var(--lg-prox, 0) * 0.90);
  transition: opacity 0.05s linear;
}

/* ── Content Layer — sits above all glass layers ─────────────────────────── */
.liquid-glass > *:not(.lg-surface):not(.lg-canvas):not(.lg-refract):not(.lg-highlight):not(.lg-edge):not(svg) {
  position: relative !important;
  z-index:  5 !important;
}


/* ── MODIFIER: liquid-glass--dark (for light page backgrounds) ────────────── */
.liquid-glass.liquid-glass--dark .lg-surface {
  background:              rgba(0, 0, 0, 0.20);
  backdrop-filter:         blur(18px) saturate(1.6) brightness(0.88);
  -webkit-backdrop-filter: blur(18px) saturate(1.6) brightness(0.88);
  box-shadow:
    inset 0  1px 0  rgba(255, 255, 255, 0.08),
    inset 0 -1px 0  rgba(0,   0,   0,   0.12);
}

.liquid-glass.liquid-glass--dark .lg-highlight {
  background: radial-gradient(
    ellipse 55% 45% at var(--lg-hx, 35%) var(--lg-hy, 25%),
    rgba(120, 160, 200, 0.28) 0%,
    rgba( 80, 120, 170, 0.10) 40%,
    transparent 70%
  );
}

/* ── MODIFIER: liquid-glass--strong ─────────────────────────────────────── */
.liquid-glass.liquid-glass--strong .lg-surface {
  background:              rgba(255, 255, 255, 0.12);
  backdrop-filter:         blur(28px) saturate(2.2) brightness(1.12);
  -webkit-backdrop-filter: blur(28px) saturate(2.2) brightness(1.12);
}

/* ── MODIFIER: liquid-glass--subtle ─────────────────────────────────────── */
.liquid-glass.liquid-glass--subtle .lg-surface {
  background:              rgba(255, 255, 255, 0.03);
  backdrop-filter:         blur(8px) saturate(1.4) brightness(1.04);
  -webkit-backdrop-filter: blur(8px) saturate(1.4) brightness(1.04);
}

/* ── MODIFIER: liquid-glass--sharp ──────────────────────────────────────── */
.liquid-glass.liquid-glass--sharp .lg-surface {
  backdrop-filter:         blur(6px) saturate(2.0) brightness(1.06);
  -webkit-backdrop-filter: blur(6px) saturate(2.0) brightness(1.06);
}

/* ── Mobile: reduce effect on touch devices (JS disabled here) ───────────── */
@media (hover: none) and (pointer: coarse) {
  .liquid-glass .lg-surface {
    backdrop-filter:         blur(8px) saturate(1.5);
    -webkit-backdrop-filter: blur(8px) saturate(1.5);
    animation: none;
  }

  .liquid-glass .lg-canvas {
    display: none !important;
  }

  .liquid-glass .lg-refract {
    filter: none !important;
  }
}