/* Motion + premium layout blocks layered on top of style.css */

/* Scroll progress + sticky header shrink */
.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), #ffb37a); z-index: 200; }
.header { transition: box-shadow .3s, background .3s; }
.header .container { transition: height .3s; }
.header.scrolled { box-shadow: 0 8px 30px rgba(10, 42, 82, .1); }
.header.scrolled .container { height: 62px; }

/* Reveal on scroll (JS adds .reveal, then .in) */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.reveal.from-left { transform: translateX(-50px); }
.reveal.from-right { transform: translateX(50px); }
.reveal.zoom { transform: scale(.92); }
.reveal.in { opacity: 1; transform: none; }

/* Title underline draw */
.title { position: relative; }
.center .title::after, .title.line::after { content: ""; display: block; width: 0; height: 4px; border-radius: 2px; background: var(--accent); margin: 14px auto 0; transition: width .9s .3s; }
.title.line::after { margin-left: 0; }
.title.in::after { width: 64px; }

/* Buttons: light sweep */
.btn { position: relative; overflow: hidden; }
.btn::after { content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%; background: linear-gradient(110deg, transparent, rgba(255,255,255,.45), transparent); transform: skewX(-20deg); transition: left .6s; }
.btn:hover::after { left: 140%; }
.btn:hover { transform: translateY(-2px); }

/* Cards: 3D tilt (JS sets --rx/--ry) + glare */
.tilt { transform: perspective(900px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)) translateY(var(--ty, 0)); transition: transform .25s, box-shadow .25s; }
.tilt:hover { --ty: -6px; }
.feature .icon-box { transition: transform .5s cubic-bezier(.3,1.6,.5,1), background .3s; }
.feature:hover .icon-box { transform: rotate(-8deg) scale(1.12); background: var(--accent); }

/* Hero extras */
.hero-sun { position: absolute; width: 520px; height: 520px; right: -140px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(255,105,0,.55), rgba(255,105,0,0) 65%); filter: blur(10px); animation: sunPulse 6s ease-in-out infinite; z-index: 1; pointer-events: none; }
@keyframes sunPulse { 50% { transform: scale(1.15); opacity: .7; } }
.hero-text.active > * { animation: slideUp .8s cubic-bezier(.2,.7,.2,1) both; }
.hero-text.active > *:nth-child(2) { animation-delay: .12s; }
.hero-text.active > *:nth-child(3) { animation-delay: .24s; }
.hero-text.active > *:nth-child(4) { animation-delay: .36s; }
.hero-text { animation: none; }
.calc { transition: transform .2s; will-change: transform; }
.scroll-hint { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 2; width: 26px; height: 42px; border: 2px solid rgba(255,255,255,.6); border-radius: 14px; display: none; }
.scroll-hint::before { content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: #fff; animation: wheel 1.6s infinite; }
@keyframes wheel { to { transform: translateY(14px); opacity: 0; } }

/* Mega menu */
.nav .has-mega { position: relative; }
.mega { position: absolute; top: calc(100% + 14px); left: 50%; width: min(860px, 92vw); transform: translate(-50%, 12px); background: #fff; border-radius: 18px; box-shadow: 0 30px 60px rgba(10,42,82,.18); padding: 26px; display: grid; grid-template-columns: repeat(4, 1fr) 1.2fr; gap: 20px; opacity: 0; visibility: hidden; transition: .25s; }
.has-mega:hover .mega, .has-mega:focus-within .mega { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.mega::before { content: ""; position: absolute; top: -16px; left: 0; right: 0; height: 16px; }
.mega .mega-h { font-family: "Roboto Condensed", "RC Fallback Roboto", "RC Fallback Arial", sans-serif; color: var(--primary); font-size: 15px; margin-bottom: 8px; }
.mega > div:not(.mega-promo) a { display: block; padding: 3px 0 !important; font-weight: 400 !important; color: var(--muted) !important; background: none !important; font-family: Roboto, sans-serif !important; }
.mega > div:not(.mega-promo) a:hover { color: var(--accent) !important; transform: translateX(4px); }
.mega-promo { border-radius: 14px; padding: 18px; color: #fff; background: linear-gradient(140deg, var(--primary), var(--primary-2)); display: flex; flex-direction: column; justify-content: space-between; }
.mega-promo b { font-size: 20px; font-family: "Roboto Condensed", "RC Fallback Roboto", "RC Fallback Arial", sans-serif; }

/* Bento grid (business areas) */
.bento { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 220px; gap: 20px; margin-top: 36px; }
.bento-item { position: relative; border-radius: 22px; overflow: hidden; color: #fff; padding: 26px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--primary); isolation: isolate; }
.bento-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .8s; }
.bento-item::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10,42,82,.1), rgba(10,42,82,.88)); }
.bento-item:hover img { transform: scale(1.08); }
.bento-item h3 { font-size: 22px; color: #fff; }
.bento-item p { color: #d3e0f3; font-size: 15px; max-height: 0; opacity: 0; overflow: hidden; transition: .5s; }
.bento-item:hover p { max-height: 100px; opacity: 1; margin-top: 6px; }
.bento-item .num { position: absolute; top: 20px; right: 24px; font: 800 44px "Roboto Condensed", "RC Fallback Roboto", "RC Fallback Arial", sans-serif; color: rgba(255,255,255,.18); }
.bento .wide { grid-column: span 2; } .bento .tall { grid-row: span 2; }

/* Dark impact band with counters */
.impact { position: relative; color: #fff; background: #0a2a52; overflow: hidden; }
.impact::before { content: ""; position: absolute; inset: 0; background: url("https://images.unsplash.com/photo-1559302504-64aae6ca6b6d?auto=format&w=1800&q=60") center/cover fixed; opacity: .18; }
.impact .container { position: relative; }
.impact .stat b { color: var(--accent); font-size: clamp(38px, 5vw, 60px); }
.impact .stat span { color: #c9d9f0; }
.impact .title { color: #fff; }

/* Timeline process */
.timeline { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-top: 48px; }
.timeline::before { content: ""; position: absolute; top: 28px; left: 8%; right: 8%; height: 2px; background: var(--line); }
.timeline::after { content: ""; position: absolute; top: 28px; left: 8%; height: 2px; width: 0; background: var(--accent); transition: width 2s .3s ease; }
.timeline.in::after { width: 84%; }
.tl-step { text-align: center; position: relative; }
.tl-step i { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); font-style: normal; font-size: 24px; position: relative; z-index: 1; transition: .3s; }
.tl-step:hover i { background: var(--accent); transform: scale(1.1); }
.tl-step h3 { color: var(--primary); font-size: 17px; }
.tl-step p { color: var(--muted); font-size: 14px; }

/* Testimonials */
.quote { background: #fff; border-radius: 20px; padding: 28px; border: 1px solid var(--line); position: relative; }
.quote::before { content: "“"; position: absolute; top: -6px; right: 22px; font: 800 90px/1 Georgia, serif; color: #dce8fa; }
.quote .stars { color: var(--accent); letter-spacing: 2px; }
.quote p { color: #34445c; margin: 10px 0 18px; }
.quote .who { display: flex; align-items: center; gap: 12px; }
.quote .avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary-2), var(--accent)); }
.quote small { color: var(--muted); display: block; }

/* FAQ accordion */
.faq { max-width: 860px; margin: 36px auto 0; }
.faq details { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; background: #fff; transition: box-shadow .3s; }
.faq details[open] { box-shadow: var(--shadow); border-color: transparent; }
.faq summary { cursor: pointer; list-style: none; padding: 18px 22px; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; color: var(--accent); transition: transform .3s; line-height: 1; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 22px 18px; color: var(--muted); }

/* Animated page banner */
.page-banner { position: relative; overflow: hidden; background-size: 200% 200%; animation: bannerShift 12s ease infinite; background-image: linear-gradient(120deg, var(--primary), var(--primary-2), #164e9e, var(--primary)); }
.page-banner::after { content: ""; position: absolute; right: -80px; top: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(255,105,0,.12); animation: spin 30s linear infinite; }
@keyframes bannerShift { 50% { background-position: 100% 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Back to top with progress ring */
.to-top { position: fixed; left: 18px; bottom: 18px; width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer; z-index: 60; background: conic-gradient(var(--accent) var(--p, 0%), #fff 0); box-shadow: var(--shadow); opacity: 0; transform: translateY(20px); transition: .3s; }
.to-top::before { content: "↑"; position: absolute; inset: 4px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 18px; }
.to-top.show { opacity: 1; transform: none; }

/* Page loader */
.loader { position: fixed; inset: 0; z-index: 300; background: var(--primary); display: grid; place-items: center; transition: opacity .5s, visibility .5s; }
.loader.done { opacity: 0; visibility: hidden; }
.loader span { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle, var(--accent) 38%, transparent 40%); box-shadow: 0 0 0 0 rgba(255,105,0,.5); animation: pulseSun 1.2s infinite; }
@keyframes pulseSun { 70% { box-shadow: 0 0 0 30px rgba(255,105,0,0); } }

@media (min-width: 1101px) { .scroll-hint { display: block; } }
@media (max-width: 1100px) { .mega { display: none; } }
@media (max-width: 1024px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .timeline { grid-template-columns: repeat(3, 1fr); row-gap: 30px; }
  .timeline::before, .timeline::after { display: none; }
}
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; grid-auto-rows: 200px; }
  .bento .wide, .bento .tall { grid-column: auto; grid-row: auto; }
  .bento-item p { max-height: none; opacity: 1; }
  .timeline { grid-template-columns: 1fr 1fr; }
  .impact::before { background-attachment: scroll; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Floating badge on "why us" image */
.float-badge { position: absolute; right: -20px; bottom: 40px; background: #fff; border-radius: 16px; padding: 16px 20px; box-shadow: 0 20px 40px rgba(10,42,82,.18); animation: bob 4s ease-in-out infinite; }
.float-badge b { display: block; font: 800 30px "Roboto Condensed", "RC Fallback Roboto", "RC Fallback Arial", sans-serif; color: var(--accent); }
.float-badge span { color: var(--muted); font-size: 14px; }
@keyframes bob { 50% { transform: translateY(-12px); } }
@media (max-width: 600px) { .float-badge { right: 12px; } }
.feature:hover .icon-box { color: #fff; }

/* Decorative photos (card layers, impact band, footer) are CSS backgrounds, which browsers fetch immediately wherever they sit.
   Hold them back until site-effects.js adds .deco-ready (2.5s after load, or on first scroll/touch), so they never compete with the banner (LCP). */
html:not(.deco-ready) :is(.card, .quote, .step, .stats .grid, .sidebar .box, .summary)::after,
html:not(.deco-ready) .impact::before,
html:not(.deco-ready) .footer::before { background-image: none !important; }

/* Hidden photo layer under plain cards: faded into the bottom-right corner, clearer on hover */
.card:not(.product):not(.project):not(.news), .quote, .step, .stats .grid, .sidebar .box:not([style]), .summary {
  position: relative; isolation: isolate; overflow: hidden;
}
/* Default photo at zero specificity so the nth-child rotation below can override it */
:where(.card, .quote, .step, .sidebar .box, .summary) { --card-bg: url("https://images.unsplash.com/photo-1509391366360-2e959784a276?auto=format&w=700&q=60"); }
.card:not(.product):not(.project):not(.news)::after, .quote::after, .step::after, .stats .grid::after, .sidebar .box:not([style])::after, .summary::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--card-bg) center / cover;
  opacity: .3; filter: saturate(1.1);
  -webkit-mask-image: linear-gradient(135deg, transparent 30%, rgba(0,0,0,.6) 65%, #000 100%);
  mask-image: linear-gradient(135deg, transparent 30%, rgba(0,0,0,.6) 65%, #000 100%);
  transform: scale(1.05); transition: opacity .5s, transform .8s;
}
.card:not(.product):not(.project):not(.news):hover::after, .quote:hover::after, .step:hover::after { opacity: .5; transform: scale(1); }
/* Rotate four photos across sibling cards so neighbours never repeat */
:is(.card, .quote, .step):nth-child(4n+2) { --card-bg: url("https://images.unsplash.com/photo-1559302504-64aae6ca6b6d?auto=format&w=700&q=60"); }
:is(.card, .quote, .step):nth-child(4n+3) { --card-bg: url("https://images.unsplash.com/photo-1613665813446-82a78c468a1d?auto=format&w=700&q=60"); }
:is(.card, .quote, .step):nth-child(4n+4) { --card-bg: url("https://images.unsplash.com/photo-1508514177221-188b1cf16e9d?auto=format&w=700&q=60"); }
.stats .grid { --card-bg: url("https://images.unsplash.com/photo-1466611653911-95081537e5b7?auto=format&w=1400&q=60"); }
.stats .grid::after { -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); mask-image: linear-gradient(90deg, transparent 30%, #000); }

/* Page banner photo: per-page image (set by site-layout.js) tinted with the brand gradient */
.page-banner { padding: 90px 0; }
.page-banner::before { content: ""; position: absolute; inset: 0; background: var(--banner-lg, none) center / cover; /* per-page photo declared inline on the banner */ opacity: .35; mix-blend-mode: luminosity; transform: scale(1.08); animation: bannerZoom 18s ease-in-out infinite alternate; }
.page-banner .container { position: relative; z-index: 1; }
@keyframes bannerZoom { to { transform: scale(1); } }

@media (max-width: 860px) {
  .impact::before { background-image: url("https://images.unsplash.com/photo-1559302504-64aae6ca6b6d?auto=format&w=800&q=55"); }
  .page-banner::before { background-size: cover; }
}
@media (max-width: 860px) {
  .stats .grid { --card-bg: url("https://images.unsplash.com/photo-1466611653911-95081537e5b7?auto=format&w=640&q=50"); }
}
@media (max-width: 860px) { .page-banner::before { background-image: var(--banner-sm, none); } }
