/*
 * Media in an article (2026-11-04): the blocks in apps/public/article_blocks.py
 * and a hero of art behind a post's title. The rule from the home page holds:
 * text never sits on paint. The title sits on an ink panel over the art, and
 * captions sit on the page.
 *
 * Motion is decoration only. Everything reads, in order, with no script and
 * under prefers-reduced-motion; static/js/article-media.js adds the motion.
 */

.zm-article { overflow-x: clip; }

/* Blocks break out of the reading column, centered on it. */
.post-body > .zm-block {
  --w: min(calc(100vw - 2rem), 64rem);
  width: var(--w);
  margin-left: calc((100% - var(--w)) / 2);
  margin-top: 3.5rem;
  margin-bottom: 3.5rem;
}
.zm-caption {
  max-width: 40rem; margin: 1.25rem auto 0; text-align: center;
  color: rgb(var(--c-ink-faint)); font-size: 0.95rem; line-height: 1.6;
}
.zm-caption p + p { margin-top: 0.5rem; }

/* Fade up when it comes on screen — only once script has said it will. */
.js-motion .zm-reveal { opacity: 0; transform: translateY(2rem); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.js-motion .zm-reveal.is-in { opacity: 1; transform: none; }

/* --- The hero: art behind the title ------------------------------------------ */
.zm-hero { position: relative; min-height: min(88vh, 54rem); display: grid; align-items: end; overflow: hidden; background: #0b0b0d; }
.zm-hero__art, .zm-hero__art img, .zm-hero__art video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.zm-hero__art { transform: scale(1.08); will-change: transform; }
.zm-hero__art video { opacity: 0; transition: opacity 1.2s ease; }
.zm-hero__art video.is-playing { opacity: 1; }
.zm-hero__inner { position: relative; padding: 0 1rem 3rem; width: 100%; max-width: 64rem; margin: 0 auto; }
@media (min-width: 640px) { .zm-hero__inner { padding: 0 2rem 4rem; } }
.zm-hero__panel {
  background: #0b0b0d; color: #f2eee7; padding: 1.5rem 1.5rem 1.75rem; max-width: 46rem;
  box-shadow: 0.75rem 0.75rem 0 #ff3cac;
}
@media (min-width: 640px) { .zm-hero__panel { padding: 2rem 2.5rem 2.25rem; } }
.zm-hero__meta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: #b7b1aa; }
.zm-hero__meta a { color: #ff3cac; }
.zm-hero .post-title { color: #f2eee7; margin-top: 1rem; }
.js-motion .zm-hero__panel { animation: zm-rise 1s .2s cubic-bezier(.2,.7,.2,1) both; }
@keyframes zm-rise { from { opacity: 0; transform: translateY(2.5rem); } }

/* --- A phone frame ------------------------------------------------------------- */
.zm-phone {
  position: relative; width: min(100%, 19rem); margin: 0 auto; aspect-ratio: 660 / 1434;
  border-radius: 2.6rem; padding: 0.55rem; background: #0b0b0d;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .08) inset, 0 2.5rem 4rem -1.5rem rgb(11 11 13 / .45), 0 0 0 2px #2a2a30;
}
.zm-phone img, .zm-phone video { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 2.1rem; background: #fff; }

.zm-phones__row { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; }
.zm-phones__row .zm-phone { flex: 0 1 17rem; margin: 0; }
/* Two phones lean in toward each other, like a spread. */
@media (min-width: 768px) {
  .zm-phones[data-count="2"] .zm-phone:first-child { transform: rotate(-3deg) translateY(1rem); }
  .zm-phones[data-count="2"] .zm-phone:last-child { transform: rotate(3deg); }
}

/* --- Video ---------------------------------------------------------------------- */
.zm-video { position: relative; }
.zm-video::before {
  content: ""; position: absolute; inset: 10% 15%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 60 172 / .55), rgb(123 63 228 / .35) 55%, transparent);
  filter: blur(2.5rem);
}
.zm-video__toggle {
  position: absolute; right: 1rem; bottom: 1rem; padding: .3rem .7rem; border-radius: 999px;
  background: rgb(11 11 13 / .7); color: #f2eee7; font-size: .75rem; letter-spacing: .04em;
}
.zm-video__toggle:focus-visible { outline: 2px solid #ff3cac; outline-offset: 2px; }

/* --- Walkthrough ---------------------------------------------------------------- */
.zm-walk__steps { list-style: none; padding: 0; counter-reset: none; }
.zm-walk__step { display: grid; grid-template-columns: 2.75rem 1fr; gap: 0 1rem; padding: 2rem 0; border-top: 1px solid rgb(var(--c-line)); }
.zm-walk__num {
  grid-row: span 2; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center;
  font-family: "Archivo", "Inter", system-ui, sans-serif; font-stretch: 62.5%; font-weight: 900; font-size: 1.4rem;
  background: rgb(var(--c-surface-alt)); color: rgb(var(--c-ink)); transition: background .4s, color .4s, transform .4s;
}
.zm-walk__text { color: rgb(var(--c-ink-soft)); }
.zm-walk__text strong { color: rgb(var(--c-ink)); }
.zm-walk__text p + p { margin-top: .75rem; }
.zm-walk__inline { margin-top: 1.5rem; width: min(100%, 16rem); margin-left: 0; }
.zm-walk__phone { display: none; }

@media (min-width: 1024px) {
  .zm-walk { display: grid; grid-template-columns: 20rem 1fr; gap: 4rem; align-items: start; }
  .zm-walk__phone { display: block; position: sticky; top: 12vh; }
  .zm-walk__phone .zm-phone img { position: absolute; inset: .55rem; width: calc(100% - 1.1rem); height: calc(100% - 1.1rem); opacity: 0; transform: scale(.97); transition: opacity .5s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
  .zm-walk__phone .zm-phone img.is-on { opacity: 1; transform: none; }
  .zm-walk__inline { display: none; }
  .zm-walk__step { min-height: 62vh; align-content: center; border-top: 0; padding: 0; }
  .zm-walk__text { font-size: 1.25rem; line-height: 1.7; transition: opacity .4s; }
  .js-motion .zm-walk__step:not(.is-on) .zm-walk__text { opacity: .35; }
  .zm-walk__step.is-on .zm-walk__num { background: #ff3cac; color: #0b0b0d; transform: scale(1.12); }
}

/* --- Bars --------------------------------------------------------------------------- */
.zm-bars { max-width: 46rem; }
.post-body > .zm-bars { --w: min(calc(100vw - 2rem), 46rem); }
.zm-bars__title, .zm-pipe__title {
  font-family: "Archivo", "Inter", system-ui, sans-serif; font-stretch: 75%; font-weight: 800;
  font-size: 1.25rem; color: rgb(var(--c-ink)); margin-bottom: 1.25rem;
}
.zm-bars__list { list-style: none; padding: 0; }
.zm-bar { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr 3rem; gap: .75rem; align-items: center; padding: .35rem 0; }
.zm-bar + .zm-bar { margin-top: 0 !important; }
.zm-bar__label { font-size: .95rem; color: rgb(var(--c-ink)); line-height: 1.3; }
.zm-bar__value { font-variant-numeric: tabular-nums; font-weight: 700; color: rgb(var(--c-ink)); text-align: right; }
.zm-bar__track { height: 1.1rem; background: rgb(var(--c-surface-alt)); border-radius: 999px; overflow: hidden; }
.zm-bar__fill { display: block; height: 100%; width: var(--v); border-radius: 999px; background: var(--pigment-violet, #7b3fe4); }
.js-motion .zm-bar__fill { width: 0; transition: width 1.4s cubic-bezier(.2,.7,.2,1); }
.js-motion .zm-bars.is-in .zm-bar__fill { width: var(--v); }
.zm-bars.is-in .zm-bar:nth-child(2) .zm-bar__fill { transition-delay: .08s; }
.zm-bars.is-in .zm-bar:nth-child(3) .zm-bar__fill { transition-delay: .16s; }
.zm-bars.is-in .zm-bar:nth-child(4) .zm-bar__fill { transition-delay: .24s; }
.zm-bars.is-in .zm-bar:nth-child(5) .zm-bar__fill { transition-delay: .32s; }
.zm-bars.is-in .zm-bar:nth-child(6) .zm-bar__fill { transition-delay: .40s; }
.zm-bars.is-in .zm-bar:nth-child(7) .zm-bar__fill { transition-delay: .48s; }
.zm-bars.is-in .zm-bar:nth-child(8) .zm-bar__fill { transition-delay: .56s; }
.zm-bars.is-in .zm-bar:nth-child(9) .zm-bar__fill { transition-delay: .64s; }
.zm-bar--bar .zm-bar__fill { background: repeating-linear-gradient(-45deg, rgb(var(--c-ink)) 0 6px, rgb(var(--c-ink-soft)) 6px 12px); }
.zm-bar--bar .zm-bar__label::after { content: " · the bar"; color: rgb(var(--c-ink-faint)); }
.zm-bar--apple .zm-bar__fill { background: linear-gradient(90deg, #ff3cac, #7b3fe4); }
.zm-bar--apple .zm-bar__label { font-weight: 700; }
.zm-bar--after .zm-bar__fill { background: linear-gradient(90deg, #22c7e8, #61b868); }
.zm-bar--after .zm-bar__label { font-weight: 700; }
.zm-bar--quiet .zm-bar__fill { background: rgb(var(--c-line-strong)); }

/* --- Pipeline ------------------------------------------------------------------------ */
.zm-pipe__stages { list-style: none; padding: 0; position: relative; display: grid; gap: 1.25rem; }
.zm-pipe__stage { position: relative; display: grid; grid-template-columns: 2.5rem 1fr; gap: .1rem 1rem; margin: 0 !important; }
.zm-pipe__dot {
  grid-row: span 2; width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  font-weight: 800; background: #0b0b0d; color: #f2eee7; box-shadow: 0 0 0 4px rgb(var(--c-ground));
}
.zm-pipe__label { font-weight: 800; color: rgb(var(--c-ink)); }
.zm-pipe__detail { font-size: .95rem; line-height: 1.5; color: rgb(var(--c-ink-soft)); }
/* The line the stages hang on, and the pulse that runs it. */
.zm-pipe__stages::before {
  content: ""; position: absolute; left: 1.2rem; top: 1rem; bottom: 1rem; width: 3px; border-radius: 3px;
  background: linear-gradient(#ff3cac, #7b3fe4, #22c7e8, #61b868);
}
@media (min-width: 900px) {
  .zm-pipe__stages { grid-template-columns: repeat(var(--n), 1fr); gap: 1rem; }
  .zm-pipe__stage { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: .6rem; }
  .zm-pipe__dot { grid-row: auto; width: 3rem; height: 3rem; font-size: 1.1rem; }
  .zm-pipe__stages::before { left: calc(50% / var(--n)); right: calc(50% / var(--n)); top: 1.4rem; bottom: auto; width: auto; height: 3px; background: linear-gradient(90deg, #ff3cac, #7b3fe4, #22c7e8, #61b868); }
}
.js-motion .zm-pipe .zm-pipe__dot { transition: background .4s, transform .4s; }
.js-motion .zm-pipe.is-in .zm-pipe__dot { animation: zm-light .6s calc(.35s * var(--i) + .3s) both; }
@keyframes zm-light {
  0% { background: #0b0b0d; transform: scale(1); }
  50% { background: #ff3cac; transform: scale(1.25); }
  100% { background: #ff3cac; color: #0b0b0d; transform: scale(1); }
}
.js-motion .zm-pipe.is-in .zm-pipe__stages::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 12px 4px #ff3cac; left: calc(1.2rem - 5px); top: 1rem;
  animation: zm-pulse-v calc(.35s * var(--n) + .3s) linear .3s both;
}
@keyframes zm-pulse-v { to { top: calc(100% - 1.5rem); opacity: 0; } }
@media (min-width: 900px) {
  .js-motion .zm-pipe.is-in .zm-pipe__stages::after { top: calc(1.4rem - 5px); left: calc(50% / var(--n)); animation-name: zm-pulse-h; }
  @keyframes zm-pulse-h { to { left: calc(100% - 50% / var(--n)); opacity: 0; } }
}

/* --- Art band ---------------------------------------------------------------------- */
.post-body > .zm-art { --w: 100vw; position: relative; height: clamp(14rem, 42vh, 30rem); overflow: hidden; margin-top: 4rem; margin-bottom: 4rem; }
.zm-art img, .zm-art video { position: absolute; left: 0; width: 100%; height: 130%; top: -15%; object-fit: cover; }
.zm-art video { opacity: 0; transition: opacity 1.2s ease; }
.zm-art video.is-playing { opacity: 1; }
.zm-art__caption { position: absolute; right: 1rem; bottom: .75rem; font-size: .75rem; color: #f2eee7; background: rgb(11 11 13 / .6); padding: .2rem .6rem; border-radius: 999px; }

@media (prefers-reduced-motion: reduce) {
  .zm-hero__art, .zm-art img { transform: none !important; }
}
@media print {
  .zm-hero__art, .zm-art, .zm-video__toggle { display: none !important; }
  .zm-hero { min-height: 0; background: none; }
  .zm-hero__panel { background: none; color: #000; box-shadow: none; }
}

/* --- Search, live ---------------------------------------------------------------- */
.zm-search__box { background: #0b0b0d; color: #f2eee7; border-radius: 1.25rem; padding: 1.5rem; box-shadow: .6rem .6rem 0 #7b3fe4; }
@media (min-width: 640px) { .zm-search__box { padding: 2rem 2.25rem; } }
.zm-search__folder { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: #b7b1aa; }
.zm-search__label { display: block; margin-top: 1rem; font-weight: 700; }
.zm-search__input {
  width: 100%; margin-top: .6rem; padding: .9rem 1.1rem; border-radius: .9rem; border: 2px solid #3a3a42;
  background: #17181d; color: #f2eee7; font-size: 1.15rem;
}
.zm-search__input:focus { outline: none; border-color: #ff3cac; box-shadow: 0 0 0 4px rgb(255 60 172 / .25); }
.zm-search__tries { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.zm-search__try { padding: .35rem .8rem; border-radius: 999px; border: 1px solid #4a4a52; color: #f2eee7; font-size: .85rem; transition: background .2s, border-color .2s; }
.zm-search__try:hover, .zm-search__try:focus-visible { background: #ff3cac; border-color: #ff3cac; color: #0b0b0d; outline: none; }
.zm-search__words { margin-top: 1rem; min-height: 1.6rem; color: #b7b1aa; font-size: .95rem; }
.zm-word { display: inline-block; padding: .05rem .5rem; margin: 0 .1rem; border-radius: .4rem; background: #ff3cac; color: #0b0b0d; font-weight: 700; }
.zm-search__rule { color: #22c7e8; }
.zm-search__files { list-style: none; padding: 0; margin-top: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.zm-file { margin: 0 !important; position: relative; border: 1px solid rgb(var(--c-line)); border-radius: .9rem; padding: .9rem 1.1rem; background: rgb(var(--c-surface)); transition: opacity .35s, border-color .35s, transform .35s, box-shadow .35s; overflow: hidden; }
.zm-file::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--s, 0%); background: linear-gradient(90deg, rgb(255 60 172 / .14), rgb(123 63 228 / .08)); transition: width .6s cubic-bezier(.2,.7,.2,1); pointer-events: none; }
.zm-file__name { position: relative; font-weight: 700; color: rgb(var(--c-ink)); font-size: .95rem; }
.zm-file__text { position: relative; margin-top: .35rem; font-size: .9rem; line-height: 1.55; color: rgb(var(--c-ink-soft)); }
.zm-file mark { background: #ff3cac; color: #0b0b0d; border-radius: .25rem; padding: 0 .15rem; }
.zm-file--dead { opacity: .45; border-style: dashed; order: 99; }
.zm-search.has-q .zm-file.is-out { opacity: .35; }
.zm-search.has-q .zm-file.is-near { opacity: .7; border-style: dashed; }
.zm-search.has-q .zm-file.is-near .zm-file__name::after { content: " · only one word matched, not sent"; font-weight: 400; color: rgb(var(--c-ink-faint)); }
.zm-search.has-q .zm-file.is-sent { border-color: #ff3cac; box-shadow: 0 .6rem 1.6rem -1rem rgb(255 60 172 / .7); }
.zm-search.has-q .zm-file.is-sent .zm-file__name::after { content: " · sent to the model"; font-weight: 400; color: rgb(var(--c-mark)); }
.zm-search__verdict { margin-top: 1rem; min-height: 1.5rem; color: rgb(var(--c-ink)); font-size: 1rem; text-align: center; }
.zm-search:not(.is-live) .zm-search__label, .zm-search:not(.is-live) .zm-search__input, .zm-search:not(.is-live) .zm-search__tries { display: none; }

/* Bars on a narrow screen: the label above its bar. */
@media (max-width: 639px) {
  .zm-bar { grid-template-columns: 1fr 3rem; gap: .2rem .75rem; padding: .45rem 0; }
  .zm-bar__label { grid-column: 1 / -1; }
}
/* With a question asked, files that matched nothing fold to their names. */
.zm-file__text { max-height: 20rem; transition: max-height .4s ease, opacity .3s; }
.zm-search.has-q .zm-file.is-out .zm-file__text { max-height: 0; opacity: 0; margin-top: 0; }
