/* ═══════════════════════════════════════════
   Distribuições de Probabilidade
   Design System
   ═══════════════════════════════════════════ */

:root {
  --bg: #090a0f;
  --surface: #0f1118;
  --surface-2: #14161f;
  --input-bg: #181b26;
  --border: #1d2030;
  --border-hover: #282c42;
  --text: #e2e5ed;
  --text-2: #868ca2;
  --text-3: #4e5368;
  --max-w: 1060px;
  --r: 14px;
  --r-sm: 8px;

  --uniform: #f59e0b;
  --exponential: #34d399;
  --normal: #60a5fa;
  --gamma: #c084fc;
  --beta: #fb7185;
  --cauchy: #22d3ee;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Sora", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Sticky Nav ─────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 10, 15, 0.86);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition:
    color 0.2s,
    background 0.2s,
    border-color 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* ── Hero ───────────────────────────────── */

.hero {
  padding: 52px 0 12px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 520px;
  margin: 8px auto 0;
  font-weight: 400;
}

/* ── Distribution Card ──────────────────── */

.dist {
  margin-bottom: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.3s;
}

.dist:hover {
  border-color: var(--border-hover);
}

.dist-head {
  padding: 16px 24px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.dist-head h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dist-notation {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text-3);
  margin-left: auto;
  font-weight: 500;
}

.dist-body {
  padding: 20px 24px 24px;
}

/* ── Formulas ───────────────────────────── */

.dist-formulas {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.formula-group {
  min-width: 160px;
}

.formula-group .f-label {
  font-family: "Sora", sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 2px;
}

.formula-group .f-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Controls ───────────────────────────── */

.dist-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 14px;
}

.sliders {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.slider-group {
  display: block;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}

.slider-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, var(--text));
}

/* Range */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  accent-color: var(--accent, var(--text));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent, var(--text));
  border: 2px solid var(--surface);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent, var(--text));
  border: 2px solid var(--surface);
  cursor: pointer;
}

/* Add Curve */

.btn-add {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-add:hover {
  border-color: var(--accent, var(--border-hover));
  color: var(--text);
  background: var(--surface-2);
}

/* ── Curve Pills ────────────────────────── */

.curve-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  min-height: 0;
}

.curve-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.curve-pill:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.curve-pill.is-active {
  border-color: var(--curve-color);
  color: var(--text);
}

.curve-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.curve-pill-x {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  padding: 0 0 0 2px;
  line-height: 1;
  transition: color 0.15s;
  font-family: inherit;
}

.curve-pill-x:hover {
  color: #fb7185;
}

.curve-pill-x:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Plots ──────────────────────────────── */

.plots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .plots-grid {
    grid-template-columns: 1fr;
  }
}

.plot-wrap {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 12px 8px;
  overflow-x: auto;
}

.plot-wrap > div:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
}

.plot-wrap svg {
  width: 100% !important;
  height: auto !important;
}

.plot-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 8px;
}

/* Observable Plot text overrides */

.plot-wrap text {
  font-family: "Sora", sans-serif !important;
  font-size: 12px !important;
  fill: var(--text-2) !important;
}

.plot-wrap [aria-label="y-axis tick label"] text,
.plot-wrap [aria-label="x-axis tick label"] text {
  font-family: "JetBrains Mono", monospace !important;
  font-size: 12px !important;
  fill: var(--text-3) !important;
}

.plot-wrap [aria-label="y-axis label"] text,
.plot-wrap [aria-label="x-axis label"] text {
  font-size: 13px !important;
  font-weight: 600 !important;
  fill: var(--text) !important;
}

/* ── Stats ──────────────────────────────── */

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 0.2s;
  flex: 1 1 auto;
}

.stat-row.is-active {
  border-color: var(--curve-color, var(--border-hover));
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.stat-key {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.stat-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ── Footer ─────────────────────────────── */

.site-footer {
  padding: 36px 0 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

.site-footer a {
  color: var(--text-2);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

/* ── Responsive ─────────────────────────── */

@media (max-width: 640px) {
  .dist-head {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .dist-notation {
    margin-left: 0;
  }

  .dist-body {
    padding: 14px 16px 18px;
  }

  .dist-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-add {
    align-self: flex-start;
  }

  .plot-wrap {
    padding: 10px 8px 6px;
  }
}
