/* Phone geometry corrections for the actual Terminal route (altdata.html). */
@media (max-width: 680px) {
  html, body.terminal-product-page { width: 100%; max-width: 100%; overflow-x: clip; }
  body.terminal-product-page main { width: 100%; max-width: 100%; overflow-x: clip !important; }
  body.terminal-product-page main *,
  body.terminal-product-page main *::before,
  body.terminal-product-page main *::after { box-sizing: border-box; min-width: 0; }

  body.terminal-product-page :is(
    .terminal-engine-story,
    .terminal-overview,
    .terminal-api-story,
    .provenance-section,
    .terminal-why,
    .terminal-video-story,
    .terminal-resources,
    #faq
  ) { width: 100% !important; max-width: 100% !important; overflow-x: clip; }

  body.terminal-product-page :is(
    .terminal-engine-story__grid,
    .terminal-overview__grid,
    .terminal-api-story__product,
    .provenance-section > .container,
    .terminal-why__grid,
    .terminal-video-story__frame,
    .terminal-resources__grid
  ) { width: calc(100% - 28px) !important; max-width: 100% !important; margin-inline: auto !important; }

  body.terminal-product-page .terminal-engine-story { padding-inline: 0 !important; }
  body.terminal-product-page .terminal-engine-story__head { width: calc(100% - 28px); margin-inline: auto; }
  body.terminal-product-page .terminal-engine-story__grid { grid-template-columns: minmax(0, 1fr) !important; gap: 44px; }
  body.terminal-product-page .terminal-engine-story__points { width: 100%; gap: 34px; }
  body.terminal-product-page .terminal-engine-story__points article { grid-template-columns: 30px minmax(0, 1fr); gap: 14px; }
  body.terminal-product-page .terminal-engine-story__points :is(h3, p) { max-width: 100%; overflow-wrap: break-word; }
  body.terminal-product-page .terminal-engine-diagram {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1.08;
    overflow: hidden !important;
  }
  body.terminal-product-page .terminal-engine-node {
    width: 96px !important;
    min-height: 92px !important;
    padding: 10px 7px !important;
    border-radius: 14px;
  }
  body.terminal-product-page .terminal-engine-node > span { width: 36px; height: 36px; }
  body.terminal-product-page .terminal-engine-node strong { font-size: 16px; }
  body.terminal-product-page .terminal-engine-node--left { left: 3% !important; }
  body.terminal-product-page .terminal-engine-node--right { right: 3% !important; }

  body.terminal-product-page .signal-layers { width: 100%; max-width: 100%; overflow: hidden; }
  body.terminal-product-page .signal-layers__shell { width: calc(100% - 28px) !important; max-width: 100%; }
  body.terminal-product-page .signal-layers__head,
  body.terminal-product-page .signal-layers__body { grid-template-columns: minmax(0, 1fr) !important; }
  body.terminal-product-page .signal-layers__head h2 {
    max-width: 9ch;
    font-size: clamp(37px, 11vw, 48px) !important;
    overflow-wrap: normal;
  }
  body.terminal-product-page .signal-layer-item,
  body.terminal-product-page .signal-layer-item__trigger,
  body.terminal-product-page .signal-layer-item__panel { width: 100%; max-width: 100%; }
  body.terminal-product-page .signal-layer-item__trigger {
    grid-template-columns: 24px minmax(0, 1fr) 18px;
    gap: 10px;
  }
  body.terminal-product-page .signal-layer-item__trigger strong,
  body.terminal-product-page .signal-layer-item__panel p { white-space: normal; overflow-wrap: break-word; }
  body.terminal-product-page .signal-layer-item__panel p { padding-right: 0; }
  body.terminal-product-page .signal-layer-item__cards {
    width: calc(100% - 36px);
    max-width: calc(100% - 36px);
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
  }
  body.terminal-product-page .signal-layer-item__cards span { flex: 1 1 120px; }
  body.terminal-product-page .signal-layers__visual {
    width: min(100%, 340px) !important;
    height: auto !important;
    aspect-ratio: 392 / 552;
    margin: 0 auto !important;
    transform: none !important;
    overflow: hidden;
  }
  body.terminal-product-page .signal-layers__diagram {
    width: 100% !important;
    height: 100% !important;
    overflow: visible;
  }

  body.terminal-product-page .terminal-resources__grid figure { width: 100%; }
  body.terminal-product-page .terminal-resources__grid img {
    width: 100%;
    height: auto;
    aspect-ratio: 1.55;
    object-fit: contain;
  }
}

@media (max-width: 360px) {
  body.terminal-product-page .terminal-engine-node { width: 88px !important; min-height: 86px !important; }
  body.terminal-product-page .terminal-engine-node strong { font-size: 15px; }
  body.terminal-product-page .signal-layers__shell { width: calc(100% - 20px) !important; }
}
