/* MRT Ventures — motion layer for motion.html. Loaded after style.css and only adds to it:
   WebGL hero, split-text reveals, scroll-linked scenes, spotlight cards, magnetic buttons.
   Every hidden state is scoped to .js, and a safety animation shows content if the script never runs. */

/* ---------- Safety ---------- */
html:not(.js) .reveal { opacity: 1; translate: none; }
.js:not(.motion-ready) .reveal,
.js:not(.motion-ready) [data-split] { animation: m-safety 0s 2.5s forwards; }
@keyframes m-safety { to { opacity: 1; translate: none; visibility: visible; } }

/* ---------- Reveals: use the translate property so transform stays free for hover/tilt ---------- */
.reveal {
  transform: none; translate: 0 24px;
  transition: opacity 1s var(--ease) calc(var(--i, 0) * 90ms), translate 1.1s var(--ease) calc(var(--i, 0) * 90ms);
}
.reveal.in { translate: none; }
.hero .reveal { transition-delay: var(--d, 0s); }

/* ---------- Split headings: each word rises out of its own mask ---------- */
.js [data-split]:not(.is-split) { visibility: hidden; }
.w { display: inline-block; clip-path: polygon(-14% -24%, 114% -24%, 114% 124%, -14% 124%); }
.w > span {
  display: inline-block; translate: 0 140%; rotate: 5deg; transform-origin: 0 100%;
  transition: translate 1.15s var(--ease), rotate 1.15s var(--ease);
  transition-delay: calc(var(--d, 0s) + var(--wi, 0) * 55ms);
}
[data-split].in .w > span { translate: none; rotate: none; }
.feature__name span { color: inherit; }
.feature__name .dot { color: var(--accent); }

/* ---------- Scroll-scrubbed statements: words go from muted to full as you read.
   Both ends keep WCAG contrast (never a faded word), so the effect is a highlight, not a dimming. ---------- */
[data-scrub-text] .sw { color: color-mix(in srgb, var(--fg) calc(100% * clamp(0, var(--p, 1) * var(--n, 1) - var(--k, 0), 1)), var(--muted)); transition: color .2s linear; }

/* ---------- Page progress ---------- */
.progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 70; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--sp, 0)); box-shadow: 0 0 10px rgba(255, 74, 28, .7); }

/* ---------- Hero ---------- */
.hero__in { translate: 0 calc(var(--hp, 0) * -60px); opacity: calc(1 - clamp(0, (var(--hp, 0) - .45) * 2.2, 1)); }
.hero__glow {
  left: var(--gx, 76%); top: var(--gy, 40%); right: auto; translate: -50% -50%;
  width: var(--gs, 60vw); height: var(--gs, 60vw); max-width: none; max-height: none;
  background: radial-gradient(closest-side, rgba(255, 74, 28, .16), rgba(255, 74, 28, .07) 38%, rgba(255, 74, 28, 0) 74%);
  filter: none;                                   /* the gradient is soft enough; a blur filter costs a GPU pass per frame on phones */
  opacity: 0; transition: opacity 1.8s var(--ease);
}
/* Touch devices: no full-screen animated grain, no backdrop blur over the live canvas */
@media (hover: none) {
  .grain { inset: 0; animation: none; }
  .ticker { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10, 10, 11, .78); }
}
.hero.lit .hero__glow { opacity: calc(1 - clamp(0, var(--hp, 0) * 1.8, 1)); transition: opacity .6s var(--ease); }
.hero__mark { position: absolute; z-index: -1; right: 9%; top: 18%; width: min(30vw, 48vh); height: auto; pointer-events: none; overflow: visible; }
.hero__mark path, .contact__mark path { fill: none; stroke-width: 14; stroke-linecap: butt; stroke-linejoin: miter; }
.hero__mark .b { stroke: var(--bone); stroke-dasharray: 280; stroke-dashoffset: 280; animation: m-draw 1.3s var(--ease) .2s forwards; }
.hero__mark .a { stroke: var(--accent); stroke-dasharray: 86; stroke-dashoffset: 86; animation: m-draw .6s var(--ease) 1.2s forwards; }
@keyframes m-draw { to { stroke-dashoffset: 0; } }
.gl .hero__mark { display: none; }

/* ---------- Ticker: driven by script (speed follows scroll velocity) ---------- */
.motion-ready .ticker__track { animation: none; will-change: transform; }

/* ---------- Light sections open up as they arrive ---------- */
.js .section--light { clip-path: inset(0 calc(var(--x, 0) * 4.5%) round calc(var(--x, 0) * 32px)); }

/* ---------- QORA flow: a rail fills as you scroll, steps light up in order ---------- */
.flow { position: relative; }
.flow__rail { position: absolute; left: calc(clamp(28px, 4vw, 56px) - 22px); top: 0; height: 0; width: 1px; background: var(--line); pointer-events: none; }
.flow__rail i { position: absolute; inset: 0; background: var(--accent); transform-origin: 50% 0; transform: scaleY(var(--fp, 1)); box-shadow: 0 0 12px rgba(255, 74, 28, .65); }
/* steps not yet reached are toned down by colour, never below WCAG contrast; the small line stays as it is */
.flow__step b { opacity: calc(.75 + .25 * var(--on, 1)); transition: opacity .35s var(--ease); }
.flow__step span { color: color-mix(in srgb, var(--bone) calc(50% + 50% * var(--on, 1)), var(--ink-2)); transition: color .35s var(--ease); }

/* ---------- Principles: dividers draw themselves ---------- */
.js .principle { border-bottom-color: transparent; position: relative; }
.js .principle::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--line-strong);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.4s var(--ease) calc(var(--i, 0) * 90ms + 150ms);
}
.js .principle.in::after { transform: scaleX(1); }

/* ---------- Contact: the mark draws itself, the arm breaks out last ---------- */
.contact__mark { opacity: 1; overflow: visible; }
.contact__mark .b { stroke: rgba(243, 240, 234, .06); stroke-dasharray: 280; stroke-dashoffset: calc(280px * (1 - clamp(0, var(--cp, 1) * 1.6, 1))); }
.contact__mark .a { stroke: rgba(255, 74, 28, .24); stroke-dasharray: 86; stroke-dashoffset: calc(86px * (1 - clamp(0, (var(--cp, 1) - .55) * 2.6, 1))); }

/* ---------- Buttons: magnetic pull (script sets translate) ---------- */
.btn { transition: background .35s var(--ease), color .35s var(--ease), transform .35s var(--ease), border-color .35s var(--ease), translate .45s var(--ease); }

/* ---------- Cards: spotlight + border light + slight tilt, pointer devices only ---------- */
@media (hover: hover) and (pointer: fine) {
  .card {
    transition: transform .5s var(--ease), border-color .5s var(--ease), background .5s var(--ease),
      opacity 1s var(--ease) calc(var(--i, 0) * 90ms), translate 1.1s var(--ease) calc(var(--i, 0) * 90ms);
  }
  .card:hover { transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px); transition-duration: .2s, .5s, .5s, 1s, 1.1s; }
  .card::before, .card::after { content: ""; position: absolute; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .45s var(--ease); }
  .card::after { inset: 0; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 74, 28, .09), transparent 62%); }
  .card::before {
    inset: -1px; padding: 1px;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 74, 28, .8), transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  }
  .card:hover::before, .card:hover::after { opacity: 1; }
}

/* ---------- QORA demo: the card pins while a phone plays the six steps ---------- */
.scene { position: relative; }
.feature.pinned { position: sticky; }
/* a tighter card so it fits a 900px viewport whole while pinned */
.feature__body { padding: clamp(28px, 3.6vw, 48px); }
.feature__name { font-size: clamp(3rem, 6vw, 5.6rem); }
.feature__p { font-size: 16px; }
.props { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.prop { display: flex; gap: 8px; align-items: baseline; padding: 11px 13px; }
.prop b { white-space: nowrap; font-size: 14px; }
.prop span { margin-top: 0; font-size: 12.5px; }
.feature__cta { margin-top: 26px; }
.feature > * { min-width: 0; }
.flow--demo { justify-content: flex-start; padding: clamp(28px, 3.6vw, 48px) clamp(24px, 3.4vw, 48px); }
.demo { display: grid; grid-template-columns: 216px 1fr; gap: 30px; align-items: center; margin-top: 4px; }
.flow__steps { position: relative; }
.flow--demo .flow__rail { left: -14px; }
.flow--demo .flow__step { grid-template-columns: 24px 1fr; gap: 10px; padding: 10px 0; }
.flow--demo .flow__step span { font-size: 13.5px; line-height: 1.4; }
.flow--demo .flow__step small { font-size: 12px; }
.flow--demo .flow__step--gate { margin-inline: -10px; padding-inline: 10px; }
.demo__note { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 18px; }

.phone { width: 216px; height: 446px; border-radius: 34px; padding: 9px; background: #1c1c20; border: 1px solid rgba(243, 240, 234, .14); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(0, 0, 0, .6); position: relative; }
.phone::before { content: ""; position: absolute; top: 15px; left: 50%; translate: -50% 0; width: 56px; height: 14px; border-radius: 999px; background: #0a0a0b; z-index: 2; }
.ph__screen { position: relative; height: 100%; border-radius: 26px; overflow: hidden; background: linear-gradient(180deg, #121214, #0d0d0f); padding: 32px 11px 12px; display: flex; flex-direction: column; gap: 7px; color: var(--bone); }
.ph__status { position: absolute; top: 8px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: center; font-size: 9px; font-weight: 600; color: var(--muted); }
.ph__status i { width: 14px; height: 7px; border: 1px solid var(--muted); border-radius: 2px; background: linear-gradient(90deg, var(--muted) 70%, transparent 70%); }
.ph__head { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.ph__head svg { width: 14px; height: 14px; overflow: visible; }
.ph__head path { fill: none; stroke-width: 14; }
.ph__head .b { stroke: var(--bone); }
.ph__head .a { stroke: var(--accent); }
.ph__head b { font-weight: 760; letter-spacing: -0.04em; }
.ph__loc { margin-left: auto; font-family: var(--mono); font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); opacity: 0; translate: 6px 0; transition: opacity .5s var(--ease), translate .5s var(--ease); }
.ph__photo { position: relative; height: 118px; border-radius: 10px; overflow: hidden; background: linear-gradient(180deg, #4a4742 0%, #35332f 55%, #2a2825 100%); opacity: 0; scale: 1.05; transition: opacity .6s var(--ease), scale .9s var(--ease), height .6s var(--ease); flex: none; }
.ph__col { position: absolute; left: 40%; top: -4px; bottom: 0; width: 26%; background: linear-gradient(90deg, #6a665f, #8a857c 40%, #5e5a53); }
.ph__hc { position: absolute; left: 41%; bottom: 10px; width: 24%; height: 22px; background: radial-gradient(3px 3px at 20% 30%, #2b2925 60%, transparent 62%), radial-gradient(3px 3px at 55% 70%, #2b2925 60%, transparent 62%), radial-gradient(2.5px 2.5px at 80% 25%, #2b2925 60%, transparent 62%), radial-gradient(2px 2px at 35% 80%, #2b2925 60%, transparent 62%), radial-gradient(2.5px 2.5px at 70% 50%, #2b2925 60%, transparent 62%); }
.ph__pin { position: absolute; left: 8px; top: 8px; font-family: var(--mono); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone); background: rgba(10, 10, 11, .7); padding: 3px 6px; border-radius: 999px; }
.ph__box { position: absolute; left: 37%; bottom: 6px; width: 32%; height: 34px; border: 1.5px solid var(--accent); border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 74, 28, .25), 0 0 14px rgba(255, 74, 28, .5); opacity: 0; scale: 1.4; transition: opacity .4s var(--ease), scale .6s var(--ease); }
.ph__card { border: 1px solid rgba(243, 240, 234, .09); background: rgba(243, 240, 234, .04); border-radius: 10px; padding: 8px 9px; opacity: 0; translate: 0 10px; transition: opacity .5s var(--ease), translate .6s var(--ease); flex: none; }
.ph__card small { display: block; font-family: var(--mono); font-size: 7.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.ph__card p { font-size: 10.5px; line-height: 1.35; letter-spacing: -0.005em; }
.ph__gate, .ph__acts { display: flex; gap: 4px; margin-top: 7px; }
.ph__gate, .ph__by { max-height: 30px; overflow: hidden; transition: max-height .45s var(--ease), opacity .4s var(--ease), margin-top .45s var(--ease); }
.ph__gate span, .ph__acts span { flex: 1; text-align: center; font-size: 8.5px; font-weight: 600; padding: 4px 0; border-radius: 999px; border: 1px solid rgba(243, 240, 234, .16); color: var(--muted); transition: background .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease); }
.ph__by { display: block; font-style: normal; font-size: 8px; color: var(--faint); margin-top: 6px; opacity: 0; transition: opacity .5s var(--ease); }
.ph__draft p span { opacity: .18; transition: opacity .25s linear; }
.ph__toast { position: absolute; left: 11px; right: 11px; bottom: 12px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 12px; background: var(--bone); color: var(--ink); font-size: 9.5px; font-weight: 600; white-space: nowrap; opacity: 0; translate: 0 16px; transition: opacity .45s var(--ease), translate .6s var(--ease); }
.ph__toast span { display: flex; flex-direction: column; line-height: 1.25; }
.ph__toast small { font-size: 8px; font-weight: 500; color: #5a5750; }
.ph__toast i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); position: relative; flex: none; }
.ph__toast i::after { content: ""; position: absolute; left: 4px; top: 3px; width: 4px; height: 7px; border: solid var(--ink); border-width: 0 1.5px 1.5px 0; rotate: 45deg; }

.phone.s1 .ph__loc { opacity: 1; translate: none; }
.phone.s1 .ph__photo { opacity: 1; scale: 1; }
.phone.s2 .ph__box { opacity: 1; scale: 1; }
.phone.s2 .ph__finding { opacity: 1; translate: none; }
.phone.s3 .ph__gate .keep { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.phone.s3 .ph__by { opacity: 1; }
.phone.s4 .ph__photo { height: 60px; }
.phone.s4 .ph__req { opacity: 1; translate: none; }
.phone.s5 .ph__gate, .phone.s5 .ph__by { max-height: 0; opacity: 0; margin-top: 0; }
.phone.s5 .ph__photo { height: 0; opacity: 0; margin-bottom: -7px; }
.phone.s5 .ph__draft { opacity: 1; translate: none; }
.phone.s5 .ph__draft p span:nth-child(1) { opacity: calc(.18 + .82 * clamp(0, var(--sp5, 1) * 4, 1)); }
.phone.s5 .ph__draft p span:nth-child(2) { opacity: calc(.18 + .82 * clamp(0, (var(--sp5, 1) - .3) * 4, 1)); }
.phone.s5 .ph__draft p span:nth-child(3) { opacity: calc(.18 + .82 * clamp(0, (var(--sp5, 1) - .6) * 4, 1)); }
.phone.s6 .ph__acts .ok { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.phone.s6 .ph__toast { opacity: 1; translate: none; }
.phone.s6 .ph__photo, .phone.s6 .ph__finding, .phone.s6 .ph__req { opacity: .5; }

/* ---------- How we work: the head stays put, the rules pass by and light up in turn ---------- */
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.rules__head { position: sticky; top: 100px; }
.rules__head .h2 { margin-top: 20px; }
.rules__meter { display: flex; align-items: center; gap: 18px; margin-top: 40px; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--faint); }
.rules__meter b { color: var(--accent); font-weight: 500; }
.rules__mark { width: 64px; height: 64px; overflow: visible; }
.rules__mark path { fill: none; stroke-width: 14; }
.rules__mark .b { stroke: rgba(243, 240, 234, .16); }
.rules__mark .a { stroke: var(--accent); stroke-dasharray: 86; stroke-dashoffset: calc(86px * (1 - var(--rp, 1))); transition: stroke-dashoffset .7s var(--ease); }
.principles--stack { grid-template-columns: 1fr; }
.principles--stack .principle { padding: 44px 0; }
/* the rule in focus is full; the others are toned down by colour and keep WCAG contrast */
.principles--stack .principle h3 { color: color-mix(in srgb, var(--fg) calc(45% + 55% * var(--on, 1)), var(--bg)); transition: color .5s var(--ease); }
.principles--stack .principle p { color: color-mix(in srgb, var(--muted) calc(100% * var(--on, 1)), var(--faint)); transition: color .5s var(--ease); }
.principles--stack .principle b { opacity: calc(.75 + .25 * var(--on, 1)); transition: opacity .5s var(--ease); }

@media (max-width: 1024px) {
  .rules { grid-template-columns: 1fr; gap: 24px; }
  .rules__head { position: static; }
  .rules__meter { display: none; }
  .principles--stack .principle { padding: 34px 0; }
}
@media (max-width: 720px) {
  .props { grid-template-columns: 1fr; }
  .prop { flex-wrap: wrap; gap: 2px 8px; }
  .prop b { white-space: normal; }
  .demo { grid-template-columns: 1fr; justify-items: center; gap: 26px; }
  .flow__steps { width: 100%; }
  .flow--demo .flow__rail { left: -12px; }
}

/* ---------- Reduced motion: final states, no movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { translate: none; transition: none; }
  .w > span { translate: none; rotate: none; transition: none; }
  .js .section--light { clip-path: none; }
  [data-scrub-text] .sw { color: inherit; }
  .flow__step b { opacity: 1; }
  .flow__step span { color: var(--bone); }
  .flow__rail i { transform: none; }
  .hero__in { translate: none; opacity: 1; }
  .hero__glow { opacity: 1; transition: none; }
  .hero__mark .b, .hero__mark .a { animation: none; stroke-dashoffset: 0; }
  .contact__mark .b, .contact__mark .a { stroke-dashoffset: 0; }
  .js .principle::after { transform: none; transition: none; }
  .card, .card:hover { transform: none; }
  .phone, .phone * { transition: none !important; }
  .principles--stack .principle h3 { color: var(--fg); }
  .principles--stack .principle p { color: var(--muted); }
  .principles--stack .principle b { opacity: 1; }
  .rules__mark .a { stroke-dashoffset: 0; transition: none; }
}
