/* home.css: HOME (หน้าแรก) — the selected robot body + body / PPE / AUTO SWITCH / guide-voice pickers + the three big links.
   tokens from tokens.css, components (.lbl, .bracket-4, .cham, .seg, .switch, .chip, .btn) from style.css,
   the body colours from mascot.css. Phone: one column, hero ≈ 45 vh · desktop (≥ 900): hero left (sticky), controls right. */

.home { display: flex; flex-direction: column; gap: var(--s-5); }

/* ---------------------------------------------------------------- hero */
.home-hero {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 26px 16px 18px; background: var(--panel); border: 1px solid var(--line);
}
.home-kicker { position: absolute; left: 16px; top: 12px; margin: 0; }
.home-body { width: 100%; height: 45vh; min-height: 240px; max-height: 440px; display: flex; justify-content: center; }
.home-body .mb { height: 100%; width: auto; max-width: 100%; }
/* turn the guide (ADR 0020): a compact row under the body; disabled = muted, the note says why */
.home-turn { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; }
.home-turn-btn { min-width: var(--touch); min-height: var(--touch); padding: 0; justify-content: center; }
.home-turn-btn .ico { width: 20px; height: 20px; }
.home-turn-front { min-height: var(--touch); }
.home-turn button:disabled { opacity: .45; cursor: default; }
.home-turn-note { margin: 2px 0 0; min-height: 1.4em; font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.home-body-fail { margin: auto; font-size: var(--fs-sm); color: var(--muted); text-align: center; }
.home-meta { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 10px; text-align: center; }
.home-name { font-family: var(--font-hud); font-size: clamp(1.5rem, 1rem + 2.4vw, 2rem); font-weight: 600; letter-spacing: .04em; margin: 0; }
.home-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; }
.home-note { margin: 0; max-width: 42ch; font-size: var(--fs-sm); color: var(--muted); line-height: 1.6; }
.home-note[hidden] { display: none; }
.home-state { margin: 4px 0 0; min-height: 1.6em; }
.home-tap { margin: 0; font-size: var(--fs-xs); color: var(--muted); }
/* tap to say hi (handoff 2026-11-16 task 4): the greeting as a caption under the body — it shows even when there is
   no sound · enters with a short fade (opacity only), no movement */
.home-say {
  position: relative; margin: 4px 0 0; max-width: 32ch; padding: 8px 14px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); color: var(--text);
  font-size: var(--fs-sm); line-height: var(--lh-tight); animation: home-say-in 180ms var(--ease-out);
}
.home-say::before { /* the speech tail points up at the body */
  content: ""; position: absolute; top: -6px; left: 50%; width: 10px; height: 10px; margin-left: -5px;
  background: var(--panel-solid); border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong);
  transform: rotate(45deg);
}
@keyframes home-say-in { from { opacity: 0; } }
.home-talk {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); padding: 0 6px;
  color: var(--scan); text-decoration: none;
}
.home-talk .ico { width: 16px; height: 16px; }
.home-talk-th { font-size: var(--fs-sm); }
@media (hover: hover) and (pointer: fine) { .home-talk:hover .home-talk-th { text-decoration: underline; } }

/* ------------------------------------------------------------ controls */
.home-ctl { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.home-block { display: flex; flex-direction: column; gap: var(--s-3); }
.home-h { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: var(--fs-lg); }
.home-h > .lbl { font-size: var(--lbl-size); }
.home-h-th { font-family: var(--font-ui); font-weight: 500; letter-spacing: 0; }

/* body picker: horizontal strip of still thumbnails (radios) */
.home-pick {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin: 0 calc(-1 * var(--edge)); padding: 2px var(--edge) 6px;
}
.home-pick::-webkit-scrollbar { display: none; }
.home-pick-btn {
  flex: 0 0 auto; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 104px; min-height: 150px; padding: 8px 6px 10px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); cursor: pointer; font: inherit; text-align: center; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease;
}
.home-pick-btn[aria-checked="true"] { border-color: var(--scan); background: var(--scan-soft); box-shadow: inset 0 2px 0 var(--scan); }
.home-pick-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .home-pick-btn:hover { background: var(--scan-hover); } }
.home-thumb { display: block; width: 72px; height: 96px; }
.home-pick-name { font-family: var(--font-ui); font-size: var(--fs-xs); line-height: 1.3; }
.home-pick-h { font-size: 10px; }

.home-switch { padding: 2px 0; }
.home-switch-l { display: flex; flex-direction: column; gap: 2px; }
.home-switch-th { font-size: var(--fs-md); }

/* AUTO SWITCH (ADR 0033): a fieldset of small check chips (same look as the voice segment) + SAVE; a hidden
   checkbox inside each label, the span shows the state; the check mark only shows when ticked */
.home-rot { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.home-rot-h { display: flex; flex-direction: column; gap: 2px; padding: 0; margin-bottom: var(--s-2); }
.home-rot-th { font-size: var(--fs-md); }
.home-rot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.home-rot-chip { position: relative; display: inline-flex; }
.home-rot-chip input { position: absolute; opacity: 0; pointer-events: none; }
.home-rot-chip > span {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); padding: 0 var(--s-3);
  border: 1px solid var(--line); border-top: 2px solid transparent; background: transparent; color: var(--text);
  font-family: var(--font-ui); font-size: var(--fs-sm); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur-1) ease, background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.home-rot-ico { width: 14px; height: 14px; opacity: 0; transition: opacity var(--dur-1) ease; }
.home-rot-chip input:checked + span { background: var(--scan-soft); color: var(--scan); border-color: var(--line); border-top-color: var(--scan); }
.home-rot-chip input:checked + span .home-rot-ico { opacity: 1; }
.home-rot-chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.home-rot-chip input:disabled + span { opacity: .45; cursor: default; }
@media (hover: hover) and (pointer: fine) { .home-rot-chip input:not(:disabled) + span:hover { background: var(--scan-hover); } }
.home-rot-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.home-rot-off[hidden] { display: none; }

.home-seg label { flex: 1 1 0; }
.home-seg label span { width: 100%; justify-content: center; font-family: var(--font-ui); font-size: var(--fs-md); letter-spacing: 0; text-transform: none; }
.home-sample-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.home-hint { margin: 0; }
.home-role { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.home-role .home-hint { flex: 1 1 16em; }

/* the three big chamfered links */
.home-links { display: grid; gap: 10px; }
.home-link {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 20px; align-items: center; gap: 14px;
  min-height: 64px; padding: 10px 18px; background: var(--panel-solid); border: 1px solid var(--line-strong);
  color: var(--text); text-decoration: none; transition: background-color var(--dur-1) ease;
}
.home-link:active { background: var(--scan-hover); }
@media (hover: hover) and (pointer: fine) { .home-link:hover { background: var(--scan-hover); } }
.home-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.home-link-ico { width: 26px; height: 26px; color: var(--scan); }
.home-link-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-link-code { font-family: var(--font-hud); font-size: 17px; font-weight: 600; letter-spacing: .14em; line-height: 1.2; }
.home-link-th { font-size: var(--fs-sm); color: var(--muted); }
.home-link-arrow { width: 18px; height: 18px; color: var(--scan); }

.home-block-def { gap: var(--s-2); }
.home-def { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: var(--fs-sm); }
.home-def[hidden] { display: none; }
.home-save { align-self: flex-start; }

/* --------------------------------------------------- desktop (≥ 900) */
@media (min-width: 900px) {
  .home { flex-direction: row; align-items: flex-start; gap: var(--s-7); }
  .home-hero { flex: 1 1 52%; position: sticky; top: 88px; min-height: 560px; padding: 40px 32px 28px; }
  .home-kicker { left: 24px; top: 18px; }
  .home-body { height: min(60vh, 520px); max-height: none; }
  .home-ctl { flex: 1 1 48%; max-width: 520px; }
  .home-pick { margin: 0; padding: 2px 0 6px; flex-wrap: wrap; overflow: visible; }
  .home-pick-btn { width: calc(20% - 7px); min-width: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-pick-btn, .home-link, .home-rot-chip > span, .home-rot-ico { transition: none; }
}
