:root {
  --echo-ink: #10233a;
  --echo-muted: #5b6b7d;
  --echo-line: #e3e8ee;
  --echo-accent: #1b6ca8;
  --echo-accent-soft: #e8f1f8;
  --echo-deep: #050a12;
  --echo-gutter: clamp(1.25rem, 5vw, 3rem);
  --echo-cyan: #7ee0ff;
  --echo-teal: #3ee0c5;
}

body {
  overflow-x: hidden;
}

body,
.navbar,
.card,
.form-label {
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  color: var(--echo-ink);
  background: #f7f9fb;
}

body:has(.tab-pane.active > .echo-home),
body:has(.tab-pane.show > .echo-home) {
  background: #050a12;
}

/* ----------------------------------------------------------------- navbar */
.navbar {
  background: #050a12 !important;
  border-bottom: 1px solid rgba(126, 224, 255, 0.12);
}

.navbar .nav-link {
  color: rgba(236, 248, 255, 0.88) !important;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.navbar .nav-link:hover {
  color: #fff !important;
}

.navbar .nav-link.active {
  color: #fff !important;
  box-shadow: inset 0 -2px 0 var(--echo-cyan);
}

.echo-brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.echo-brand-name {
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: 0.16em;
  color: #fff;
  text-shadow: 0 0 18px rgba(126, 224, 255, 0.28);
}

.echo-brand-tagline {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(220, 240, 252, 0.86);
}

@media (max-width: 900px) {
  .echo-brand-tagline {
    display: none;
  }
}

/* ------------------------------------------------------------------- home */
/* The home page breaks out of the bootstrap container so that the hero can
   span the full window while its contents stay on the same grid. */
.echo-home {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background: #050a12;
  color: #e8eef6;
  min-height: calc(100vh - 56px);
}

.tab-content > .tab-pane:has(> .echo-home) {
  margin-top: 0 !important;
}

.echo-body {
  max-width: calc(1240px + 2 * var(--echo-gutter));
  margin: 0 auto;
  padding: 0 var(--echo-gutter) 4.5rem;
}

.echo-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: min(78vh, 780px);
  margin-bottom: 2.4rem;
  padding: 4.4rem var(--echo-gutter) 3.6rem;
  background:
    radial-gradient(ellipse 70% 52% at 78% 32%, rgba(158, 58, 168, 0.24), transparent 62%),
    radial-gradient(ellipse 48% 44% at 66% 64%, rgba(22, 72, 168, 0.22), transparent 64%),
    radial-gradient(ellipse 34% 28% at 90% 16%, rgba(48, 186, 210, 0.16), transparent 58%),
    radial-gradient(ellipse 42% 32% at 10% 6%, rgba(62, 224, 197, 0.09), transparent 56%),
    radial-gradient(ellipse 55% 26% at 40% 100%, rgba(168, 78, 36, 0.1), transparent 62%),
    linear-gradient(168deg, #03050c 0%, #070e1a 42%, #0a1730 72%, #061018 100%);
  color: #fff;
}

.echo-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(126, 200, 230, 0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 200, 230, 0.038) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 72% 78% at 72% 48%, #000 18%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

.echo-hero::after {
  content: "";
  position: absolute;
  inset: -8%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 42% 34% at 82% 28%, rgba(186, 80, 170, 0.2), transparent 70%),
    radial-gradient(ellipse 30% 26% at 70% 72%, rgba(40, 110, 200, 0.14), transparent 72%);
  mix-blend-mode: screen;
  animation: echo-nebula-drift 42s ease-in-out infinite;
}

.echo-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.echo-hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(5, 10, 18, 0.82) 0%, rgba(5, 10, 18, 0.18) 46%, transparent 68%),
    linear-gradient(180deg, rgba(5, 10, 18, 0.2) 0%, transparent 22%, transparent 78%, rgba(5, 10, 18, 0.55) 100%);
}

.echo-hero-inner {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 0.95fr);
  gap: 2rem;
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  min-height: 28rem;
}

.echo-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(220, 244, 255, 0.92);
}

.echo-hero-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--echo-teal);
  box-shadow: 0 0 0 0 rgba(62, 224, 197, 0.7);
  animation: echo-pulse 2.4s ease-out infinite;
}

.echo-hero-title {
  margin-top: 0.85rem;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.02;
  text-shadow: 0 0 42px rgba(126, 224, 255, 0.28);
}

.echo-hero-tagline {
  margin-top: 0.55rem;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d4eefc;
}

.echo-hero-lead {
  margin-top: 1.35rem;
  max-width: 40rem;
  font-size: 1.02rem;
  line-height: 1.7;
  color: rgba(245, 251, 255, 0.9);
}

.echo-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.8rem 2.6rem;
  margin-top: 2.3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(126, 224, 255, 0.16);
}

.echo-stat-value {
  font-size: 1.85rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: #f3fbff;
}

.echo-hero:not(.is-ready) .echo-stat-value {
  opacity: 0;
}

.echo-stat-label {
  margin-top: 0.18rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(228, 244, 255, 0.82);
}

.echo-hero-stage {
  position: relative;
  min-height: 22rem;
  height: min(52vh, 440px);
  pointer-events: none;
}

.echo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.echo-home .echo-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(16, 34, 54, 0.92), rgba(8, 16, 28, 0.94));
  border: 1px solid rgba(140, 196, 230, 0.16);
  border-radius: 6px;
  padding: 1.4rem 1.45rem 1.55rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.echo-home .echo-card:hover {
  border-color: rgba(126, 224, 255, 0.42);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(126, 224, 255, 0.08),
    0 22px 48px rgba(0, 0, 0, 0.32);
}

.echo-card-eyebrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.echo-card-index {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--echo-teal);
}

.echo-card-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(210, 232, 245, 0.82);
}

.echo-home .echo-card-title {
  font-size: 1.14rem;
  font-weight: 650;
  color: #f2f7fb;
}

.echo-home .echo-card-meta {
  margin-top: 0.3rem;
  font-size: 0.84rem;
  color: rgba(214, 234, 246, 0.88);
  font-variant-numeric: tabular-nums;
}

.echo-home .echo-comp-heading {
  margin: 1.35rem 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(210, 232, 246, 0.8);
}

.echo-comp-item + .echo-comp-item {
  margin-top: 0.5rem;
}

.echo-comp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.86rem;
}

.echo-home .echo-comp-name {
  color: #eef6fb;
}

.echo-home .echo-comp-value {
  color: rgba(210, 232, 246, 0.86);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  white-space: nowrap;
}

.echo-home .echo-comp-track {
  margin-top: 0.24rem;
  height: 3px;
  border-radius: 99px;
  background: rgba(126, 224, 255, 0.1);
  overflow: hidden;
}

.echo-home .echo-comp-fill {
  height: 100%;
  border-radius: 99px;
  width: 0;
  background: linear-gradient(90deg, #1f8ec4, #3ee0c5);
  box-shadow: 0 0 10px rgba(62, 224, 197, 0.35);
  animation: echo-comp-fill 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.25s forwards;
}

.echo-section-title {
  margin: 2.6rem 0 1.1rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--echo-muted);
}

.echo-home .echo-section-title {
  margin: 2.8rem 0 1.15rem;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  color: rgba(214, 236, 248, 0.84);
}

.echo-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.echo-home .echo-feature {
  background: rgba(12, 24, 40, 0.78);
  border: 1px solid rgba(140, 196, 230, 0.12);
  border-left: 2px solid var(--echo-cyan);
  border-radius: 6px;
  padding: 1.1rem 1.2rem 1.2rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.echo-home .echo-feature:hover {
  border-color: rgba(126, 224, 255, 0.32);
  transform: translateY(-1px);
}

.echo-feature-index {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--echo-teal);
  margin-bottom: 0.4rem;
}

.echo-home .echo-feature-title {
  font-weight: 620;
  font-size: 0.98rem;
  color: #f2f7fb;
}

.echo-home .echo-feature-body {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(220, 238, 248, 0.88);
}

.echo-about {
  max-width: 1000px;
}

.echo-about .card-body p,
.echo-about .card-body li {
  line-height: 1.7;
}

@keyframes echo-pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 224, 197, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(62, 224, 197, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 224, 197, 0); }
}

@keyframes echo-nebula-drift {
  0%,
  100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-2.2%, 1.6%) scale(1.05); }
}

@keyframes echo-comp-fill {
  from { width: 0; }
  to { width: var(--echo-fill, 0%); }
}

@media (max-width: 900px) {
  .echo-hero {
    min-height: 0;
    padding: 2.6rem var(--echo-gutter) 2.2rem;
  }

  .echo-hero-inner {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .echo-hero-stage {
    display: none;
  }

  .echo-hero-canvas {
    opacity: 0.42;
  }

  .echo-hero-vignette {
    background: linear-gradient(180deg, rgba(5, 10, 18, 0.28) 0%, rgba(5, 10, 18, 0.72) 100%);
  }

  .echo-hero-title {
    font-size: 2.4rem;
    letter-spacing: 0.16em;
  }

  .echo-stats {
    gap: 1.2rem 1.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .echo-hero-live,
  .echo-hero::after,
  .echo-home .echo-comp-fill,
  .echo-home .echo-card,
  .echo-home .echo-feature {
    animation: none;
    transition: none;
  }

  .echo-home .echo-comp-fill {
    width: var(--echo-fill, 0%);
  }
}

/* ------------------------------------------------------------- app chrome */
.card {
  margin-bottom: 1rem;
  border-color: var(--echo-line);
}

.card-header {
  font-weight: 600;
  font-size: 0.95rem;
  background: #fbfcfd;
}

.sidebar .form-group,
.sidebar .shiny-input-container {
  margin-bottom: 0.9rem;
}

/* A little air between checkbox-group titles and the options. */
.sidebar .shiny-input-checkboxgroup > label {
  display: block;
  margin-bottom: 0.4rem;
}

.sidebar .checkbox label,
.sidebar .form-check-label {
  font-size: 0.88rem;
}

.shiny-data-frame {
  font-variant-numeric: tabular-nums;
}

/* Long cell type names should wrap in the dropdowns */
.selectize-dropdown-content .option {
  white-space: normal;
  line-height: 1.35;
}

.nav-tabs .nav-link {
  font-size: 0.92rem;
}

.btn-primary {
  background-color: var(--echo-accent);
  border-color: var(--echo-accent);
}

.btn-primary:hover {
  background-color: #155a8c;
  border-color: #155a8c;
}

/* Shiny radio/checkbox group titles use .control-label (not Bootstrap
   .form-label). Space the title from .shiny-options-group below it.
   See shiny.ui._utils.shiny_input_label and posit.co/py/docs/ui-customize. */
.echo-scoring-method .control-label {
  display: block;
  margin-bottom: 0.75rem !important;
}

.echo-scoring-method .shiny-options-group {
  margin-top: 0.35rem;
}
