/* ========================================================================== */
/* Matt Makes Those — Home / Z-Axis                                           */
/* Loaded only by index.html. Shared nav/auth/footer styles stay in main.css. */
/* Concept: the page is a print in progress — scroll position is the Z axis. */
/* ========================================================================== */

body.home-page {
  --mm-cyan: #35e0ff;
  --mm-red: #ff5c5c;
  --mm-orange: #ffa040;
  --mm-teal: #38d4b8;
  --mm-ink: #dde6f8;
  --mm-line: rgba(141, 170, 210, 0.18);
  --mm-line-soft: rgba(141, 170, 210, 0.10);
  --font-disp: "Chakra Petch", Inter, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  background-image:
    radial-gradient(ellipse 70% 44% at 50% -12%, rgba(53, 224, 255, 0.055) 0%, transparent 64%),
    linear-gradient(180deg, #090d16 0%, #070a11 100%);
}

/* Quiet the shared fixed grid/noise — the strata below replace them */
body.home-page::before,
body.home-page::after { display: none; }

body.home-page .home-shell::after { display: none; }

/* ── Background: layer strata + printhead beam ───────────────────── */
/* Two line strata parallax at different rates (JS feeds --z-coarse /  */
/* --z-fine, pre-wrapped to one pattern period, so overscan is small). */

.zbg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.zbg .zl {
  position: absolute;
  left: 0;
  right: 0;
  top: -140px;
  bottom: -140px;
  will-change: transform;
}

.zl-coarse {
  background: repeating-linear-gradient(180deg,
    rgba(53, 224, 255, 0.052) 0 1px, transparent 1px 112px);
  transform: translate3d(0, calc(var(--z-coarse, 0) * -1px), 0);
}

.zl-fine {
  background: repeating-linear-gradient(180deg,
    rgba(141, 170, 210, 0.05) 0 1px, transparent 1px 28px);
  transform: translate3d(0, calc(var(--z-fine, 0) * -1px), 0);
}

/* Printhead beam — descends from 16vh to 80vh across the full scroll. */
/* Soft "cooling" glow above the hairline, nothing below it yet.       */

.zbeam {
  position: absolute;
  left: 0;
  right: 0;
  top: -160px;
  height: 160px;
  background: linear-gradient(180deg,
    transparent,
    rgba(53, 224, 255, 0.035) 72%,
    rgba(53, 224, 255, 0.085) 97%,
    rgba(53, 224, 255, 0.30) 100%);
  transform: translate3d(0, calc(16vh + var(--zp, 0) * 64vh + 160px), 0);
  will-change: transform;
}

/* ── Z ruler (wide screens only) ─────────────────────────────────── */

.zruler {
  position: fixed;
  top: calc(var(--header-h) + 28px);
  bottom: 28px;
  right: 10px;
  z-index: 4;
  display: none;
  gap: 9px;
  pointer-events: none;
  font-family: var(--font-mono);
}

@media (min-width: 1280px) {
  .zruler { display: flex; }
}

.zr-readout {
  display: flex;
  gap: 0.9rem;
  writing-mode: vertical-rl;
  color: var(--hint);
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
}

.zr-readout b {
  color: var(--mm-cyan);
  font-weight: 500;
  opacity: 0.9;
}

.zr-track {
  position: relative;
  width: 9px;
  background:
    repeating-linear-gradient(180deg, var(--mm-line) 0 1px, transparent 1px 70px) left / 100% 100% no-repeat,
    repeating-linear-gradient(180deg, var(--mm-line-soft) 0 1px, transparent 1px 14px) right / 55% 100% no-repeat;
}

.zr-carriage {
  position: absolute;
  right: 0;
  top: calc(var(--zp, 0) * 100%);
  width: 100%;
  height: 2px;
  margin-top: -1px;
  background: var(--mm-cyan);
  box-shadow: 0 0 9px rgba(53, 224, 255, 0.65);
}

/* ── Hero ────────────────────────────────────────────────────────── */

.hero-min {
  min-height: min(680px, calc(88vh - var(--header-h)));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(1.5rem, 5vh, 3.5rem) 0 1.5rem;
}

.hm-kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.7rem;
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* tiny hexagon glyph — carries the motif to every viewport */
.hm-kicker::before {
  content: "";
  width: 12px;
  height: 13px;
  background: var(--mm-cyan);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  filter: drop-shadow(0 0 5px rgba(53, 224, 255, 0.6));
  animation: kick-hex 14s linear infinite;
}

@keyframes kick-hex { to { rotate: 360deg; } }

.nameplate {
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--text-strong);
  font-family: var(--font-disp);
  font-size: clamp(2.9rem, 10vw, 6.6rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.nameplate .np-outline {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(53, 224, 255, 0.72);
  text-shadow: 0 0 30px rgba(53, 224, 255, 0.16);
  transition: color 0.35s ease, text-shadow 0.35s ease;
}

/* the outline pass gets its infill on hover */
.nameplate:hover .np-outline {
  color: rgba(53, 224, 255, 0.14);
  text-shadow: 0 0 42px rgba(53, 224, 255, 0.30);
}

.nameplate .np-cursor {
  display: inline-block;
  font-weight: 500;
  color: var(--mm-teal);
  animation: mm-blink 1.1s steps(1) infinite;
}

@keyframes mm-blink { 50% { opacity: 0; } }

.those-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin: 1.7rem 0 0;
  font-family: var(--font-mono);
  font-size: clamp(0.86rem, 1.9vw, 1rem);
}

.those-line .eq { color: var(--mute); letter-spacing: 0.04em; }

.those-word {
  padding: 0 0.1rem 0.2rem;
  color: var(--mm-cyan);
  background: none;
  border: 0;
  border-bottom: 1px dashed rgba(53, 224, 255, 0.45);
  font: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.15s, text-shadow 0.15s;
}

.those-word:hover {
  border-bottom-style: solid;
  border-bottom-color: var(--mm-cyan);
  text-shadow: 0 0 14px rgba(53, 224, 255, 0.45);
}

/* typewriter caret — present only while the word is being retyped */
.those-word.typing { border-bottom-color: rgba(53, 224, 255, 0.2); }

.those-word.typing::after {
  content: "▍";
  margin-left: 2px;
  color: var(--mm-teal);
}

.hm-sub {
  max-width: 46ch;
  margin: 1.5rem 0 0;
  color: var(--mute);
  font-size: 0.98rem;
  line-height: 1.75;
}

.hm-scroll {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: clamp(2.4rem, 7vh, 4.2rem);
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.15s;
}

.hm-scroll i {
  width: 1px;
  height: 32px;
  background: linear-gradient(180deg, var(--mm-cyan), transparent);
  animation: z-drip 2.4s ease-in-out infinite;
}

@keyframes z-drip {
  0%   { transform: scaleY(0); transform-origin: top; }
  45%  { transform: scaleY(1); transform-origin: top; }
  55%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.hm-scroll:hover { color: var(--mm-cyan); }

/* ── Sections ────────────────────────────────────────────────────── */

.zsec { margin-top: clamp(7.5rem, 16vh, 11rem); }

/* Scroll reveal — .zfx is added by JS only (no-JS keeps all visible) */
.zfx .zsec {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.zfx .zsec.in { opacity: 1; transform: none; }

/* parts on the plate cascade in a beat behind their section */
.zfx .zindex .zrow,
.zfx .gallery-grid .card,
.zfx .zkit { opacity: 0; }

.zfx .zsec.in .zindex .zrow,
.zfx .zsec.in .gallery-grid .card,
.zfx .zsec.in .zkit {
  animation: zrise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.zfx .zsec.in .zindex .zrow:nth-child(2),
.zfx .zsec.in .gallery-grid .card:nth-child(2) { animation-delay: 0.09s; }

.zfx .zsec.in .zindex .zrow:nth-child(3),
.zfx .zsec.in .gallery-grid .card:nth-child(3) { animation-delay: 0.18s; }

.zfx .zsec.in .zindex .zrow:nth-child(4),
.zfx .zsec.in .gallery-grid .card:nth-child(4) { animation-delay: 0.27s; }

.zfx .zsec.in .zkit { animation-delay: 0.4s; }

/* `translate`, not `transform` — hover lifts keep working after the fill */
@keyframes zrise {
  from { opacity: 0; translate: 0 18px; }
  to   { opacity: 1; translate: 0 0; }
}

.zhead {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 1.6rem;
}

.z-idx {
  color: var(--mm-cyan);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  opacity: 0.8;
}

.zhead h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-disp);
  font-size: clamp(1.02rem, 2.2vw, 1.28rem);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.z-rule {
  flex: 1;
  height: 1px;
  align-self: center;
  background: linear-gradient(90deg, var(--mm-line), transparent);
}

/* ── Index of work ───────────────────────────────────────────────── */

/* rows sit apart like parts on a build plate — the brim walls need clearance */
.zindex {
  display: grid;
  gap: 34px;
}

.zrow {
  --acc: var(--mm-cyan);
  position: relative;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto 1.4rem;
  align-items: center;
  gap: 1.4rem;
  padding: 1.15rem 1rem 1.15rem 0.9rem;
  border: 1px solid var(--mm-line-soft);
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s;
}

.zrow::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18%;
  bottom: 18%;
  width: 2px;
  background: var(--acc);
  opacity: 0;
  transform: scaleY(0.3);
  transition: opacity 0.22s, transform 0.22s;
}

.zrow:hover {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--acc) 6%, transparent), transparent 55%);
}

.zrow:hover::before { opacity: 1; transform: none; }

.zr-rack      { --acc: var(--mm-cyan); }
.zr-barcode   { --acc: var(--mm-red); }
.zr-organizer { --acc: var(--mm-orange); }
.zr-tower     { --acc: var(--mm-teal); }

.zr-n {
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  transition: color 0.2s;
}

.zrow:hover .zr-n { color: var(--acc); }

.zr-body h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-disp);
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.zr-body p {
  margin: 0.22rem 0 0;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.zrow:hover .zr-body h3 { color: var(--acc); }

.zr-status {
  color: var(--acc);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
}

.zr-status .live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 8px var(--acc);
  animation: mm-pulse 1.6s ease-in-out infinite;
  vertical-align: 1px;
}

@keyframes mm-pulse { 50% { opacity: 0.35; } }

.zr-go {
  color: var(--hint);
  font-family: var(--font-mono);
  transition: transform 0.2s, color 0.2s;
}

.zrow:hover .zr-go {
  color: var(--acc);
  transform: translateX(5px);
}

.zkit {
  margin: 1.7rem 0 0;
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  line-height: 2.1;
  text-transform: uppercase;
}

/* ── Media / gallery / game — quiet the shared shells ────────────── */

body.home-page .video-wrap {
  border-color: var(--mm-line);
  border-radius: 8px;
  box-shadow: none;
  background: #060a10;
}

/* HUD corner brackets on the footage frame */
body.home-page .video-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  --vb: rgba(53, 224, 255, 0.55);
  background:
    linear-gradient(var(--vb), var(--vb)) left top / 18px 2px no-repeat,
    linear-gradient(var(--vb), var(--vb)) left top / 2px 18px no-repeat,
    linear-gradient(var(--vb), var(--vb)) right top / 18px 2px no-repeat,
    linear-gradient(var(--vb), var(--vb)) right top / 2px 18px no-repeat,
    linear-gradient(var(--vb), var(--vb)) left bottom / 18px 2px no-repeat,
    linear-gradient(var(--vb), var(--vb)) left bottom / 2px 18px no-repeat,
    linear-gradient(var(--vb), var(--vb)) right bottom / 18px 2px no-repeat,
    linear-gradient(var(--vb), var(--vb)) right bottom / 2px 18px no-repeat;
}

/* recording tag riding the footage */
.feed-tag {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.35em 0.7em;
  color: var(--mm-ink);
  background: rgba(6, 10, 16, 0.66);
  border: 1px solid rgba(53, 224, 255, 0.28);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  pointer-events: none;
}

.feed-tag i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mm-red);
  box-shadow: 0 0 8px var(--mm-red);
  animation: mm-pulse 1.6s ease-in-out infinite;
}

body.home-page .card { border-radius: 8px; }

/* clearance so adjacent card walls don't collide */
body.home-page .gallery-grid {
  gap: 2rem;
  counter-reset: plate;
}

/* gallery cards read as numbered build plates */
body.home-page .card {
  position: relative;
  counter-increment: plate;
}

body.home-page .card::after {
  content: "Plate 00" counter(plate);
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 0.28em 0.6em;
  color: var(--mm-cyan);
  background: rgba(6, 10, 16, 0.72);
  border: 1px solid rgba(53, 224, 255, 0.24);
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  pointer-events: none;
}

body.home-page .card .title {
  font-family: var(--font-disp);
  font-size: 0.92rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

body.home-page .card .meta {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.home-page .card img {
  filter: saturate(0.94);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.4s ease;
}

body.home-page .card:hover img {
  transform: scale(1.045);
  filter: saturate(1.1);
}

/* each plate warms into its own filament color on hover */
body.home-page .card:nth-child(3n + 1):hover { border-color: rgba(53, 224, 255, 0.45); }
body.home-page .card:nth-child(3n + 2):hover { border-color: rgba(255, 92, 92, 0.45); }
body.home-page .card:nth-child(3n):hover     { border-color: rgba(255, 160, 64, 0.45); }

body.home-page #gameHost {
  max-width: 700px;
  margin: 0 auto;
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.5);
  box-shadow: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

body.home-page #gameHost:hover {
  border-color: rgba(53, 224, 255, 0.4);
  box-shadow: 0 0 34px rgba(53, 224, 255, 0.07);
}

body.home-page #gameHost canvas { cursor: pointer; }

/* right-aligned chip in a section header (e.g. "◆ FREE PLAY") */
.zhead-tag {
  color: var(--mm-teal);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mono-caption {
  margin: 1.5rem 0 0; /* keeps clear of the extrusion line's travel band */
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  line-height: 1.7;
}

.mono-caption .cap-accent { color: var(--mm-teal); }

.game-sec { text-align: left; }

.game-sec .hint {
  margin-top: 1.5rem; /* keeps clear of the extrusion line's travel band */
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--hint);
  text-align: center;
}

.game-sec .hint kbd {
  padding: 0.12em 0.5em;
  margin: 0 0.1em;
  color: var(--mm-ink);
  background: rgba(141, 170, 210, 0.09);
  border: 1px solid var(--mm-line);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.92em;
}

/* ── Outro ───────────────────────────────────────────────────────── */

.zend {
  text-align: center;
  padding: clamp(1.5rem, 5vh, 3rem) 0 1rem;
}

.zend h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-disp);
  font-size: clamp(1.5rem, 4.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.zend p {
  margin: 0.8rem 0 0;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.zend-link {
  display: inline-block;
  margin-top: 1.7rem;
  padding: 0.78rem 1.6rem;
  color: var(--mm-cyan);
  background: rgba(53, 224, 255, 0.05);
  border: 1px solid rgba(53, 224, 255, 0.4);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.zend-link:hover {
  background: rgba(53, 224, 255, 0.12);
  border-color: var(--mm-cyan);
  box-shadow: 0 0 26px rgba(53, 224, 255, 0.16);
}

/* end-of-print stamp — lights up when the nozzle closes the last loop */
.zdone {
  margin: 2.4rem 0 0;
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.35;
  transition: opacity 0.6s ease, color 0.6s ease, text-shadow 0.6s ease;
}

.zdone b {
  font-weight: 500;
  color: inherit;
}

.zdone.on {
  opacity: 1;
  color: var(--mm-teal);
  text-shadow: 0 0 18px rgba(56, 212, 184, 0.45);
  animation: stamp-in 0.55s cubic-bezier(0.2, 1.5, 0.3, 1);
}

@keyframes stamp-in {
  from { scale: 0.88; }
  to   { scale: 1; }
}

/* ── Keyboard focus ──────────────────────────────────────────────── */

.zrow:focus-visible,
.zend-link:focus-visible,
.those-word:focus-visible,
.hm-scroll:focus-visible {
  outline: 1px solid var(--mm-cyan);
  outline-offset: 4px;
}

/* ── Brim extrusion overlay ──────────────────────────────────────── */
/* One document-spanning SVG; JS extrudes a perimeter path around each */
/* [data-brim] element in document order as scroll feeds the nozzle.   */

.brim-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 6;
  overflow: visible;
  pointer-events: none;
}

.brim-layer .brim {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.4s ease, filter 0.3s ease;
}

/* actively extruding — hot filament */
.brim-layer .brim.on { opacity: 0.95; }

/* loop closed — cooled into a quiet outline */
.brim-layer .brim.done { opacity: 0.32; }

/* hover link — the part under the cursor re-lights its walls */
.brim-layer .brim.hl { opacity: 0.9; }

/* print-bed art keeps a little more presence once cooled */
.brim-layer .brim.art.done { opacity: 0.5; }

/* hero hexagon vortex — origin of the whole extrusion line */
.brim-layer .brim.hexo { stroke-width: 2.2; }

.brim-layer .brim.hexo.done {
  opacity: 0.62;
  animation: hex-breathe 5.5s ease-in-out infinite alternate;
}

@keyframes hex-breathe {
  from { opacity: 0.42; }
  to   { opacity: 0.72; }
}

/* ambient hexagon decorations: counter-rotating dashed orbits + nucleus */
.hexdeco {
  fill: none;
  stroke: rgba(53, 224, 255, 0.24);
  stroke-width: 1;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}

.hexdeco.spin-a { animation: hd-in 1.2s 0.7s both, hd-spin 160s 0.7s linear infinite; }
.hexdeco.spin-b { animation: hd-in 1.2s 1s both, hd-spin-rev 95s 1s linear infinite; }

@keyframes hd-in { to { opacity: 1; } }
@keyframes hd-spin { to { transform: rotate(360deg); } }
@keyframes hd-spin-rev { to { transform: rotate(-360deg); } }

.hexdeco-dot {
  fill: #35e0ff;
  pointer-events: none;
  opacity: 0;
  animation: hd-dot 3.6s 1.2s ease-in-out infinite alternate both;
}

@keyframes hd-dot {
  from { opacity: 0.2; }
  to   { opacity: 0.75; }
}

/* molten head: white-hot core + colored bloom trailing the nozzle */
.brim-hot {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.brim-hot.hglow { stroke-width: 8; }
.brim-hot.hcore { stroke-width: 2.4; }
.brim-hot.hglow.live { opacity: 0.3; }
.brim-hot.hcore.live { opacity: 0.95; }

/* printhead reticle spins while extruding */
.nz-ret {
  transform-box: fill-box;
  transform-origin: center;
  animation: nz-spin 1.5s linear infinite;
}

@keyframes nz-spin { to { transform: rotate(360deg); } }

.brim-nozzle { transition: opacity 0.25s ease; }
.brim-nozzle.off { opacity: 0; }

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .zrow {
    grid-template-columns: minmax(0, 1fr) auto 1.2rem;
    gap: 1rem;
  }
  .zr-n { display: none; }
  .hero-min { min-height: min(560px, calc(84vh - var(--header-h))); }
}

/* ── Travel moves (G0) ───────────────────────────────────────────── */
/* Repositioning, not extrusion: thin while the head runs them, then   */
/* parked as a faint dashed ghost — the plate reads as clean toolpath  */
/* instead of tangled filament.                                        */

.brim-layer .trav { stroke-width: 1.1; }

.brim-layer .trav.on { opacity: 0.5; }

.brim-layer .trav.done {
  opacity: 0.15;
  stroke-dasharray: 4 8 !important;
  stroke-dashoffset: 0 !important;
}

/* head in transit: reticle spins up, glow goes cold */
.brim-nozzle.moving .nz-ret { animation-duration: 0.55s; }
.brim-nozzle.moving .nz-glow { opacity: 0.07; }

/* ── Z registration ticks (left margin, wide screens) ────────────── */

.zticks line { stroke: var(--mm-line); }

.zticks text {
  fill: var(--hint);
  opacity: 0.6;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
}

/* ── G-code console (extra-wide screens only) ────────────────────── */

.gcode {
  position: fixed;
  left: 22px;
  bottom: 74px;
  z-index: 4;
  display: none;
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  line-height: 2.1;
  letter-spacing: 0.05em;
  white-space: pre;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 30%, transparent 96%);
  mask-image: linear-gradient(180deg, #000 0, #000 30%, transparent 96%);
}

/* newest instruction rides hot */
.gcode::first-line { color: var(--mm-cyan); }

@media (min-width: 1680px) {
  .gcode { display: block; }
}

/* ── Gantry carriage riding the printhead beam ───────────────────── */

.zbeam-head {
  position: absolute;
  left: 0;
  top: -4px;
  width: 26px;
  height: 8px;
  transform: translate3d(calc(8vw + var(--zp, 0) * 80vw), calc(16vh + var(--zp, 0) * 64vh + 160px), 0);
  will-change: transform;
}

/* the carriage itself sweeps on its own clock (compositor-only child) */
.zbeam-head b {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #d9f9ff, var(--mm-cyan));
  clip-path: polygon(0 0, 100% 0, 78% 55%, 58% 100%, 42% 100%, 22% 55%);
  opacity: 0.9;
  filter: drop-shadow(0 0 7px rgba(53, 224, 255, 0.75));
  animation: head-sweep 9s ease-in-out infinite alternate;
}

@keyframes head-sweep {
  from { transform: translateX(-16px); }
  to   { transform: translateX(16px); }
}

/* ── Footer: end-of-job G-code sign-off ──────────────────────────── */

body.home-page .site-footer .foot-gcode {
  margin-top: 0.4rem;
  color: var(--hint);
  opacity: 0.65;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
}

/* ── Reach-out modal ─────────────────────────────────────────────── */

.zend-link { cursor: pointer; }

.idea-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 7, 12, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.idea-backdrop.open { display: flex; }

.idea-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.9rem 2rem 1.7rem;
  background: linear-gradient(180deg, rgba(10, 15, 24, 0.98), rgba(7, 10, 17, 0.98));
  border: 1px solid rgba(53, 224, 255, 0.28);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 42px rgba(53, 224, 255, 0.07);
  animation: idea-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* HUD corner brackets */
.idea-modal::before,
.idea-modal::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.idea-modal::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--mm-cyan);
  border-left: 2px solid var(--mm-cyan);
}

.idea-modal::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--mm-cyan);
  border-right: 2px solid var(--mm-cyan);
}

@keyframes idea-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.idea-kicker {
  margin: 0 0 0.6rem;
  color: var(--mm-teal);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.idea-modal h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-disp);
  font-size: clamp(1.25rem, 3.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.idea-sub {
  margin: 0.7rem 0 1.4rem;
  color: var(--mute);
  font-size: 0.88rem;
  line-height: 1.65;
}

.idea-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.9rem;
}

.idea-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.95rem;
}

.idea-field span {
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.idea-field em {
  font-style: normal;
  opacity: 0.7;
  letter-spacing: 0.08em;
}

.idea-field input,
.idea-field textarea {
  padding: 0.68rem 0.75rem;
  color: var(--text);
  background: rgba(9, 14, 22, 0.9);
  border: 1px solid var(--mm-line);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.idea-field textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

.idea-field input:focus,
.idea-field textarea:focus {
  outline: none;
  border-color: rgba(53, 224, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(53, 224, 255, 0.12);
}

/* honeypot — parked far off-canvas; bots still "see" it */
.idea-hp {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.idea-error {
  display: none;
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.7rem;
  color: #ffabab;
  background: rgba(255, 92, 92, 0.08);
  border: 1px solid rgba(255, 92, 92, 0.35);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.idea-error.show { display: block; }

.idea-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.idea-send {
  padding: 0.78rem 1.7rem;
  color: #041018;
  background: var(--mm-cyan);
  border: 1px solid var(--mm-cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}

.idea-send:hover {
  box-shadow: 0 0 26px rgba(53, 224, 255, 0.4);
  transform: translateY(-1px);
}

.idea-send:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.idea-privacy {
  flex: 1;
  min-width: 180px;
  color: var(--hint);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

.idea-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  padding: 0.25rem 0.55rem;
  color: var(--mute);
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, text-shadow 0.15s;
}

.idea-close:hover {
  color: var(--mm-cyan);
  text-shadow: 0 0 12px rgba(53, 224, 255, 0.6);
}

.idea-done {
  text-align: center;
  padding: 1.2rem 0 0.4rem;
}

.idea-done-stamp {
  margin: 0;
  color: var(--mm-teal);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(56, 212, 184, 0.45);
}

.idea-done-body {
  margin: 0.9rem auto 1.4rem;
  max-width: 40ch;
  color: var(--mute);
  font-size: 0.9rem;
  line-height: 1.7;
}

.idea-done-body b {
  color: var(--text-strong);
  font-weight: 600;
}

@media (max-width: 560px) {
  .idea-modal { padding: 1.5rem 1.1rem 1.3rem; }
  .idea-grid { grid-template-columns: 1fr; gap: 0; }
}

.idea-send:focus-visible,
.idea-close:focus-visible,
.idea-done-close:focus-visible {
  outline: 1px solid var(--mm-cyan);
  outline-offset: 4px;
}

/* ── Reduced motion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .zbeam { display: none; }
  .zbeam-head { display: none; }
  .gcode { display: none !important; }
  .idea-modal { animation: none; }
  .idea-send { transition: none; }
  .brim-nozzle { display: none; }
  .brim-layer .brim { transition: none; }
  .brim-layer .brim.hexo.done { animation: none; }
  .nz-ret, .hexdeco.spin-a, .hexdeco.spin-b, .hexdeco-dot { animation: none; }
  .hexdeco { opacity: 1; }
  .hexdeco-dot { opacity: 0.5; }
  .brim-hot { transition: none; }
  .zdone { transition: none; }
  .nameplate .np-cursor,
  .hm-scroll i,
  .zr-status .live-dot { animation: none; }
  .hm-kicker::before,
  .feed-tag i,
  .zdone.on { animation: none; }
  body.home-page .card img { transition: none; }
  .nameplate .np-outline { transition: none; }
  .zrow, .zr-go, .zrow::before, .zend-link { transition: none; }
}
