/* Moving Atoms homepage hero ("click to explore" the scanned factory). See /ma/xhero/hero.js.
   The server-rendered hero stays in the page for hydration; it is hidden here from first paint and
   replaced by .ma-xh once the module mounts. html.ma-xh-off (no WebGL / error) restores it. */
@font-face { font-family: "MA General Sans"; src: url(/factory-floor-scan/fonts/generalsans-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "MA General Sans"; src: url(/factory-floor-scan/fonts/generalsans-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "MA Plex Mono"; src: url(/ma/fonts/IBMPlexMono-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "MA Plex Mono"; src: url(/ma/fonts/IBMPlexMono-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root { --xh-card: #0c0c12; --xh-line: rgba(255,255,255,.09); --xh-accent: #be8fff; --xh-accent-strong: #8d4dff;
  --xh-text: #f4f4f6; --xh-text-2: rgba(244,244,246,.66); --xh-text-3: rgba(244,244,246,.42);
  --xh-mono: "MA Plex Mono", ui-monospace, monospace; --xh-ease: cubic-bezier(.2,.8,.2,1);
  --xh-top: 104px; --xh-side: max(40px, calc((100vw - 1500px) / 2)); }

/* ---------- replace the old hero from first paint ---------- */
html:not(.ma-xh-off) #main-content section:has(> .ma-hero-img) { background: #0a0a0a; }
html:not(.ma-xh-off) #main-content section:has(> .ma-hero-img) > :not(.ma-xh) { visibility: hidden; }
/* placeholder card + poster until the module mounts (same geometry as .ma-xh-card) */
html:not(.ma-xh-off):not(.ma-xh-mounted) #main-content section:has(> .ma-hero-img)::before {
  content: ""; position: absolute; z-index: 1; top: var(--xh-top); left: var(--xh-side); right: var(--xh-side); bottom: 28px; border-radius: 22px;
  border: 1px solid var(--xh-line); background: var(--xh-card) url(/ma/xhero/poster-wide.webp) center / cover no-repeat; }
/* the "Backed by" strip moves into the hero */
html.ma-xh-mounted .ma-backed { display: none; }

/* ---------- card ---------- */
.ma-xh { position: absolute; inset: 0; z-index: 2; font-family: "MA General Sans", system-ui, sans-serif; color: var(--xh-text); -webkit-font-smoothing: antialiased; }
.ma-xh *, .ma-xh *::before, .ma-xh *::after { box-sizing: border-box; }
.ma-xh a, .ma-xh button { font: inherit; color: inherit; text-decoration: none; }
.ma-xh button { border: 0; background: none; cursor: pointer; padding: 0; }
.ma-xh-card { position: absolute; top: var(--xh-top); left: var(--xh-side); right: var(--xh-side); bottom: 28px; border-radius: 22px; overflow: hidden;
  background: var(--xh-card); border: 1px solid var(--xh-line); }
.ma-xh-poster { position: absolute; inset: 0; background: url(/ma/xhero/poster-wide.webp) center / cover no-repeat; transition: opacity .8s ease; }
.ma-xh-card.ready .ma-xh-poster { opacity: 0; }
.ma-xh-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; opacity: 0; transition: opacity .8s ease; touch-action: pan-y; }
.ma-xh-card.ready canvas { opacity: 1; }
.ma-xh-card.exploring canvas { cursor: grab; }

/* explore window: masks the card around itself, holds the explore UI */
.ma-xh-win { position: absolute; left: 0; top: 0; border-radius: 16px; pointer-events: none; opacity: 0; transition: opacity .3s; box-shadow: 0 0 0 200vmax var(--xh-card); }
.ma-xh-win::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid rgba(190,143,255,.28); pointer-events: none; }
.ma-xh-card.exploring .ma-xh-win { opacity: 1; }

/* copy */
.ma-xh-copy { position: absolute; z-index: 3; left: 44px; top: 50%; transform: translateY(-50%); width: 40%; max-width: 560px; pointer-events: none; animation: ma-xh-in .9s var(--xh-ease) both; }
.ma-xh-eyebrow { font: 400 12px/1 var(--xh-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--xh-text-2); display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.ma-xh-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--xh-accent); animation: ma-xh-ping 2.6s ease-out infinite; }
.ma-xh h1 { margin: 0; font-family: inherit; font-weight: 500; font-size: clamp(40px, 4.4vw, 70px); line-height: 1.02; letter-spacing: -0.035em; color: var(--xh-text); }
.ma-xh h1 mark { color: inherit; background: linear-gradient(transparent 58%, rgba(141,77,255,.85) 58%, rgba(141,77,255,.85) 90%, transparent 90%); padding: 0 .04em; }
.ma-xh-copy p { margin: 22px 0 0; font-size: 18px; line-height: 1.55; color: var(--xh-text-2); max-width: 470px; }
.ma-xh-ctas { display: flex; gap: 10px; margin-top: 30px; pointer-events: auto; }
.ma-xh-btn { padding: 15px 22px; border-radius: 999px; font-size: 15.5px; font-weight: 500; display: inline-flex; gap: 9px; align-items: center; background: var(--xh-text); color: #0b0b10 !important; transition: transform .2s var(--xh-ease); }
.ma-xh-btn:hover { transform: translateY(-1px); }
.ma-xh-backed { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--xh-line); display: flex; align-items: center; gap: 26px; pointer-events: auto; }
.ma-xh-backed .lbl { font: 400 11.5px/1 var(--xh-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--xh-text-3); }
.ma-xh-backed .logo { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 500; opacity: .9; transition: opacity .2s; }
.ma-xh-backed .logo:hover { opacity: 1; }
.ma-xh-backed img { display: block; }
.ma-xh-backed small { font-size: 11.5px; line-height: 1.05; font-weight: 500; color: var(--xh-text-2); }

/* "Click to explore" */
.ma-xh-tip { position: absolute; z-index: 4; left: 0; top: 0; pointer-events: none; transition: opacity .35s; }
.ma-xh .ma-xh-tip button { pointer-events: auto; position: absolute; left: 0; bottom: 10px; transform: translateX(-50%); white-space: nowrap; display: inline-flex; gap: 8px; align-items: center;
  background: var(--xh-accent-strong); color: #fff; font: 500 11.5px/1 var(--xh-mono); letter-spacing: .14em; text-transform: uppercase;
  padding: 10px 14px; border-radius: 999px; animation: ma-xh-bob 2.8s ease-in-out infinite; box-shadow: 0 0 0 6px rgba(141,77,255,.18), 0 10px 30px rgba(141,77,255,.35); }
.ma-xh-tip button::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--xh-accent-strong); }
.ma-xh-tip button i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: ma-xh-blink 1.4s steps(1) infinite; }
.ma-xh-card.exploring .ma-xh-tip, .ma-xh-card.leaving .ma-xh-tip { opacity: 0; }
.ma-xh-card.exploring .ma-xh-tip button, .ma-xh-card.leaving .ma-xh-tip button { pointer-events: none; }
/* before the live scene is ready the tip sits on the poster's diorama */
.ma-xh-card:not(.ready) .ma-xh-tip { left: var(--xh-tip-x, 69.5%); top: var(--xh-tip-y, 28%); transform: none !important; }
.ma-xh-card.waiting .ma-xh-tip button { animation: none; opacity: .85; }

/* explore UI */
.ma-xh-label { position: absolute; left: 18px; top: 16px; opacity: 0; transition: opacity .5s; }
.ma-xh-card.exploring .ma-xh-label { opacity: 1; transition-delay: 1.5s; }
.ma-xh-label .k { font: 500 11px/1 var(--xh-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--xh-accent); }
.ma-xh-label .n { font-size: 20px; font-weight: 500; margin-top: 7px; letter-spacing: -0.01em; text-shadow: 0 1px 14px rgba(0,0,0,.5); }
.ma-xh-hint { position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: rgba(12,12,18,.6); backdrop-filter: blur(10px); border: 1px solid var(--xh-line); font: 500 11.5px/1 var(--xh-mono); letter-spacing: .12em; text-transform: uppercase;
  padding: 10px 14px; border-radius: 999px; opacity: 0; transition: opacity .5s; }
.ma-xh-card.exploring .ma-xh-hint { opacity: 1; transition-delay: 1.9s; }
.ma-xh-card.exploring .ma-xh-hint.gone { opacity: 0; transition-delay: 0s; }
.ma-xh-hint svg { width: 14px; height: 14px; color: var(--xh-accent); }
.ma-xh-bar { position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 12px); display: flex; gap: 6px; align-items: center; opacity: 0; transition: opacity .5s, transform .6s var(--xh-ease); }
.ma-xh-card.exploring .ma-xh-bar { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; transition-delay: 1.5s; }
.ma-xh .ma-xh-chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; white-space: nowrap;
  background: rgba(12,12,18,.62) !important; backdrop-filter: blur(12px); border: 1px solid var(--xh-line) !important; transition: border-color .2s; }
.ma-xh .ma-xh-chip:hover { border-color: rgba(190,143,255,.6) !important; }
.ma-xh .ma-xh-chip svg { width: 14px; height: 14px; }
.ma-xh-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(12,12,18,.62); backdrop-filter: blur(12px); border: 1px solid var(--xh-line); }
.ma-xh .ma-xh-seg button { height: 28px; padding: 0 13px !important; border-radius: 999px; font: 500 11px/1 var(--xh-mono) !important; letter-spacing: .1em; text-transform: uppercase; color: var(--xh-text-2) !important; transition: background .25s, color .25s; }
.ma-xh .ma-xh-seg button.on { background: var(--xh-accent-strong) !important; color: #fff !important; }
.ma-xh-loading { position: absolute; left: 50%; top: 50%; width: 160px; height: 2px; margin: -1px 0 0 -80px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; opacity: 0; transition: opacity .4s; }
.ma-xh-loading i { display: block; height: 100%; width: 0; background: var(--xh-accent); transition: width .2s; }
.ma-xh-loader { position: absolute; left: 72%; bottom: 30px; width: 160px; height: 2px; margin-left: -80px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; opacity: 0; transition: opacity .5s; }
.ma-xh-loader i { display: block; height: 100%; width: 0; background: var(--xh-accent); transition: width .2s; }
.ma-xh-card.loading:not(.ready) .ma-xh-loader, .ma-xh-card.waiting .ma-xh-loader { opacity: 1; }

@keyframes ma-xh-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ma-xh-bob { 50% { transform: translate(-50%, -4px); } }
@keyframes ma-xh-ping { 0% { box-shadow: 0 0 0 0 rgba(190,143,255,.55); } 70%, 100% { box-shadow: 0 0 0 8px rgba(190,143,255,0); } }
@keyframes ma-xh-blink { 50% { opacity: .25; } }

/* ---------- narrow screens: copy on top, factory below ---------- */
@media (max-width: 899px) {
  :root { --xh-top: 84px; --xh-side: 12px; }
  html:not(.ma-xh-off):not(.ma-xh-mounted) #main-content section:has(> .ma-hero-img)::before,
  .ma-xh-poster { background-image: url(/ma/xhero/poster-narrow.webp); background-position: center bottom; }
  .ma-xh-card, html:not(.ma-xh-off):not(.ma-xh-mounted) #main-content section:has(> .ma-hero-img)::before { bottom: 12px; }
  .ma-xh-copy { top: 22px; transform: none; left: 20px; right: 20px; width: auto; transition: opacity .4s; }
  .ma-xh-eyebrow { font-size: 10.5px; letter-spacing: .12em; margin-bottom: 16px; }
  .ma-xh h1 { font-size: 33px; }
  .ma-xh-copy p { font-size: 15px; line-height: 1.5; margin-top: 12px; }
  .ma-xh-ctas { margin-top: 18px; }
  .ma-xh-btn { padding: 12px 18px; font-size: 14.5px; }
  .ma-xh-backed { margin-top: 18px; padding-top: 14px; gap: 14px; }
  .ma-xh-backed .lbl { font-size: 10px; letter-spacing: .1em; }
  .ma-xh-backed .logo { font-size: 13.5px; gap: 6px; }
  .ma-xh-backed .logo img[width="26"] { width: 20px; height: 20px; }
  .ma-xh-backed .logo img[width="104"] { width: 76px; height: 16px; }
  .ma-xh-backed small { font-size: 9.5px; }
  .ma-xh-card { --xh-tip-x: 49.2%; --xh-tip-y: 70.2%; }
  .ma-xh-card.exploring .ma-xh-copy { opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
  .ma-xh-bar { gap: 4px; } .ma-xh .ma-xh-chip { padding: 0 10px; font-size: 12.5px; }
}
