/* Platforms: the deployment board (js/sections/platforms.js). One tile per platform, status as
   shape + word + colour; a live controller check under it. Wide: one row. Medium: 3 + 2. Narrow: rows. */

.platforms__board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }

.plat {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 228px;
  padding: 24px 22px 20px;
  background: linear-gradient(180deg, rgba(23, 27, 32, 0.92), rgba(10, 12, 14, 0.92));
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
/* Hairline + the top spine: solid amber at launch, dashed amber next, none planned. The hairline is a
   1px frame cut out of a filled box, so it runs along the cut corners too (a box-shadow stops at them). */
.plat::before, .padchip::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; background-color: var(--line-2);
  clip-path: polygon(evenodd, 0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 0,
    1px 1px, 1px calc(100% - var(--cut) - 0.414px), calc(var(--cut) + 0.414px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px),
    calc(100% - 1px) calc(var(--cut) + 0.414px), calc(100% - var(--cut) - 0.414px) 1px, 1px 1px);
}
.plat::after { content: ''; position: absolute; left: 0; right: var(--cut); top: 0; height: 3px; }
.plat--launch::after { background: var(--amber); box-shadow: 0 0 14px var(--amber-glow); }
.plat--next::after { background: linear-gradient(90deg, var(--amber) 55%, transparent 0) 0 0 / 12px 3px repeat-x; }

.plat__icon { display: block; color: var(--bone-2); margin-bottom: auto; }
.plat__icon svg { width: 58px; height: 58px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.plat__icon path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .plat:not(.is-in) .plat__icon path { stroke-dashoffset: 1; }
.js .plat.is-in .plat__icon path { transition: stroke-dashoffset 1.3s var(--ease-out) calc(200ms + var(--i, 0) * 90ms), fill var(--d-slow) ease; }
.plat__icon .scr { fill: transparent; }
/* launch screens power on as the board comes up; the others stay dark */
.plat--launch.is-in .scr { fill: rgba(255, 177, 46, 0.1); transition-delay: calc(900ms + var(--i, 0) * 90ms); }
.plat:hover .scr { fill: rgba(255, 177, 46, 0.2); transition-delay: 0s; }
.plat--planned .plat__icon { color: var(--bone-3); }

.plat__name { margin-top: 26px; font-family: var(--f-display); font-weight: 800; font-size: var(--t-h3); line-height: 1; letter-spacing: 0.02em; text-transform: uppercase; color: var(--bone); }
.plat--planned .plat__name { color: var(--bone-2); }
.plat__via { margin-top: 6px; font-size: var(--t-small); color: var(--bone-3); }
.plat__status {
  display: flex; align-items: center; gap: 10px; align-self: stretch;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-weight: 500; font-size: 0.95rem; color: var(--bone);
}
.plat--next .plat__status { color: var(--amber); }
.plat--planned .plat__status { color: var(--bone-3); }

/* ---------- lights (also the controller chip's) ---------- */
.plat-light { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; }
.plat-light svg { width: 16px; height: 16px; overflow: visible; }
.plat-light--launch circle { fill: var(--amber); filter: drop-shadow(0 0 4px var(--amber-glow)); }
.plat-light--next circle { fill: none; stroke: var(--amber); stroke-width: 2; }
.plat-light--planned circle { fill: none; stroke: var(--bone-3); stroke-width: 1.5; stroke-dasharray: 2.4 2.1; }
.plat-light::after { content: ''; position: absolute; inset: 1px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--amber); opacity: 0; }
.platforms__board.is-on .plat-light--next::after { animation: plat-ping 2.2s var(--ease-out) infinite; }
@keyframes plat-ping { 0% { opacity: 0.85; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(2.6); } }
/* the board boots: lights flicker on in turn */
.js .plat.is-in .plat-light svg { animation: plat-boot 700ms steps(1) both; animation-delay: calc(500ms + var(--i, 0) * 110ms); }
@keyframes plat-boot { 0% { opacity: 0; } 20% { opacity: 1; } 35% { opacity: 0.2; } 50% { opacity: 1; } 62% { opacity: 0.4; } 75%, 100% { opacity: 1; } }

/* ---------- the controller check ---------- */
.platforms__pad {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px;
  margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line);
}
.platforms__padline { font-size: var(--t-lead); color: var(--bone-2); }
.padchip {
  --cut: 8px;
  position: relative; display: inline-flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 10px 8px 18px;
  background: rgba(236, 230, 217, 0.04);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  transition: background var(--d-med) ease;
}
.padchip::before { transition: background-color var(--d-med) ease; }
.padchip.is-live { background: var(--amber-wash); }
.padchip.is-live::before { background-color: rgba(255, 177, 46, 0.4); }
.padchip.is-live .plat-light::after { animation: plat-ping 1.1s var(--ease-out) 2; }
.padchip__text { font-weight: 500; font-size: 0.95rem; color: var(--bone-2); }
.padchip.is-live .padchip__text { color: var(--bone); }

/* A B X Y in their diamond, like the pad: outline at rest, amber while held */
.padchip__face { position: relative; width: 56px; height: 56px; flex: none; }
.padchip__face i {
  position: absolute; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font-family: var(--f-display); font-weight: 700; font-style: normal; font-size: 11px; line-height: 1;
  color: var(--bone-3); box-shadow: inset 0 0 0 1.5px var(--bone-4);
  transition: background var(--d-med) ease, color var(--d-med) ease, box-shadow var(--d-med) ease;
}
.padchip__face .pad-y { left: 18px; top: 0; }
.padchip__face .pad-x { left: 0; top: 18px; }
.padchip__face .pad-b { left: 36px; top: 18px; }
.padchip__face .pad-a { left: 18px; top: 36px; }
.padchip.is-live .padchip__face i { color: var(--bone); box-shadow: inset 0 0 0 1.5px var(--bone-3); }
.padchip.is-live .padchip__face .pad-a { background: var(--bone); color: var(--bg-0); box-shadow: none; }
.padchip__face i.is-down, .padchip.is-live .padchip__face i.is-down {
  background: var(--amber); color: var(--amber-ink); box-shadow: 0 0 14px var(--amber-glow); transition-duration: 40ms;
}
.padchip__face i.is-hit { animation: plat-pop 260ms var(--ease-out); }
@keyframes plat-pop { 0% { transform: scale(1.35); } 100% { transform: none; } }

/* ---------- medium: 3 + 2 ---------- */
@media (min-width: 641px) and (max-width: 1080px) {
  .platforms__board { grid-auto-flow: row; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .plat { grid-column: span 2; min-height: 214px; }
  .plat:nth-last-child(2):nth-child(3n + 1), .plat:nth-last-child(1):nth-child(3n + 2) { grid-column: span 3; }
  .plat:nth-last-child(1):nth-child(3n + 1) { grid-column: span 6; }
}

/* ---------- narrow: one row per platform ---------- */
@media (max-width: 640px) {
  .platforms__board { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .plat {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 14px; row-gap: 2px; align-items: center;
    min-height: 0; padding: 14px 16px 14px 14px;
  }
  .plat::after { right: auto; top: 0; bottom: 0; width: 3px; height: auto; left: 0; }
  .plat--next::after { background: linear-gradient(180deg, var(--amber) 55%, transparent 0) 0 0 / 3px 10px repeat-y; }
  .plat__icon { grid-row: 1 / 3; margin: 0; }
  .plat__icon svg { width: 40px; height: 40px; }
  .plat__name { grid-column: 2; margin: 0; font-size: 1.3rem; }
  .plat__via { grid-column: 2; margin: 0; }
  .plat__status { grid-column: 3; grid-row: 1 / 3; margin: 0; padding: 0; border: 0; gap: 8px; font-size: 0.875rem; }
  .platforms__pad { flex-direction: column; align-items: stretch; }
  .platforms__padline { font-size: 1.05rem; }
  .padchip { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .platforms__board.is-on .plat-light--next::after, .padchip.is-live .plat-light::after,
  .js .plat.is-in .plat-light svg, .padchip__face i.is-hit { animation: none; }
}
:root[data-motion='off'] :is(.platforms__board.is-on .plat-light--next, .padchip.is-live .plat-light)::after,
:root.js[data-motion='off'] .plat.is-in .plat-light svg, :root[data-motion='off'] .padchip__face i.is-hit { animation: none; }
