/* ============================================================
   ui-anima-xform.css — "This one… becomes this." gallery.
   Three mini browser windows that morph between a plain
   "before" skin and a styled "after" skin of the SAME fictional
   content. Scoped under .ua-x-* (state classes too: .ua-x-after,
   .ua-x-seg-on) · window chrome + footer use site tokens
   (warm-light theme). The pages INSIDE the windows are
   "someone else's websites" — each carries its own literal
   palette, so one may go near-black while the site stays cream.
   ============================================================ */
.ua-x-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px;
  margin-top: var(--space-xl, 48px);
  font-family: var(--font-sans, sans-serif); color: var(--color-text, #1a1a17);
}
.ua-x-card { min-width: 0; display: flex; flex-direction: column; }

/* ---- window chrome (site tokens) --------------------------- */
.ua-x-win {
  border: 1px solid var(--color-border, #e0ddd1); border-radius: var(--radius-lg, 10px);
  overflow: hidden; background: var(--color-bg, #f5f4ef);
  box-shadow: var(--shadow-lg, 0 24px 60px -20px rgba(26,26,23,.14));
}
.ua-x-tb { display: flex; align-items: center; gap: 8px; padding: 7px 11px; background: var(--color-surface, #eae7dd); border-bottom: 1px solid var(--color-border, #e0ddd1); }
.ua-x-dots { display: flex; gap: 4px; flex: none; }
.ua-x-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--color-border, #e0ddd1); }
.ua-x-url { flex: 1; min-width: 0; max-width: 240px; margin: 0 auto; text-align: center; font-family: var(--font-mono, monospace); font-size: 12px; color: var(--color-muted, #6c6b61); border: 1px solid var(--color-border, #e0ddd1); background: var(--color-surface, #eae7dd); border-radius: 999px; padding: 3px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-stage { position: relative; height: 360px; overflow: hidden; }

/* ---- shared page skeleton + morph -------------------------- */
.ua-x-page { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px 15px; overflow: hidden; transition: background-color .7s ease, color .7s ease; }
.ua-x-head, .ua-x-site, .ua-x-meta, .ua-x-items, .ua-x-item, .ua-x-sw,
.ua-x-name, .ua-x-price, .ua-x-desc, .ua-x-btn, .ua-x-ing, .ua-x-ing span,
.ua-x-step, .ua-x-n {
  min-width: 0;
  transition: background-color .7s ease, color .7s ease, border-color .7s ease,
    border-radius .7s ease, padding .7s ease, margin .7s ease, gap .7s ease,
    font-size .7s ease, letter-spacing .7s ease, width .7s ease, height .7s ease;
}
.ua-x-item:nth-child(2), .ua-x-step:nth-child(2) { transition-delay: .05s; }
.ua-x-item:nth-child(3), .ua-x-step:nth-child(3) { transition-delay: .1s; }
.ua-x-item:nth-child(4) { transition-delay: .15s; }
.ua-x-btn { cursor: default; user-select: none; -webkit-user-select: none; white-space: nowrap; }

/* corner tag — fades in once each morph has landed */
.ua-x-tag { position: absolute; right: 10px; bottom: 10px; z-index: 2; font: 500 12px/1 var(--font-mono, monospace); letter-spacing: .04em; border: 1px solid transparent; border-radius: 999px; padding: 5px 9px; opacity: 0; transform: translateY(4px); transition: opacity .35s ease, transform .35s ease; pointer-events: none; white-space: nowrap; }
.ua-x-tag b { font-weight: 600; color: var(--accent, #d9542b); }
.ua-x-page.ua-x-after .ua-x-tag { opacity: 1; transform: none; transition-delay: .85s; }

/* ---- footer: prompt line + before/after toggle ------------- */
.ua-x-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; min-width: 0; }
.ua-x-prompt { flex: 1; min-width: 0; margin: 0; font-family: var(--font-mono, monospace); font-size: 12.5px; letter-spacing: .01em; color: var(--color-muted, #6c6b61); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-arrow { color: var(--accent, #d9542b); }
.ua-x-seg { flex: none; display: inline-flex; border: 1px solid var(--color-border, #e0ddd1); border-radius: 999px; overflow: hidden; background: var(--color-bg, #f5f4ef); }
.ua-x-seg-b { appearance: none; -webkit-appearance: none; border: none; margin: 0; background: transparent; cursor: pointer; font: 600 12px/1 var(--font-mono, monospace); letter-spacing: .07em; text-transform: uppercase; color: var(--color-muted, #6c6b61); padding: 6px 11px; transition: background-color .25s, color .25s; }
.ua-x-seg-b + .ua-x-seg-b { border-left: 1px solid var(--color-border, #e0ddd1); }
.ua-x-seg-b:hover { color: var(--accent, #d9542b); }
.ua-x-seg-b:focus-visible { outline: 2px solid var(--accent, #d9542b); outline-offset: -2px; }
.ua-x-seg-b.ua-x-seg-on { background: var(--accent-soft, rgba(217,84,43,.1)); color: var(--accent, #d9542b); }

/* ============================================================
   CARD 1 · brookmarket.example — pottery list → gallery boutique
   ============================================================ */
.ua-x-p1 { background: #ffffff; color: #26251f; }
.ua-x-p1 .ua-x-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid #e8e8e2; }
.ua-x-p1 .ua-x-site { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-p1 .ua-x-meta { flex: none; margin-left: auto; font-size: 12px; color: #8b8b80; background: #f2f2ec; border: 1px solid #f2f2ec; border-radius: 999px; padding: 3px 8px; }
.ua-x-p1 .ua-x-items { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ua-x-p1 .ua-x-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; border: 1px solid #e8e8e2; border-radius: 8px; padding: 8px 10px; background: #fdfdfb; }
.ua-x-p1 .ua-x-sw { width: 18px; height: 18px; border-radius: 4px; background: #e3e3dc; }
.ua-x-p1 .ua-x-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-p1 .ua-x-price { font-size: 12.5px; color: #7c7c72; }
.ua-x-p1 .ua-x-btn { font-size: 12.5px; font-weight: 600; color: #ffffff; background: #3b64c8; border: 1px solid #3b64c8; border-radius: 6px; padding: 5px 10px; }
.ua-x-p1 .ua-x-tag { background: #fffdf6; border-color: #e6dcc4; color: #8a7c58; }

.ua-x-p1.ua-x-after { background: #faf6ec; color: #2b241a; }
.ua-x-p1.ua-x-after .ua-x-head { border-bottom-color: #e6dcc4; padding-bottom: 12px; }
.ua-x-p1.ua-x-after .ua-x-site { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 400; font-size: 18px; color: #2b241a; }
.ua-x-p1.ua-x-after .ua-x-meta { background: transparent; border-color: #ddd0ae; color: #8a7c58; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; }
.ua-x-p1.ua-x-after .ua-x-items { gap: 0; margin-top: 6px; }
.ua-x-p1.ua-x-after .ua-x-item { background: transparent; border-color: transparent transparent #eadfc6 transparent; border-radius: 0; padding: 11px 4px; }
.ua-x-p1.ua-x-after .ua-x-item:last-child { border-bottom-color: transparent; }
.ua-x-p1.ua-x-after .ua-x-sw { width: 30px; height: 30px; border-radius: 3px; }
.ua-x-p1.ua-x-after .ua-x-i1 .ua-x-sw { background: #c98a6f; }
.ua-x-p1.ua-x-after .ua-x-i2 .ua-x-sw { background: #9fb48f; }
.ua-x-p1.ua-x-after .ua-x-i3 .ua-x-sw { background: #d8c193; }
.ua-x-p1.ua-x-after .ua-x-i4 .ua-x-sw { background: #92a8b5; }
.ua-x-p1.ua-x-after .ua-x-name { font-family: Georgia, serif; font-weight: 400; font-size: 15px; color: #2b241a; }
.ua-x-p1.ua-x-after .ua-x-price { font-family: var(--font-mono, monospace); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #8a7c58; }
.ua-x-p1.ua-x-after .ua-x-btn { background: transparent; border-color: #cbbd97; color: #7a6a45; border-radius: 999px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 5px 11px; }

/* ============================================================
   CARD 2 · fieldguide.example — API docs → power-user terminal
   ============================================================ */
.ua-x-p2 { background: #ffffff; color: #27272b; }
.ua-x-p2 .ua-x-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid #e8e8e6; position: relative; }
.ua-x-p2 .ua-x-site { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-p2 .ua-x-meta { flex: none; margin-left: auto; font-size: 12px; color: #84848c; background: #f1f1f3; border: 1px solid #f1f1f3; border-radius: 999px; padding: 3px 8px; }
/* thin scanline band over the header — invisible until "after" */
.ua-x-p2 .ua-x-head::after { content: ""; position: absolute; left: -15px; right: -15px; top: -14px; bottom: 0; background: repeating-linear-gradient(180deg, rgba(126,224,141,.06) 0 1px, transparent 1px 3px); opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.ua-x-p2 .ua-x-items { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; margin-top: 11px; }
.ua-x-p2 .ua-x-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: start; gap: 3px 10px; border: 1px solid #e8e8e6; border-radius: 8px; padding: 10px 12px; background: #fcfcfb; }
.ua-x-p2 .ua-x-name { grid-column: 1; font-family: var(--font-mono, monospace); font-size: 13px; color: #35558f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-p2 .ua-x-desc { grid-column: 1; font-size: 12.5px; line-height: 1.45; color: #6b6b70; }
.ua-x-p2 .ua-x-btn { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; font-weight: 600; color: #4a4a52; background: #f1f1f3; border: 1px solid #dcdce0; border-radius: 6px; padding: 5px 10px; }
.ua-x-p2 .ua-x-tag { background: #101a12; border-color: #2a3c2e; color: #7fa387; }

.ua-x-p2.ua-x-after { background: #0d120e; color: #b9d6bf; }
.ua-x-p2.ua-x-after .ua-x-head { border-bottom-color: #1e2c21; }
.ua-x-p2.ua-x-after .ua-x-head::after { opacity: 1; }
.ua-x-p2.ua-x-after .ua-x-site { font-family: var(--font-mono, monospace); font-weight: 500; font-size: 12.5px; letter-spacing: .04em; text-transform: lowercase; color: #8fd99b; }
.ua-x-p2.ua-x-after .ua-x-meta { background: transparent; border-color: #2a3c2e; color: #5e8168; font-family: var(--font-mono, monospace); font-size: 12px; letter-spacing: .06em; border-radius: 4px; }
.ua-x-p2.ua-x-after .ua-x-item { background: #111812; border-color: #1e2c21; border-radius: 4px; padding: 11px 12px; }
.ua-x-p2.ua-x-after .ua-x-name { color: #7ee08d; }
.ua-x-p2.ua-x-after .ua-x-desc { font-family: var(--font-mono, monospace); font-size: 12px; line-height: 1.5; color: #7fa387; }
.ua-x-p2.ua-x-after .ua-x-btn { background: #101a12; border-color: #2a3c2e; color: #7ee08d; font-family: var(--font-mono, monospace); font-weight: 500; font-size: 12px; letter-spacing: .05em; border-radius: 4px; }

/* ============================================================
   CARD 3 · stovetop.example — recipe → warm cookbook spread
   ============================================================ */
.ua-x-p3 { background: #ffffff; color: #2a2822; }
.ua-x-p3 .ua-x-head { display: flex; align-items: center; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid #eae8e0; }
.ua-x-p3 .ua-x-site { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-x-p3 .ua-x-btn { flex: none; font-size: 12.5px; font-weight: 600; color: #ffffff; background: #4a7d55; border: 1px solid #4a7d55; border-radius: 6px; padding: 5px 11px; }
.ua-x-p3 .ua-x-ing { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 8px; padding: 0; }
.ua-x-p3 .ua-x-ing span { font-size: 12px; color: #6d6b60; background: #f3f2ec; border: 1px solid #f3f2ec; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.ua-x-p3 .ua-x-steps { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 7px; }
.ua-x-p3 .ua-x-step { display: flex; align-items: flex-start; gap: 9px; border: 1px solid #eae8e0; border-radius: 8px; padding: 8px 10px; background: #fdfdfa; font-size: 12.5px; line-height: 1.5; color: #4c4a42; }
.ua-x-p3 .ua-x-n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border-radius: 50%; background: #eef0e8; color: #77756a; font-size: 12px; font-weight: 600; }
.ua-x-p3 .ua-x-tag { background: #fffcf1; border-color: #e2d5b2; color: #7a6a3d; }

.ua-x-p3.ua-x-after { background: #f9f3e2; color: #332b1c; }
.ua-x-p3.ua-x-after .ua-x-head { border-bottom-color: #e2d5b2; padding-bottom: 12px; }
.ua-x-p3.ua-x-after .ua-x-site { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-size: 20px; color: #2e2612; }
.ua-x-p3.ua-x-after .ua-x-btn { background: transparent; border-color: #c3b183; color: #77663a; border-radius: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding: 5px 11px; }
.ua-x-p3.ua-x-after .ua-x-ing { margin: 13px 0 10px; gap: 6px 4px; }
.ua-x-p3.ua-x-after .ua-x-ing span { background: transparent; border-color: transparent; color: #77663a; font-family: var(--font-mono, monospace); font-size: 12px; letter-spacing: .09em; text-transform: uppercase; padding: 0; border-radius: 0; }
.ua-x-p3.ua-x-after .ua-x-ing span:not(:last-child)::after { content: " ·"; color: #c3b183; letter-spacing: 0; margin-right: 6px; }
.ua-x-p3.ua-x-after .ua-x-steps { gap: 0; }
.ua-x-p3.ua-x-after .ua-x-step { background: transparent; border-color: transparent transparent #eadfbd transparent; border-radius: 0; padding: 10px 2px; font-family: Georgia, serif; font-size: 13px; line-height: 1.55; color: #4c4028; }
.ua-x-p3.ua-x-after .ua-x-step:last-child { border-bottom-color: transparent; }
.ua-x-p3.ua-x-after .ua-x-n { background: transparent; width: 20px; height: 22px; border-radius: 0; font-family: Georgia, serif; font-size: 23px; font-weight: 700; color: #ab8b50; }

/* ---- reduced motion: no morphs, instant swaps -------------- */
@media (prefers-reduced-motion: reduce) {
  .ua-x-page, .ua-x-head, .ua-x-site, .ua-x-meta, .ua-x-items, .ua-x-item,
  .ua-x-sw, .ua-x-name, .ua-x-price, .ua-x-desc, .ua-x-btn, .ua-x-ing,
  .ua-x-ing span, .ua-x-step, .ua-x-n, .ua-x-tag, .ua-x-seg-b,
  .ua-x-p2 .ua-x-head::after { transition: none; }
}

/* ---- responsive -------------------------------------------- */
@media (max-width: 900px) {
  .ua-x-grid { grid-template-columns: 1fr; gap: 30px; max-width: 560px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 420px) {
  .ua-x-url { max-width: 160px; }
  .ua-x-foot { flex-wrap: wrap; }
  .ua-x-page { padding: 12px 13px; }
}
