/*
   tool-focus.css — focused shell shared by the input and diagnostics tools.
   This file composes the existing Buddy components; controllers and state
   machines keep their original IDs, events and runtime semantics.
   Tokens only: no literal colors or page-wide overrides.
*/

/* --- Focused shell --------------------------------------------------------- */
.tool-focus-page .hero-buddy {
  gap: var(--space-5);
  max-width: 800px;
  margin-inline: auto;
  padding-block: 48px var(--space-4);
}

.tool-focus-page .hero-kicker {
  display: none;
}

.tool-focus-page .hero-text {
  min-width: 0;
}

.tool-focus-page .hero-buddy h1 {
  max-width: 22ch;
  font-size: clamp(2rem, 4vw, 3rem);
}

.tool-focus-page .hero-sub {
  max-width: 52ch;
  margin-top: var(--space-2);
}

.tool-focus-page .hero-buddy .mascot {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  border-radius: 25px;
}

/* buddy-extra.js wraps each face with Miko's name and antenna. Keep that
   wrapper in lock-step with the compact face so its label stays in the hero
   instead of inheriting mic.css's legacy 120px shell. The bottom margin gives
   the absolutely positioned name a real place in the hero row. */
.tool-focus-page .hero-buddy .miko-buddy {
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  margin-bottom: var(--space-4);
}

/* mic/AV's compact antenna proportions: the capsule clears the header while
   the mascot keeps its existing bob animation and decorative accessories. */
.tool-focus-page .hero-buddy .miko-antenna-stem {
  top: -8px;
  left: calc(50% - 2px);
  width: 16px;
  height: 16px;
  border-width: 3px;
  border-top-left-radius: 10px;
  transform: none;
}

.tool-focus-page .hero-buddy .miko-antenna-capsule {
  top: -30px;
  left: calc(50% + 5px);
  width: 16px;
  height: 24px;
  border-width: 3px;
  transform: rotate(15deg);
}

.tool-focus-page .hero-buddy .miko-name {
  top: calc(100% + var(--space-1));
}

/* mic.css adds a 32px offset to non-mic pages for its original 120px face.
   The focused hero already reserves its own clearance, so remove that offset
   at equal specificity without changing any shared body layout. */
body.tool-focus-page .hero-buddy .miko-buddy {
  margin-top: 0;
}

.tool-focus-page .hero-buddy .mascot .eye {
  top: 27px;
  width: 13px;
  height: 16px;
}

.tool-focus-page .hero-buddy .mascot .eye-l { left: 21px; }
.tool-focus-page .hero-buddy .mascot .eye-r { right: 21px; }
.tool-focus-page .hero-buddy .mascot .blush { top: 42px; width: 14px; height: 9px; }
.tool-focus-page .hero-buddy .mascot .blush-l { left: 11px; }
.tool-focus-page .hero-buddy .mascot .blush-r { right: 11px; }
.tool-focus-page .hero-buddy .mascot .mouth { top: 48px; width: 32px; height: 18px; }
.tool-focus-page .hero-buddy .mascot.face-worried .mouth { top: 56px; height: 13px; }
.tool-focus-page .hero-buddy .mascot.face-flat .mouth { top: 55px; width: 24px; height: 0; }
.tool-focus-page .hero-buddy .mascot.face-sleepy .mouth { top: 53px; width: 20px; height: 10px; }
.tool-focus-page .hero-buddy .mascot.face-sleepy .eye { top: 34px; height: 4px; }
.tool-focus-page .hero-buddy .mascot .wave { top: -12px; right: -9px; font-size: 22px; }

.tool-focus-page .tool {
  display: block;
  max-width: 800px;
  margin-inline: auto;
  padding-bottom: var(--space-4);
}

.tool-focus-page .interview {
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
  padding-bottom: var(--space-4);
}

.tool-focus-page .test-card {
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
}

.tool-focus-page .action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.tool-focus-page .test-card > .card-top {
  min-height: 32px;
}

.tool-focus-page .card-top > .device-tag {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.tool-focus-page .test-card > .verdict {
  margin-top: 0;
}

.tool-focus-page .test-card .action-row .btn,
.tool-focus-page .test-card button {
  min-height: 44px;
}

.tool-focus-page .test-card #reset-btn {
  background: var(--canvas);
  color: var(--ink);
  box-shadow: var(--sticker-sm);
}

/* --- Compact live readings ----------------------------------------------- */
.tool-focus-page .compact-readings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  min-width: 0;
}

.tool-focus-page .compact-reading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.tool-focus-page .compact-reading-label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tool-focus-page .compact-readings > .compact-reading > span:first-child:not(.compact-reading-note) {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tool-focus-page .compact-reading-value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-focus-page .compact-readings > .compact-reading > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-focus-page .compact-reading-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tool-focus-page .compact-reading-note {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 0.72rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-focus-page .compact-reading[data-reading="warning"] .compact-reading-value {
  overflow: visible;
  color: var(--warn);
  text-overflow: clip;
  white-space: normal;
}

.tool-focus-page .compact-reading-heading {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  border: 0;
  padding: 0 0 var(--space-1);
  background: transparent;
}

.tool-focus-page .compact-reading-heading .compact-reading-label {
  color: var(--ink);
  font-size: 0.82rem;
}

.tool-focus-page .compact-reading-heading .compact-reading-note {
  flex: 0 1 auto;
  margin-left: var(--space-2);
}

/* --- Native secondary disclosures ---------------------------------------- */
.tool-focus-page .disclosure-stack {
  display: grid;
  gap: var(--space-5);
  max-width: 800px;
  margin: var(--space-5) auto var(--space-5);
}

.tool-focus-page .page-disclosure {
  overflow: hidden;
  background: var(--canvas);
  border: 2px solid var(--line);
  border-radius: var(--r);
  box-shadow: none;
}

.tool-focus-page .page-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  list-style: none;
}

.tool-focus-page .page-disclosure > summary::-webkit-details-marker {
  display: none;
}

.tool-focus-page .page-disclosure > summary::after {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  margin: -5px 2px 0 0;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  transition: transform var(--dur-fast) ease;
}

.tool-focus-page .page-disclosure[open] > summary {
  border-bottom: 2px solid var(--line);
}

.tool-focus-page .page-disclosure[open] > summary::after {
  margin-top: 5px;
  transform: rotate(225deg);
}

.tool-focus-page .page-disclosure > summary:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: -4px;
}

.tool-focus-page .focus-details-body,
.tool-focus-page .page-disclosure > .side {
  min-width: 0;
  padding: var(--space-4);
}

.tool-focus-page .focus-details-body > .side,
.tool-focus-page .page-disclosure > .side {
  gap: var(--space-4);
}

.tool-focus-page .focus-details-body > .side {
  display: flex;
  flex-direction: column;
}

.tool-focus-page .focus-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.tool-focus-page .focus-check-card {
  min-width: 0;
  gap: var(--space-2);
  padding: var(--space-4);
  border-width: 1px;
  box-shadow: none;
}

.tool-focus-page .focus-check-card .db-readout {
  margin-top: var(--space-2);
}

.tool-focus-page .focus-check-card .btn {
  width: 100%;
  margin-top: var(--space-2);
}

.tool-focus-page .help-content {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
  padding: var(--space-4);
}

.tool-focus-page .help-content .guide-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 2px dashed var(--line);
}

.tool-focus-page .help-content .page-info {
  max-width: none;
  margin: 0;
}

.tool-focus-page .help-content .page-info h2 {
  margin-top: var(--space-5);
}

/* --- Input-family composition -------------------------------------------- */
.keyboard-focus-page .tool {
  max-width: 960px;
}

.keyboard-focus-page .keyboard-scroll {
  min-width: 0;
  scroll-margin-top: 100px;
}

.keyboard-focus-page .keyboard-live-readings {
  margin-top: var(--space-1);
}

.mouse-focus-page .mouse-stage {
  min-height: clamp(260px, 34vw, 320px);
  scroll-margin-top: 180px;
}

.mouse-focus-page .mouse-live-readings {
  margin-top: var(--space-1);
}

.mouse-focus-page .mouse-wheel-history {
  display: flex;
  min-width: 0;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: none;
}

.mouse-focus-page .mouse-wheel-history-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mouse-focus-page .cps-pad {
  min-height: 84px;
}

.mouse-focus-page #cps-btn {
  margin-top: var(--space-4);
}

.controller-focus-page .test-card > .verdict {
  order: 1;
}

.controller-focus-page .test-card > .side-head,
.controller-focus-page .test-card > .pad-grid,
.controller-focus-page .test-card > .stick-row,
.controller-focus-page .test-card > #drift-readout,
.controller-focus-page .test-card > .action-row {
  order: 2;
}

.controller-focus-page .pad-grid {
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
}

.controller-focus-page .stick-row {
  justify-content: center;
}

.touch-focus-page .touch-live-readings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--space-1);
}

.touch-focus-page .touch-stage {
  min-height: clamp(240px, 38vw, 340px);
}

@media (max-width: 600px) {
  .tool-focus-page .hero-buddy {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-3);
    max-width: none;
    margin-inline: 0;
    /* Keep the compact antenna clear of the sticky header even at the
       -8px bob apex: 40px top room minus the -20px capsule leaves headroom. */
    padding-block: 40px var(--space-3);
    text-align: left;
  }

  .tool-focus-page .hero-buddy .miko-buddy {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    margin-bottom: var(--space-4);
  }

  .tool-focus-page .hero-buddy .mascot {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    margin: 0;
    border-radius: 17px;
    transform: none;
  }

  /* The mobile face is already authored at 54px (rather than AV's scaled
     82px face), so scale the antenna itself to the same 54px proportions. */
  .tool-focus-page .hero-buddy .miko-antenna-stem {
    top: -5px;
    left: calc(50% - 1px);
    width: 10px;
    height: 10px;
    border-width: 2px;
    border-top-left-radius: 6px;
  }

  .tool-focus-page .hero-buddy .miko-antenna-capsule {
    top: -20px;
    left: calc(50% + 3px);
    width: 11px;
    height: 16px;
    border-width: 2px;
  }

  .tool-focus-page .hero-buddy .miko-antenna-capsule::after {
    height: 1px;
    box-shadow: 0 4px 0 var(--line);
  }

  .tool-focus-page .hero-buddy .mascot .eye {
    top: 18px;
    width: 9px;
    height: 11px;
  }

  .tool-focus-page .hero-buddy .mascot .eye-l { left: 14px; }
  .tool-focus-page .hero-buddy .mascot .eye-r { right: 14px; }
  .tool-focus-page .hero-buddy .mascot .blush { top: 28px; width: 9px; height: 6px; }
  .tool-focus-page .hero-buddy .mascot .blush-l { left: 7px; }
  .tool-focus-page .hero-buddy .mascot .blush-r { right: 7px; }
  .tool-focus-page .hero-buddy .mascot .mouth { top: 32px; width: 21px; height: 12px; border-bottom-width: 3px; }
  .tool-focus-page .hero-buddy .mascot.face-worried .mouth { top: 36px; height: 9px; border-top-width: 3px; }
  .tool-focus-page .hero-buddy .mascot.face-flat .mouth { top: 36px; width: 16px; border-bottom-width: 3px; }
  .tool-focus-page .hero-buddy .mascot.face-sleepy .mouth { top: 34px; width: 14px; height: 8px; border-bottom-width: 3px; }
  .tool-focus-page .hero-buddy .mascot.face-sleepy .eye { top: 23px; height: 3px; }
  .tool-focus-page .hero-buddy .mascot .wave { top: -9px; right: -7px; font-size: 16px; }

  .tool-focus-page .interview {
    padding-bottom: var(--space-3);
  }

  .tool-focus-page .hero-buddy h1 {
    font-size: clamp(1.75rem, 8vw, 2.15rem);
    line-height: 1.05;
  }

  .tool-focus-page .hero-sub {
    margin-inline: 0;
    font-size: 0.95rem;
  }

  .tool-focus-page .tool,
  .tool-focus-page .disclosure-stack {
    max-width: none;
  }

  .tool-focus-page .test-card {
    padding: var(--space-3);
  }

  .keyboard-focus-page .keyboard {
    min-width: 560px;
  }

  .tool-focus-page .compact-readings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-focus-page .compact-reading-heading {
    grid-column: 1 / -1;
  }

  .tool-focus-page .page-disclosure > summary {
    min-height: 48px;
    padding-inline: var(--space-3);
  }

  .tool-focus-page .focus-details-body,
  .tool-focus-page .page-disclosure > .side,
  .tool-focus-page .help-content {
    padding: var(--space-3);
  }

  .tool-focus-page .focus-check-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .mouse-focus-page .mouse-wheel-history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .tool-focus-page .compact-reading {
    padding-inline: var(--space-2);
  }

  .tool-focus-page .compact-reading-value {
    font-size: 1rem;
  }

  .tool-focus-page .compact-reading-code {
    font-size: 0.7rem;
  }

  .mouse-focus-page .mouse-wheel-history-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-focus-page .page-disclosure > summary::after,
  .tool-focus-page .hero-buddy .mascot .eye,
  .tool-focus-page .hero-buddy .mascot .mouth {
    transition: none;
  }

  .tool-focus-page .hero-buddy .mascot {
    animation: none;
  }
}
