/* =====================================================================
   Marin Operations home page: "subtle motion" refresh (v2)
   Every rule is scoped to html.v2, so removing that class (or this file)
   gives back the current design exactly. All motion is off under
   prefers-reduced-motion.
   ===================================================================== */

/* ---------- 1. Scroll reveal that works in every browser ----------
   The current site uses CSS scroll timelines (Chrome only); Safari/iPhone
   and Firefox show sections with no motion. v2 uses IntersectionObserver
   (new.js adds .is-in) with a soft stagger inside grids. */
html.v2 .reveal,
html.v2 .rv-item {
  animation: none;
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity .75s cubic-bezier(.2, .7, .2, 1),
    transform .75s cubic-bezier(.2, .7, .2, 1);
  transition-delay: calc(min(var(--i, 0), 6) * 70ms);
}
html.v2 .reveal.is-in,
html.v2 .rv-item.is-in { opacity: 1; transform: none; }

/* Icons inside a revealed card pop in a moment later */
html.v2 .card .card-icon,
html.v2 .why > i,
html.v2 .values i,
html.v2 .pain-fix > i {
  transform: scale(.6);
  opacity: 0;
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1), opacity .4s ease;
  transition-delay: calc(min(var(--i, 0), 6) * 70ms + .25s);
}
html.v2 .is-in .card-icon,
html.v2 .is-in.why > i,
html.v2 .is-in .values i,
html.v2 .values .is-in i,
html.v2 .is-in .pain-fix > i { transform: none; opacity: 1; }
html.v2 .card.is-in .card-icon { transform: none; opacity: 1; }

/* Step numbers: the outline fills with brand blue as each step appears */
html.v2 .step-num {
  background: linear-gradient(90deg, var(--blue), #5ad1ff) no-repeat 0 0 / 0% 100%;
  -webkit-background-clip: text; background-clip: text;
  transition: background-size 1s cubic-bezier(.2, .7, .2, 1);
  transition-delay: calc(min(var(--i, 0), 6) * 70ms + .3s);
}
html.v2 .step.is-in .step-num { background-size: 100% 100%; }

/* ---------- 2. Hero entrance on page load ---------- */
html.v2 .hero-copy > *,
html.v2 .hero .tech-strip {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  animation: v2-rise .9s cubic-bezier(.2, .7, .2, 1) forwards;
}
html.v2 .hero-copy > .eyebrow  { animation-delay: .05s; }
html.v2 .hero-copy > h1        { animation: none; opacity: 1; transform: none; filter: none; }
html.v2 .hero-copy > .lead     { animation-delay: .75s; }
html.v2 .hero-copy > .hero-ctas{ animation-delay: .9s; }
html.v2 .hero-copy > .hero-points { animation-delay: 1.05s; }
html.v2 .hero .tech-strip      { animation-delay: 1.3s; }

/* Headline words rise one after another (new.js wraps them in .w) */
html.v2 .hero h1 .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(.45em);
  filter: blur(8px);
  animation: v2-rise .8s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: calc(.2s + var(--w) * .16s);
}
@keyframes v2-rise { to { opacity: 1; transform: none; filter: none; } }

/* The hero card drifts slightly as you scroll (desktop only, set by new.js) */
html.v2 .hero-visual { transform: translate3d(0, var(--par, 0px), 0); will-change: transform; }

/* ---------- 3. Light that follows the pointer on cards (mouse/trackpad only) ---------- */
@media (hover: hover) and (pointer: fine) {
  html.v2 .card,
  html.v2 .why,
  html.v2 .step,
  html.v2 .pain { position: relative; isolation: isolate; }
  html.v2 .card::after,
  html.v2 .why::after,
  html.v2 .step::after,
  html.v2 .pain::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(53, 76, 237, .11), transparent 70%);
    opacity: 0; transition: opacity .3s ease; pointer-events: none;
  }
  html.v2 .card-feature::after { background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(90, 209, 255, .18), transparent 70%); z-index: 0; }
  html.v2 .card:hover::after,
  html.v2 .why:hover::after,
  html.v2 .step:hover::after,
  html.v2 .pain:hover::after { opacity: 1; }
  html.v2 .why, html.v2 .step { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
  html.v2 .why:hover, html.v2 .step:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

  /* Soft sheen across primary buttons on hover */
  html.v2 .btn-primary { position: relative; overflow: hidden; }
  html.v2 .btn-primary::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
    transform: translateX(-120%);
  }
  html.v2 .btn-primary:hover::before { transform: translateX(120%); transition: transform .7s ease; }
}

/* ---------- 4. Reading-progress line under the header ---------- */
html.v2 .v2-progress {
  position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 101;
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--blue), #5ad1ff);
  pointer-events: none;
}

/* ---------- 5. Phones: header tucks away while reading, returns on scroll up ---------- */
@media (max-width: 960px) {
  html.v2 .site-header { transition: transform .3s ease, background .25s ease, box-shadow .25s ease; }
  html.v2 .site-header.v2-tucked { transform: translateY(-100%); }
}

/* ---------- 6. Phones: sticky "Start a project" bar after the hero ---------- */
html.v2 .v2-cta-bar { display: none; }
@media (max-width: 760px) {
  html.v2 .v2-cta-bar {
    display: flex; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(10, 18, 38, .92);
    backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-top: 1px solid rgba(255, 255, 255, .08);
    transform: translateY(110%); transition: transform .35s cubic-bezier(.2, .7, .2, 1);
  }
  html.v2 .v2-cta-bar.show { transform: none; }
  html.v2 .v2-cta-bar .btn { flex: 1; padding: .85em 1em; }
  html.v2 .v2-cta-bar .btn-call { flex: 0 0 auto; width: 48px; padding: 0; color: var(--white); border-color: rgba(255, 255, 255, .25); background: transparent; }
  html.v2 .site-footer { padding-bottom: 72px; }
}

/* ---------- 7. FAQ answers glide open (browsers that support it) ---------- */
html.v2 .faq { interpolate-size: allow-keywords; }
html.v2 .faq details::details-content {
  height: 0; overflow: clip;
  transition: height .35s ease, content-visibility .35s allow-discrete;
}
html.v2 .faq details[open]::details-content { height: auto; }
html.v2 .faq details p { animation: none; }
html.v2 .faq details[open] p { animation: v2-fade .45s ease both; }
@keyframes v2-fade { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- reduced motion: everything visible, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  html.v2 .reveal, html.v2 .rv-item,
  html.v2 .hero-copy > *, html.v2 .hero .tech-strip, html.v2 .hero h1 .w,
  html.v2 .card .card-icon, html.v2 .why > i, html.v2 .values i, html.v2 .pain-fix > i {
    opacity: 1 !important; transform: none !important; filter: none !important; animation: none !important; transition: none !important;
  }
  html.v2 .step-num { background-size: 100% 100% !important; transition: none !important; }
  html.v2 .hero-visual { transform: none !important; }
  html.v2 .site-header.v2-tucked { transform: none; }
  html.v2 .v2-progress { display: none; }
}
