/* Public label/value results only; genuine tables and independent layouts retain their owners. */
body .twoip-service {
  --twoip-service-result-label-cap: 22%;
  --twoip-service-result-item-min: 24ch;
  --twoip-service-result-column-gap: var(--twoip-service-form-control-gap);
}
body .twoip-service :is(.twoip-service-results--default,.twoip-service-results--wide-label) {
  --twoip-results-columns: fit-content(var(--twoip-service-result-label-cap)) minmax(0,1fr);
}
/* Technical collections adapt to their allocated value column, not viewport breakpoints.
 * Measurement name/value grids retain their separate layout contract. */
body .twoip-service .twoip-service-collection > .twoip-service-collection__grid:not(.twoip-service-collection__grid--measurements) {
  grid-template-columns: repeat(auto-fit,minmax(min(100%,var(--twoip-service-result-item-min)),1fr));
}
/* IPv4/CIDR uses the shared collection's four desktop tracks. The longest
 * IPv4 prefix is 18 characters; tablet/mobile retain width-driven tracks. */
body .twoip-service .twoip-service-collection__grid:has(> .twoip-service-collection__item--ipv4):not(:has(> li:not(.twoip-service-collection__item--ipv4))) {
  --twoip-service-result-item-min: 18ch;
}
@media (min-width:1024px) {
  body .twoip-service .twoip-service-collection__grid:has(> .twoip-service-collection__item--ipv4):not(:has(> li:not(.twoip-service-collection__item--ipv4))) {
    grid-template-columns: repeat(4,minmax(0,1fr));
  }
}
/* IPv6 reserves the longest supplied prefix, capped at the shared device
 * track count. One very narrow track retains the existing emergency wrap. */
body .twoip-service .twoip-service-collection > .twoip-service-collection__grid.twoip-service-collection__grid--ipv6 {
  --twoip-service-result-tracks: 2;
  grid-template-columns: repeat(auto-fill,minmax(max(min(100%,var(--twoip-service-result-item-min)),calc((100% - (var(--twoip-service-result-tracks) - 1) * var(--twoip-service-form-control-gap)) / var(--twoip-service-result-tracks))),1fr));
}
@media (min-width:768px) {
  body .twoip-service .twoip-service-collection > .twoip-service-collection__grid.twoip-service-collection__grid--ipv6 { --twoip-service-result-tracks: 3; }
}
@media (min-width:1024px) {
  body .twoip-service .twoip-service-collection > .twoip-service-collection__grid.twoip-service-collection__grid--ipv6 { --twoip-service-result-tracks: 4; }
}
/* Share the intrinsic label track across each semantic property set, so values
 * align between rows. Unmarked tables and mixed comparison structures are excluded. */
@supports (grid-template-columns: subgrid) {
  @media (min-width:768px) {
    body .twoip-service .twoip-service-results > dl:has(> .twoip-result-row),
    body .twoip-service .twoip-result-list.twoip-service-results:has(> .twoip-result-row) {
      display: grid; grid-template-columns: var(--twoip-results-columns);
      column-gap: var(--twoip-service-result-column-gap); row-gap: 0;
    }
    body .twoip-service .twoip-service-results > dl > .twoip-result-row,
    body .twoip-service .twoip-result-list.twoip-service-results > .twoip-result-row {
      grid-column: 1 / -1; grid-template-columns: subgrid;
    }
  }
}

/* One result may contain several Details/ResultList property sets (e.g. IP
 * metadata followed by WHOIS). Reuse the existing compact cap for every set;
 * keep normal block flow so section margins and row heights stay unchanged. */
@media (min-width:768px) {
  body .twoip-service .twoip-service-results:has(> :is(.twoip-service-details,.twoip-result-list) ~ :is(.twoip-service-details,.twoip-result-list)) > :is(.twoip-service-details,.twoip-result-list) {
    --twoip-results-columns: minmax(0,var(--twoip-service-result-label-cap)) minmax(0,1fr);
  }
}

/* Atomic IPv4/CIDR leaves must never inherit the prose emergency-wrap rule.
 * Responsive tracks reserve the longest 18-character IPv4/prefix. */
body .twoip-service .twoip-service-collection__grid > .twoip-service-collection__item--ipv4,
body .twoip-service .twoip-service-collection__item--ipv4 .twoip-inline-label {
  white-space: nowrap; overflow-wrap: normal; word-break: normal;
}

/* Source identity + outcome needs room for resolver geography or protocol names.
 * Only explicit specialized producers opt in; ordinary Details keep their cap. */
body .twoip-service .twoip-service-results--source-label {
  --twoip-service-result-label-cap: 40%;
}
/* DNS records are full technical values, not compact status captions. Long TXT
 * and IPv6 answers wrap within the specialized outcome track without clipping. */
body .twoip-service .twoip-service-results--source-label [data-twoip-record-value],
body .twoip-service .twoip-service-results--source-label [data-twoip-record-value] .twoip-inline-label {
  white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
}

/* Property gaps follow the real service column, independently of form/list gaps.
 * Vertical metrics and the approved intrinsic label proportions stay unchanged. */
@media (min-width:768px) {
  body .twoip-service :is(.twoip-service-results--default,.twoip-service-results--wide-label) .twoip-result-row {
    column-gap: var(--twoip-service-result-column-gap);
  }
}
/* Responsive separation is measured against the allocated service column,
 * not viewport width. Reuse the 16px control token; cap at three token steps. */
@container twoip-service (min-width:0px) {
  :is(.twoip-service-results,.twoip-service-results--source-label) {
    --twoip-service-result-column-gap: clamp(var(--twoip-service-form-control-gap),4cqi,calc(var(--twoip-service-form-control-gap) * 3));
  }
}
