/* ==========================================================================
   ToolsHub4u — Components v3 "Instrument"
   Buttons, chips, rails, readouts, cards, inputs, navigation surfaces.
   ========================================================================== */

/* ---------- buttons ------------------------------------------------------- */
.btn {
  --btn-h: 44px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--btn-h);
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-text);
  font-size: 0.90625rem;
  font-weight: 640;
  letter-spacing: -0.004em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms var(--ease-soft), border-color 160ms var(--ease-soft),
    color 160ms var(--ease-soft), box-shadow 220ms var(--ease-soft), transform 120ms var(--ease-soft);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--action);
  color: var(--action-ink);
  border-color: var(--action);
  box-shadow: var(--shadow-1);
}
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }

.btn-signal {
  background: var(--phosphor);
  color: var(--phosphor-ink);
  border-color: var(--phosphor-text);
  box-shadow: var(--shadow-1);
}
.btn-signal:hover { background: var(--phosphor-dim); border-color: var(--phosphor-dim); }

.btn-ghost {
  border-color: var(--line-2);
  color: var(--text-100);
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--line-3);
  background: color-mix(in srgb, var(--text-100) 6%, transparent);
}

.btn-quiet {
  color: var(--text-200);
  padding-inline: 0;
  min-height: 36px;
}
.btn-quiet:hover { color: var(--text-100); }

.btn-lg { --btn-h: 52px; padding-inline: 26px; font-size: 0.96875rem; }
.btn-sm { --btn-h: 34px; padding-inline: 13px; font-size: 0.8125rem; }

/* icon-only */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-200);
  transition: background-color 150ms, color 150ms, border-color 150ms;
}
.icon-btn:hover { background: var(--ink-600); color: var(--text-100); border-color: var(--line-1); }
/* Touch screens: 38px is above the 24px WCAG minimum but still small for a
   thumb. Give icon-only buttons a full 44px target and keep them apart. */
@media (pointer: coarse), (max-width: 860px) {
  .icon-btn { width: 44px; height: 44px; }
}

/* the primary button's sheen follows the pointer: one authored moment */
.btn--magnetic { will-change: transform; }

/* ---------- icons --------------------------------------------------------- */
.icon {
  width: 20px; height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- tags, chips, pills -------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 100px;
  border: 1px solid var(--line-2);
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-200);
  white-space: nowrap;
  transition: background-color 150ms, border-color 150ms, color 150ms;
}
.chip:hover { border-color: var(--line-3); color: var(--text-100); background: color-mix(in srgb, var(--text-100) 5%, transparent); }
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--text-100);
  border-color: var(--text-100);
  color: var(--ink-900);
}
.chip .n {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  opacity: 0.62;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-300);
}
.tag--signal { border-color: color-mix(in srgb, var(--phosphor) 42%, transparent); color: var(--phosphor-text); }

/* live dot: the one pulsing element on a page */
.dot-live {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--phosphor) 60%, transparent);
  animation: pulse-live 2.4s var(--ease-soft) infinite;
  flex: none;
}
@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--phosphor) 55%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--phosphor) 0%, transparent); }
}

/* ---------- step rail: the assigned direction's signature ------------------ */
.steps {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--ink-700);
}
.steps__item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  min-width: 0;
  border-right: 1px solid var(--line-1);
  position: relative;
  transition: background-color 260ms var(--ease-soft), color 260ms var(--ease-soft);
}
.steps__item:last-child { border-right: 0; }
.steps__num {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 3px;
  border: 1px solid var(--line-3);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-300);
  flex: none;
  transition: background-color 260ms var(--ease-soft), border-color 260ms, color 260ms;
}
.steps__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 260ms;
}
.steps__item.is-done .steps__num { border-color: var(--phosphor-dim); color: var(--phosphor-text); }
.steps__item.is-done .steps__label { color: var(--text-200); }
.steps__item.is-active {
  background: color-mix(in srgb, var(--phosphor) 9%, transparent);
}
.steps__item.is-active .steps__num {
  background: var(--phosphor);
  border-color: var(--phosphor-text);
  color: var(--phosphor-ink);
}
.steps__item.is-active .steps__label { color: var(--text-100); }
.steps__item.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--phosphor);
  transform-origin: left;
  animation: step-sweep 900ms var(--ease-out) both;
}
@keyframes step-sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Phones: three mono labels cannot share one 360px row at 11px, so the row
   used to truncate to "E…", "A…", "CO…". Tighten the rail and let a label run
   onto a second line instead of losing its letters. */
@media (max-width: 620px) {
  .steps__item { padding: 9px 10px; gap: 7px; }
  .steps__label {
    font-size: clamp(0.5625rem, 2.6vw, 0.6875rem);
    letter-spacing: 0.04em;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

/* ---------- readout: a measured number as an instrument display ------------ */
.readout {
  padding: 20px 22px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--text-100) 4%, transparent), transparent 55%),
    var(--ink-700);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-100) 6%, transparent);
}
.readout__label { margin-bottom: 6px; }
.readout__value {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-100);
}
.readout__unit { font-size: 0.5em; color: var(--text-300); margin-left: 4px; letter-spacing: 0; }
.readout__note { margin-top: 6px; font-size: var(--step--1); color: var(--text-300); }

.readout__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  margin-top: 18px;
  border-top: 1px solid var(--line-1);
  padding-top: 14px;
  gap: 0;
}
.readout__stat {
  padding-right: 14px;
  border-right: 1px solid var(--line-1);
  margin-right: 14px;
  min-width: 0;
}
.readout__stat:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.readout__stat dt {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-300);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readout__stat dd {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-100);
  letter-spacing: -0.01em;
}

/* ---------- inputs -------------------------------------------------------- */
.field { display: grid; gap: 7px; min-width: 0; }
.field > label, .field__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-300);
}
.field__hint { font-size: 0.75rem; color: var(--text-400); line-height: 1.45; }

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  background: var(--ink-800);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text-100);
  font-size: 0.9375rem;
  transition: border-color 160ms, background-color 160ms, box-shadow 160ms;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--phosphor-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--phosphor) 16%, transparent);
  background: var(--ink-700);
}
.input::placeholder, .textarea::placeholder { color: var(--text-400); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; font-family: var(--font-text); }
.select { appearance: none; cursor: pointer; padding-right: 36px; }

/* ---------- surface panels ------------------------------------------------ */
.panel {
  background: var(--ink-700);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-lg);
}
.panel--raised { box-shadow: var(--shadow-2); }
.panel--flush { border-radius: var(--radius-md); }

/* hairline grid tile: a tool link that reads as an instrument key */
.key {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 14px;
  min-height: 112px;
  background: var(--ink-700);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: background-color 200ms var(--ease-soft), border-color 200ms var(--ease-soft), transform 260ms var(--ease-out);
}
.key::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--key-hue, var(--phosphor)) 22%, transparent), transparent 62%);
  opacity: 0;
  transition: opacity 260ms var(--ease-soft);
  pointer-events: none;
}
.key:hover { border-color: color-mix(in srgb, var(--key-hue, var(--phosphor)) 48%, transparent); transform: translateY(-2px); }
.key:hover::before { opacity: 1; }
.key:focus-visible { border-color: var(--key-hue, var(--phosphor)); }
.key__name { font-weight: 620; font-size: 0.9375rem; letter-spacing: -0.008em; color: var(--text-100); position: relative; }
.key__meta {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-400);
  position: relative;
  margin-top: auto;
}
.key__glyph { color: var(--key-hue, var(--phosphor)); position: relative; opacity: 0.9; }
.key__go {
  position: absolute;
  top: 14px; right: 14px;
  color: var(--text-400);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 220ms, transform 220ms var(--ease-out), color 220ms;
}
.key:hover .key__go { opacity: 1; transform: none; color: var(--key-hue, var(--phosphor)); }

/* ---------- scroll reveal (JS sets .is-in; no-JS stays visible) ----------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 720ms var(--ease-out), transform 720ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .dot-live { animation: none; }
  .steps__item.is-active::after { animation: none; }
}

/* ---------- marquee lane -------------------------------------------------- */
.lane {
  overflow: hidden;
  border-block: 1px solid var(--line-1);
  /* the item carries 7px of vertical padding so each link is a 33px tap
     target; the lane gives those 14px back to stay the same height */
  padding-block: 6px;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.lane__track {
  display: flex;
  gap: 0;
  width: max-content;
  animation: lane-scroll 46s linear infinite;
}
.lane:hover .lane__track { animation-play-state: paused; }
@keyframes lane-scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .lane__track { animation: none; flex-wrap: wrap; width: auto; } }
.lane__item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 7px 22px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-300);
  white-space: nowrap;
}
.lane__item::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--line-3); }

/* Author byline, shared by every content page */
.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 9px;
  margin: 16px 0 0;
  font-family: var(--font-text);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-300);
}
.byline a {
  color: var(--text-200);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.byline a:hover,
.byline a:focus-visible { color: var(--text-100); text-decoration-thickness: 2px; }
.byline__by a { font-weight: 600; }
.byline__sep { color: var(--text-400); user-select: none; }
@media print { .byline, .byline a { color: #000; } }
/* Long unbroken tokens (binary strings, URLs) must not widen the page */
.prose { overflow-wrap: break-word; }
