/* Transcendence — motion layer (light theme). Loaded after style.css + elite.css.
   One orchestrated opening (splash → hero), then quiet, earned motion on scroll/hover.
   Timing model borrowed from Remotion: every sequence is a fixed timeline with
   ease-out entrances and ease-in exits. Everything is off under reduced motion. */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.7, 0, .84, 0);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --intro: 0s;
}
html.tt-intro { --intro: 1.55s; }

/* ================= 1. Logo splash ================= */
.tt-splash { display: none; }
html.tt-intro .tt-splash {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; align-content: center; gap: 22px;
  background: #fff;
  animation: tt-splash-out .55s var(--ease-in) 1.5s forwards;
}
html.tt-intro .tt-splash::after {
  /* amber dawn behind the mark — the reference's glow, kept warm and low */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 560px; height: 560px; translate: -50% -58%;
  background: radial-gradient(closest-side, rgba(233,161,59,.20), rgba(233,161,59,0));
  opacity: 0; animation: tt-fade-in .9s var(--ease-out) .2s forwards;
  pointer-events: none;
}
.tt-splash-mark { width: 104px; height: 104px; overflow: visible; position: relative; z-index: 1; }
.tt-splash-mark .s-chev { stroke-dasharray: 100; stroke-dashoffset: 100; animation: tt-draw .6s var(--ease-io) forwards; }
.tt-splash-mark .s-chev-3 { animation-delay: .05s; }
.tt-splash-mark .s-chev-2 { animation-delay: .22s; }
.tt-splash-mark .s-chev-1 { animation-delay: .39s; }
.tt-splash-mark .s-apex { opacity: 0; transform-box: fill-box; transform-origin: center; animation: tt-apex-land .45s var(--ease-out) .78s forwards; }
.tt-splash-word {
  position: relative; z-index: 1; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: -.03em; color: var(--ink);
  clip-path: inset(0 0 100% 0); animation: tt-wipe-up .6s var(--ease-out) .85s forwards;
}
.tt-splash-word span {
  display: block; margin-top: 6px;
  font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; letter-spacing: .34em; text-transform: uppercase; color: var(--ink-faint);
}
.tt-splash.is-flying .tt-splash-mark { transition: transform .6s var(--ease-io); }
.tt-splash.is-flying .tt-splash-word { transition: opacity .25s var(--ease-in); opacity: 0; }

@keyframes tt-splash-out { to { opacity: 0; visibility: hidden; } }
@keyframes tt-fade-in { to { opacity: 1; } }
@keyframes tt-apex-land { from { opacity: 0; transform: translateY(-26px) scale(.4) rotate(45deg); } to { opacity: 1; transform: none; } }
@keyframes tt-wipe-up { to { clip-path: inset(0 0 0 0); } }

/* Nav mark waits for the splash so the logo appears to "land" there */
html.tt-intro .nav .brand-mark-anim .tt-chev,
html.tt-intro .nav .brand-mark-anim .tt-apex { animation-delay: calc(var(--intro) + .1s), 6s; }

/* ================= 2. Hero: light beam + word-by-word resolve ================= */
.hero { isolation: isolate; }
.hero-beam {
  position: absolute; inset: -20% -10% auto auto; width: 70%; height: 140%;
  z-index: 0; pointer-events: none; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 30%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%);
}
.hero-beam::before {
  /* one diagonal shaft of amber light that sweeps in, then rests and breathes */
  content: ""; position: absolute; top: 0; left: 30%; width: 34%; height: 100%;
  background: linear-gradient(90deg, rgba(233,161,59,0) 0%, rgba(233,161,59,.22) 46%, rgba(255,214,150,.40) 50%, rgba(233,161,59,.22) 54%, rgba(233,161,59,0) 100%);
  filter: blur(18px);
  transform: rotate(28deg) translateX(-140%);
  opacity: 0;
  animation: tt-beam-in 1.6s var(--ease-out) calc(var(--intro) + .25s) forwards,
             tt-beam-breathe 7s ease-in-out calc(var(--intro) + 1.9s) infinite;
}
.hero-beam::after {
  /* the bright core line of the beam */
  content: ""; position: absolute; top: 0; left: 46%; width: 1.5px; height: 100%;
  background: linear-gradient(180deg, transparent 5%, rgba(214,135,20,.75) 40%, rgba(214,135,20,.0) 92%);
  transform: rotate(28deg) translateX(-900%); opacity: 0;
  animation: tt-beam-core 1.6s var(--ease-out) calc(var(--intro) + .25s) forwards;
}
@keyframes tt-beam-in { to { transform: rotate(28deg) translateX(0); opacity: 1; } }
@keyframes tt-beam-core { to { transform: rotate(28deg) translateX(0); opacity: 1; } }
@keyframes tt-beam-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .62; } }

.hero h1.hero-title .w {
  display: inline-block;
  opacity: 0; filter: blur(10px); transform: translateY(.32em);
  animation: tt-word .9s var(--ease-out) forwards;
  animation-delay: calc(var(--intro) + .15s + var(--i, 0) * 70ms);
}
.hero h1.hero-title .grad {
  text-decoration: none;
  background: linear-gradient(var(--signal), var(--signal)) 0 94% / 0% .11em no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  animation: tt-underline .8s var(--ease-io) calc(var(--intro) + .75s) forwards;
}
@keyframes tt-underline { to { background-size: 100% .11em; } }
/* manual skip-ink: the white halo is painted above the underline, so descenders break it cleanly */
.hero h1.hero-title .grad .w { text-shadow: 3px 0 #fff, -3px 0 #fff, 0 3px #fff, 3px 3px #fff, -3px 3px #fff; }
@keyframes tt-word { to { opacity: 1; filter: blur(0); transform: none; } }

/* The rest of the hero follows the headline instead of popping in on load */
.hero .hero-eyebrow.reveal, .hero .hero-sub.reveal, .hero .hero-actions.reveal, .hero .hero-proof.reveal, .hero .hero-stats.reveal {
  transition-delay: calc(var(--intro) + var(--d, 0s));
}
.hero .hero-eyebrow { --d: 0s; }
.hero .hero-sub { --d: .7s; }
.hero .hero-actions { --d: .85s; }
.hero .hero-proof { --d: 1s; }
.hero .hero-stats { --d: .55s; }

/* ================= 3. Animated line icons ================= */
.ic { display: block; overflow: visible; }
.ic .d { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ic .a { fill: var(--signal); }
.ic .as { fill: none; stroke: #d68714; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ic .soft { fill: rgba(233,161,59,.16); }
.ic .cur { fill: #fff; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.ic .ping-ring { fill: none; stroke: #d68714; stroke-width: 1.6; }
.ic .trail { fill: none; stroke: #d68714; stroke-width: 2.2; stroke-linecap: round; opacity: .55; }
.reveal .ic .cur, .reveal .ic .trail { opacity: 0; transition: opacity .5s var(--ease-out) .9s; }
.reveal.visible .ic .cur { opacity: 1; }
.reveal.visible .ic .trail { opacity: .55; }

/* draw-in on reveal: every stroke uses pathLength="1" */
.reveal .ic .d, .reveal .ic .as { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.1s var(--ease-io); }
.reveal .ic .a, .reveal .ic .soft { opacity: 0; transition: opacity .5s var(--ease-out) .7s; }
.reveal.visible .ic .d, .reveal.visible .ic .as { stroke-dashoffset: 0; }
.reveal.visible .ic .a, .reveal.visible .ic .soft { opacity: 1; }
.reveal.visible .ic .d:nth-of-type(2) { transition-delay: .12s; }
.reveal.visible .ic .d:nth-of-type(3) { transition-delay: .24s; }
.reveal.visible .ic .d:nth-of-type(4) { transition-delay: .36s; }

/* Each icon has ONE living part. It plays once after drawing in, then again on hover/focus. */
.ic * { transform-box: fill-box; }
.play .ic, .service-card:hover .ic, .process-step:hover .ic { --run: running; }
/* keyframes below all rest at 0%/100%, so a paused icon always shows its finished drawing */

/* Web Applications — dashboard bars rise, live dot pings */
.ic-webapp .bar { transform-origin: 50% 100%; animation: ic-bar 2.4s var(--ease-io) infinite; }
.ic-webapp .bar:nth-of-type(2) { animation-delay: .15s; }
.ic-webapp .bar:nth-of-type(3) { animation-delay: .3s; }
.ic-webapp .bar:nth-of-type(4) { animation-delay: .45s; }
.ic-webapp .ping { transform-origin: center; animation: ic-ping 2.4s var(--ease-out) infinite; }
@keyframes ic-bar { 0%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.45); } 70% { transform: scaleY(1.08); } }
@keyframes ic-ping { 0% { transform: scale(1); opacity: 0; } 8% { transform: scale(1); opacity: .9; } 80%, 100% { transform: scale(2.6); opacity: 0; } }

/* Websites — the cursor travels to the CTA and presses it */
.ic-site .cursor { animation: ic-cursor 2.8s var(--ease-io) infinite; }
.ic-site .cta { transform-origin: center; animation: ic-press 2.8s var(--ease-io) infinite; }
@keyframes ic-cursor { 0%, 12% { transform: translate(14px, -16px); } 48%, 62% { transform: none; } 100% { transform: translate(14px, -16px); } }
@keyframes ic-press { 0%, 50%, 66%, 100% { transform: none; filter: none; } 56% { transform: scale(.9); filter: brightness(1.12); } }

/* Apps & Games — a ball on a real parabola: X is linear, Y eases out then in */
.ic-games .ballx { animation: ic-ballx 1.6s linear infinite alternate; }
.ic-games .bally { animation: ic-bally .8s infinite alternate; animation-timing-function: cubic-bezier(.33, 0, .66, 1); }
@keyframes ic-ballx { from { transform: translateX(0); } to { transform: translateX(14px); } }
@keyframes ic-bally { 0% { transform: translateY(0); animation-timing-function: cubic-bezier(.33,1,.68,1); } 100% { transform: translateY(-16px); } }

/* Discover — the lens sweeps the row of ideas */
.ic-discover .lens { animation: ic-scan 3.2s var(--ease-io) infinite; }
@keyframes ic-scan { 0%, 100% { transform: none; } 25% { transform: translateX(-12px); } 75% { transform: translateX(12px); } }

/* Design — the curve is drawn again by the nib */
.ic-design .stroke { stroke-dasharray: 1; animation: ic-redraw 3s var(--ease-io) infinite; }
.ic-design .nib { animation: ic-nib 3s var(--ease-io) infinite; }
@keyframes ic-redraw { 0% { stroke-dashoffset: 0; } 8% { stroke-dashoffset: 1; } 62%, 100% { stroke-dashoffset: 0; } }
@keyframes ic-nib { 0% { transform: none; } 8% { transform: translate(-30px, 24px); } 62%, 100% { transform: none; } }

/* Build — blocks drop into a stack */
.ic-build .blk { animation: ic-drop 2.8s var(--ease-out) infinite; }
.ic-build .blk-2 { animation-delay: .18s; }
.ic-build .blk-3 { animation-delay: .36s; }
@keyframes ic-drop { 0% { transform: none; opacity: 1; } 10% { transform: translateY(-14px); opacity: 0; } 34%, 100% { transform: none; opacity: 1; } }

/* After the per-icon `animation` shorthands (which reset play-state): loops only run while --run is set */
.ic [data-loop] { animation-play-state: var(--run, paused) !important; }

/* Launch — the TT chevrons lift off with a trail */
.ic-launch .lift { animation: ic-lift 2.6s var(--ease-io) infinite; }
.ic-launch .trail { stroke-dasharray: .25 .2; animation: ic-trail 2.6s linear infinite; }
@keyframes ic-lift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes ic-trail { to { stroke-dashoffset: -.9; } }

/* ================= 4. Services + Process layout with icons ================= */
.service-card { overflow: hidden; }
.service-card .service-icon { color: var(--ink); }
.service-card::after {
  /* hairline amber that grows along the top edge on hover — the card's only accent */
  content: ""; position: absolute; left: 28px; right: 28px; top: 0; height: 2px;
  background: var(--signal); transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease-out);
}
.service-card:hover::after, .service-card:focus-within::after { transform: scaleX(1); }

.process-grid { position: relative; border-top: 0; }
.process-rail {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--rule);
}
.process-rail i {
  position: absolute; inset: 0; background: linear-gradient(90deg, #d68714, var(--signal));
  transform: scaleX(var(--p, 0)); transform-origin: left;
}
.process-step { position: relative; padding-top: 34px; }
.process-step::before {
  /* node on the rail; lights when the rail reaches it */
  content: ""; position: absolute; top: -5px; left: 26px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--rule-strong);
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.process-step.is-lit::before { background: var(--signal); border-color: #d68714; box-shadow: 0 0 0 6px rgba(233,161,59,.18); }
.process-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.process-step .ic { width: 52px; height: 52px; }

/* ================= 5. Contact horizon ================= */
.section-contact { position: relative; isolation: isolate; }
.section-contact::before {
  content: ""; position: absolute; left: 50%; bottom: 0; z-index: -1;
  width: min(1400px, 160%); aspect-ratio: 2.4 / 1; translate: -50% 85%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(233,161,59,.42), rgba(246,190,110,.22) 50%, rgba(255,255,255,0) 100%);
  opacity: 0; transition: translate 1.6s var(--ease-out), opacity 1.2s var(--ease-out);
}
.section-contact.is-in::before { translate: -50% 52%; opacity: 1; }
.contact-card, .lead-form { background: rgba(255,255,255,.86); backdrop-filter: blur(6px); }

/* ================= 6. Reduced motion ================= */
@media (prefers-reduced-motion: reduce) {
  html.tt-intro .tt-splash { display: none; }
  .hero-beam::before, .hero-beam::after { animation: none; transform: rotate(28deg); opacity: .8; }
  .hero h1.hero-title .w { animation: none; opacity: 1; filter: none; transform: none; }
  .hero h1.hero-title .grad { animation: none; background-size: 100% .11em; }
  .reveal .ic .d, .reveal .ic .as { stroke-dashoffset: 0; transition: none; }
  .reveal .ic .a, .reveal .ic .soft { opacity: 1; transition: none; }
  .ic [data-loop], .ic .stroke { animation: none !important; stroke-dashoffset: 0; }
  .service-card::after, .section-contact::before { transition: none; }
  .section-contact::before { translate: -50% 52%; opacity: 1; }
  .process-rail i { transform: scaleX(1); }
}

@media (max-width: 900px) {
  .hero-beam { width: 120%; opacity: .7; }
  .process-rail { display: none; }
  .process-step::before { display: none; }
  .process-step { padding-top: 28px; }
}
