/*
 * tuning-database.co.uk, v3: /file-service-pricing/
 * (templates/page-file-service-pricing.php). The five packs stand as a CSS 3D
 * stack, each as tall as the files it holds; pointing at a pack lights its row
 * in the price table (:has, no script). They rise into place once.
 */

/* 1. the hero and the stack ------------------------------------------------- */

.fsp-hero {
  align-items: center;
}

.stack3d {
  display: grid;
  place-items: end center;
  min-height: 360px;
  padding-block: var(--sp-6) var(--sp-8);
  perspective: 1400px;
}

.stack3d__scene {
  --k: 1;
  display: flex;
  align-items: flex-end;
  gap: calc(40px * var(--k));
  transform: rotateX(-24deg) rotateY(-34deg);
  transform-style: preserve-3d;
}

.stack3d__pack {
  --w: calc(76px * var(--k));
  --d: calc(76px * var(--k));
  position: relative;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  transition: transform var(--dur-2) var(--ease-out);
  animation: fsp-rise 0.8s var(--ease-out) both;
}

.stack3d__pack--5 { --h: calc(64px * var(--k)); }
.stack3d__pack--10 { --h: calc(96px * var(--k)); animation-delay: 80ms; }
.stack3d__pack--25 { --h: calc(148px * var(--k)); animation-delay: 160ms; }
.stack3d__pack--50 { --h: calc(204px * var(--k)); animation-delay: 240ms; }
.stack3d__pack--100 { --h: calc(280px * var(--k)); animation-delay: 320ms; }

.stack3d__face {
  position: absolute;
  backface-visibility: hidden;
}

.stack3d__face--front {
  inset: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: var(--sp-3);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--step--1);
  line-height: 1.1;
  transform: translateZ(calc(var(--d) / 2));
}

.stack3d__face--front b {
  font-size: var(--step-2);
}

.stack3d__face--side {
  top: 0;
  left: calc((var(--w) - var(--d)) / 2);
  width: var(--d);
  height: 100%;
  background: var(--signal-4);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2));
}

.stack3d__face--top {
  left: 0;
  top: calc((var(--h) - var(--d)) / 2);
  width: var(--w);
  height: var(--d);
  background: var(--signal-1);
  transform: rotateX(90deg) translateZ(calc(var(--h) / 2));
}

.stack3d__price,
.stack3d__tool {
  position: absolute;
  left: 50%;
  white-space: nowrap;
  font-size: var(--step--1);
  transform: translateX(-50%) translateZ(calc(var(--d) / 2));
}

.stack3d__price {
  top: calc(100% + var(--sp-2));
  color: var(--ink);
  font-weight: 700;
}

.stack3d__tool {
  bottom: calc(100% + var(--d) / 2 + var(--sp-2));
  color: var(--accent-ink);
  font-weight: 700;
}

@media (hover: hover) {
  .stack3d__pack:hover {
    transform: translateY(-10px);
  }
}

/* Pointing at a pack lights its row in the table. */
.fsp:has(.stack3d__pack--5:hover) .fsp-table tr[data-pack="5"],
.fsp:has(.stack3d__pack--10:hover) .fsp-table tr[data-pack="10"],
.fsp:has(.stack3d__pack--25:hover) .fsp-table tr[data-pack="25"],
.fsp:has(.stack3d__pack--50:hover) .fsp-table tr[data-pack="50"],
.fsp:has(.stack3d__pack--100:hover) .fsp-table tr[data-pack="100"] {
  background: var(--bg-hover);
}

/* Movement only: an animated opacity, even one that has ended, makes Chrome
   draw the pack flat (only its front face showed). */
@keyframes fsp-rise {
  from {
    transform: translateY(60px);
  }

  to {
    transform: none;
  }
}

/* Smaller packs on smaller screens (a scaled stack kept its full width in
   the layout and pushed phones sideways). */
@media (max-width: 899px) {
  .stack3d {
    min-height: 0;
  }

  .stack3d__scene {
    --k: 0.72;
  }
}

@media (max-width: 479px) {
  .stack3d__scene {
    --k: 0.5;
  }

  .stack3d__face--front {
    font-size: 11px;
  }

  .stack3d__face--front b {
    font-size: var(--step-0);
  }

  .stack3d__price {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stack3d__pack {
    animation: none;
    transition: none;
  }
}

/* 2. the price table -------------------------------------------------------- */

.fsp-table td b {
  color: var(--ink);
}

.fsp-table__sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: var(--step--1);
}

.fsp-table tr[data-pack="100"] .fsp-table__sub {
  color: var(--accent-ink);
  font-weight: 600;
}

/* 3. the tiers -------------------------------------------------------------- */

.fsp-tiers {
  display: grid;
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fsp-tier {
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--bg-raised);
}

.fsp-tier > * + * {
  margin-top: var(--sp-2);
}

.fsp-tier h3 {
  font-size: var(--step-2);
}

.fsp-tier__for {
  color: var(--accent-ink);
  font-weight: 700;
}

.fsp-tier p:not(.fsp-tier__for) {
  color: var(--ink-2);
}

@media (min-width: 900px) {
  .fsp-tiers {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* 4. what one file carries, bigger vehicles ---------------------------------- */

.fsp-what {
  display: grid;
  gap: var(--sp-7);
}

.fsp-what h2 {
  font-size: var(--step-2);
}

.fsp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: 0;
  list-style: none;
}

@media (min-width: 900px) {
  .fsp-what {
    grid-template-columns: 2fr 1fr;
  }
}

/* 5. the cars we tune most, a page each ------------------------------------- */

.fsp-cars {
  columns: 16rem auto;
  column-gap: var(--sp-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fsp-cars li {
  break-inside: avoid;
  padding-block: var(--sp-1);
}
