/* Motion system: page-load hero entrance, scroll reveals, hover feedback.
   Curves follow a strong ease-out for entrances and an ease-in-out for
   on-screen reveals; hover effects only apply to fine pointers. */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* ---------- Buttons: press feedback ---------- */
:is(.btn, .btn-primary, .btn-ghost, .btn-outline) {
  transition:
    color 200ms ease,
    background-color 200ms ease,
    border-color 200ms ease,
    transform 160ms var(--ease-out);
}
:is(.btn, .btn-primary, .btn-ghost, .btn-outline):active { transform: scale(0.97); }

/* ---------- Hero entrance (once per page load) ---------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: none; }
}
.hero-intro > * { animation: rise-in 700ms var(--ease-out) both; }
.hero-intro > :nth-child(2) { animation-delay: 70ms; }
.hero-intro > :nth-child(3) { animation-delay: 140ms; }
.hero-intro > :nth-child(4) { animation-delay: 210ms; }
.hero-intro > :nth-child(5) { animation-delay: 280ms; }
.hero-intro > :nth-child(6) { animation-delay: 350ms; }
.hero-media { animation: slide-in-right 900ms var(--ease-out) 120ms both; }

/* ---------- Scroll reveal (applied by site.js, once) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal="clip"] {
  opacity: 1;
  transform: scale(1.04);
  clip-path: inset(0 0 100% 0);
  transition:
    clip-path 900ms var(--ease-in-out),
    transform 1200ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal][data-visible] { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }

/* ---------- Cards: spotlight, accent edge, lift ---------- */
:is(.card, .card-dark)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(158, 42, 43, 0.07), transparent 45%);
  transition: opacity 300ms ease;
}
.card-dark::before {
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(224, 88, 90, 0.14), transparent 45%);
}
:is(.card, .card-dark)::after {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  top: -1px;
  height: 3px;
  border-radius: 0.5rem 0.5rem 0 0;
  background: #9e2a2b;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 350ms var(--ease-out);
  pointer-events: none;
}
.card {
  transition:
    transform 250ms var(--ease-out),
    box-shadow 250ms var(--ease-out),
    border-color 200ms ease;
}
.card-dark { transition: border-color 200ms ease, background-color 200ms ease; }
.icon-tile { transition: background-color 200ms ease, color 200ms ease, transform 250ms var(--ease-out); }

@media (hover: hover) and (pointer: fine) {
  :is(.card, .card-dark):not(form):hover::before { opacity: 1; }
  :is(.card, .card-dark):not(form):hover::after { transform: scaleX(1); }
  .card:not(form):hover { border-color: rgba(158, 42, 43, 0.3); }
  .card-dark:hover { border-color: rgba(255, 255, 255, 0.2); background-color: rgba(255, 255, 255, 0.07); }
  /* Only clickable cards lift, so the motion never promises a click that isn't there. */
  :is(a.card, .card:has(a, button)):not(form):hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -12px rgba(13, 33, 55, 0.18);
  }
  .card:not(form):hover .icon-tile { background-color: #9e2a2b; color: #fff; transform: translateY(-2px); }
  .card-dark:hover .icon-tile { transform: translateY(-2px); }
}

/* ---------- About: scroll-linked timeline ---------- */
.timeline-rail {
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -0.5px;
  background: #9e2a2b;
  transform: scaleY(0);
  transform-origin: top;
  z-index: 1;
  pointer-events: none;
}
.timeline-dot { background: #d4dbe5; z-index: 2; transition: background-color 300ms ease, transform 300ms var(--ease-out); }
[data-timeline] li.is-passed .timeline-dot { background: #9e2a2b; transform: scale(1.15); }
.no-timeline .timeline-rail { transform: none; }
.no-timeline .timeline-dot { background: #9e2a2b; }

/* ---------- Homepage: capabilities marquee ---------- */
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-track { animation: marquee 45s linear infinite; }
.marquee-track ul { padding-right: 2.5rem; }
@media (hover: hover) and (pointer: fine) {
  .marquee:hover .marquee-track { animation-play-state: paused; }
}

/* ---------- Reduced motion: keep fades, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-intro > *, .hero-media { animation: fade-in 300ms ease both; animation-delay: 0ms; }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  .js [data-reveal], .js [data-reveal="clip"] { transform: none; clip-path: none; transition: opacity 300ms ease; transition-delay: 0ms; }
  .js [data-reveal="clip"] { opacity: 0; }
  .js [data-reveal][data-visible] { opacity: 1; }
  .marquee-track { animation: none; }
  .marquee { overflow-x: auto; }
  :is(.card, .card-dark)::after, .icon-tile, .card { transition-property: opacity, color, background-color, border-color; }
  :is(a.card, .card:has(a, button)):hover { transform: none !important; }
  .timeline-rail { transform: none !important; }
  .timeline-dot { background: #9e2a2b; }
}
