/* ============================================================
   TOLLO Studio — Motion Layer (V4)
   Scroll reveals, cursor effects, magnetic buttons, spotlight
   cards, parallax, ripple, page transitions.
   Everything is progressive: content is fully visible without JS
   and when the visitor prefers reduced motion.
   Uses individual `translate` / `scale` properties so it never
   fights the existing `transform`-based tilt and layouts.
   ============================================================ */

:root {
  --fx-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fx-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Page transitions ───────────────────────────────────────── */
@keyframes fxPageIn { from { opacity: 0; } to { opacity: 1; } }
html.fx-ready body { animation: fxPageIn 0.55s ease-out backwards; }
html.fx-leaving body { opacity: 0; transition: opacity 0.22s ease-in; }

/* ── Scroll reveal (only when JS + motion allowed) ──────────── */
html.js-motion [data-fx] {
  opacity: 0;
  filter: blur(6px);
  transition: opacity 0.8s var(--fx-ease), translate 0.8s var(--fx-ease), scale 0.8s var(--fx-ease), filter 0.8s var(--fx-ease);
  transition-delay: var(--fx-delay, 0ms);
  will-change: opacity, translate;
}
html.js-motion [data-fx="up"]    { translate: 0 36px; }
html.js-motion [data-fx="left"]  { translate: -48px 0; }
html.js-motion [data-fx="right"] { translate: 48px 0; }
html.js-motion [data-fx="zoom"]  { scale: 0.9; }
html.js-motion [data-fx="rise"]  { translate: 0 60px; scale: 0.96; }
html.js-motion [data-fx].fx-in {
  opacity: 1; filter: none; translate: 0 0; scale: 1; will-change: auto;
}

/* ── Animated gradient text ─────────────────────────────────── */
@keyframes fxGradShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.text-gradient { background-size: 220% 220%; animation: fxGradShift 7s ease-in-out infinite; }

/* Typing caret */
@keyframes fxCaret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
#dynamic-hero-word::after { content: ''; display: inline-block; width: 3px; height: 0.9em; margin-left: 4px; vertical-align: -0.08em; background: var(--accent-primary); border-radius: 2px; animation: fxCaret 0.9s steps(1) infinite; }

/* ── Ambient gradient blobs (fixed, behind everything) ──────── */
.fx-ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.fx-blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.22; will-change: translate; }
.fx-blob--1 { width: 42vmax; height: 42vmax; left: -10vmax; top: -8vmax; background: var(--accent-primary); animation: fxBlobA 22s ease-in-out infinite alternate; }
.fx-blob--2 { width: 36vmax; height: 36vmax; right: -12vmax; top: 30vh; background: var(--accent-secondary); animation: fxBlobB 26s ease-in-out infinite alternate; }
.fx-blob--3 { width: 30vmax; height: 30vmax; left: 25vw; bottom: -14vmax; background: var(--accent-tertiary); animation: fxBlobC 30s ease-in-out infinite alternate; }
@keyframes fxBlobA { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes fxBlobB { to { transform: translate(-12vmax, -8vmax) scale(1.2); } }
@keyframes fxBlobC { to { transform: translate(-10vmax, -12vmax) scale(0.9); } }
[data-theme="light"] .fx-blob { opacity: 0.16; }

/* ── Custom cursor (fine pointers only) ─────────────────────── */
.fx-cursor-dot, .fx-cursor-ring { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 5000; border-radius: 50%; opacity: 0; transition: opacity 0.3s; }
.fx-cursor-dot { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; background: var(--accent-primary); }
.fx-cursor-ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1.5px solid var(--accent-primary); mix-blend-mode: normal; transition: opacity 0.3s, width 0.25s var(--fx-ease), height 0.25s var(--fx-ease), margin 0.25s var(--fx-ease), background-color 0.25s, border-color 0.25s; }
html.fx-cursor-on .fx-cursor-dot, html.fx-cursor-on .fx-cursor-ring { opacity: 1; }
html.fx-cursor-hover .fx-cursor-ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: var(--accent-glow); border-color: var(--accent-secondary); }
html.fx-cursor-down .fx-cursor-ring { width: 26px; height: 26px; margin: -13px 0 0 -13px; }

/* ── Spotlight on cards ─────────────────────────────────────── */
.fx-spot { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.35s ease;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), var(--accent-glow, rgba(139, 92, 246, 0.2)), transparent 60%); z-index: 2; }
.fx-has-spot:hover > .fx-spot { opacity: 1; }

/* ── Ripple ─────────────────────────────────────────────────── */
.fx-rippleable { position: relative; overflow: hidden; }
.fx-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: rgba(255, 255, 255, 0.45); transform: scale(0); animation: fxRipple 0.65s ease-out forwards; }
@keyframes fxRipple { to { transform: scale(1); opacity: 0; } }

/* Magnetic helper */
.fx-magnetic { transition: translate 0.35s var(--fx-ease); }

/* ── Navbar hide / show on scroll ───────────────────────────── */
.navbar { transition: translate 0.45s var(--fx-ease), background-color var(--transition-base), backdrop-filter var(--transition-base), box-shadow var(--transition-base); }
.navbar.fx-nav-hidden { translate: 0 -160%; }

/* ── Hover micro-interactions ───────────────────────────────── */
.feature-icon, .highlight-icon, .card-icon, .project-icon-box, .metric-icon, .stack-letter-orb { transition: transform 0.45s var(--fx-spring); }
.card:hover .feature-icon, .card:hover .card-icon, .highlight-card:hover .highlight-icon, .metric-card:hover .metric-icon, .project-card:hover .project-icon-box, .stack-card:hover .stack-letter-orb { transform: scale(1.14) rotate(-7deg); }
.btn .btn-icon-right, .nav-cta span, .project-btn-detail span { display: inline-block; transition: translate 0.3s var(--fx-ease); }
.btn:hover .btn-icon-right, .nav-cta:hover span, .project-btn-detail:hover span { translate: 5px 0; }
.tech-marquee-section:hover .tech-marquee-track { animation-play-state: paused; }
.marquee-pill { transition: transform 0.3s var(--fx-spring), box-shadow 0.3s; }
.marquee-pill:hover { transform: translateY(-4px) scale(1.06); }
.footer-column a, .footer-brand a { display: inline-block; transition: translate 0.25s var(--fx-ease), color 0.2s; }
.footer-column a:hover { translate: 6px 0; }
.nav-links a { transition: translate 0.25s var(--fx-ease), color 0.2s, background-color 0.2s; }
.nav-links a:hover { translate: 0 -2px; }
.section-label { position: relative; }
@keyframes fxFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.hero-badge, .product-badge { animation: fxFloat 5s ease-in-out infinite; }
.back-to-top { transition: opacity 0.3s, translate 0.3s var(--fx-spring), transform 0.3s var(--fx-spring); }
.back-to-top:hover { translate: 0 -5px; }

/* Tabs / modal / banners */
@keyframes fxPanel { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
.product-tab-panel.active { animation: fxPanel 0.45s var(--fx-ease) both; }
@keyframes fxPop { from { opacity: 0; scale: 0.92; translate: 0 24px; } to { opacity: 1; scale: 1; translate: 0 0; } }
.project-modal-backdrop.open .project-modal { animation: fxPop 0.45s var(--fx-spring) both; }
.upcoming-banner { position: relative; overflow: hidden; }
.upcoming-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(56, 189, 248, 0.22) 50%, transparent 70%); translate: -120% 0; animation: fxShine 4.5s ease-in-out infinite; pointer-events: none; }
@keyframes fxShine { 0%, 55% { translate: -120% 0; } 100% { translate: 120% 0; } }
.status-badge--upcoming { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5); animation: fxPulseRing 2.2s ease-out infinite; }
@keyframes fxPulseRing { 0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.45); } 70%, 100% { box-shadow: 0 0 0 10px rgba(56, 189, 248, 0); } }

/* Scroll progress glow */
#scroll-progress-bar { transition: width 0.1s linear; }

/* Disable heavy effects for reduced-motion & touch */
@media (prefers-reduced-motion: reduce) {
  html.js-motion [data-fx] { opacity: 1 !important; filter: none !important; translate: none !important; scale: none !important; }
  .fx-ambient, .fx-cursor-dot, .fx-cursor-ring { display: none !important; }
  .text-gradient { animation: none; }
}
@media (hover: none), (pointer: coarse) {
  .fx-cursor-dot, .fx-cursor-ring { display: none !important; }
}
@media (max-width: 768px) {
  .fx-blob { filter: blur(60px); opacity: 0.18; }
  html.js-motion [data-fx="left"], html.js-motion [data-fx="right"] { translate: 0 30px; }
}

/* Studio rail: spans the whole viewport height, top to bottom, inside its own gutter */

/* Full-width scrolling marquee fades out before the rail gutter instead of running under it */
@media (min-width: 1101px) {
  .tech-marquee-section {
    -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 84px, #000 150px, #000 calc(100% - 60px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, transparent 84px, #000 150px, #000 calc(100% - 60px), transparent 100%);
  }
}


/* ============================================================
   Vertical studio rail — responsive, always full height, always
   inside its own gutter (phones, tablets, "desktop site" mode, PCs)
   ============================================================ */
#vertical-studio-rail {
  display: flex; top: 0; bottom: 0; height: 100vh; height: 100dvh; transform: none;
  --rail-gutter: 84px;
}
#vertical-studio-rail .rail-hairline { background: linear-gradient(180deg, transparent, var(--accent-primary) 8%, var(--accent-tertiary) 92%, transparent); }
#vertical-studio-rail .rail-letters-wrap { padding: 92px 0 22px; }  /* first letter starts below the floating navbar */
.container { padding-left: max(var(--space-xl), var(--rail-pad, 0px)); padding-right: max(var(--space-xl), var(--rail-pad, 0px)); }
.navbar .container { padding-left: var(--space-xl); padding-right: var(--space-xl); }

/* Phones: slim rail, content keeps a clear strip beside it */
@media (max-width: 768px) {
  :root { --rail-pad: 0px; }
  #vertical-studio-rail { left: 3px; width: 22px; }
  #vertical-studio-rail .rail-node { font-size: clamp(12px, 2.4vh, 18px); -webkit-text-stroke-width: 0.4px; }
  #vertical-studio-rail .rail-divider { font-size: clamp(9px, 1.6vh, 13px); }
  #vertical-studio-rail .rail-letters-wrap { padding: 84px 0 18px; }
  body { padding-left: 0; }
  .container, .container--wide { padding-left: max(var(--space-md), 36px); }
  .tech-marquee-section { -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 26px, #000 56px, #000 100%); mask-image: linear-gradient(to right, transparent 0, transparent 26px, #000 56px, #000 100%); }
}
/* Tablets / "desktop site" on phones / small laptops */
@media (min-width: 769px) and (max-width: 1100px) {
  :root { --rail-pad: 76px; }
  #vertical-studio-rail { left: 8px; width: 44px; }
  #vertical-studio-rail .rail-node { font-size: clamp(22px, 3.8vh, 36px); }
  #vertical-studio-rail .rail-divider { font-size: clamp(14px, 2vh, 20px); }
  .tech-marquee-section { -webkit-mask-image: linear-gradient(to right, transparent 0, transparent 60px, #000 110px, #000 100%); mask-image: linear-gradient(to right, transparent 0, transparent 60px, #000 110px, #000 100%); }
}
/* Desktops */
@media (min-width: 1101px) {
  :root { --rail-pad: 130px; }
  #vertical-studio-rail { left: 14px; width: 64px; }
  #vertical-studio-rail .rail-node { font-size: clamp(30px, 4.6vh, 50px); -webkit-text-stroke-width: 0.9px; }
  #vertical-studio-rail .rail-divider { font-size: clamp(18px, 2.4vh, 26px); }
  #vertical-studio-rail .rail-letters-wrap { padding: 28px 0; }
  .navbar { width: min(94vw, 1260px, calc(100vw - 180px)); }
}

/* Footer: three equal columns across the full width, then one serial company row */
.footer-grid.footer-grid--3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2xl); width: 100%; }
.footer-grid--3 > * { width: 100%; }
.footer-company-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem;
  margin-top: var(--space-xl); padding: var(--space-md) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.footer-company-label { font-size: var(--font-size-xs); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-primary); }
.footer-company-row a { font-size: var(--font-size-sm); color: var(--text-secondary); font-weight: 600; transition: color 0.2s, translate 0.25s var(--fx-ease); }
.footer-company-row a:hover { color: var(--accent-primary); translate: 0 -2px; }
@media (max-width: 768px) {
  .footer-grid.footer-grid--3 { grid-template-columns: 1fr; gap: var(--space-xl); }
  .footer-company-row { justify-content: space-between; gap: 0.6rem 1rem; }
}

.footer-company-row { width: 100%; max-width: 100%; box-sizing: border-box; }
.footer-company-row a { white-space: nowrap; }

/* Footer uses the full page width — the studio rail stops where the footer begins */
.footer .container { padding-left: var(--space-xl); padding-right: var(--space-xl); }
@media (max-width: 768px) { .footer .container { padding-left: var(--space-md); padding-right: var(--space-md); } }
