/* New Trend Safety Co — animated edition.
   Everything here is an enhancement: html.anim is set by js/animations.js, so without JS (or with reduced motion) the page is the calm version. */

:root { --ease-out: cubic-bezier(.16, 1, .3, 1); --ease-io: cubic-bezier(.65, 0, .35, 1); }

/* ---------- Page load: header + hero choreography ---------- */
html.anim .site-header { animation: hdr-in .7s var(--ease-out) both; }
@keyframes hdr-in { from { transform: translateY(-100%); } to { transform: none; } }

html.anim .hero-copy > *,
html.anim .page-hero-copy > * { animation: rise .9s var(--ease-out) both; }
html.anim .hero-copy > :nth-child(1), html.anim .page-hero-copy > :nth-child(1) { animation-delay: .15s; }
html.anim .hero-copy > :nth-child(2), html.anim .page-hero-copy > :nth-child(2) { animation-delay: .25s; }
html.anim .hero-copy > :nth-child(3), html.anim .page-hero-copy > :nth-child(3) { animation-delay: .55s; }
html.anim .hero-copy > :nth-child(4), html.anim .page-hero-copy > :nth-child(4) { animation-delay: .7s; }
html.anim .hero-copy > :nth-child(5), html.anim .page-hero-copy > :nth-child(5) { animation-delay: .85s; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* Headline words rise from a mask, one after another */
html.anim .hero-copy h1, html.anim .page-hero-copy h1 { animation: none; }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.w > span { display: inline-block; animation: word-up 1s var(--ease-out) both; animation-delay: calc(.3s + var(--i) * .09s); }
@keyframes word-up { from { transform: translateY(105%); } to { transform: none; } }

/* The red slash in eyebrows sweeps in */
html.anim .eyebrow::before { animation: slash 1s var(--ease-out) both .2s; transform-origin: left center; }
@keyframes slash { from { transform: skewX(-24deg) scaleX(0); } to { transform: skewX(-24deg) scaleX(1); } }

/* Hero media: curtain wipe, then a slow drift */
html.anim .hero .media, html.anim .page-hero .media { animation: wipe 1.3s var(--ease-io) both .35s; }
@keyframes wipe { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
html.anim .hero .media img, html.anim .page-hero .media img { animation: drift 18s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.08) translate(-1%, 0); } to { transform: scale(1.14) translate(1.5%, -1%); } }
.hero .media { overflow: visible; }
.hero .media img { border-radius: var(--radius); }
.hero .media .clip { position: absolute; inset: 0; overflow: hidden; border-radius: var(--radius); }

/* ---------- Live compliance card over the hero photo ---------- */
.audit-card {
  position: absolute;
  left: -36px;
  bottom: -32px;
  width: min(300px, 78%);
  background: #ffffff;
  color: var(--ink);
  border-radius: 10px;
  padding: 18px 18px 16px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .35);
  display: grid;
  gap: 12px;
  z-index: 2;
}
html.anim .audit-card { animation: card-in .9s var(--ease-out) both 1.2s; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.audit-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.audit-card .t { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.audit-card .pct { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.audit-card .bar { height: 6px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.audit-card .bar i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--red), #ff5a64); border-radius: inherit; transition: width .7s var(--ease-out); }
.audit-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.audit-card li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: center; font-size: .9rem; color: var(--muted); transition: color .3s; }
.audit-card li .box { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #c9cdd4; display: grid; place-items: center; transition: background-color .3s, border-color .3s, transform .3s var(--ease-out); }
.audit-card li .box svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3.2; fill: none; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .4s ease .1s; }
.audit-card li.done { color: var(--ink); }
.audit-card li.done .box { background: var(--red); border-color: var(--red); transform: scale(1.08); }
.audit-card li.done .box svg { stroke-dashoffset: 0; }
.audit-card li.active .box { border-color: var(--red); animation: ping 1s ease-in-out infinite; }
@keyframes ping { 50% { box-shadow: 0 0 0 5px rgba(207, 31, 44, .15); } }
.audit-card footer { font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; display: flex; justify-content: space-between; }
.audit-card footer b { color: #1a8a46; font-weight: 600; opacity: 0; transition: opacity .4s; }
.audit-card.complete footer b { opacity: 1; }
@media (max-width: 900px) { .audit-card { left: 12px; bottom: -28px; } .hero .wrap { padding-bottom: 96px; } }

/* ---------- Credentials marquee ---------- */
.creds.marquee .wrap { flex-wrap: nowrap; overflow: hidden; }
.creds.marquee .track-wrap { overflow: hidden; flex: 1; min-width: 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.creds.marquee ul { flex-wrap: nowrap; width: max-content; animation: marquee 32s linear infinite; }
.creds.marquee ul li { white-space: nowrap; }
.creds.marquee:hover ul { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (max-width: 600px) { .creds.marquee .creds-label { display: none; } }

/* ---------- Scroll reveals ---------- */
html.anim .reveal { opacity: 0; transform: translateY(32px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); transition-delay: calc(var(--d, 0) * 90ms); }
html.anim .reveal.in { opacity: 1; transform: none; }
html.anim .reveal-img { clip-path: inset(0 0 100% 0); transition: clip-path 1.2s var(--ease-io); }
html.anim .reveal-img.in { clip-path: inset(0 0 0 0); }
html.anim .reveal-img img { transform: scale(1.15); transition: transform 1.8s var(--ease-out); }
html.anim .reveal-img.in img { transform: scale(1); }

/* ---------- Process line draws across ---------- */
html.anim .steps { position: relative; }
html.anim .steps::before { content: ""; position: absolute; top: 0; left: 0; height: 2px; width: 100%; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform 1.8s var(--ease-io) .2s; z-index: 1; }
html.anim .steps.in::before { transform: scaleX(1); }
html.anim .step::after { display: none; }
@media (max-width: 900px) { html.anim .steps::before { display: none; } html.anim .step::after { display: block; } }

/* ---------- Service cards ---------- */
.service { position: relative; overflow: hidden; }
.service::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease-out); }
.service:hover::after, .service:focus-visible::after { transform: scaleX(1); }
.service .icon { transition: transform .45s var(--ease-out); }
.service:hover .icon { transform: translateY(-3px) rotate(-6deg); }
.service .icon path, .service .icon rect, .service .icon circle { stroke-dasharray: 80; stroke-dashoffset: 0; }
.service:hover .icon path, .service:hover .icon rect, .service:hover .icon circle { animation: redraw .9s var(--ease-out); }
@keyframes redraw { from { stroke-dashoffset: 80; } to { stroke-dashoffset: 0; } }
.service .more { display: inline-flex; gap: 6px; transition: gap .3s var(--ease-out), color .2s; }
.service:hover .more { gap: 12px; }

/* ---------- Cards that lift ---------- */
.course, .benefit, .sector, .vm-card, .contact-card { transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s; }
.course:hover, .sector:hover, .contact-card:hover { transform: translateY(-4px); box-shadow: 0 18px 36px rgba(21, 23, 27, .08); border-color: #c9cdd4; }
.ppe-item .media { transition: box-shadow .4s; }
.ppe-item:hover .media { box-shadow: 0 18px 36px rgba(21, 23, 27, .12); }

/* ---------- Buttons ---------- */
.btn { position: relative; overflow: hidden; }
.btn svg { transition: transform .3s var(--ease-out); }
.btn:hover svg { transform: translateX(4px); }
.btn-red::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: skewX(-24deg); transition: left .7s var(--ease-out); }
.btn-red:hover::after { left: 130%; }

/* ---------- Nav underline follows the pointer ---------- */
@media (min-width: 1021px) { .nav { position: relative; } }
.nav-ink { position: absolute; bottom: 14px; height: 2px; background: var(--red); left: 0; width: 0; transition: transform .45s var(--ease-out), width .45s var(--ease-out), opacity .3s; pointer-events: none; opacity: 0; }
@media (max-width: 1020px) { .nav-ink { display: none; } }
@media (min-width: 1021px) { html.anim .nav a[aria-current="page"] { box-shadow: none; } }

/* ---------- Red CTA band: slow moving slashes (echo of the logo) ---------- */
.cta { position: relative; overflow: hidden; }
.cta::before { content: ""; position: absolute; inset: -50% -10%; background: repeating-linear-gradient(-66deg, rgba(255, 255, 255, .06) 0 22px, transparent 22px 64px); animation: slide 14s linear infinite; pointer-events: none; }
.cta .wrap { position: relative; }
@keyframes slide { to { transform: translateX(128px); } }

/* ---------- Quote marks draw in ---------- */
html.anim .promise blockquote { position: relative; }

/* ---------- WhatsApp: one gentle pulse to get noticed ---------- */
.wa-float::before { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(31, 168, 85, .55); }
html.anim .wa-float { animation: wa-in .7s var(--ease-out) both 1.8s; }
html.anim .wa-float::before { animation: wa-pulse 2.2s ease-out 3 2.6s; }
@keyframes wa-in { from { opacity: 0; transform: translateY(30px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes wa-pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 168, 85, .55); } 100% { box-shadow: 0 0 0 18px rgba(31, 168, 85, 0); } }

/* ---------- Scroll progress ---------- */
.progress { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; height: 3px; width: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); z-index: 80; pointer-events: none; }

/* ---------- Reduced motion: switch it all off ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.anim .reveal, html.anim .reveal-img, html.anim .reveal-img img { opacity: 1; transform: none; clip-path: none; }
  .creds.marquee ul { transform: none; }
  .progress { display: none; }
}

/* Hero: wipe the photo, not the box, so the compliance card can sit outside its edges */
html.anim .hero .media { animation: none; }
html.anim .hero .media .clip { animation: wipe 1.3s var(--ease-io) both .35s; }
@media (prefers-reduced-motion: reduce) { html.anim .hero .media .clip { animation: none !important; } }

/* ---------- Round 2 ---------- */

/* Photos inside split sections: parallax driven by --py (the reveal scale settles first) */
html.anim .split .reveal-img.in img { transform: translateY(var(--py, 0)) scale(1.06); transition: transform 1.8s var(--ease-out); }
html.anim .split .reveal-img img { will-change: transform; }

/* Eyebrow slash sweeps in when its section reveals, not on page load */
html.anim .reveal .eyebrow::before, html.anim .detail .eyebrow::before { animation: none; transform: skewX(-24deg) scaleX(0); transition: transform .8s var(--ease-out) .25s; }
html.anim .reveal.in .eyebrow::before { transform: skewX(-24deg) scaleX(1); }

/* Icons draw themselves when their block reveals */
html.anim .detail .icon *, html.anim .sector .icon * { stroke-dasharray: 90; stroke-dashoffset: 90; transition: stroke-dashoffset 1.4s var(--ease-out) .2s; }
html.anim .detail.in .icon *, html.anim .sector.in .icon * { stroke-dashoffset: 0; }

/* Spotlight that follows the pointer */
.service, .course, .sector { background-image: radial-gradient(260px circle at var(--mx, -300px) var(--my, -300px), rgba(207, 31, 44, .07), transparent 70%); }
.course-more { background-image: radial-gradient(260px circle at var(--mx, -300px) var(--my, -300px), rgba(255, 255, 255, .08), transparent 70%); }

/* Header tightens on scroll */
.site-header { transition: box-shadow .35s, background-color .35s; }
.nav-row { transition: min-height .35s var(--ease-out); }
.brand img { transition: width .35s var(--ease-out); }
.site-header.scrolled { box-shadow: 0 8px 24px rgba(21, 23, 27, .07); }
@media (min-width: 1021px) {
  .site-header.scrolled .nav-row { min-height: 64px; }
  .site-header.scrolled .brand img { width: 190px; }
  .site-header.scrolled .nav-ink { bottom: 8px; }
}

/* Owner's quote lights up word by word on scroll */
.promise blockquote.scrub .qw { color: var(--line); transition: color .35s; }
.section-dark .promise blockquote.scrub .qw, .on-dark .promise blockquote.scrub .qw { color: var(--ink-3); }
.promise blockquote.scrub .qw.lit { color: var(--ink); }
.section-dark .promise blockquote.scrub .qw.lit, .on-dark .promise blockquote.scrub .qw.lit { color: var(--white); }

/* Brand tiles flip to dark on hover */
.brands li { transition: background-color .3s, color .3s, border-color .3s, transform .4s var(--ease-out); }
.brands li:hover { background: var(--ink); color: var(--white); border-color: var(--ink); transform: translateY(-3px); }

/* Page transitions */
html.anim body { animation: page-in .45s ease both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
html.leaving body { opacity: 0; transition: opacity .3s ease; }

/* Form fields: label lifts colour on focus */
.field:focus-within label { color: var(--red); transition: color .2s; }

@media (prefers-reduced-motion: reduce) {
  .promise blockquote.scrub .qw { color: inherit !important; }
  html.anim body { opacity: 1 !important; }
}
/* keep the spotlight when the hover background kicks in */
.service:hover, .course:hover, .sector:hover { background-color: var(--paper); background-image: radial-gradient(260px circle at var(--mx, -300px) var(--my, -300px), rgba(207, 31, 44, .08), transparent 70%); }
.course-more:hover { background-color: var(--ink); background-image: radial-gradient(260px circle at var(--mx, -300px) var(--my, -300px), rgba(255, 255, 255, .09), transparent 70%); }

/* Hero visual: photo + compliance card */
.hero-visual { position: relative; min-width: 0; }
@media (max-width: 900px) {
  .hero .wrap { padding-bottom: clamp(56px, 8vw, 104px); }
  .audit-card {
    position: relative;
    left: auto; bottom: auto;
    width: auto;
    max-width: 420px;
    margin: -44px 16px 0;
  }
}
@media (max-width: 400px) {
  .audit-card { margin: -36px 10px 0; padding: 16px 14px 14px; }
  .audit-card li { font-size: .86rem; }
}

/* Phone menu slides down when opened */
@media (max-width: 1020px) {
  html.anim .nav.open { animation: menu-in .35s var(--ease-out) both; }
  html.anim .nav.open a { animation: rise .45s var(--ease-out) both; }
  html.anim .nav.open a:nth-child(2) { animation-delay: .03s; } html.anim .nav.open a:nth-child(3) { animation-delay: .06s; }
  html.anim .nav.open a:nth-child(4) { animation-delay: .09s; } html.anim .nav.open a:nth-child(5) { animation-delay: .12s; }
  html.anim .nav.open a:nth-child(6) { animation-delay: .15s; } html.anim .nav.open a:nth-child(7) { animation-delay: .18s; }
  html.anim .nav.open a:nth-child(8) { animation-delay: .21s; }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
