/* IP WHOIS Lookup (/tools/ip-whois/) */
.iw-page {
  --iw-iana: var(--txt-3);
  --iw-rir: var(--primary-ink);
  --iw-parent: var(--rtype-cname-fg);
  --iw-network: var(--rtype-a-fg);
  --iw-address: var(--rtype-mx-fg);
}

.iw-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: end; }
.iw-field label { display: block; font-weight: 600; margin-bottom: 8px; }
.iw-field input { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--txt); font-family: var(--font-mono); font-size: var(--text-body); }
.iw-field input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.iw-form .btn-primary:disabled { opacity: .65; cursor: wait; }
.iw-help { margin: 12px 0 0; color: var(--txt-3); font-size: var(--text-small); line-height: 1.6; }
.iw-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.iw-samples-label { color: var(--txt-3); font-size: var(--text-small); }
.iw-sample { font-family: var(--font-mono); font-size: var(--text-compact); }
.iw-sample small { margin-left: 4px; font-family: var(--font-sans); color: var(--txt-3); }

.iw-message { margin: 20px 0 0; color: var(--txt-2); }
.iw-message:empty { display: none; }
.iw-message--error { padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--red) 45%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--badge-err-bg) 60%, var(--surface)); color: color-mix(in srgb, var(--red) 85%, var(--txt)); }

.iw-results { display: grid; gap: 32px; margin-top: 24px; }
.iw-results[hidden] { display: none; }
.iw-section h2 { margin: 0 0 8px; font-size: 1.35rem; }
.iw-lede { margin: 0 0 16px; color: var(--txt-3); line-height: 1.65; max-width: 760px; }
.iw-lede a, .iw-verdict a, .iw-contact a { color: var(--primary-ink); overflow-wrap: anywhere; }
.iw-mono { font-family: var(--font-mono); font-size: var(--text-compact); overflow-wrap: anywhere; }
.iw-dim { color: var(--txt-3); }

/* Summary */
.iw-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.iw-summary--single { grid-template-columns: minmax(0, 1fr); }
.iw-verdict { padding: 24px; border: 1px solid color-mix(in srgb, var(--iw-network) 40%, var(--border)); border-radius: var(--radius-card); background: color-mix(in srgb, var(--rtype-a-bg) 55%, var(--surface)); }
.iw-verdict--special { border-color: var(--border); background: var(--surface); }
.iw-eyebrow { margin: 0 0 4px; font-size: var(--text-caption); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--txt-3); overflow-wrap: anywhere; }
.iw-verdict-title { margin: 0 0 10px; font-size: 1.5rem; line-height: 1.3; overflow-wrap: anywhere; }
.iw-verdict-title:focus { outline: none; }
.iw-verdict-lead { margin: 0; color: var(--txt-2); line-height: 1.6; overflow-wrap: anywhere; }
.iw-verdict p + p { margin-top: 12px; }
.iw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; padding: 0; list-style: none; }
.iw-chip { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--txt-2); font-size: var(--text-caption); font-weight: 700; }
.iw-chip--rir { border-color: color-mix(in srgb, var(--iw-rir) 40%, var(--border)); color: var(--iw-rir); }
.iw-abuse { margin: 16px 0 0; }
.iw-facts { margin: 0; padding: 8px 24px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.iw-fact { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.iw-fact:first-child { border-top: 0; }
.iw-fact dt { color: var(--txt-3); font-size: var(--text-small); }
.iw-fact dd { margin: 0; overflow-wrap: anywhere; font-size: var(--text-small); }

/* Allocation path */
.iw-path { position: relative; margin: 0; padding: 20px; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface2); }
.iw-step { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 14px; }
.iw-step + .iw-step { margin-top: 12px; }
.iw-step:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: -14px; width: 2px; background: var(--border); }
.iw-step-marker { position: relative; z-index: 1; width: 14px; height: 14px; margin: 18px 0 0 3px; border: 3px solid var(--iw-step, var(--txt-3)); border-radius: 50%; background: var(--surface); }
.iw-step-body { min-width: 0; padding: 14px 16px; border: 1px solid var(--border); border-left: 4px solid var(--iw-step, var(--txt-3)); border-radius: 10px; background: var(--surface); }
.iw-step--iana { --iw-step: var(--iw-iana); }
.iw-step--transfer { --iw-step: var(--amber); }
.iw-step--parent { --iw-step: var(--iw-parent); }
.iw-step--network { --iw-step: var(--iw-network); }
.iw-step--network .iw-step-body { background: color-mix(in srgb, var(--rtype-a-bg) 45%, var(--surface)); }
.iw-step--address { --iw-step: var(--iw-address); }
.iw-step-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.iw-step-tag { padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--iw-step) 14%, var(--surface)); color: color-mix(in srgb, var(--iw-step) 85%, var(--txt)); font-size: var(--text-caption); font-weight: 800; letter-spacing: .03em; }
.iw-step-title { overflow-wrap: anywhere; }
.iw-step-handle { color: var(--txt-3); font-family: var(--font-mono); font-size: var(--text-caption); overflow-wrap: anywhere; }
.iw-step-range { margin: 6px 0 0; font-family: var(--font-mono); font-size: var(--text-compact); color: var(--txt-2); overflow-wrap: anywhere; }
.iw-step-note { margin: 6px 0 0; color: var(--txt-3); font-size: var(--text-small); line-height: 1.55; }
.iw-bar { position: relative; height: 14px; margin-top: 12px; border-radius: 4px; background: color-mix(in srgb, var(--iw-step) 16%, var(--surface2)); overflow: hidden; }
.iw-bar-fill { position: absolute; top: 0; bottom: 0; min-width: 3px; border-radius: 3px; background: var(--txt-3); }
.iw-bar-fill--parent { background: var(--iw-parent); }
.iw-bar-fill--network { background: var(--iw-network); }
.iw-bar-fill--address { background: var(--iw-address); }
.iw-bar-caption { display: flex; justify-content: space-between; gap: 8px; margin: 4px 0 0; color: var(--txt-3); font-size: var(--text-caption); }
.iw-bar-caption > span:nth-child(2) { text-align: center; }
.iw-bar-caption .iw-mono { font-size: var(--text-caption); }

/* Contacts */
.iw-contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.iw-contact { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); font-size: var(--text-small); line-height: 1.5; min-width: 0; }
.iw-contact--abuse { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
.iw-contact p { margin: 4px 0 0; overflow-wrap: anywhere; }
.iw-contact-roles { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px !important; }
.iw-role { padding: 1px 8px; border-radius: 999px; background: var(--surface2); color: var(--txt-2); font-size: var(--text-caption); font-weight: 700; }
.iw-contact--abuse .iw-role:first-child { background: color-mix(in srgb, var(--amber) 16%, var(--surface)); color: color-mix(in srgb, var(--amber) 80%, var(--txt)); }
.iw-contact-name { margin: 0; font-size: var(--text-body); overflow-wrap: anywhere; }

/* Record */
.iw-details { margin-top: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.iw-details summary { cursor: pointer; font-weight: 600; color: var(--txt-2); }
.iw-details summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.iw-remark-title { margin: 14px 0 4px; font-size: var(--text-small); }
.iw-pre { max-height: 420px; margin: 10px 0 0; padding: 12px; overflow: auto; border-radius: 8px; background: var(--surface2); color: var(--txt-2); font-family: var(--font-mono); font-size: var(--text-caption); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .iw-summary { grid-template-columns: minmax(0, 1fr); }
  .iw-form { grid-template-columns: minmax(0, 1fr); }
  .iw-path { padding: 14px 12px; }
  .iw-step { grid-template-columns: 16px minmax(0, 1fr); gap: 8px; }
  .iw-step-marker { width: 12px; height: 12px; margin-left: 0; border-width: 2px; }
  .iw-step:not(:last-child)::before { left: 7px; }
  .iw-fact { grid-template-columns: 110px minmax(0, 1fr); }
  .iw-facts { padding: 6px 16px; }
  .iw-bar-caption .iw-mono { display: none; }
  .iw-bar-caption { justify-content: center; }
}
.iw-results + .tools-intro { margin-top: 32px; }
