/* ==========================================================
   The price cards explained with drawings (task #252). Linked only by the software pages listed in ART_PLANS (includes/art-plans.php), after art.css.
   Every rule starts with a class that only art-plans.js adds (pa-...), so a card that was not dressed looks exactly as style.css draws it, and a page that does not
   link this file is not touched by a single line of it. The drawings use the tokens of art.css (--art-ink, --art-accent, --art-wash).
   Only transform, translate and opacity ever change over time. Every movement starts when its block scrolls into view (art-plans.js adds .pa-seen)
   and is wrapped in prefers-reduced-motion: no-preference; without the script or with reduced motion every drawing is simply there, complete. Nothing loops.
   ========================================================== */

/* ---------- a group (Own it / Rent it): what the way of buying means, in a picture ---------- */
.pa-explain { display: flex; align-items: flex-start; gap: 4px; max-width: 440px; margin: 14px 0 0; }
.pa-ex { display: grid; flex: 1 1 0; justify-items: center; gap: 6px; min-width: 0; text-align: center; }
.pa-ex-ic { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 60px; height: 60px; padding: 0 14px; box-sizing: border-box; border-radius: 30px; background: #fff; box-shadow: 0 0 0 1px var(--border); }
.pa-ex-ic > svg { flex: none; }   /* one 32px icon: a 60px circle; two icons (Rent it): a pill with the same 14px of room on every side (task #255; they used to hang over the edge of a fixed 60px circle) */
/* A way with fewer than three steps (Rent it has ONE; art-plans.js adds pa-explain-few) took the whole 440px row and centred its picture. Its steps now start at the left, flush with
   the heading text: each step is as wide as its picture and caption need, at most a column of the three-step Own it row (a third of the row without the two arrows, never under 104px),
   picture and caption at the left; a long caption wraps inside that column (task #255). The three-step row keeps its own rules above. */
.pa-explain-few .pa-ex { flex: 0 1 auto; max-width: 126px; max-width: max(calc((100% - 60px) / 3), 104px); justify-items: start; text-align: left; }
.pa-ex-t { font-size: .78rem; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.pa-arrow { position: relative; flex: 0 0 22px; align-self: flex-start; height: 0; margin-top: 30px; border-top: 2px dotted var(--line-2); transform-origin: left center; }
.pa-arrow::after { content: ''; position: absolute; right: -1px; top: -3px; width: 7px; height: 7px; border-top: 2px solid var(--line-2); border-right: 2px solid var(--line-2); transform: rotate(45deg); }

/* ---------- the money lines: a picture for each, joined by a dotted line ---------- */
.pa-money { display: grid; gap: 10px; margin-top: 2px; }
.pa-step, .pa-fact { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start; }
.pa-step-ic { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); }
.pa-money-own .pa-step:not(:last-child)::after {
  content: ''; position: absolute; left: 17px; top: 38px; bottom: -10px; width: 0; border-left: 2px dotted var(--line-2); transform-origin: top center;
}
.pa-step-body { display: grid; align-content: center; min-width: 0; min-height: 36px; }
.pa-year .pa-step-body { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.pa-step .plan-price { margin: 0; line-height: 1.25; }
.pa-step .plan-price strong { display: inline-block; line-height: 1.2; }
.pa-step .plan-meta { margin: 0; padding-top: 2px; }
.pa-step .plan-meta { padding-top: 0; }
.pa-then { margin: 0; font-size: .95rem; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pa-then .plan-then { display: inline; }
.pa-step .plan-free {   /* the free first year, as a green ribbon */
  display: inline-block; margin: 0; padding: 3px 14px 3px 10px; font-size: .85rem; line-height: 1.4; color: #fff; background: var(--cta);
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%);
}

/* ---------- support and storage ---------- */
.pa-facts { display: grid; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.pa-fact .plan-support { align-self: center; margin: 0; }
.pa-storage .plan-sub { margin: 0 0 2px; }
.pa-storage .plan-storage li { padding: 2px 0; border: 0; }
.pa-storage .plan-note { margin-top: 4px; }
.pa-drive .fillbar { transform-box: fill-box; transform-origin: left center; transform: scaleX(var(--fill, 1)); }
.pa-drive.pa-nofill .fillbar { display: none; }

/* ---------- the features: a grid of pictures. Included = in colour with a tick; new over the card before = ringed with a plus; not included = pale with a cross ---------- */
.pa-feats { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.pa-plus { margin: 0 0 12px; font-size: .88rem; font-weight: 600; color: var(--cta-hover); }
.pa-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 4px; margin: 0; padding: 0; list-style: none; }
.pa-tile { position: relative; min-width: 0; }
.pa-face { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; gap: 5px; text-align: center; }   /* the one column is as wide as the tile, so a long unbroken word of a name the table does not know wraps inside the tile instead of pushing the column wider */
.pa-ic { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; }
.pa-tile.is-new .pa-ic { background: rgba(16, 185, 129, .22); box-shadow: 0 0 0 1.5px var(--cta); }
.pa-tile.is-off .art-icon { opacity: .38; }
.pa-label { max-width: 100%; font-size: .7rem; line-height: 1.25; letter-spacing: -.01em; color: var(--text); overflow-wrap: break-word; }
.pa-tile.is-off .pa-label { color: var(--muted); }
.pa-mark { position: absolute; top: -4px; right: -4px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--cta); color: #fff; }
.pa-mark svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pa-tile.is-off .pa-mark { background: #fff; color: var(--muted); box-shadow: 0 0 0 1px var(--line-2); }

/* ---------- "All features": the platform's own words, in a disclosure that needs no script ---------- */
.pa-all { margin-top: 14px; border-top: 1px solid var(--border); }
.pa-all summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-size: .93rem; font-weight: 600; color: var(--ink); cursor: pointer; list-style: none; }
.pa-all summary::-webkit-details-marker { display: none; }
.pa-all summary::after {
  content: ''; flex: none; width: 8px; height: 8px; margin-right: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg); transition: transform var(--dur-fast) var(--ease-out);
}
.pa-all[open] summary::after { transform: translateY(2px) rotate(225deg); }
.pa-all .plan-features { margin: 0 0 6px; }
.pa-dressed .plan-cta { padding-top: 18px; }
@media (max-width: 520px) { .plan-card.pa-dressed { padding-inline: 20px; } }   /* a little more room for four pictures across */

/* ---------- the swipe row (ART_PLANS_RAIL, off by default): on a phone the plans of a way sit in a row, the next card showing at the edge ---------- */
@media (max-width: 760px) {
  [data-art-rail] .plan-grid {
    display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gut);
    margin-inline: calc(var(--gut) * -1); padding: 20px var(--gut) 24px; scrollbar-width: thin;
  }
  [data-art-rail] .plan-card { flex: 0 0 min(84%, 340px); scroll-snap-align: start; }
}

/* ---------- movement ---------- */
@keyframes pa-pop { from { opacity: 0; transform: scale(calc(1 - var(--move) * .4)); } }
@keyframes pa-line-y { from { transform: scaleY(0); } }
@keyframes pa-line-x { from { transform: scaleX(0); } }
@keyframes pa-fill { from { transform: scaleX(0); } }
@keyframes pa-ribbon { from { opacity: 0; translate: calc(var(--move) * -10px) 0; } }
@keyframes pa-hop { 40% { transform: translateY(-4px) scale(1.06); } }

@media (prefers-reduced-motion: no-preference) {
  .pa-money .pa-step:nth-child(2), .pa-explain .pa-ex:nth-of-type(2) { --s: 1; }
  .pa-money .pa-step:nth-child(3), .pa-explain .pa-ex:nth-of-type(3) { --s: 2; }
  /* the cards of a row start one after another (script.js sets --i on the cards that arrive together), and inside a card the blocks follow each other:
     the money lines, then support and storage, then the features, so only a few things move in the same moment */
  .pa-dressed { --o: calc(var(--i, 0) * 260ms * var(--k)); }

  /* the three money steps arrive one after another; the dotted line grows down behind them */
  .pa-money.pa-seen .pa-step-ic { animation: pa-pop calc(260ms * var(--k)) var(--spring-snap) calc(var(--o, 0ms) + var(--s, 0) * 130ms * var(--k)) backwards; }
  .pa-money-own.pa-seen .pa-step:not(:last-child)::after { animation: pa-line-y calc(300ms * var(--k)) var(--ease-out) calc(var(--o, 0ms) + (var(--s, 0) * 130ms + 100ms) * var(--k)) backwards; }
  .pa-money.pa-seen .plan-free { animation: pa-ribbon calc(340ms * var(--k)) var(--spring-snap) calc(var(--o, 0ms) + 420ms * var(--k)) backwards; }

  /* the picture of a way of buying, one step at a time */
  .pa-explain.pa-seen .pa-ex-ic { animation: pa-pop calc(260ms * var(--k)) var(--spring-snap) calc(var(--s, 0) * 200ms * var(--k)) backwards; }
  .pa-explain.pa-seen .pa-arrow { animation: pa-line-x calc(240ms * var(--k)) var(--ease-out) calc(100ms * var(--k)) backwards; }
  .pa-explain.pa-seen .pa-arrow ~ .pa-arrow { animation-delay: calc(300ms * var(--k)); }

  /* support and storage: the drive fills to the plan's own size */
  .pa-facts.pa-seen .pa-step-ic { animation: pa-pop calc(260ms * var(--k)) var(--spring-snap) calc(var(--o, 0ms) + 260ms * var(--k)) backwards; }
  .pa-facts.pa-seen .pa-fact:nth-child(2) .pa-step-ic { animation-delay: calc(var(--o, 0ms) + 380ms * var(--k)); }
  .pa-facts.pa-seen .pa-drive .fillbar { animation: pa-fill calc(600ms * var(--k)) var(--ease-out) calc(var(--o, 0ms) + 440ms * var(--k)) backwards; }

  /* the features: the included ones settle in, one by one (what is new over the card before is ringed, and settles in the same way) */
  .pa-feats.pa-seen .pa-tile.is-on .pa-face { animation: pa-pop calc(220ms * var(--k)) var(--spring-snap) calc(var(--o, 0ms) + 500ms * var(--k) + var(--t, 0) * 80ms * var(--k)) backwards; }
}

/* hover replays one icon (a touch screen has no hover; the picture is complete anyway) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .pa-tile.is-on:hover .art-icon, .pa-step:hover .art-icon, .pa-ex:hover .art-icon { animation: pa-hop calc(420ms * var(--k)) var(--spring-snap); }
}

@media (forced-colors: active) {
  .pa-mark, .pa-tile.is-new .pa-ic { forced-color-adjust: none; }
}
