/* ============================================================
   Jarq, on the page — styles for the live pieces (try.js).
   Colours come from the page's own tokens; nothing here is a hex.
   ============================================================ */

/* ---------- watch / try switch in the demo titlebar ---------- */
.demo-titlebar { padding-top: 7px; padding-bottom: 7px; }
.demo-tabs[hidden], #try-foot[hidden], .fit-panel[hidden], .jq-add[hidden] { display: none; }
#demo-mode {
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-family: inherit; font-weight: 500; font-size: 11.5px; line-height: 1;
  letter-spacing: .01em;
  user-select: none;
}
#demo-mode button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--gray);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  transition: color .18s ease, background .18s ease;
}
#demo-mode button.on {
  color: var(--bone);
  background: rgba(var(--fg-rgb), 0.12);
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
#demo-mode button i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 0 rgba(var(--orange-rgb), .55);
  animation: jq-ping 2.2s ease-out infinite;
}
#demo-mode button.on i { animation: none; box-shadow: none; }
@keyframes jq-ping {
  0%   { box-shadow: 0 0 0 0 rgba(var(--orange-rgb), .55); }
  70%  { box-shadow: 0 0 0 7px rgba(var(--orange-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--orange-rgb), 0); }
}
.demo-body { cursor: pointer; }
.demo-body:has(#scene-try:not(.hidden)) { cursor: auto; }

/* ---------- the live scene ---------- */
#scene-try { padding: 0; gap: 0; user-select: text; -webkit-user-select: text; }
.ld-win {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ld-app {
  font-family: inherit; font-weight: 500; font-size: 11px; line-height: 1;
  color: var(--gray-dim);
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ld-app::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 3px;
  background: rgba(var(--fg-rgb), 0.16);
}
.ld {
  font-family: inherit; font-weight: 400; font-size: 15px; line-height: 1.6;
  color: var(--bone);
  -webkit-tap-highlight-color: transparent;
}
.ld p { margin: 0 0 8px; }
.ld p:last-child { margin-bottom: 0; }
.ld .s {
  border-radius: 4px;
  padding: 1px 2px;
  margin: -1px -2px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, opacity .16s ease, box-shadow .18s ease;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
@media (hover: hover) {
  .ld .s:hover { background: rgba(var(--fg-rgb), 0.08); }
}
.ld .s.hint {
  box-shadow: inset 0 -2px 0 rgba(var(--orange-rgb), .55);
  animation: jq-hint 1.8s ease-in-out infinite;
}
@keyframes jq-hint {
  0%, 100% { box-shadow: inset 0 -2px 0 rgba(var(--orange-rgb), .35); }
  50%      { box-shadow: inset 0 -2px 0 rgba(var(--orange-rgb), .9); }
}
.ld .s.on {
  background: rgba(var(--fg-rgb), 0.16);
  color: var(--bone);
}
.ld .s.out { opacity: .25; }
.ld .s.flash {
  background: rgba(var(--orange-rgb), .22);
  animation: jq-flash 1.2s ease-out forwards;
}
@keyframes jq-flash {
  0%   { background: rgba(var(--orange-rgb), .28); }
  100% { background: rgba(var(--orange-rgb), 0); }
}
.ld ::selection { background: rgba(var(--orange-rgb), .32); }

.ld .ld-app-2 { margin-top: 16px; }
/* the Messages bubble in the live scene */
.ld p.ld-bubble {
  display: inline-block;
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 6px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.5;
}

.ld p.ld-bubble.me {
  display: block;
  margin-left: 12%;
  border-radius: 16px 16px 6px 16px;
  background: rgba(var(--fg-rgb), 0.08);
  border-color: rgba(var(--fg-rgb), 0.06);
}
.fit-live .ld p.ld-bubble { max-width: 100%; }
/* the dictation field */
.ld-dictate { display: flex; flex-direction: column; align-items: stretch; }
.ld-dictate .jq-pair { align-self: flex-end; }
.ld-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), 0.03);
  border: 1px solid var(--line);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.ld-input.listening {
  border-color: rgba(var(--orange-rgb), .5);
  box-shadow: 0 0 0 4px rgba(var(--orange-rgb), .10);
}
.ld-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--bone);
  font-family: inherit; font-weight: 400; font-size: 14.5px; line-height: 1.4;
  outline: 0;
  -webkit-user-select: text;
  user-select: text;
}
.ld-input input::placeholder { color: var(--gray-dim); }
.jq-mic {
  appearance: none;
  border: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bone);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  position: relative;
  transition: background .2s ease, transform .2s ease;
}
.jq-mic svg { width: 16px; height: 16px; fill: currentColor; }
.jq-mic:active { transform: scale(.94); }
.jq-mic.live { background: var(--orange); color: var(--bg); }
.jq-mic.live::before, .jq-mic.live::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--orange-rgb), .6);
  animation: jq-wave 1.6s ease-out infinite;
}
.jq-mic.live::after { animation-delay: .8s; }
@keyframes jq-wave {
  0%   { transform: scale(.9); opacity: .9; }
  100% { transform: scale(1.7); opacity: 0; }
}
.jq-mic-status {
  font-family: inherit; font-weight: 400; font-size: 12.5px; line-height: 1.5;
  color: var(--gray);
  margin-top: 8px;
  display: none;
  animation: jq-fade .25s ease;
}
.jq-mic-status.show { display: block; }
@keyframes jq-fade { from { opacity: 0; } to { opacity: 1; } }
.jq-mic-status .heard { color: var(--bone); font-style: italic; }
.jq-pair {
  appearance: none;
  border: 1px dashed rgba(var(--fg-rgb), 0.16);
  background: transparent;
  color: var(--gray);
  font-family: inherit; font-weight: 500; font-size: 12px; line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: border-color .2s ease, color .2s ease;
}
.jq-pair:hover { border-color: var(--orange); color: var(--bone); }

/* captions under every live piece */
.ld-cap {
  font-family: inherit; font-weight: 400; font-size: 12.5px; line-height: 1.5;
  color: var(--gray);
  margin-top: 10px;
  display: none;
  animation: jq-fade .25s ease;
}
.ld-cap.show { display: block; }
/* an empty caption takes no room: the window grows when there is something to say */
.ld-win .ld-cap { margin-top: 0; }
.ld-cap .check, .jq-mic-status .check, #jq-bub .check { color: var(--orange); font-weight: 600; }
.ld-cap a { color: var(--bone); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--orange); }

/* try-mode foot: hint + reset, where the tabs were */
#try-foot {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  font-size: 13px; line-height: 1.45;
  color: var(--gray);
  min-height: 34px;
}
#try-foot .try-reset {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--bone);
  font-family: inherit; font-weight: 500; font-size: 12px; line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex: none;
}
#try-foot .try-reset:hover { border-color: rgba(var(--fg-rgb), 0.16); }

/* ---------- popup and bubble ---------- */
#jq-pop {
  position: fixed;
  z-index: 60;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-width: calc(100vw - 24px);
  padding: 4px;
  border-radius: 12px;
  background: var(--panel-float);
  border: 1px solid rgba(var(--fg-rgb), 0.16);
  box-shadow: 0 12px 32px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.18);
  font-family: inherit; font-weight: 600; font-size: 12.5px; line-height: 1;
  color: var(--bone);
  user-select: none;
  -webkit-user-select: none;
  transform-origin: top left;
  animation: jq-pop .16s cubic-bezier(.2,.8,.2,1);
}
#jq-pop.show { display: inline-flex; }
@keyframes jq-pop {
  from { opacity: 0; transform: translateY(4px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
#jq-pop b {
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s ease, color .14s ease;
}
#jq-pop b:hover { background: var(--card); color: var(--bone); }
#jq-pop b.hit { background: var(--orange); color: var(--bg); }
#jq-pop b.busy { animation: jq-pulse 1s ease-in-out infinite; }
#jq-pop i { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
#jq-pop b.eye { padding: 6px 8px; display: inline-flex; }
#jq-pop b.eye svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes jq-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

#jq-bub {
  position: fixed;
  z-index: 59;
  display: none;
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel-float);
  border: 1px solid rgba(var(--fg-rgb), 0.16);
  box-shadow: 0 12px 32px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.18);
  font-family: inherit; font-weight: 400; font-size: 14.5px; line-height: 1.5;
  color: var(--bone);
  animation: jq-pop .18s cubic-bezier(.2,.8,.2,1);
}
#jq-bub.show { display: block; }
#jq-bub .bc { margin-top: 8px; font-size: 12px; color: var(--gray); }

/* ---------- the case picker ---------- */
/* Sits right under the hero demo: less air above than a full section, and
   the head is the page's own kicker + h2. */
section.fit { padding: 56px 0 72px; }
.fit-head { max-width: 560px; margin-bottom: 28px; }
.fit-head .section-sub { margin-top: 10px; }

#fit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.fit-card {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 18px 18px 16px;
  cursor: pointer;
  color: var(--bone);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 132px;
  transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.fit-card:hover { border-color: rgba(var(--fg-rgb), 0.16); background: var(--card-hover); transform: translateY(-1px); }
.fit-card.on {
  border-color: rgba(var(--orange-rgb), .7);
  box-shadow: 0 0 0 3px rgba(var(--orange-rgb), .14);
  background: var(--card-hover);
}
.fit-card > svg { width: 22px; height: 22px; fill: none; stroke: var(--gray); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.fit-card.on > svg { stroke: var(--orange); }
.fit-card b { font-weight: 500; font-size: 15.5px; line-height: 1.3; letter-spacing: -.01em; }
.fit-card > span { font-family: inherit; font-weight: 400; font-size: 13px; line-height: 1.45; color: var(--gray); }
/* A small button inside the card, so it reads as something to press and
   not as four statements to agree with. The whole card is still the target;
   the pill only says so. On the open card it turns into a filled "Open". */
.fit-go {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  font-style: normal; font-weight: 500; font-size: 12.5px; line-height: 1;
  letter-spacing: .01em;
  color: var(--bone);
  padding: 7px 10px 7px 12px;
  border-radius: 99px;
  border: 1px solid rgba(var(--fg-rgb), 0.16);
  background: rgba(var(--fg-rgb), 0.03);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.fit-go svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.fit-go .b { display: none; }
.fit-card:hover .fit-go { border-color: rgba(var(--fg-rgb), 0.3); background: rgba(var(--fg-rgb), 0.07); }
.fit-card:hover .fit-go svg { transform: translateX(2px); }
.fit-card.on .fit-go { background: var(--bone); border-color: var(--bone); color: var(--bg); }
.fit-card.on .fit-go .a { display: none; }
.fit-card.on .fit-go .b { display: inline; }
.fit-card.on .fit-go svg { transform: rotate(90deg); }

.fit-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 0;
  overflow: hidden;
  animation: jq-panel .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes jq-panel {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.fit-copy { padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fit-copy h3 { font-weight: 500; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; color: var(--bone); margin: 0; }
.fit-copy p { font-family: inherit; font-weight: 400; font-size: 15px; line-height: 1.55; color: var(--gray); margin: 0; }
.fit-copy .email-form { margin: auto 0 0; }
.fit-copy .email-form:first-of-type { margin-top: 18px; }
.fit-copy .email-err { margin-top: 8px; }
.fit-copy .cta-note { margin-top: 8px; }
.fit-live {
  padding: 24px;
  background: rgba(var(--fg-rgb), 0.02);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.fit-live .ld { font-size: 15.5px; }
.fit-live .ld-frame {
  border-radius: 14px;
  background: var(--panel-float);
  border: 1px solid var(--line);
  padding: 18px 20px;
}
.fit-live .ld-frame + .ld-frame { margin-top: 10px; }

/* ---------- the button builder ---------- */
.jq-build { user-select: text; -webkit-user-select: text; }
.jq-build .big-capsule b { cursor: pointer; }
.jq-build .big-capsule b.plus {
  border: 1px dashed rgba(var(--fg-rgb), 0.16);
  background: transparent;
  color: var(--gray);
  min-width: 34px;
  text-align: center;
}
.jq-build .big-capsule b.plus:hover { border-color: var(--orange); color: var(--bone); }
.jq-build .big-capsule b.custom { border: 1px solid rgba(var(--orange-rgb), .5); }
.jq-build .big-capsule b.new { animation: jq-in .4s cubic-bezier(.2,.8,.2,1); }
.jq-build .big-capsule b.busy { animation: jq-pulse 1s ease-in-out infinite; }
@keyframes jq-in { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.jq-add {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.jq-add[hidden] { display: none; }
.jq-add input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(var(--fg-rgb), 0.16);
  background: rgba(var(--fg-rgb), 0.04);
  color: var(--bone);
  font-family: inherit; font-weight: 400; font-size: 14px; line-height: 1.3;
  padding: 9px 12px;
  border-radius: 10px;
  outline: 0;
  -webkit-user-select: text;
  user-select: text;
}
.jq-add input:focus { border-color: var(--orange); }
.jq-add button {
  appearance: none;
  border: 0;
  background: var(--bone);
  color: var(--bg);
  font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
}
.jq-build-note { font-family: inherit; font-weight: 400; font-size: 12.5px; line-height: 1.5; color: var(--gray); margin-top: 8px; min-height: 1.5em; }
.jq-build .sample {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--panel-float);
  border: 1px solid var(--line);
  font-family: inherit; font-weight: 400; font-size: 15px; line-height: 1.55;
  color: var(--bone);
}
.jq-build .sample .s { cursor: default; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  #fit-grid { grid-template-columns: repeat(2, 1fr); }
  /* minmax(0, …), not a bare 1fr: the email form's input + button have a
     min-content wider than a phone, and a bare 1fr would grow the column to
     fit them and push the live column past the right edge. */
  .fit-panel { grid-template-columns: minmax(0, 1fr); }
  .fit-live { border-left: 0; border-top: 1px solid var(--line); order: -1; }
  .fit-copy { padding: 22px 20px 22px; }
}
@media (max-width: 600px) {
  section.fit { padding: 40px 0 56px; }
  #fit-grid { gap: 8px; }
  .fit-card { padding: 14px 14px 13px; min-height: 0; gap: 8px; border-radius: 14px; }
  .fit-card b { font-size: 14.5px; }
  .fit-card > span { font-size: 12.5px; }
  .fit-go { font-size: 12px; padding: 6px 9px 6px 10px; margin-top: 2px; }
  .fit-live { padding: 16px; }
  .fit-copy { padding: 20px 16px 20px; }
  .fit-copy .email-form .btn { padding: 11px 14px; }
  .fit-live .ld-frame { padding: 14px 16px; }
  #demo-mode button { padding: 5px 8px; font-size: 11px; }
  /* One row that scrolls sideways beats two rows that wrap wherever they
     like; the languages and the eye come first, the verbs follow. */
  #jq-pop { font-size: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #jq-pop::-webkit-scrollbar { display: none; }
  #jq-pop b { padding: 9px 9px; flex: none; }
  #jq-pop i { flex: none; }
  .jq-pair { white-space: normal; text-align: center; line-height: 1.3; font-size: 11.5px; }
  #try-foot { flex-direction: column; align-items: flex-start; }
}
/* On a phone there is no drag-select, so a tap is the whole gesture: keep
   the OS from opening its own copy/paste callout over ours. */
@media (hover: none) {
  .ld .s { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

@media (prefers-reduced-motion: reduce) {
  #demo-mode button i, .ld .s.hint, .jq-mic.live::before, .jq-mic.live::after, #jq-pop, #jq-bub, .fit-panel, .jq-build .big-capsule b.new { animation: none; }
}
