/* Styles for the "Every number is a middle" post. Colors follow the blog's
   Bootswatch Slate theme; chart series use a colorblind-checked set that
   keeps 3:1 contrast on the card background. */
:root {
  --g-surface: #32383e;      /* Slate card */
  --g-soft: #272b30;         /* Slate page background */
  --g-ink: #e9ecef;
  --g-ink-2: #aaaaaa;        /* Slate body text */
  --g-muted: #7a8288;
  --g-rule: #1c1f23;
  --g-grid: #40464d;
  --g-accent: #5bc0de;       /* Slate "info" */
  --g-accent-soft: #2c4954;
  --g-s1: #3987e5;           /* 3 divides n */
  --g-s2: #d95926;           /* 5 divides n, 3 does not */
  --g-s3: #199e70;           /* neither */
  --g-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.g-figure { text-align: left; margin: 1.5rem 0 2rem; }
.g-figure .card-body { display: flex; flex-direction: column; gap: 1rem; }
.g-controls { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; }
.g-controls .form-check-inline { margin-right: 0; }
.g-controls .form-check-label, .g-small { font-size: 0.85rem; color: var(--g-ink-2); }
.g-n { width: 12rem; }
.g-n input { font-family: var(--g-mono); font-weight: 600; text-align: center; }
.g-range { width: 12rem; max-width: 100%; }

.g-mono, .g-math { font-family: var(--g-mono); font-variant-numeric: tabular-nums; }
.g-math {
  font-size: 0.85em; background: var(--g-soft); border: 1px solid var(--g-rule);
  border-radius: 0.25rem; padding: 0.6rem 0.9rem; overflow-x: auto; white-space: nowrap;
  text-align: left; margin-bottom: 1rem;
}

.g-line-wrap { overflow-x: auto; }
#line { display: block; width: 100%; height: auto; min-width: 520px; }
#line text { font-family: var(--g-mono); }
.g-readout { font-size: 1.1rem; line-height: 1.45; margin: 0; }
.g-readout strong { color: var(--g-accent); }
.g-readout .g-sub { display: block; font-size: 0.9rem; color: var(--g-ink-2); margin-top: 0.25rem; }

@keyframes g-arc-in { from { opacity: 0; } to { opacity: 1; } }
.arc-try { animation: g-arc-in 0.25s ease-out both; }
.arc-hit { animation: g-arc-in 0.4s ease-out both; }
@media (prefers-reduced-motion: reduce) { .arc-try, .arc-hit { animation: none; } }

.g-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; text-align: left; margin-bottom: 1rem; }
.g-chip {
  font: 0.78rem var(--g-mono); border: 1px solid var(--g-rule); border-radius: 0.25rem;
  padding: 0.2rem 0.5rem; background: var(--g-soft); color: var(--g-ink-2); font-variant-numeric: tabular-nums;
}
.g-chip.hit { border-color: var(--g-accent); background: var(--g-accent-soft); color: var(--g-ink); font-weight: 600; }
.g-chip .idx { color: var(--g-muted); margin-right: 0.3rem; }
.g-chip .why { color: var(--g-muted); }
.g-note { font-size: 0.9rem; color: var(--g-ink-2); text-align: left; }

.g-chart-box { position: relative; min-width: 0; }
.g-chart-box canvas { display: block; width: 100%; }
#overlay { position: absolute; inset: 0; cursor: crosshair; }
#overlay:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
.g-tip {
  position: absolute; pointer-events: none; background: var(--g-surface); color: var(--g-ink);
  border: 1px solid var(--g-rule); border-radius: 0.25rem; padding: 0.45rem 0.6rem;
  font: 0.75rem/1.5 var(--g-mono); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); white-space: nowrap; z-index: 2;
}
.g-tip[hidden] { display: none; }
.g-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font: 0.78rem var(--g-mono); color: var(--g-ink-2); }
.g-legend .sw { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 0.35rem; vertical-align: -0.05rem; }
.g-legend .val { color: var(--g-ink); font-weight: 600; }
.g-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.75rem; }
.g-stat { border-top: 1px solid var(--g-rule); padding-top: 0.4rem; }
.g-stat .k { font: 0.68rem var(--g-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--g-muted); }
.g-stat .v { font: 600 1.15rem var(--g-mono); font-variant-numeric: tabular-nums; }
.g-stat .v small { display: block; font-size: 0.72rem; font-weight: 400; color: var(--g-ink-2); }
.g-table-wrap { max-height: 20rem; overflow: auto; }
.g-table-wrap table { font: 0.78rem var(--g-mono); font-variant-numeric: tabular-nums; margin: 0; }
.g-table-wrap td, .g-table-wrap th { text-align: right; }
.g-table-wrap td:first-child, .g-table-wrap th:first-child { text-align: left; }
.g-figure summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--g-ink-2); }
#hist { display: block; width: 100%; height: auto; }
#hist text { font-family: var(--g-mono); }

/* Slate's secondary buttons barely change when active, so mark the chosen option clearly */
.g-figure .btn-group .btn.active { background: var(--g-accent); border-color: var(--g-accent); color: var(--g-rule); }
.g-tip { background: var(--g-soft); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.g-table-wrap .table { background: transparent; color: var(--g-ink-2); }
.g-table-wrap .table th, .g-table-wrap .table td { border-color: var(--g-grid); }

/* Marks where the author's introduction ends; the theme's own <hr> is nearly invisible on its dark background */
.g-divider { border-top: 1px solid var(--g-muted); margin: 2.5rem 0; }
