/* Adamas Digital — the principle deck.
   The five reasons on the homepage, shown as a coverflow: one card square to
   the viewer, its neighbours turned away into the distance either side.

   The cards are placed by site.js, which writes a transform onto each one
   according to how far it sits from the front. Everything here is the look of
   a card and the stage they sit on; nothing here decides the order. Without
   the script the deck falls back to a plain stack, which is why the layout
   rules below do not depend on any class the script adds. */

.principle-deck {
  /* The section is a two-column grid and this is the wider column. The stage
     is allowed to overhang it: a card turned away from the viewer belongs
     partly outside the column, and clipping it flat would undo the depth. */
  position: relative;
}

.deck-stage {
  position: relative;
  height: 340px;
  /* Distance to the vanishing point. Too near and the turned cards shear;
     this is far enough that they read as rotated rather than distorted. */
  perspective: 1500px;
  perspective-origin: 50% 45%;
}

/* ---- A card ------------------------------------------------------------ */
.deck-stage > article {
  position: absolute;
  top: 0;
  left: 50%;
  width: clamp(230px, 22vw, 320px);
  height: 100%;
  box-sizing: border-box;
  padding: 30px 28px;
  border: 1px solid #ffffff1f;
  border-radius: 20px;
  /* Opaque, and that is the point. A coverflow only reads if the front card
     hides the ones behind it; translucent cards let four sets of text stack
     up in the same place and none of them can be read. Lifted a little off
     the section's black so the turned cards still separate from it. */
  background: #17171b;
  box-shadow: 0 30px 60px #00000073;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform .65s cubic-bezier(.22, 1, .36, 1),
              opacity .55s ease,
              border-color .55s ease;
}

/* Before the script runs, and if it never does, the cards simply stack. */
.deck-stage:not(.is-placed) > article {
  position: relative;
  left: auto;
  width: auto;
  height: auto;
  margin-bottom: 14px;
}

.deck-stage.is-placed { }

.deck-stage > article > span {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  color: var(--blue);
  background: var(--paper);
  border-radius: 50%;
}

.deck-stage > article small {
  display: block;
  margin-top: 26px;
  color: #fff6;
  font-family: var(--display);
  letter-spacing: .12em;
  font-size: 9px;
}

.deck-stage > article h3 {
  margin: 8px 0 12px;
  font-family: var(--display);
  letter-spacing: -.04em;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 500;
  line-height: 1.05;
}

.deck-stage > article p {
  margin: 0;
  max-width: none;
  color: #ffffff94;
  font-size: 13px;
  line-height: 1.6;
}

/* The card facing the viewer is the one being read, so it gets the contrast;
   the rest sit back. */
.deck-stage > article.is-front {
  border-color: #ffffff4d;
  background: #1e1e24;
}

.deck-stage > article:not(.is-front) { cursor: pointer; }

/* ---- Controls ---------------------------------------------------------- */
.deck-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.deck-arrow,
.deck-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff2e;
  border-radius: 50%;
  background: none;
  color: var(--paper);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}

.deck-arrow:hover,
.deck-play:hover,
.deck-arrow:focus-visible,
.deck-play:focus-visible {
  background: #ffffff1f;
  border-color: #ffffff6b;
}

/* One button, two glyphs: whichever action is available is the one shown. */
.deck-play .deck-icon-play { display: none; }
.deck-play.is-paused .deck-icon-pause { display: none; }
.deck-play.is-paused .deck-icon-play { display: block; }

@media (max-width: 900px) {
  .deck-stage { height: 320px; }
  .deck-stage > article { width: clamp(230px, 62vw, 300px); }
}

@media (max-width: 720px) {
  .deck-stage { height: 300px; perspective: 1100px; }
  .deck-controls { margin-top: 24px; }
}

/* Reduced motion keeps the deck but takes the movement out of it: the cards
   still change, they just stop turning and sliding to do it. site.js also
   leaves the deck paused, so nothing advances unasked. */
@media (prefers-reduced-motion: reduce) {
  .deck-stage > article { transition: none; }
}
