/* ============================================================================
   Gamepad / Controller Tester — tool layer over base.css
   base.css supplies reset, type, forms, buttons, chips, badges, panels, tables,
   header, footer, focus rings. This file adds the accent and only what is
   unique to this tool.

   Accent — rose-crimson, measured against base.css surfaces (WCAG relative
   luminance):
     dark  #ef6189  6.1:1 on --bg   5.6:1 on --surface   6.3:1 on --bg-sunk
     light #960830  8.5:1 on --bg   8.8:1 on --surface   7.8:1 on --bg-sunk
   Both clear the 4.5:1 text floor on all three surfaces in both themes.
   ========================================================================= */
:root { --accent: #ef6189; --accent-dim: rgba(239, 97, 137, 0.14); }
@media (prefers-color-scheme: light) {
  :root { --accent: #960830; --accent-dim: rgba(150, 8, 48, 0.10); }
}

.brand svg .mark-bg { fill: var(--accent); }
.brand svg .mark-fg { fill: var(--on-accent); }

/* base has no visually-hidden helper */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================================================================
   The instrument bay
   ========================================================================= */

.gp-tool { margin-bottom: 2.5rem; }

.gp-status {
  margin-bottom: 1.25rem;
}
.gp-empty-msg { margin: 0; color: var(--text-dim); }

.gp-pads {
  display: grid;
  gap: 1.5rem;
}

.gp-pad { display: grid; gap: 1.5rem; }

.gp-pad-head { display: grid; gap: 0.85rem; }
.gp-pad-head h3 { margin: 0; }

.gp-meta {
  display: grid;
  gap: 0.75rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
}
.gp-field .readout { font-size: 0.95rem; word-break: break-word; }

.gp-mapping-note { margin: 0; }

.gp-rumble {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
}
.gp-rumble-note { flex: 1 1 16rem; min-width: 0; }

/* ---------------------------------------------------------------- sticks -- */

.gp-sticks { align-items: start; }

.gp-stick { display: grid; gap: 0.55rem; justify-items: start; }

.gp-stick-box {
  position: relative;
  width: clamp(9rem, 26vw, 11rem);
  aspect-ratio: 1;
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.gp-stick-cross {
  position: absolute; inset: 0;
}
.gp-stick-cross::before, .gp-stick-cross::after {
  content: "";
  position: absolute;
  background: var(--line);
}
.gp-stick-cross::before { left: 0; right: 0; top: 50%; height: 1px; transform: translateY(-50%); }
.gp-stick-cross::after { top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); }

.gp-stick-dot, .gp-stick-rest {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  left: 50%; top: 50%;
}
.gp-stick-rest {
  width: 0.5rem; height: 0.5rem;
  background: transparent;
  border: 1px solid var(--text-faint);
}
.gp-stick-dot {
  width: 0.85rem; height: 0.85rem;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.gp-stick-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}
.gp-stick-readout .field { display: inline-flex; align-items: baseline; gap: 0.35rem; }
.gp-stick-readout .field-label { font-size: 0.625rem; }
.gp-stick-readout .readout { font-size: 0.9375rem; }

.gp-drift-badge { text-transform: none; }

/* ----------------------------------------------------------------- d-pad -- */

.gp-dpad { display: grid; gap: 0.55rem; justify-items: start; }

.gp-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 2.35rem);
  grid-template-rows: repeat(3, 2.35rem);
  gap: 0.3rem;
}
.gp-dpad-cell {
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.gp-dpad-up    { grid-column: 2; grid-row: 1; }
.gp-dpad-left  { grid-column: 1; grid-row: 2; }
.gp-dpad-right { grid-column: 3; grid-row: 2; }
.gp-dpad-down  { grid-column: 2; grid-row: 3; }
.gp-dpad-cell.is-pressed {
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* --------------------------------------------------------------- buttons -- */

.gp-buttons { display: grid; gap: 0.55rem; }

.gp-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr));
  gap: 0.5rem;
}

.gp-btn {
  display: grid;
  gap: 0.35rem;
  background: var(--bg-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
}
.gp-btn.is-pressed {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.gp-btn-label {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.gp-btn.is-pressed .gp-btn-label { color: var(--accent); }

.gp-btn-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.gp-btn-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}
.gp-btn.is-trigger .gp-btn-bar { height: 6px; }
.gp-btn-value {
  font-size: 0.6875rem;
  color: var(--text-dim);
}

/* ============================================================================
   Article furniture
   ========================================================================= */

.section { max-width: 74ch; }
.section table { max-width: none; }

.callout {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.1rem;
  margin: 0 0 1.2em;
  font-size: 0.9375rem;
  color: var(--text-dim);
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }

.pagelinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.pagelinks a {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
}
.pagelinks a:hover { border-color: var(--accent); }
.pagelinks strong { display: block; color: var(--accent); margin-bottom: 0.15rem; }
.pagelinks span { display: block; color: var(--text-dim); font-size: 0.875rem; }

.noscript {
  background: var(--err-bg);
  border: 1px solid var(--err);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  color: var(--err);
  font-size: 0.9375rem;
}
