/* =========================================================================
   FULLDOT — Text & Section Effects (paired with text-effects.js)
   ========================================================================= */

/* ── 1) Heading line-by-line reveal ──────────────────────────────────── */
[data-stagger-lines] {
  display: block;
}
.text-fx-line {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  filter: blur(4px);
  transition: opacity 900ms var(--ease-glide),
              transform 900ms var(--ease-glide),
              filter 900ms var(--ease-glide);
  transition-delay: var(--line-delay, 0ms);
}
/* For multi-line: each .line is its own block */
[data-stagger-lines] > .text-fx-line {
  display: block;
}
[data-stagger-lines].is-visible .text-fx-line,
.text-fx-line.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* ── 2) Eyebrow / caption underline drawing ─────────────────────────── */
.text-fx-eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
.text-fx-eyebrow::before,
.h-section__eyebrow.text-fx-eyebrow::before {
  /* override existing static line with animated version */
  content: "";
  display: inline-block;
  width: 0;
  height: 1px;
  background: linear-gradient(to right, var(--copper-glow), transparent);
  transition: width 1200ms var(--ease-glide) 200ms;
}
.text-fx-eyebrow.is-visible::before,
.h-section__eyebrow.text-fx-eyebrow.is-visible::before {
  width: 32px;
}
/* When eyebrow has the leading "—" already in text, hide the synthetic line */
.text-fx-eyebrow:not(.h-section__eyebrow):not(.page-hero__eyebrow)::before {
  display: none;
}

/* ── 3) Long list auto-stagger ──────────────────────────────────────── */
.text-fx-list > li {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 600ms var(--ease-glide),
              transform 600ms var(--ease-glide);
  transition-delay: var(--item-delay, 0ms);
}
.text-fx-list.is-visible > li {
  opacity: 1;
  transform: translateX(0);
}

/* ── 4) Section top gradient line ────────────────────────────────────── */
.section-fx {
  position: relative;
}
.section-fx::after {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--copper-rgb), 0.35) 30%,
    rgba(var(--teal-rgb), 0.30) 70%,
    transparent 100%);
  transform: translateX(-50%);
  transition: width 1400ms var(--ease-glide) 200ms;
  pointer-events: none;
  z-index: 2;
}
.section-fx.is-visible::after {
  width: min(560px, 70vw);
}
/* Skip on the immediate first section (hero) and footer */
.hero.section-fx::after,
.section--ink.section-fx::after { display: none; }
/* Light section variant: more visible */
.section--paper-deep.section-fx::after,
.section--paper-warm.section-fx::after {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--bronze-rgb), 0.45) 30%,
    rgba(var(--coral-rgb), 0.35) 70%,
    transparent 100%);
}

/* ── 5) Form input focus glow ────────────────────────────────────────── */
.form__row {
  position: relative;
  transition: transform var(--dur-base) var(--ease-glide);
}
.form__row.is-focused {
  transform: translateY(-1px);
}
.form__row label {
  transition: color var(--dur-base) var(--ease-out);
}
.form__row.is-focused label {
  color: var(--bronze-deep);
}
.form__row input,
.form__row textarea,
.form__row select {
  transition: all var(--dur-base) var(--ease-glide);
}
.form__row.is-focused input,
.form__row.is-focused textarea,
.form__row.is-focused select {
  border-color: var(--bronze);
  box-shadow:
    0 0 0 3px rgba(var(--bronze-rgb), 0.12),
    0 0 0 6px rgba(var(--teal-rgb), 0.06),
    0 1px 0 rgba(255,255,255,0.5) inset;
  background: var(--paper-cream);
}

/* Reduced motion override */
@media (prefers-reduced-motion: reduce) {
  .text-fx-line,
  .text-fx-list > li,
  .text-fx-eyebrow::before,
  .section-fx::after {
    transition: none !important;
    animation: none !important;
  }
  .text-fx-line { opacity: 1; transform: none; filter: none; }
  .text-fx-list > li { opacity: 1; transform: none; }
  .text-fx-eyebrow.is-visible::before { width: 32px; }
  .section-fx.is-visible::after { width: min(560px, 70vw); }
}

/* =========================================================================
   RWD / TOUCH GUARDS — prevent stuck hover on touch, lighten heavy effects on mobile
   ========================================================================= */

/* Touch / no-hover devices: disable hover-triggered transforms & glows
   (these classes still respond to :focus-visible for keyboard users) */
@media (hover: none), (pointer: coarse) {
  .photo:hover img,
  .photo--svg:hover .photo__svg-wrap,
  .scene-gallery__item:hover .scene-gallery__svg,
  .scene-gallery__item:hover img,
  .scene-gallery__item:hover,
  .persona:hover,
  .case-card:hover,
  .service:hover,
  .module:hover,
  .plan:hover,
  .btn:hover {
    transform: none !important;
  }
  /* Magnetic CTAs / 3D tilt: disable on touch */
  [data-magnetic],
  [data-tilt] {
    transform: none !important;
  }
}

/* Mobile (≤ 720px): lighten WebGL / particle / blur work for battery + INP */
@media (max-width: 720px) {
  /* Hero particles canvas: hidden on phones to reduce paint cost */
  .hero-particles { display: none; }
  /* Reduce blur radii (cheaper compositor) */
  .text-fx-line { filter: blur(2px); }
  /* Story portrait gradient adornment off to save fill rate */
  .story__portrait::before,
  .story__portrait::after { opacity: 0.6; }
}

/* Very small phones: also drop WebGL hero canvas to a static gradient */
@media (max-width: 480px) {
  #hero-canvas { opacity: 0.55; }
}

/* Global reduced-motion: stop all infinite + heavy transition animations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  #hero-canvas,
  .hero-particles { display: none; }
}
