/* app.css — components for Palette Studio. Authored entirely with §3 tokens. */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.5;
  -webkit-font-smoothing: antialiased; transition: background .2s, color .2s;
}
h1, h2, h3 { margin: 0; font-weight: 600; font-family: var(--display); letter-spacing: -.01em; }
button { font-family: var(--font); cursor: pointer; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.micro { font-size: var(--fs-micro); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }

/* buttons (one style, both themes) */
.btn { height: var(--tap); padding: 0 14px; border-radius: var(--r-ctrl); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 7px; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.icon { padding: 0; width: var(--tap); justify-content: center; font-size: 15px; }

/* header */
header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 9px; margin-right: 4px; }
.logo .mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center;
  color: var(--on-accent); font-family: var(--display); font-weight: 700; font-size: 15px; }
.logo .t { font-family: var(--display); font-weight: 600; font-size: 17px; }
.logo .t small { color: var(--text-faint); font-weight: 500; font-size: 12px; margin-left: 5px; font-family: var(--font); }
.spacer { flex: 1; }
.hexin { display: flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-ctrl); padding: 0 10px; height: var(--tap); }
.hexin span { color: var(--text-faint); font-size: 13px; }
.hexin input { border: none; background: transparent; color: var(--text); font-family: var(--mono); font-size: 13px;
  width: 72px; outline: none; text-transform: uppercase; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-ctrl); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; color: var(--text-muted); height: 30px; padding: 0 12px;
  border-radius: 8px; font-weight: 500; font-size: 12.5px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button:focus-visible { outline: none; box-shadow: var(--focus); }

/* layout */
main { max-width: 1180px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.workspace { display: grid; gap: 16px; }
.sw { border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); flex: none; }

/* picker */
.picker .head { padding: 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
input[type="search"], select { height: var(--tap); border: 1px solid var(--border); border-radius: var(--r-ctrl);
  background: var(--surface); color: var(--text); padding: 0 10px; font-family: inherit; font-size: 13px; width: 100%; }
input:focus, select:focus, .hexin:focus-within { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.list { max-height: 60vh; overflow: auto; padding: 6px; }
.paintrow { display: flex; align-items: center; gap: 2px; }
.paint { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: var(--r-ctrl); cursor: pointer; border: 1px solid transparent; flex: 1; min-width: 0; text-align: left; background: transparent; }
.paint:hover { background: var(--surface-2); }
.paint[aria-current="true"] { background: var(--accent-weak); border-color: var(--accent); }
.paint .nm { font-size: 13px; font-weight: 500; }
.paint .br { font-size: 11px; color: var(--text-muted); }
.count { padding: 8px 14px 14px; font-size: 12px; color: var(--text-faint); }

/* base hero */
.hero { display: flex; gap: 16px; align-items: center; }
.hero .big { width: 84px; height: 84px; }
.hero h2 { font-size: var(--fs-h1); }
.tag { font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted); }
.tag.role { background: var(--accent-weak); color: var(--accent); }
.tag.approx { background: var(--warning-weak); color: var(--warning); }
.hexline { margin-top: 9px; font-family: var(--mono); font-size: 13px; color: var(--text-muted); }

.hint { color: var(--text-faint); font-size: 12px; margin: 6px 0 0; }

/* tabs + panels */
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin-top: 8px; overflow-x: auto; }
.tabs button { border: none; background: transparent; padding: 11px 2px; color: var(--text-muted); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[data-panel] { animation: mh-fade .22s ease both; }
@keyframes mh-fade { from { opacity: 0; } to { opacity: 1; } }
.palette { display: flex; border-radius: var(--r-ctrl); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); height: 48px; margin: 14px 0 0; }
.palette > div { flex: 1; }

/* role slots (ideal vs actual) */
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-top: 14px; }
.slot { border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px; background: var(--surface); }
.slot .shead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.slot .role { font-family: var(--display); font-weight: 600; font-size: 14px; }
.slot .wt { font-size: 11px; color: var(--text-faint); }
.ivsa { display: flex; align-items: center; gap: 10px; }
.ivsa .ideal, .ivsa .act { width: 44px; height: 44px; flex: none; }
.ivsa .arr { color: var(--text-faint); }
.ivsa .nm { font-size: 12.5px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ivsa .br { font-size: 11px; color: var(--text-muted); }
.ttl { font-size: 11px; color: var(--text-faint); font-weight: 500; margin-bottom: 2px; }
.de { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 3px; font-size: 11px; font-weight: 500; }
.de .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.ladder { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.ladder .step { flex: 1; text-align: center; }
.ladder .step .sw { width: 100%; height: 30px; }
.ladder .step .cap { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.ladder .step .pn { font-size: 10.5px; font-weight: 500; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* generic chips/rows reused by equivalents + a11y */
.eq { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.eqc { display: flex; gap: 9px; align-items: center; border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 9px; }
.eqc .sw { width: 38px; height: 38px; }
.placeholder { color: var(--text-faint); font-size: 13px; padding: 24px 4px; }

/* explore wheel (M5) */
.wheelwrap { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; }
.wheelcol { flex: none; }
.wcanvas { touch-action: none; cursor: grab; display: block; }
.wctrl { display: flex; align-items: center; gap: 10px; margin-top: 12px; width: 280px; max-width: 100%; }
.wctrl input[type="range"] { accent-color: var(--accent); }
.miniwrap { flex: 1; min-width: 220px; }
.mini { display: flex; flex-direction: column; gap: 7px; }
.mrow { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.mrow .arr { color: var(--text-faint); }
.mrow .mn { font-weight: 500; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* accessibility (M7) */
.crow { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; margin: 7px 0; }
.crow .clab { font-size: 12px; font-weight: 500; }
.cstrip { display: flex; gap: 5px; }
.ctr { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.ctrbox { border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 12px; }
.ctrbox .pair { display: flex; gap: 7px; margin: 8px 0; }
.ratio { font-size: 20px; font-weight: 600; font-family: var(--display); }
.collide { margin-top: 16px; font-size: 12.5px; background: var(--warning-weak); color: var(--warning); border-radius: var(--r-ctrl); padding: 10px 12px; }
.collide.ok { background: var(--success-weak); color: var(--success); }

/* owned star + compare + toast (M8) */
.own { flex: none; font-size: 16px; line-height: 1; color: var(--text-faint); cursor: pointer; padding: 4px 6px;
  background: transparent; border: none; border-radius: var(--r-ctrl); }
.own:hover { color: var(--text-muted); }
.own:focus-visible { outline: none; box-shadow: var(--focus); }
.own.on, .own.on:hover { color: var(--accent); }
.compare { border: 1px solid var(--border); border-radius: var(--r-ctrl); padding: 10px 12px; margin: 4px 0 10px; background: var(--surface-2); }
.cmphead { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.cmprow { display: flex; align-items: center; gap: 10px; margin: 5px 0; flex-wrap: wrap; }
.cmplab { font-size: 12px; min-width: 180px; }
.cmppal { display: flex; flex: 1; min-width: 160px; height: 22px; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.cmppal span { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: var(--r-pill); font-size: 13px; font-weight: 500; box-shadow: var(--shadow); z-index: 50; }

/* responsive */
@media (max-width: 860px) {
  main { grid-template-columns: 1fr; gap: 16px; }
  .picker { order: -1; }
  .list { max-height: 230px; }
}
@media (max-width: 520px) {
  :root { --tap: 44px; }
  .bar { padding: 10px 14px; gap: 8px; }
  .logo .t small { display: none; }
  .hexin { order: 3; flex: 1 1 100%; }
  .hexin input { width: 100%; }
  main { padding: 14px; }
  .pad { padding: 14px; }
  .hero .big { width: 64px; height: 64px; }
  .seg { width: 100%; }
  .seg button { flex: 1; text-align: center; }
}

/* motion — fades + gentle bounce (§3.4) */
@keyframes mh-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes mh-pop { 0% { transform: scale(.82); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
.card { animation: mh-rise .32s cubic-bezier(.2,.7,.2,1) both; }
.hero .big { animation: mh-pop .42s cubic-bezier(.34,1.56,.64,1) both; }
.btn:active, .seg button:active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
