/* Steam Analysis tier cards on the phone: the same deck as the homepage testimonial cards
   (assets/css/testi-cards.css). 900px and narrower: a straight stack, the two cards behind stepping up
   and to the right inside the side gutters, one card in front that moves on every few seconds and follows
   swipes, with arrows and dots under it. Wider than 900px: the three cards sit side by side as before.
   steam-tier-deck.js sets data-layout on .sd-wrap; without the script the cards sit in a row the reader scrolls.
   The deck cards keep name, price, "Made for" and the button always visible; the feature list opens on a tap
   on the card body, with a dashed hint row that says so. Load AFTER steam-tier-card.css. Reusable on the homepage with the same markup (see DESIGN.md, "Tier Deck"). */
:root{ --sd-dx: 14px; --sd-dy: 14px; --sd-dur: 300ms; }

.sd-wrap{ position: relative; }
.sa-more{ display: none; }
.sd-controls{ display: none; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.sd-btn{
  all: unset; box-sizing: border-box; cursor: pointer; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--rule); color: var(--ink-2);
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .18s var(--ease);
}
.sd-btn svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sd-btn:hover{ border-color: var(--clay); color: var(--clay); }
.sd-btn:active{ transform: scale(0.94); }
.sd-btn:focus-visible{ outline: 2px solid var(--clay); outline-offset: 3px; }
.sd-dots{ display: flex; gap: 8px; }
.sd-dot{ all: unset; cursor: pointer; width: 8px; height: 8px; border-radius: 999px; background: var(--rule); transition: width .3s var(--ease), background-color .3s var(--ease); }
.sd-dot.is-active{ width: 22px; background: var(--clay); }
.sd-dot:focus-visible{ outline: 2px solid var(--clay); outline-offset: 3px; }

@media (max-width: 900px){
  /* No script yet: a row the reader scrolls */
  .sd-wrap:not([data-layout]) .sa-tiers{ display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; scrollbar-width: none; padding-block: 8px 24px; }
  .sd-wrap:not([data-layout]) .sa-tiers::-webkit-scrollbar{ display: none; }
  .sd-wrap:not([data-layout]) .sa-tiers > .sa-tier{ width: min(340px, 86vw); flex: none; }

  /* Safety net: anything in the deck that reaches past the side gutters is clipped at the window
     edge, so the phone page never scrolls sideways. */
  #versions{ overflow-x: clip; }

  /* Deck */
  .sd-wrap[data-layout="deck"] .sa-tiers{ display: block; position: relative; padding: 0; height: calc(var(--sd-deck-h, 520px) + 2 * var(--sd-dy) + 8px); touch-action: pan-y; }
  .sd-wrap[data-layout="deck"] .sa-tier{
    position: absolute; top: calc(2 * var(--sd-dy)); left: 0; width: calc(100% - 2 * var(--sd-dx));
    height: var(--sd-deck-h, auto); box-sizing: border-box;
    transition: transform var(--sd-dur) var(--ease), opacity var(--sd-dur) var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
    transform: var(--sd-pose);
  }
  /* Phone: every card gets the clay border the Solo Dev card has on wide screens */
  .sd-wrap[data-layout="deck"] .sa-tier{ border-color: color-mix(in srgb, var(--clay) 40%, var(--rule)); }
  .sd-wrap[data-layout="deck"] .sa-tier:hover{ scale: 1; }
  .sd-wrap[data-layout="deck"] .sa-tier:not(.is-front){ pointer-events: none; }
  .sd-wrap[data-layout="deck"] .sa-tier.is-out{ transition-duration: calc(var(--sd-dur) * .6); }
  .sd-wrap[data-layout="deck"] .sd-controls{ display: flex; }

  /* Deck cards: name, price, feature list and button are shown. A tap on the card body swaps the list for
     "Made for" (steam-tier-deck.js builds the hint row and toggles .is-open). */
  .sd-wrap[data-layout="deck"] .sa-for{ position: static; opacity: 1; transform: none; order: 0; padding: 0; margin: 0; border: 0; pointer-events: auto; }
  .sd-wrap[data-layout="deck"] .sa-for[hidden]{ display: none; }
  .sd-wrap[data-layout="deck"] .sa-for p{ font-size: 19px; }
  .sd-wrap[data-layout="deck"] .sa-tier:hover .sa-body > ul,
  .sd-wrap[data-layout="deck"] .sa-tier:focus-within .sa-body > ul{ opacity: 1; filter: none; }
  .sd-wrap[data-layout="deck"] .sa-body > ul[hidden]{ display: none; }
  .sd-wrap[data-layout="deck"] .sa-tier.is-front .sa-body{ cursor: pointer; }
  .sd-wrap[data-layout="deck"] .sa-more{
    all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 8px;
    align-self: stretch; margin: auto 0 12px; padding: 10px 12px; min-height: 44px; cursor: pointer;
    border: 1px dashed color-mix(in srgb, var(--clay) 45%, var(--rule)); border-radius: 12px;
    font-family: var(--mono); font-size: 12px; letter-spacing: 0.065em; line-height: 1.3; text-transform: uppercase; text-align: center; color: var(--ink-2);
    transition: border-color .2s var(--ease), color .2s var(--ease);
  }
  .sd-wrap[data-layout="deck"] .sa-more:hover, .sd-wrap[data-layout="deck"] .sa-more[aria-expanded="true"]{ border-color: var(--clay); color: var(--ink); }
  .sd-wrap[data-layout="deck"] .sa-more:focus-visible{ outline: 2px solid var(--clay); outline-offset: 3px; }
  .sa-more svg{ flex: none; width: 16px; height: 16px; fill: none; stroke: var(--clay); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
  .sa-more[aria-expanded="true"] svg{ transform: rotate(180deg); }
  /* A small nudge on the chevron of the front card until the reader has tapped once */
  .sd-wrap:not(.is-tapped) .sa-tier.is-front .sa-more[aria-expanded="false"] svg{ animation: sd-nudge 1.8s var(--ease) 1.2s infinite; }
  @keyframes sd-nudge{ 0%, 55%, 100%{ transform: translateY(0); } 25%{ transform: translateY(3px); } }
  .sd-wrap[data-layout="deck"] .sa-body > :is(ul, .sa-for):not([hidden]){ animation: sd-list-in .3s var(--ease); }
  @keyframes sd-list-in{ from{ opacity: 0; transform: translateY(-4px); } to{ opacity: 1; transform: none; } }
}

@media (prefers-reduced-motion: reduce){
  .sd-wrap[data-layout="deck"] .sa-tier{ transition: none; }
  .sa-more svg{ transition: none; animation: none !important; }
  .sd-wrap[data-layout="deck"] .sa-body > :is(ul, .sa-for):not([hidden]){ animation: none; }
}
