/* ---------- Design tokens ---------- */
:root {
  --navy: #202158;
  --navy-800: #1a1b4a;
  --navy-900: #15163d;
  --navy-50: #ecebf6;
  --orange: #ff9800;
  --orange-600: #e68900;
  --orange-50: #fff4e5;
  --orange-text: #a86400; /* #ff9800 darkened for readable text on white (4.7:1) */
  --bg: #ffffff;
  --bg-soft: #f8f8fc;
  --text: #1a1b3f;
  --muted: #505178;
  --muted-2: #6a6b93;
  --line: #e5e5ef;
  --line-2: #f0f0f6;

  --radius-btn: 12px;
  --radius-card: 18px;
  --shadow-sm: 0 1px 2px rgba(26, 27, 63, 0.06), 0 4px 14px -6px rgba(26, 27, 63, 0.1);
  --shadow-md: 0 2px 4px rgba(26, 27, 63, 0.04), 0 18px 40px -18px rgba(26, 27, 63, 0.22);
  --shadow-lg: 0 30px 60px -28px rgba(32, 33, 88, 0.38);

  /* Side gutter: 120px on desktop, stepping down on smaller screens (see media queries below). */
  --pad-x: 120px;
  --gap: 20px;
  --head-h: 76px;
  --f-head: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-body: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + 12px);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--f-head); color: var(--navy); margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Full-width content: only the 120px side gutter, no centred max-width. */
.container { width: 100%; padding-inline: var(--pad-x); }
:focus-visible { outline: 3px solid rgba(255, 152, 0, 0.6); outline-offset: 3px; border-radius: 6px; }

/* ---------- Buttons (one radius, consistent styles) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  height: 54px; padding: 0 1.6rem; border-radius: var(--radius-btn);
  font-family: var(--f-body); font-weight: 600; font-size: 1rem; line-height: 1;
  border: 1.5px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn .i { width: 1.15rem; height: 1.15rem; transition: transform 0.2s ease; }
.btn:hover .i.arrow { transform: translateX(3px); }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 14px 26px -14px rgba(230, 137, 0, 0.9); }
.btn-primary:hover { background: var(--orange-600); transform: translateY(-1px); }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-outline:hover { border-color: var(--navy); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.btn-ghost:hover { border-color: #fff; transform: translateY(-1px); }
.btn-sm { height: 46px; padding: 0 1.2rem; font-size: 0.95rem; }

.link-arrow { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--navy); font-size: 0.9rem; }
.link-arrow .i { width: 0.95rem; height: 0.95rem; transition: transform 0.2s ease; }
.link-arrow:hover { color: var(--orange-text); }
.link-arrow:hover .i { transform: translateX(3px); }

/* ---------- Sections ---------- */
.section { padding-block: clamp(3.5rem, 6vw, 5.5rem); }
.section.soft { background: var(--bg-soft); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange-text);
}
.eyebrow.chip { padding: 0.45rem 0.95rem; border-radius: 999px; background: #fff; border: 1px solid #f8d3a1; letter-spacing: 0.12em; }
.eyebrow .i { width: 1rem; height: 1rem; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: clamp(1.8rem, 3vw, 2.5rem); }
.sec-head .copy { max-width: 920px; }
.sec-title { font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 700; margin-top: 0.9rem; }
.sec-title::after { content: ''; display: block; width: 64px; height: 4px; border-radius: 4px; background: var(--orange); margin-top: 0.9rem; }
.sec-head.center { justify-content: center; text-align: center; }
.sec-head.center .sec-title::after { margin-inline: auto; }
.sec-intro { margin-top: 0.9rem; font-size: 1.15rem; color: var(--muted); line-height: 1.7; }

/* ---------- Unified card ---------- */
.card {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.card:hover {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px);
  box-shadow: 0 2px 4px rgba(26, 27, 63, 0.04), 0 28px 50px -22px rgba(32, 33, 88, 0.38);
  border-color: transparent;
}
/* while the pointer moves, the tilt follows it closely instead of easing */
.card.tilting { transition: transform 0.12s ease-out, box-shadow 0.35s ease, border-color 0.35s ease; }

/* spotlight that follows the cursor (position set by src/lib/cardFx.js) */
.card::before {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 152, 0, 0.14), rgba(255, 255, 255, 0.06) 40%, transparent 65%);
  opacity: 0; transition: opacity 0.35s ease;
}
/* animated gradient border */
.card::after {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--ang, 0deg), var(--orange), #f8c77f, var(--navy), #5556a8, var(--orange));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity 0.35s ease;
}
.card:hover::before, .card:hover::after { opacity: 1; }

.card .media { position: relative; aspect-ratio: 2 / 1; overflow: hidden; background: linear-gradient(135deg, var(--navy-50), #fdf1dc); }
.card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.6s ease; }
.card:hover .media img { transform: scale(1.08); filter: saturate(1.12) contrast(1.03); }
/* light sweep across the photo on hover */
.card .media::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.38) 50%, transparent 65%);
  translate: -120% 0;
}
.card:hover .media::after { translate: 120% 0; transition: translate 0.9s cubic-bezier(0.3, 0.6, 0.2, 1); }
/* navy wash rising from the bottom of the photo */
.card .media::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(0deg, rgba(32, 33, 88, 0.35), transparent 55%);
  opacity: 0; transition: opacity 0.45s ease;
}
.card:hover .media::before { opacity: 1; }
.card h3 { transition: color 0.3s ease; }
.card:hover h3 { color: var(--navy-800); }
.card .body { padding: 1.05rem 1.2rem 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.card h3 { font-size: 1.14rem; font-weight: 600; }
/* descriptions are capped at two lines */
.card p {
  color: var(--muted); font-size: 0.95rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .foot { margin-top: auto; padding-top: 0.35rem; display: flex; justify-content: flex-end; }

.badge-ic {
  position: absolute; left: 12px; top: 12px; z-index: 1; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff; background: var(--navy);
  box-shadow: 0 8px 18px -8px rgba(21, 22, 61, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.9);
}
.badge-ic.o { background: var(--orange); }
.badge-ic .i { width: 1.1rem; height: 1.1rem; }
.badge-ic { transition: transform 0.5s cubic-bezier(0.3, 1.6, 0.4, 1), box-shadow 0.3s ease; }
.card:hover .badge-ic { transform: scale(1.12) rotate(-10deg); box-shadow: 0 10px 22px -8px rgba(21, 22, 61, 0.8), 0 0 0 4px rgba(255, 255, 255, 0.95); }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.2rem; }
.chips li {
  font-size: 0.8rem; font-weight: 500; color: var(--navy); background: var(--bg-soft); border: 1px solid var(--line-2); padding: 0.2rem 0.6rem; border-radius: 999px;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.card:hover .chips li { background: var(--orange-50); border-color: #fbe0bd; color: var(--orange-text); }
.card:hover .chips li:nth-child(even) { background: var(--navy-50); border-color: #dcdcee; color: var(--navy); }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }

/* ---------- Scroll reveal (uses `translate`/`rotate`/`scale` so hover `transform` still works) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rv { opacity: 0; translate: 0 22px; }
  .rv.in { animation: rv-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--rv-delay, 0ms) both; }

  /* cards flip up out of the page, unblurring as they land */
  .card.rv { opacity: 0; translate: 0 48px; rotate: x 14deg; scale: 0.95; transform-origin: 50% 100%; }
  .card.rv.in { animation: rv-card 0.95s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--rv-delay, 0ms) * 1.4) both; }

  /* once in, a card's chips pop in one by one */
  .card.rv .chips li { opacity: 0; scale: 0.7; }
  .card.rv.in .chips li { animation: chip-in 0.5s cubic-bezier(0.3, 1.5, 0.4, 1) both; }
  .card.rv.in .chips li:nth-child(1) { animation-delay: calc(var(--rv-delay, 0ms) * 1.4 + 0.45s); }
  .card.rv.in .chips li:nth-child(2) { animation-delay: calc(var(--rv-delay, 0ms) * 1.4 + 0.53s); }
  .card.rv.in .chips li:nth-child(3) { animation-delay: calc(var(--rv-delay, 0ms) * 1.4 + 0.61s); }
  .card.rv.in .chips li:nth-child(n + 4) { animation-delay: calc(var(--rv-delay, 0ms) * 1.4 + 0.69s); }

  /* badge icons spin in */
  .card.rv .badge-ic { opacity: 0; }
  .card.rv.in .badge-ic { animation: badge-in 0.7s cubic-bezier(0.3, 1.5, 0.4, 1) calc(var(--rv-delay, 0ms) * 1.4 + 0.3s) both; }

  /* section title underline grows */
  .sec-head.rv .sec-title::after { width: 0; }
  .sec-head.rv.in .sec-title::after { animation: grow-line 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s forwards; }

  /* the gradient border slowly circles while hovered */
  .card:hover::after { animation: ang 4s linear infinite; }
}
@keyframes rv-in { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
@keyframes rv-card {
  0% { opacity: 0; translate: 0 48px; rotate: x 14deg; scale: 0.95; filter: blur(6px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; translate: 0 0; rotate: x 0deg; scale: 1; filter: none; }
}
@keyframes chip-in { from { opacity: 0; scale: 0.7; } to { opacity: 1; scale: 1; } }
@keyframes badge-in { from { opacity: 0; scale: 0.3; rotate: -120deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes grow-line { from { width: 0; } to { width: 64px; } }
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes ang { to { --ang: 360deg; } }

.grid-4, .ai-grid, .badges, .ev-row { perspective: 1400px; }

@media (max-width: 1280px) {
  :root { --pad-x: 56px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) { :root { --pad-x: 40px; } }
@media (max-width: 760px) {
  :root { --pad-x: 20px; }
  body { font-size: 1rem; }
  .sec-head { flex-direction: column; align-items: flex-start; }
  .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .eyebrow { letter-spacing: 0.08em; font-size: 0.78rem; }
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: clamp(16px, 2.5vw, 32px); bottom: clamp(16px, 2.5vw, 32px); z-index: 70;
  width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; background: var(--navy); box-shadow: 0 16px 30px -12px rgba(32, 33, 88, 0.7), 0 0 0 4px rgba(255, 255, 255, 0.85);
  opacity: 0; pointer-events: none; translate: 0 16px; scale: 0.8;
  transition: opacity 0.3s ease, translate 0.4s cubic-bezier(0.3, 1.4, 0.4, 1), scale 0.4s cubic-bezier(0.3, 1.4, 0.4, 1), background 0.25s ease;
}
.to-top.show { opacity: 1; pointer-events: auto; translate: 0 0; scale: 1; }
.to-top:hover { background: var(--orange); }
.to-top .i { width: 1.3rem; height: 1.3rem; rotate: -90deg; transition: translate 0.25s ease; }
.to-top:hover .i { translate: 0 -2px; }
