/* jasontuhy.com · Command palette with résumé — styles
   Requires tokens.css. Intro animations run while <main> has the class "play". app.js removes
   that class when the intro ends (2s), so later class changes can never restart the intro.
   The prefers-reduced-motion setting turns motion off. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); }
a { color: inherit; }

.pq-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Page ---------- */
.pq {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding: clamp(20px, 3vw, 40px);
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot) 1.2px, rgba(14, 14, 14, 0) 1.7px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
  overflow: clip;
}

.pq-stage {
  flex: 1; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
}

/* ---------- Hero ---------- */
.pq-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.pq-name { margin: 0; font-size: clamp(44px, 6.6vw, 104px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.95; }
.pq-role { margin: 0; font-size: clamp(17px, 1.5vw, 22px); font-weight: 600; letter-spacing: -0.01em; }
.pq-tagline { margin: 0; font-size: clamp(15px, 1.25vw, 18px); font-weight: 400; color: var(--muted-on-paper); }

/* Name "select-all" sweep: an ink bar sweeps across, the name flashes orange, then settles to ink */
.pq-sel { position: relative; display: inline-block; padding: 0 0.08em; isolation: isolate; }
.pq-sel::before {
  content: ""; position: absolute; top: -0.02em; bottom: -0.02em; left: 0; right: 0;
  background: var(--ink); transform: scaleX(0); transform-origin: 0 50%; z-index: -1;
}

/* "Search the résumé. Try …" chips */
.pq-tries {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px;
  font: 600 12px/1.2 var(--font-mono);
}
.pq-try {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink);
  font: 600 12px/1 var(--font-mono); cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.pq-try:hover { background: var(--ink); color: var(--paper); }
.pq-try:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Palette window ---------- */
.pq-pal {
  position: relative; width: min(1100px, 100%);
  border-radius: var(--radius-palette); background: var(--ink); color: var(--text-on-ink);
  box-shadow: var(--shadow-palette); transform-origin: 50% 0;
  container-type: inline-size; /* the list/preview layout responds to the palette's width (see Responsive) */
}
.pq-pal a { color: var(--text-on-ink); }

.pq-inputrow {
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-palette) var(--radius-palette) 0 0;
}
/* Keyboard focus cue (added for the build: the design relies on the caret alone) */
.pq-inputrow:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.pq-prompt { color: var(--accent); }
.pq-input {
  flex: 1; min-width: 0; height: 64px; padding: 0; border: 0; outline: none; background: transparent;
  font: 500 18px/1.2 var(--font-mono); color: var(--text-on-ink); caret-color: var(--accent);
}
.pq-input::placeholder { color: var(--placeholder); }

.pq-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pq-ics { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.pq-kc {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); border-bottom-width: 2px;
  background: var(--surface-1); color: var(--text-on-ink-2); font: 600 11px/1 var(--font-mono);
}

.pq-body { display: flex; flex-wrap: wrap; } /* wrap is only a fallback for browsers without container queries */

/* ---------- Result list ---------- */
.pq-listwrap { position: relative; flex: 1 1 360px; min-width: 0; padding: var(--list-pad); }
.pq-list { position: relative; }

.pq-head {
  margin: 0; height: var(--head-h); padding: 11px 12px 0;
  font: 600 11px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-on-ink);
}

/* Sliding highlight: one bar that moves with translateY to the selected row */
.pq-hl {
  position: absolute; left: var(--list-pad); right: var(--list-pad); top: var(--list-pad); height: var(--row-h);
  border-radius: var(--radius-row); background: var(--accent);
  transition: transform 0.24s var(--ease-zip), opacity 0.2s; pointer-events: none;
}
/* Activation flash. It lives on ::after so toggling it never restarts the bar's own intro animation. */
.pq-hl::after { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0; }
.pq-hl.is-act::after { animation: pqFlash 0.7s ease-out; }

.pq-row {
  position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  height: var(--row-h); padding: 0 12px; border-radius: var(--radius-row);
  text-decoration: none; color: var(--text-on-ink); transition: color 0.18s;
}
button.pq-row { width: 100%; margin: 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.pq-pal .pq-row.is-sel, .pq-pal .pq-row.is-sel:hover { color: var(--ink); }
.pq-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pq-row.is-sel:focus-visible { outline-color: var(--ink); }

.pq-ri {
  display: flex; width: 30px; height: 30px; align-items: center; justify-content: center;
  border-radius: var(--radius-md); background: var(--surface-2); color: var(--accent);
  font: 800 14px/1 var(--font-mono); transition: background-color 0.18s;
}
.pq-row.is-sel .pq-ri { background: var(--ink); }
.pq-rtxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pq-rl { font-size: 15px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pq-rs { font-size: 12px; font-weight: 500; line-height: 1.2; opacity: 0.72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pq-row.is-sel .pq-rs { opacity: 0.85; } /* 5.0:1 on the orange bar (0.72 would be 4.1:1, below AA) */
.pq-mark { background: none; color: inherit; font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pq-rk { display: inline-flex; opacity: 0; transition: opacity 0.15s; }
.pq-row.is-sel .pq-rk { opacity: 1; }
.pq-rk .pq-kc { background: var(--ink); border-color: var(--ink); color: var(--accent); }

/* Empty state */
.pq-empty { padding: 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.pq-empty-msg { margin: 0; font-size: 15px; color: var(--text-on-ink-3); }
.pq-empty-sugs { display: flex; flex-wrap: wrap; gap: 8px; }
.pq-sug {
  min-height: 44px; padding: 0 14px; border-radius: var(--radius-row); border: 1px solid var(--line-2);
  background: var(--surface-1); color: var(--text-on-ink); font: 500 13px/1 var(--font-mono); cursor: pointer;
}
.pq-sug:hover { border-color: var(--accent); }
.pq-sug:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Preview pane ---------- */
.pq-prev {
  flex: 1.5 1 420px; min-width: 0; padding: 24px 26px;
  display: flex; flex-direction: column; gap: 16px;
  border-left: 1px solid var(--line);
}
.pq-pi {
  display: flex; width: 56px; height: 56px; flex: none; align-items: center; justify-content: center;
  border-radius: var(--radius-xl); background: var(--accent); color: var(--ink); font: 800 24px/1 var(--font-mono);
}
.pq-pi .pq-ic { width: 26px; height: 26px; }
.pq-kick { margin: 0; font: 600 11px/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-on-ink); }
.pq-pt { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.pq-co { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--text-on-ink); }
.pq-meta { margin: 0; font: 500 12px/1.4 var(--font-mono); color: var(--muted-on-ink); }
.pq-pd { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-on-ink-3); }
.pq-pd-lg { font-size: 17px; color: var(--text-on-ink-2); }
.pq-rolehead { display: flex; align-items: center; gap: 16px; }
.pq-rolehead > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pq-ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--text-on-ink-2); }
.pq-ul li { position: relative; padding-left: 18px; }
.pq-ul li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 7px; height: 7px; background: var(--accent); }
.pq-ul strong { color: var(--text-on-ink); font-weight: 700; }
.pq-hit { background: var(--accent); color: var(--ink); border-radius: var(--radius-xs); }
.pq-hit:empty { display: none; }
.pq-chips { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.pq-chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-md);
  border: 1px solid var(--line-2); background: var(--surface-1); color: var(--text-on-ink);
  font: 600 13px/1 var(--font-mono); transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.pq-chip.is-hit { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.pq-actions { display: flex; flex-wrap: wrap; gap: 10px; }
:is(.pq-pal, .pq-dialog) .pq-open {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; min-height: 48px; padding: 0 18px;
  border-radius: var(--radius-lg); background: var(--accent); color: var(--ink);
  font-size: 15px; font-weight: 700; text-decoration: none; transition: transform 0.2s, background-color 0.2s;
}
:is(.pq-pal, .pq-dialog) .pq-open:hover { transform: translateY(-2px); background: var(--accent-hover); color: var(--ink); }
:is(.pq-pal, .pq-dialog) .pq-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:is(.pq-pal, .pq-dialog) .pq-open2 { background: transparent; color: var(--text-on-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
:is(.pq-pal, .pq-dialog) .pq-open2:hover { background: var(--accent); color: var(--ink); }
.pq-busy { display: flex; flex-direction: column; gap: 10px; }
.pq-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pq-barfill { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; animation: pqFill 1.2s var(--ease-fill) both; }

/* ---------- Footer ---------- */
.pq-foot {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 10px 16px; border-top: 1px solid var(--line);
  font: 500 12px/1.2 var(--font-mono); color: var(--muted-on-ink);
}
.pq-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.pq-keys > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Intro (runs while <main> has .play) ---------- */
.play .pq-sel::before { animation: pqSelBar 1.3s var(--ease-swipe) 0.2s backwards; }
.play .pq-sel { animation: pqSelText 1.3s steps(1, end) 0.2s backwards; }
.play .pq-line { animation: pqUp 0.7s var(--ease-out-expo) 0.55s backwards; }
.play .pq-tries { animation: pqUp 0.7s var(--ease-out-expo) 0.7s backwards; }
.play .pq-pal { animation: pqSummon 0.95s var(--ease-spring) 0.62s backwards; }
.play .pq-inner { animation: pqGlitch 0.32s steps(1, end) 1.5s backwards; }
.play .pq-hl { animation: pqFade 0.3s 1.35s backwards; }
.play .pq-foot { animation: pqFade 0.5s 1.4s backwards; } /* last intro animation: ends at 1.9s */

/* Rows slide in whenever they appear: during the intro (staggered delay set inline by app.js)
   and when a search brings them back (no delay). app.js only adds .pq-rowin while motion is on. */
.pq-rowin { animation: pqRow 0.5s var(--ease-out-expo) backwards; }

@keyframes pqFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pqSelBar {
  0% { transform: scaleX(0); transform-origin: 0 50%; }
  40% { transform: scaleX(1); transform-origin: 0 50%; }
  75% { transform: scaleX(1); transform-origin: 100% 50%; }
  100% { transform: scaleX(0); transform-origin: 100% 50%; }
}
@keyframes pqSelText { 0% { color: transparent; } 25% { color: var(--accent); } 85% { color: var(--ink); } 100% { color: var(--ink); } }
@keyframes pqUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pqSummon {
  0% { transform: translateY(-150px) scale(0.12, 0.04); opacity: 0; filter: blur(14px); }
  45% { opacity: 1; filter: blur(0); }
  100% { transform: translateY(0) scale(1, 1); opacity: 1; filter: blur(0); }
}
@keyframes pqGlitch {
  0% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  20% { clip-path: inset(12% 0 58% 0); transform: translate(-10px, 0); }
  40% { clip-path: inset(62% 0 6% 0); transform: translate(8px, 0); }
  60% { clip-path: inset(30% 0 40% 0); transform: translate(-5px, 0); }
  80% { clip-path: inset(0 0 0 0); transform: translate(3px, 0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
}
@keyframes pqRow { from { transform: translateX(-22px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pqFlash {
  0% { opacity: 1; background-color: var(--paper); box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.9); }
  100% { opacity: 1; background-color: var(--accent); box-shadow: 0 0 0 14px rgba(var(--accent-rgb), 0); }
}
@keyframes pqFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Responsive ---------- */
/* List and preview sit side by side while the palette is at least 780px wide (their flex bases:
   360px + 420px). Below that, the preview stacks under the list and the divider moves to the top. */
@container (width < 780px) {
  .pq-body { flex-direction: column; }
  .pq-listwrap, .pq-prev { flex: 0 0 auto; }
  .pq-prev { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Motion off: OS setting ---------- */
@media (prefers-reduced-motion: reduce) {
  .pq *, .pq *::before, .pq *::after { animation: none !important; transition: none !important; }
}

/* Portfolio integration: native touch preview, short archive, and usable plain résumé. */
.pq-try,.pq-sug{min-height:44px}
.pq-clear,.pq-dialog-head button{display:grid;place-items:center;background:transparent;color:var(--text-on-ink);border:0;font:400 24px/1 var(--font-sans);width:44px;height:44px;cursor:pointer}
.pq-clear{flex:none}
.pq-clear:focus-visible,.pq-dialog-head button:focus-visible,.pq-prev:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
.pq-inputrow:has(.pq-clear:not([hidden])) .pq-escape-hint{display:none}
.pq-detail,.pq-dialog{color:var(--text-on-ink)}
.pq-dialog{border:1px solid var(--line);border-radius:16px;padding:18px;background:var(--ink);width:min(38rem,calc(100% - 20px));max-width:none;max-height:85dvh;overflow:auto;overflow-wrap:anywhere;box-shadow:0 20px 50px #0008}
.pq-dialog::backdrop{background:#0e0e0eb5}
.pq-dialog-head{display:flex;gap:12px;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line);margin-bottom:16px}
.pq-dialog-head h2{font:600 13px var(--font-mono);margin:0}
.pq-tail,.pq-plain{width:min(100%,1100px);font-size:.9rem}
.pq-tail{display:flex;justify-content:space-between;align-items:flex-start;flex-wrap:wrap;gap:.35rem 1.25rem}
.pq-tail nav{display:flex;flex-wrap:wrap;gap:.75rem}
.pq-tail :is(a,summary){display:inline-flex;align-items:center;min-height:44px;cursor:pointer}
.pq-tail summary{display:list-item;padding-block:.75rem}
.pq-tail summary:focus-visible,.pq-tail a:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.pq-record{max-width:37ch}
.pq-record p{margin:0 0 .12rem}
.pq-plain{max-width:46rem}
.pq-plain li{margin-bottom:.45rem}
@media(max-width:840px){
  .pq-body{flex-direction:column}
  .pq-listwrap,.pq-prev{flex:0 0 auto}
  .pq-prev{border-left:0;border-top:1px solid var(--line)}
  .pq-row[aria-haspopup="dialog"]::after{content:"›";position:absolute;right:16px;color:inherit;font-size:19px}
  .pq-row[aria-haspopup="dialog"] .pq-rk{display:none}
  .pq-row[aria-haspopup="dialog"] .pq-rtxt{margin-right:16px}
  .pq-escape-hint{display:none}
}
