/* Grace Hopper's nanosecond — latency you can hold in your hand.
   Pick a duration; see how far a signal travels in that time and what that length
   compares to. The point: delay is not abstract — every nanosecond is a physical
   length of wire a signal must cross. Vanilla JS, no deps, no build. Dark theme.
   Palette shared with sibling widgets: cyan = the wire, white = primary. No red. */

#nanosecond-wire {
  --nw-wire: #5ac8fa;                /* the signal's reach */
  font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background: var(--color-bg-elevated, #111111);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
  border-radius: 16px;
  padding: clamp(16px, 3vw, 26px);
  margin: 2.5rem 0;
  color: var(--color-text-primary, #ffffff);
}

.nw-title { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }
.nw-explain {
  font-size: 0.9rem; line-height: 1.55; margin: 8px 0 18px;
  color: var(--color-text-secondary, rgba(255, 255, 255, 0.7));
}

/* duration selector */
.nw-durations { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.nw-dur {
  appearance: none; cursor: pointer; font: inherit; font-size: 0.85rem;
  font-family: var(--font-mono, "SF Mono", Monaco, monospace);
  color: var(--color-text-secondary, rgba(255,255,255,0.6));
  background: transparent; border: 1px solid var(--color-border, rgba(255,255,255,0.14));
  border-radius: 8px; padding: 8px 13px; transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.nw-dur:hover { color: var(--color-text-primary, #fff); border-color: rgba(255,255,255,0.4); }
.nw-dur.is-on {
  color: #0b0b0b; font-weight: 650;
  background: var(--color-accent, #fff); border-color: var(--color-accent, #fff);
}

/* the headline distance */
.nw-figure {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.nw-distance { font-size: clamp(2rem, 7vw, 3rem); font-weight: 700; line-height: 1; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; }
.nw-for { font-size: 0.92rem; color: var(--color-text-secondary, rgba(255,255,255,0.65)); }
.nw-for b { color: var(--nw-wire); font-weight: 600; }

/* the wire graphic (log-scaled so each step visibly grows) */
.nw-track {
  position: relative; height: 12px; margin: 18px 0 10px;
  background: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden;
}
.nw-fill {
  position: absolute; inset: 0 auto 0 0; height: 100%; width: 0;
  background: linear-gradient(90deg, rgba(90,200,250,0.5), var(--nw-wire));
  border-radius: 6px; transition: width 0.55s cubic-bezier(.2,.7,.2,1);
}
/* glowing wire-tip so even the shortest length reads as a wire, not an empty bar */
.nw-fill::after {
  content: ""; position: absolute; right: -2px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; border-radius: 50%; background: var(--nw-wire);
  box-shadow: 0 0 10px var(--nw-wire);
}
.nw-scalenote { font-size: 0.74rem; color: var(--color-text-tertiary, rgba(255,255,255,0.4)); }

/* the human comparison */
.nw-compare {
  margin-top: 16px; font-size: 0.96rem; line-height: 1.55;
  background: var(--color-bg-surface, #1a1a1a);
  border: 1px solid var(--color-border-subtle, rgba(255,255,255,0.08));
  border-radius: 12px; padding: 14px 16px;
  color: var(--color-text-secondary, rgba(255,255,255,0.8));
}
.nw-compare b { color: #fff; }

.nw-quip {
  margin-top: 14px; font-size: 0.86rem; line-height: 1.5; font-style: italic;
  color: var(--color-text-tertiary, rgba(255,255,255,0.5));
}

.nw-noscript { font-size: 0.9rem; color: var(--color-text-secondary, rgba(255,255,255,0.65)); line-height: 1.6; }
