/* ==========================================================
   MOTION LAYER — ambient field, grain, cursor aura, live
   canvas, marquee bands, word reveals. Loaded on every page.
   ========================================================== */

/* ---- the hero's flames, carried quietly behind the whole page ---- */
#field {
  position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -2;
  pointer-events: none; opacity: 0; transition: opacity .9s ease;
}
#field.on { opacity: 1; }

/* ---- a soft light that follows the cursor, behind the content ---- */
.aura {
  position: fixed; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, rgba(95,211,160,.22), rgba(115,165,250,.08) 55%, transparent 72%);
  will-change: transform; opacity: 0; transition: opacity .6s;
}
.aura.on { opacity: 1; }
:root[data-theme="light"] .aura {
  width: 170px; height: 170px; margin: -85px 0 0 -85px; box-shadow: none;
  background: radial-gradient(closest-side, rgba(18,128,90,.24), rgba(60,110,210,.10) 55%, transparent 75%);
}
@media (hover: none) { .aura { display: none; } }

/* ---- film grain: takes the plastic off every surface ---- */
.grain {
  position: fixed; inset: -60px; z-index: 300; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .085; mix-blend-mode: overlay;
  animation: grain 1.1s steps(6) infinite;
}
:root[data-theme="light"] .grain { opacity: .11; mix-blend-mode: multiply; }
@keyframes grain {
  0% { transform: translate(0, 0); } 17% { transform: translate(-22px, 14px); }
  33% { transform: translate(18px, -26px); } 50% { transform: translate(-12px, 30px); }
  67% { transform: translate(28px, 6px); } 83% { transform: translate(-30px, -12px); }
  100% { transform: translate(0, 0); }
}

/* ---- surfaces go translucent so the field moves behind them ---- */
:root {
  --raise:   rgba(13,17,25,.58);
  --raise-2: rgba(20,26,40,.62);
}
:root[data-theme="light"] {
  --raise:   rgba(255,255,255,.62);
  --raise-2: rgba(244,246,251,.66);
}
.card, .step, .inst, .post, .form, .game, .game-gate, .mini-card, .folio-stage, .wk {
  -webkit-backdrop-filter: blur(16px) saturate(1.15); backdrop-filter: blur(16px) saturate(1.15);
}
.inst-foot { background: transparent; }

/* ---- headings arrive word by word ---- */
.w { display: inline-block; white-space: pre; }
.js .split .w {
  opacity: 0; transform: translateY(.55em) rotate(2deg); filter: blur(6px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1), filter .9s;
  transition-delay: calc(var(--i) * 70ms);
}
.js .rise.in .split .w, .js .split.in .w { opacity: 1; transform: none; filter: none; }

/* ---- magnetic buttons ---- */
.mag { transition: transform .35s cubic-bezier(.2,.7,.2,1); will-change: transform; }

/* ==========================================================
   MARQUEE — methods drifting past, faster when you scroll
   ========================================================== */
.marquee {
  position: relative; overflow: hidden; padding: clamp(18px, 3vw, 34px) 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.mq-row { display: flex; width: max-content; will-change: transform; }
.mq-row + .mq-row { margin-top: 2px; }
.mq-row span {
  font-family: var(--serif); font-size: clamp(34px, 6vw, 76px); line-height: 1.12;
  white-space: nowrap; padding-right: .5em; color: var(--white); letter-spacing: -.01em;
}
.mq-row span i { font-style: italic; color: var(--iris); }
.mq-row span b { font-weight: 400; color: var(--dim-2); padding: 0 .28em; }
.mq-row.ghost span {
  color: transparent; -webkit-text-stroke: 1px var(--edge-2);
  font-style: italic;
}
.mq-row.ghost span b { color: transparent; }

/* ==========================================================
   LIVE CANVAS — nodes, wires, data flowing through
   ========================================================== */
.flow-section { position: relative; padding: clamp(40px, 6vw, 80px) 0 clamp(30px, 4vw, 56px); }
.flow-head { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.flow-hint { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim-2); }
.flow-hint::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3ccf7a; margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 0 0 rgba(60,207,122,.6); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(60,207,122,.55); } 70% { box-shadow: 0 0 0 9px rgba(60,207,122,0); } 100% { box-shadow: 0 0 0 0 rgba(60,207,122,0); } }

.flow-shell {
  position: relative; margin: clamp(18px, 2.4vw, 30px) auto 0; width: min(100%, 1320px);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 6%, #000 92%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 6%, #000 92%, transparent);
}
.flow-shell::-webkit-scrollbar { display: none; }
.flow { position: relative; transform-origin: 0 0; }
.flow-dots {
  position: absolute; inset: -80px; pointer-events: none;
  background-image: radial-gradient(circle, var(--edge-2) 1.1px, transparent 1.4px);
  background-size: 26px 26px; opacity: .7; will-change: transform;
}
.flow-wires { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.flow-wires .wb { fill: none; stroke: var(--edge-2); stroke-width: 1.4; }
.flow-wires .wf {
  fill: none; stroke: var(--iris); stroke-width: 1.6; stroke-linecap: round;
  stroke-dasharray: 2 14; animation: wireFlow 1.4s linear infinite; opacity: .75;
}
@keyframes wireFlow { to { stroke-dashoffset: -32; } }
.flow-wires .pk { fill: #fff; filter: drop-shadow(0 0 5px var(--iris)) drop-shadow(0 0 12px var(--iris)); }
:root[data-theme="light"] .flow-wires .pk { fill: var(--iris); filter: drop-shadow(0 0 4px rgba(18,128,90,.6)); }
.flow-wires .hot { stroke: var(--gold); opacity: 1; }

.node {
  position: absolute; left: 0; top: 0; border-radius: 14px;
  background: var(--raise); border: 1px solid var(--edge-2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 30px 60px -36px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.02) inset;
  cursor: grab; user-select: none; -webkit-user-select: none; will-change: transform;
  transition: border-color .3s, box-shadow .3s;
}
:root[data-theme="light"] .node { box-shadow: 0 26px 50px -30px rgba(20,28,45,.35); }
.node:hover { border-color: var(--iris); }
.node.drag { cursor: grabbing; box-shadow: 0 40px 80px -30px rgba(0,0,0,.95), 0 0 0 1px var(--iris); z-index: 5; }
.node-h {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px 8px;
  border-bottom: 1px solid var(--edge); font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .06em; color: var(--dim); white-space: nowrap; overflow: hidden;
}
.node-h .ttl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.node-h .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--iris)); flex: none; }
.node-h .st { margin-left: auto; color: var(--dim-2); font-size: 9.5px; }
.node-b { padding: 10px 12px 12px; font-size: 12.5px; color: var(--dim); }
.port {
  position: absolute; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%;
  background: var(--void); border: 1.5px solid var(--iris);
}
.port.in { left: -5px; } .port.out { right: -5px; }

/* node bodies */
.csv-win { height: 118px; overflow: hidden; position: relative; font-family: var(--mono); font-size: 10.5px; }
.csv-win::after { content: ""; position: absolute; inset: auto 0 0; height: 30px; background: linear-gradient(transparent, var(--raise)); }
.csv-rows { animation: csvScroll 9s linear infinite; }
.csv-rows div { display: grid; grid-template-columns: 30px 1fr 34px 30px; gap: 6px; padding: 3px 0; border-bottom: 1px dashed var(--edge); color: var(--dim); }
.csv-rows div b { font-weight: 400; color: var(--white); }
@keyframes csvScroll { to { transform: translateY(-50%); } }
.ck { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; font-size: 11.5px; }
.ck li { display: flex; gap: 7px; align-items: center; opacity: .35; transition: opacity .4s; }
.ck li::before { content: ""; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--edge-2); flex: none; transition: background .3s, border-color .3s; }
.ck li.on { opacity: 1; color: var(--white); }
.ck li.on::before { background: #3ccf7a; border-color: #3ccf7a; box-shadow: inset 0 0 0 2px var(--raise); }
.big-n { font-size: 26px; font-weight: 600; letter-spacing: -.03em; color: var(--white); font-variant-numeric: tabular-nums; line-height: 1.1; }
.big-n small { font-size: 11px; font-family: var(--mono); color: var(--dim-2); font-weight: 400; letter-spacing: .04em; margin-left: 6px; }
.xbars { display: flex; align-items: flex-end; gap: 7px; height: 92px; padding-top: 6px; }
.xbars i { flex: 1; border-radius: 4px 4px 1px 1px; background: var(--c); transition: height 1.2s cubic-bezier(.3,.8,.2,1); }
.xbar-lab { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9.5px; color: var(--dim-2); margin-top: 6px; }
.pv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 11.5px; }
.pv span:nth-child(even) { font-family: var(--mono); color: var(--white); font-variant-numeric: tabular-nums; }
.pv .sig { color: #3ccf7a !important; }
.pv-foot { margin-top: 8px; font-family: var(--mono); font-size: 9.5px; color: var(--dim-2); letter-spacing: .04em; }
.node-img { padding: 6px; }
.node-img img { display: block; width: 100%; border-radius: 9px; pointer-events: none; }
.node-img .zoom { position: absolute; right: 12px; bottom: 12px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
  background: rgba(4,6,10,.72); color: #F4F6FB; padding: 4px 8px; border-radius: 100px; opacity: 0; transition: opacity .25s; }
.node:hover .zoom { opacity: 1; }
.typed { font-family: var(--serif); font-size: 23px; line-height: 1.15; color: var(--white); min-height: 2.4em; }
.typed::after { content: ""; display: inline-block; width: 2px; height: .9em; background: var(--iris); margin-left: 3px; vertical-align: -2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.hub { text-align: center; padding: 18px 16px; }
.hub b { display: block; font-size: 20px; letter-spacing: .22em; color: var(--white); font-weight: 700; }
.hub span { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--dim); }
.chip-node .node-b { padding: 9px 14px; font-family: var(--mono); font-size: 12px; color: var(--white); letter-spacing: .04em; }

/* full-size viewer for canvas images */
.fview { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 4vw;
  background: rgba(2,3,6,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); opacity: 0; transition: opacity .3s; }
.fview.on { opacity: 1; }
.fview img { max-width: min(1400px, 100%); max-height: 88vh; border-radius: 12px; box-shadow: 0 40px 120px -40px #000;
  transform: scale(.96); transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.fview.on img { transform: none; }
.fview button { position: absolute; top: 18px; right: 22px; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; font-size: 22px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .grain, .csv-rows, .flow-wires .wf, .flow-hint::before { animation: none; }
  .js .split .w { opacity: 1; transform: none; filter: none; }
}

/* one running line, in the first style */
.marquee.thin { padding: clamp(6px, 1vw, 12px) 0; margin: clamp(10px, 2vw, 24px) 0; }
.marquee.thin .mq-row span { font-size: clamp(14px, 1.25vw, 17px); letter-spacing: .01em; }

.flow-wires .wb.dot { stroke-dasharray: 1.5 7; stroke-linecap: round; stroke-width: 2.2; stroke: var(--dim); }

/* brighter small text on dark */
:root:not([data-theme="light"]) { --dim: #B6BECD; --dim-2: #8A95A9; }
:root:not([data-theme="light"]) .f input, :root:not([data-theme="light"]) .f select, :root:not([data-theme="light"]) .f textarea { color: #F4F6FB; border-color: rgba(255,255,255,.22); }
:root:not([data-theme="light"]) .f label { color: #C3CAD8; }
:root:not([data-theme="light"]) .chart-note, :root:not([data-theme="light"]) .bar-label, :root:not([data-theme="light"]) .bar-value { color: #C9D0DD; }

/* moon: inside the work ring, and behind Recent work */
.orbit-stage { isolation: isolate; }
.orbit-moon { position: absolute; left: 50%; top: 50%; width: 118%; height: 118%; transform: translate(-50%, -50%); object-fit: cover; z-index: -1; pointer-events: none;
  border-radius: 50%; opacity: 0; transition: opacity 1.2s;
  -webkit-mask-image: radial-gradient(closest-side, #000 52%, transparent 96%); mask-image: radial-gradient(closest-side, #000 52%, transparent 96%); }
.orbit-moon.on { opacity: .62; }
:root[data-theme="light"] .orbit-moon.on { opacity: .34; }
.has-moon { position: relative; overflow: hidden; }
.has-moon > .wrap { position: relative; z-index: 1; }
.moon-wrap.pg { position: absolute; top: 0; bottom: 0; right: -4%; width: min(52%, 700px); z-index: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 50% 46% at 50% 46%, #000 45%, transparent 100%); mask-image: radial-gradient(ellipse 50% 46% at 50% 46%, #000 45%, transparent 100%); }
.page-moon { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s; }
.page-moon.on { opacity: .5; }
:root[data-theme="light"] .page-moon.on { opacity: .28; }
@media (max-width: 900px) { .moon-wrap.pg { display: none; } }

/* Amy in the corner of each service card */
.mini-card { position: relative; }
.mini-me { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; z-index: 3; box-shadow: 0 0 0 2px var(--void), 0 0 0 3px var(--edge-2); }

/* light theme: no moon. A dim sun instead. */
:root[data-theme="light"] .orbit-moon, :root[data-theme="light"] .page-moon { display: none; }
:root[data-theme="light"] .orbit-stage::before, :root[data-theme="light"] .moon-wrap.pg::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 86%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,214,140,.55), rgba(255,190,120,.28) 45%, rgba(255,190,120,0) 72%); animation: sunBreath 9s ease-in-out infinite; }
:root[data-theme="light"] .moon-wrap.pg { -webkit-mask-image: none; mask-image: none; overflow: visible; }
:root[data-theme="light"] .moon-wrap.pg::before { z-index: 0; width: 70%; }
@keyframes sunBreath { 50% { transform: translate(-50%, -50%) scale(1.06); opacity: .85; } }
/* the one moon reaches a little past the ring */
.orbit-moon { width: 128%; height: 128%; }
/* Amy sits in the empty bottom-right corner of each card */
.mini-me { top: auto; bottom: 14px; right: 14px; width: 38px; height: 38px; }

/* the decision is sealed in an envelope, flies a looping trail, and opens on a desktop */
.mailer { display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--edge-2); }
.env, .fly-env { position: relative; width: 46px; height: 32px; border-radius: 4px; background: linear-gradient(160deg, #d9d1ff, #9b8af0); box-shadow: 0 8px 18px -8px rgba(0,0,0,.7); }
.env::after, .fly-env::after { content: ""; position: absolute; inset: 0; border-radius: 4px; z-index: 2;
  background: linear-gradient(to top right, transparent 49%, rgba(0,0,0,.14) 50%, transparent 51%), linear-gradient(to top left, transparent 49%, rgba(0,0,0,.14) 50%, transparent 51%); }
.env .flap, .fly-env .flap { position: absolute; left: 0; right: 0; top: 0; height: 18px; background: #b8abf8; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transform: rotateX(180deg); transition: transform .45s; z-index: 3; }
.fly-env .flap { transform: none; }
.env .ppr, .fly-env .ppr { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 30px; background: #fff; border-radius: 2px; padding: 4px; display: grid; gap: 3px; align-content: start; z-index: 1;
  transform: translateY(-26px); opacity: 0; transition: transform .55s cubic-bezier(.3,.8,.2,1), opacity .3s; }
.fly-env .ppr { display: none; }
.ppr b { display: block; height: 3px; border-radius: 2px; background: #12805A; } .ppr b:nth-child(2) { width: 70%; background: #E8B872; } .ppr b:nth-child(3) { width: 45%; background: #c8cdd8; }
.mailer.load .ppr { opacity: 1; transform: translateY(-2px); }
.mailer.seal .flap { transform: rotateX(0deg); }
.mailer.gone .env { opacity: 0; transition: opacity .15s; }
.mailer.back .env, .mailer.back .ppr, .mailer.back .flap { transition: none; }
.mail-meta { display: grid; gap: 2px; min-width: 0; font-family: var(--mono); font-size: 9.5px; color: var(--dim-2); }
.mail-meta em { font-style: normal; color: var(--white); font-size: 9px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-meta .att::before { content: "\1F4CE  "; font-size: 9px; }
.fly-env { position: absolute; left: 0; top: 0; z-index: 9; display: none; pointer-events: none; transform-origin: 23px 16px;
  box-shadow: 0 14px 28px -10px rgba(18,128,90,.75), 0 0 24px rgba(95,211,160,.35); }
.flow-wires .mail-ghost { fill: none; stroke: var(--edge-2); stroke-width: 1.4; stroke-dasharray: 4 6; stroke-linecap: round; }
.flow-wires .mail-trail { fill: none; stroke: var(--iris); stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: round; transition: opacity .8s; filter: drop-shadow(0 0 4px rgba(95,211,160,.6)); }
/* the desktop */
.node:has(.dk-mon) .port { display: none; }
.dk-mon { padding: 14px 14px 12px; display: grid; justify-items: center; }
.dk-scr { position: relative; width: 100%; height: 156px; border-radius: 8px; background: #0b0d14; border: 6px solid #15171d; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.06); transition: box-shadow .4s; }
.dk-neck { width: 34px; height: 26px; background: linear-gradient(90deg, #26282e, #3a3c42, #26282e); clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%); }
.dk-foot { width: 96px; height: 6px; border-radius: 3px; background: #2a2c32; }
.dk-inbox { position: absolute; inset: 10px; display: grid; gap: 8px; align-content: start; transition: opacity .25s; }
.dk-inbox i { height: 14px; border-radius: 3px; background: rgba(255,255,255,.07); }
.dk-inbox i:first-child { width: 70%; background: rgba(95,211,160,.16); }
.dk-mail { position: absolute; inset: 0; background: #f6f4ef; color: #17181f; padding: 12px 14px; display: grid; gap: 6px; align-content: start;
  transform: scale(.2); opacity: 0; transform-origin: 50% 0; transition: transform .55s cubic-bezier(.2,1.3,.4,1), opacity .25s; }
.dk-from { font-family: var(--mono); font-size: 8.5px; color: #6b6f7c; }
.dk-subj { margin: 0; font-family: var(--serif); font-size: 20px; line-height: 1.12; color: #17181f; }
.dk-att { justify-self: start; font-family: var(--mono); font-size: 8.5px; color: #12805A; }
.dk-att::before { content: "\1F4CE "; }
.node.pop .dk-mail { transform: none; opacity: 1; }
.node.pop .dk-inbox { opacity: 0; }
.node.pop .dk-scr { box-shadow: 0 0 0 2px var(--iris), 0 0 36px rgba(95,211,160,.45); }
/* the drag hint, easy to see */
.flow-hint.strong { font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--white);
  padding: 7px 14px 7px 12px; border-radius: 100px; border: 1px solid var(--edge-2); background: var(--wash); }

/* the desktop stands on its own, no card around it */
.node:has(.dk-mon) { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.node:has(.dk-mon) .node-h { border: 0; justify-content: center; padding-bottom: 0; }
.node:has(.dk-mon) .node-h .st { display: none; }
.node:has(.dk-mon):hover { border: 0; }
/* drag hint: a hand that drags left and right */
.flow-hint.strong::before { display: none; }
.flow-hint .hand { width: 20px; height: 20px; margin-right: 8px; vertical-align: -5px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; animation: handDrag 2.2s ease-in-out infinite; }
@keyframes handDrag { 0%, 100% { transform: translateX(0) rotate(0); } 40% { transform: translateX(10px) rotate(-8deg); } 60% { transform: translateX(10px) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .flow-hint .hand { animation: none; } }
