/* ============================================================================
   St Andrews Taxicab — Trust / Statistics 3D interactive card deck
   Progressive enhancement: styles only take effect once JS adds `.trust--ready`
   to the `.trust` element. Without JS the section keeps its default grid layout.
   Colour language: misty light background, white/translucent glass cards,
   deep-teal typography, gold accent, soft teal/gold glow.
   ========================================================================== */

/* ---------- Stage ---------- */
.trust--ready {
  /* Offset is derived from the card width so the side cards ALWAYS clear the
     centre card (gap ≈ 10% of card width) on every viewport. */
  --card-w: clamp(240px, 26vw, 330px);
  --side-offset: calc(var(--card-w) * 1.1);

  position: relative;
  display: block;
  perspective: 1400px;
  transform-style: preserve-3d;
  height: 320px;          /* deck fills this; controls sit just below */
  margin: 0 auto;
}

.trust--ready .trust__item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--card-w);
  margin: 0;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(201, 162, 39, .35);
  border-radius: 18px;
  padding: 1.7rem 1.5rem 1.8rem;
  text-align: center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  cursor: pointer;
  box-shadow:
    0 14px 34px rgba(15, 76, 92, .12),
    0 2px 8px rgba(15, 76, 92, .06);
  transition:
    transform 800ms cubic-bezier(.22, 1, .36, 1),
    opacity   600ms ease,
    filter    600ms ease,
    box-shadow 600ms ease,
    border-color 600ms ease;
  /* default (pre-position) centring — overridden by state classes below */
  transform: translate(-50%, -50%) !important;
  opacity: 1;
}

/* Neutralise the site-wide fx-reveal opacity (it would otherwise hide these
   cards). The 3D position transforms below are !important and already win over
   the reveal's non-important `transform: none`, so we must NOT set a transform
   here or it would override the is-left/is-right placement. */
html.js-fx .trust--ready .trust__item.fx-reveal,
html.js-fx .trust--ready .trust__item.fx-reveal.is-visible {
  opacity: 1 !important;
}

/* ---------- Side cards (always visible, angled backward) ---------- */
.trust--ready .trust__item.is-left,
.trust--ready .trust__item.is-right {
  opacity: .82 !important;
  z-index: 1;
  filter: blur(.2px);
}
.trust--ready .trust__item.is-left {
  transform:
    translate(-50%, -50%)
    translate3d(calc(var(--side-offset) * -1), 15px, -50px)
    rotateY(10deg) scale(.90) !important;
}
.trust--ready .trust__item.is-right {
  transform:
    translate(-50%, -50%)
    translate3d(var(--side-offset), 15px, -50px)
    rotateY(-10deg) scale(.90) !important;
}

/* ---------- Centre / hero card ---------- */
.trust--ready .trust__item.is-center {
  opacity: 1 !important;
  z-index: 3;
  cursor: default;
  border-width: 2px;
  border-color: rgba(201, 162, 39, .60);
  /* sits in front of the side cards */
  transform:
    translate(-50%, -50%)
    translate3d(0, 0, 80px)
    rotateY(0deg) scale(1.08) !important;
  box-shadow:
    0 30px 70px rgba(15, 76, 92, .18),
    0 0 38px rgba(201, 162, 39, .28);
}
.trust--ready .trust__item.is-center .num {
  font-size: 2.4rem;
  background: linear-gradient(120deg, #0F4C5C 0%, #C9A227 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* small premium accent above the number (no HTML change) */
.trust--ready .trust__item.is-center::before {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin: 0 auto .9rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #0F4C5C, #C9A227);
}
/* subtle animated gold sheen behind the content */
.trust--ready .trust__item.is-center::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 80% at 50% 0%, rgba(201, 162, 39, .20), transparent 60%);
  opacity: .18;
  animation: trust-sheen 4.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.trust--ready .trust__item.is-center .num,
.trust--ready .trust__item.is-center .lbl {
  position: relative;
  z-index: 1;
}
@keyframes trust-sheen {
  0%, 100% { opacity: .14; }
  50%      { opacity: .42; }
}

/* ---------- Hover elevation (all cards) ---------- */
.trust--ready .trust__item:hover {
  box-shadow:
    0 22px 48px rgba(15, 76, 92, .16),
    0 0 26px rgba(201, 162, 39, .18);
}
.trust--ready .trust__item.is-center:hover {
  box-shadow:
    0 36px 80px rgba(15, 76, 92, .20),
    0 0 44px rgba(201, 162, 39, .32);
}

/* ---------- Controls (prev / next / dots) ---------- */
.trust__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-top: 1.4rem;       /* small gap directly beneath the deck */
}
.trust__nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong, rgba(15, 76, 92, .26));
  background: #ffffff;
  color: var(--brand-teal, #0F4C5C);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(15, 76, 92, .10);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.trust__nav:hover {
  background: var(--brand-teal, #0F4C5C);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-1px);
}
.trust__nav:focus-visible {
  outline: 3px solid var(--brand-gold, #C9A227);
  outline-offset: 2px;
}
.trust__dots {
  display: flex;
  gap: .55rem;
  align-items: center;
}
.trust__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 76, 92, .22);
  cursor: pointer;
  transition: background .25s ease, transform .25s ease, width .25s ease, border-radius .25s ease;
}
.trust__dot.is-active {
  width: 22px;
  border-radius: 999px;
  background: var(--brand-gold, #C9A227);
}
.trust__dot:focus-visible {
  outline: 3px solid var(--brand-teal, #0F4C5C);
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .trust--ready {
    --card-w: clamp(200px, 22vw, 260px);
    height: 300px;
  }
}
@media (max-width: 620px) {
  .trust--ready {
    --card-w: clamp(220px, 74vw, 260px);
    --side-offset: clamp(150px, 46vw, 190px);   /* neighbours peek from edges */
    height: 280px;
  }
  .trust--ready .trust__item.is-left {
    transform:
      translate(-50%, -50%)
      translate3d(calc(var(--side-offset) * -1), 12px, -40px)
      rotateY(7deg) scale(.88) !important;
  }
  .trust--ready .trust__item.is-right {
    transform:
      translate(-50%, -50%)
      translate3d(var(--side-offset), 12px, -40px)
      rotateY(-7deg) scale(.88) !important;
  }
  .trust--ready .trust__item.is-center {
    transform:
      translate(-50%, -50%)
      translate3d(0, 0, 70px)
      rotateY(0deg) scale(1.04) !important;
  }
  .trust--ready .trust__item.is-center .num { font-size: 2.1rem; }
}

/* ---------- Reduced motion: flat, no 3D ---------- */
@media (prefers-reduced-motion: reduce) {
  .trust--ready .trust__item {
    transition: opacity .4s ease, transform .4s ease;
    filter: none !important;
  }
  .trust--ready .trust__item.is-left {
    transform: translate(-50%, -50%) translateX(calc(var(--side-offset) * -.55)) scale(.94) !important;
    opacity: .85 !important;
  }
  .trust--ready .trust__item.is-right {
    transform: translate(-50%, -50%) translateX(calc(var(--side-offset) * .55)) scale(.94) !important;
    opacity: .85 !important;
  }
  .trust--ready .trust__item.is-center {
    transform: translate(-50%, -50%) scale(1) !important;
  }
  .trust--ready .trust__item.is-center::after { animation: none; opacity: .2; }
  .trust__nav { transition: none; }
}
