/* Haplo AI (templates/haplo_ai.html): the story's readouts and the feature panels.
   The 3D is static/motion/haploai.js. Anything drawn from the app keeps its rounded corners
   and its own dark palette (Assets.xcassets/Colors). */

/* the giant word has eight letters and a space, so it runs smaller than Cinder's */
.mx-app--haploai .mx-story__word { --word: 15.3vw; --word-phone: 16.6vw; }
.mx-haploai-plane { display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; fill: currentColor; }

/* the beats have sentence-long titles, so they run smaller than Cinder's session names */
.mx-app--haploai .mx-story__step-in { max-width: 520px; }
.mx-app--haploai .mx-story__step h2 { font-size: clamp(40px, 4.3vw, 70px); }

/* ---------- the story's readouts ---------- */
.mx-app--haploai .mx-story__fig { margin: 26px 0 0; }
.mx-app--haploai .mx-story__fig .mx-num { min-width: 1.4ch; }
.mx-haploai-reads { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.mx-haploai-reads > div {
  min-width: 92px; padding: 9px 13px 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(14, 14, 17, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.mx-haploai-reads dt { font-size: 11px; }
.mx-haploai-reads dd { margin: 1px 0 0; font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mx-haploai-reads__tokens { display: none; }   /* wide screens show the count as the big numeral */
.mx-haploai-price { margin-top: 16px; }
.mx-app--haploai .mx-story__step .mx-actions { margin-top: 26px; }

/* the prompt and the whole reply, for anyone not watching the phone: read by screen readers,
   and shown when there is no WebGL */
.mx-haploai-transcript {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mx-story.no-gl .mx-haploai-transcript {
  position: static; width: auto; height: auto; margin: 22px 0 0; overflow: visible; clip: auto; white-space: normal;
  display: flex; flex-direction: column; gap: 10px; max-width: 460px;
}
.mx-haploai-transcript p { margin: 0; font-size: 15.5px; line-height: 1.5; }
.mx-haploai-transcript__me { align-self: flex-end; padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--graphite); }
.mx-haploai-transcript__ai { color: var(--bone-2); }

/* step 2: the four models, lit as the cards are */
.mx-haploai-models { max-width: 460px; margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.mx-haploai-models li {
  position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ash);
  transition: color .3s var(--ease), opacity .3s var(--ease);
}
.mx-haploai-models li::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--accent-ink);
  transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease);
}
.mx-haploai-models img { width: 30px; height: 30px; border-radius: 8px; transition: transform .35s var(--ease); }
.mx-haploai-models__name b { display: block; font-weight: 600; font-size: 16px; color: var(--bone-2); transition: color .3s var(--ease); }
.mx-haploai-models__name i { display: block; font-style: normal; font-size: 13px; }
.mx-haploai-models__gb { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.mx-haploai-models li.is-now, .mx-haploai-models li.is-picked { color: var(--bone-2); }
.mx-haploai-models li.is-now b, .mx-haploai-models li.is-picked b { color: var(--bone); }
.mx-haploai-models li.is-now img { transform: scale(1.12); }
.mx-haploai-models li.is-now::after, .mx-haploai-models li.is-picked::after { transform: scaleX(1); }
.mx-haploai-models li.is-picked .mx-haploai-models__gb::before {
  content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2 5.1 8.3 9.2 3.9' fill='none' stroke='white' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.mx-haploai-models li.is-out { opacity: .42; }

@media (max-width: 860px) {
  /* the copy sits under the phone, so it stays short: the count joins the readouts */
  .mx-app--haploai .mx-story__step h2 { font-size: 34px; }
  .mx-app--haploai .mx-story__fig { display: none; }
  .mx-haploai-reads__tokens { display: block; }
  .mx-haploai-reads__tokens dd { min-width: 6.4ch; }
  .mx-haploai-reads { margin-top: 14px; gap: 6px; }
  .mx-haploai-reads > div { min-width: 0; padding: 7px 11px 8px; }
  .mx-haploai-reads dd { font-size: 15px; }
  .mx-app--haploai .mx-story__src { margin-top: 14px; font-size: 12.5px; }
  .mx-haploai-models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; margin-top: 14px; }
  .mx-haploai-models li { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 8px 0; }
  .mx-haploai-models img { width: 24px; height: 24px; border-radius: 6px; }
  .mx-haploai-models__name b { font-size: 14.5px; }
  .mx-haploai-models__name i { font-size: 12px; }
  .mx-haploai-models__gb { display: none; }
  .mx-haploai-models li.is-picked .mx-haploai-models__name b::after {
    content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 6px; vertical-align: -1px; border-radius: 50%;
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2 5.1 8.3 9.2 3.9' fill='none' stroke='white' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 9px no-repeat;
  }
  .mx-app--haploai .mx-story__step .mx-actions { margin-top: 16px; }
  .mx-haploai-price { margin-top: 10px; }
}

/* ---------- the feature panels: the app's own UI, small ---------- */
.mx-haploai-chat { display: flex; flex-direction: column; gap: 10px; }
.mx-haploai-chat__me {
  align-self: flex-end; max-width: 80%; margin: 0; padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, .09); border-radius: 16px; background: var(--graphite-2); font-size: 15px;
}
.mx-haploai-chat__cap { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-weight: 500; font-size: 12.5px; color: #9F9FA1; }
.mx-haploai-chat__cap svg { width: 11px; height: 11px; fill: var(--accent); }
.mx-haploai-chat__ai { margin: 0; font-size: 15px; line-height: 1.5; color: var(--bone); }
.mx-haploai-chat__foot { margin-top: 18px; }
.mx-haploai-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -2px;
  background: var(--accent); animation: mx-haploai-blink 1.1s steps(1) infinite;
}
@keyframes mx-haploai-blink { 50% { opacity: 0; } }

.mx-haploai-list { margin: 0; padding: 0; list-style: none; }
.mx-haploai-list li {
  display: grid; grid-template-columns: 30px minmax(0, 1.2fr) minmax(0, 1fr) 52px; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.mx-haploai-list li:last-child { border-bottom: 0; }
.mx-haploai-list img { width: 30px; height: 30px; border-radius: 8px; }
.mx-haploai-list b { display: block; font-weight: 600; font-size: 15px; }
.mx-haploai-list i { display: block; font-style: normal; font-size: 12.5px; color: var(--ash); }
.mx-haploai-list em { font-style: normal; font-weight: 600; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.mx-haploai-bar { height: 6px; border-radius: 3px; background: var(--graphite-2); overflow: hidden; }
.mx-haploai-bar i { width: calc(var(--v) * 100%); height: 100%; border-radius: 3px; background: var(--accent-ink); }

.mx-haploai-net { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mx-haploai-net li {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px; background: var(--graphite-2);
}
.mx-haploai-net__ic { font-size: 17px; text-align: center; }
.mx-haploai-net b { display: block; font-weight: 600; font-size: 14.5px; }
.mx-haploai-net i { display: block; font-style: normal; font-size: 12.5px; color: var(--ash); }
.mx-haploai-net em {
  font-style: normal; font-stretch: 62%; font-weight: 650; font-size: 11.5px; letter-spacing: .14em;
  text-transform: uppercase; white-space: nowrap; color: var(--ash);
}
.mx-haploai-net .is-never em { color: #7BE38F; }

.mx-haploai-gen { justify-content: flex-start; gap: 12px; }
.mx-haploai-gen img { display: block; width: 100%; height: 168px; object-fit: cover; object-position: 50% 24%; border-radius: 14px; }
.mx-haploai-gen__row { display: flex; justify-content: space-between; gap: 12px; }
.mx-haploai-gen__bar { height: 5px; border-radius: 3px; background: var(--accent-ink); }

.mx-haploai-look { justify-content: flex-start; gap: 10px; }
.mx-haploai-look__photo { align-self: flex-end; width: 96px; height: 118px; overflow: hidden; border-radius: 14px; }
.mx-haploai-look__photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.mx-haploai-look .mx-haploai-chat__me { font-size: 14.5px; }
.mx-haploai-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.mx-haploai-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: mx-haploai-dot 1.3s infinite; }
.mx-haploai-dots i:nth-child(2) { animation-delay: .16s; }
.mx-haploai-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes mx-haploai-dot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.mx-haploai-code { padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: 14px; background: #0F0F0F; }
.mx-haploai-code pre { margin: 14px 0 0; overflow-x: auto; font: 500 15px/1.65 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--bone-2); }
/* Xcode's default dark theme */
.mx-haploai-code .k { color: #FC5FA3; font-weight: 700; }
.mx-haploai-code .t { color: #5DD8FF; }
.mx-haploai-code .f { color: #67B7A4; }
.mx-haploai-code .n { color: #D0BF69; }

.mx-haploai-checks { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; font-size: 16px; color: var(--bone-2); }
.mx-haploai-checks li { display: flex; align-items: center; gap: 12px; }
.mx-haploai-checks li::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2 5.1 8.3 9.2 3.9' fill='none' stroke='white' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat;
}

@media (prefers-reduced-motion: reduce) {
  /* motion.css drops the word's transform here, centring included, so centre it with top instead */
  .mx-app--haploai .mx-story__word { top: calc(44% - var(--word) * .4); }
  .mx-haploai-caret, .mx-haploai-dots i { animation: none; }
  .mx-haploai-models li, .mx-haploai-models li::after, .mx-haploai-models img, .mx-haploai-models__name b { transition: none; }
}
@media (prefers-reduced-motion: reduce) and (max-width: 860px) {
  .mx-app--haploai .mx-story__word { top: calc(30% - var(--word-phone) * .4); }
}
