/* ===========================================================================
   Mobile and tablet fixes for the homepage platform section
   (<section id="platform">: .eng-head + the layered diagram .lay).
   Load AFTER the design-system stylesheets. Media-query rules only; every
   selector is scoped to #platform; logical properties so it holds in RTL.
   Desktop (above 1100px) is untouched.
   =========================================================================== */

/* ---- Touch tablets and below: tap target for the one small text link ---- */
@media (max-width:1100px){
  #platform .lay__flows a{min-height:44px;margin-block:-10px;padding-inline-end:12px}
}

/* ---- Tablet and phone: the diagram is stacked (base CSS collapses at 1000) ---- */
@media (max-width:1000px){
  /* body copy never under 15px */
  #platform .lay__tx-h,
  #platform .lay__ai-h,
  #platform .lay__what,
  #platform .lay__ai-cells span,
  #platform .lay__spend-tx span,
  #platform .lay__spend-agent,
  #platform .lay__flows{font-size:15px}
  #platform .lay__spend-agent b{font-size:15px}
  #platform .lay strong small{font-size:13px;max-width:none}

  /* keep the drawing connected: bring back short wires between the bands
     and the Teradix block (base CSS hides them and leaves loose gaps) */
  #platform .lay__band{margin-block:0}
  #platform .lay__wires{display:flex;justify-content:space-around;height:40px;padding-inline:var(--pad)}
  #platform .lay__wire:nth-child(n+4){display:none}

  /* supplier / ERP flows read as one wrapped row under the band title */
  #platform .lay__flows{flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px 26px}

  /* five products in two columns: the fifth fills its row, no orphan hole */
  #platform .lay__prod:last-child{grid-column:1 / -1}

  /* price negotiation agent: the +8% stat sits under the copy, in one line,
     so the copy is not squeezed into a 140px column */
  #platform .lay__ai-wide{grid-template-columns:minmax(0,1fr)!important}
  #platform .lay__ai-wide strong{grid-column:1;grid-row:auto;align-self:start;margin-top:6px}
  #platform .lay__ai strong,
  #platform .lay__spend strong{flex-direction:row;align-items:baseline;flex-wrap:wrap;gap:4px 12px}

  /* spend analytics: icon, copy, stat in one row (the stat used to drop
     into the icon column and stretch it) */
  #platform .lay__spend{grid-template-columns:auto minmax(0,1fr) auto}
  #platform .lay__spend strong{flex-direction:column;gap:6px}
  #platform .lay__spend strong small{max-width:18ch}
}

/* ---- Tablet only: the bands still have room for the desktop three-part row ---- */
@media (min-width:641px) and (max-width:1000px){
  #platform .lay__band{grid-template-columns:auto minmax(0,1fr) auto}
  #platform .lay__flows{grid-column:auto;flex-direction:column;align-items:flex-start;gap:10px}
}

/* ---- Phone ---- */
@media (max-width:560px){
  #platform .lay{--g:10px;--pad:14px}
  #platform .lay__wire:nth-child(n+3){display:none}
  #platform .lay__wires{height:40px}

  /* bands: smaller drawing, flows back to a readable list */
  #platform .lay__band{gap:12px 14px;padding-block:16px}
  #platform .lay__art{width:84px}
  #platform .lay__flows{flex-direction:column;align-items:flex-start;gap:10px}
  #platform .lay__tx-h{gap:6px}

  /* product cards: icon beside the text, a third shorter than the stacked card */
  #platform .lay__prod:last-child{grid-column:auto}
  #platform .lay__prod a{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:14px;row-gap:5px;align-items:start;
    padding-block:16px 18px;padding-inline:14px 40px}
  #platform .lay__prod .ico3{grid-column:1;grid-row:1 / span 3;width:52px;align-self:center}
  #platform .lay__prod .lay__no{grid-column:2;grid-row:1}
  #platform .lay__prod b{grid-column:2;grid-row:2;font-size:18px}
  #platform .lay__prod .lay__what{grid-column:2;grid-row:3}

  /* agent cells: same icon-beside-text rhythm */
  #platform .lay__ai-cells li,
  #platform .lay__ai-cells .lay__ai-wide{display:grid!important;grid-template-columns:40px minmax(0,1fr)!important;column-gap:14px;row-gap:6px;align-content:start;padding:16px 14px}
  #platform .lay__ai-cells .ico3--agent{grid-column:1;grid-row:1 / span 2}
  #platform .lay__ai-cells b{grid-column:2;grid-row:1;align-self:center;font-size:17px}
  #platform .lay__ai-cells span{grid-column:2;grid-row:2;max-width:none}
  #platform .lay__ai-wide strong{grid-column:2;grid-row:3;margin-top:4px;font-size:30px}

  /* spend analytics: copy on top, stat on its own line under a rule */
  #platform .lay__spend{grid-template-columns:auto minmax(0,1fr);gap:14px;padding-inline-end:40px}
  #platform .lay__spend>.ico3{width:52px;align-self:start}
  #platform .lay__spend strong{grid-column:1 / -1;flex-direction:row;align-items:baseline;gap:4px 12px;
    padding-top:12px;border-top:1px solid rgba(255,255,255,.22);font-size:30px}
  #platform .lay__spend strong small{max-width:none}
  #platform .lay__spend .lay__go{top:26px;margin-top:0}

  #platform .flow__note{line-height:1.6;text-align:start}
}
