/*
 * IP Lookup: widget styles (Nitro Sites tools hub).
 *
 * Reads the live nitrosites design tokens (brand yellow, dark surface, fonts)
 * with literal fallbacks so the standalone dev harness looks right too. Visual
 * language deliberately echoes the /network/ globe tooltip.
 *
 * Author: Rick Moore
 */
/* Flag web font (Twemoji Country Flags, ~78 KB). Windows/Chrome has no flag glyphs
 * in its emoji font, so regional-indicator flag emoji fall back to the two country
 * letters (e.g. "AU"). Applying this font to the flag spans makes real flags render
 * on every platform. */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url("./flags.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+1F1E6-1F1FF; /* regional indicator symbols only */
}
/* ── Host shell intro ────────────────────────────────────────────────────────
 * The nitrosites /tools/<slug>/ shell renders the tool's MDX description in a
 * .tool-intro block ABOVE the mount point. This is an immersive globe tool, so we
 * lead with the globe: hide that prose wall and tighten the page top. (app.css
 * loads ONLY on this tool's page, so this overrides nothing elsewhere.) The SEO
 * copy still lives in the page <title>/meta/description + SoftwareApplication
 * schema, and the hub card. */
.tool-page {
  padding-top: 0 !important;
}
/* Hide the whole intro (breadcrumb + prose) so the globe sits immersively right
   under the site nav. The BreadcrumbList JSON-LD lives in the page head, so SEO
   is unaffected. */
.tool-intro {
  display: none !important;
}

.ipl {
  --ipl-accent: var(--color-primary, #f8f904);
  --ipl-accent-2: var(--color-secondary, #b026ff);
  --ipl-text: var(--color-text, #e9eefb);
  --ipl-muted: var(--color-muted, #9fb0d0);
  --ipl-bg: var(--color-bg, #05070f);
  --ipl-surface: var(--color-surface, #0c1120);
  --ipl-border: var(--color-border-strong, rgba(255, 255, 255, 0.14));
  /* Glass + glow pulled straight from the nitrosites theme tokens. */
  --ipl-glass: var(--overlay-medium, rgba(2, 4, 6, 0.65));
  --ipl-glass-strong: var(--overlay-strong, rgba(2, 4, 6, 0.86));
  --ipl-border-strong: var(--color-border-strong, #3a3e48);
  --ipl-glow: var(--color-glow-soft, rgba(248, 249, 4, 0.18));
  --ipl-glow-2: var(--color-glow-2-soft, rgba(176, 38, 255, 0.18));
  --ipl-radius: var(--r-md, 12px);
  --ipl-font: var(--font-body, system-ui, -apple-system, Segoe UI, Roboto, sans-serif);
  --ipl-display: var(--font-display, var(--ipl-font));
  font-family: var(--ipl-font);
  color: var(--ipl-text);
}
/* Reset box-sizing locally so widths include padding/border even on the
   standalone harness (the live BaseLayout already sets this globally). */
.ipl,
.ipl *,
.ipl *::before,
.ipl *::after {
  box-sizing: border-box;
}

/* Full-bleed globe stage, breaks out of the article column to the viewport. */
.ipl-stage {
  position: relative;
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  min-height: clamp(520px, 78vh, 960px);
  overflow: hidden;
  border-radius: 0;
  background: radial-gradient(
    120% 90% at 50% 16%,
    var(--ipl-surface) 0%,
    var(--ipl-bg) 58%,
    #000 100%
  );
}
.ipl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
.ipl-canvas:active {
  cursor: grabbing;
}

/* Play / pause, large yellow icon, top-left. Paused = spin stopped + driveable. */
.ipl-playpause {
  position: absolute;
  z-index: 4;
  top: clamp(16px, 4vw, 30px);
  right: clamp(14px, 3vw, 28px);
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--ipl-border);
  border-radius: var(--r-full, 999px);
  background: var(--ipl-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ipl-accent);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
}
.ipl-playpause:hover {
  border-color: var(--ipl-accent);
  background: var(--ipl-glass-strong);
  box-shadow: 0 0 16px var(--ipl-glow);
  transform: scale(1.05);
}
.ipl-playpause svg {
  width: 27px;
  height: 27px;
  display: block;
}
.ipl-playpause .ipl-pp-play {
  display: none;
}
.ipl-playpause.is-paused {
  border-color: var(--ipl-accent);
  box-shadow: 0 0 16px var(--ipl-glow);
}
.ipl-playpause.is-paused .ipl-pp-pause {
  display: none;
}
.ipl-playpause.is-paused .ipl-pp-play {
  display: block;
}

/* Search bar: glass pill, top-centre. */
.ipl-search {
  position: absolute;
  z-index: 3;
  top: clamp(16px, 4vw, 40px);
  left: 50%;
  transform: translateX(-50%);
  width: min(448px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 7px 7px 14px;
  border: 1px solid var(--ipl-border);
  border-radius: var(--r-full, 999px);
  background: var(--ipl-glass);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition:
    border-color 0.28s var(--ease, ease),
    box-shadow 0.28s var(--ease, ease),
    background 0.28s var(--ease, ease),
    transform 0.2s var(--ease, ease);
}
/* In use, ready to type: the pill blooms into rich purple-tinted glass. */
.ipl-search:focus-within {
  background: var(--ipl-glass-strong);
  border-color: var(--ipl-accent-2);
  transform: translateX(-50%) translateY(-1px);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow:
    0 0 0 3px var(--ipl-glow-2),
    0 0 30px var(--ipl-glow-2),
    0 18px 54px rgba(0, 0, 0, 0.55);
}
.ipl-input:focus,
.ipl-input:focus-visible {
  outline: none; /* the pill itself shows focus via :focus-within */
}
.ipl-search-ico {
  flex: none;
  width: 20px;
  height: 20px;
  /* Electric-purple brand globe (theme secondary). */
  color: var(--color-secondary, #b026ff);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--color-secondary, #b026ff) 55%, transparent));
}
.ipl-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ipl-text);
  font: inherit;
  font-size: 15px;
  padding: 6px 2px;
  outline: none;
}
.ipl-input::placeholder {
  color: var(--ipl-muted);
}
.ipl-go,
.ipl-me {
  flex: none;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--r-full, 999px);
  font-family: var(--ipl-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.ipl-go {
  background: var(--ipl-accent);
  color: var(--color-primary-fg, #0a0a0a);
  box-shadow: 0 0 0 rgba(248, 249, 4, 0);
}
.ipl-go:hover {
  box-shadow: 0 0 18px var(--color-glow-soft, rgba(248, 249, 4, 0.45));
  transform: translateY(-1px);
}
.ipl-me {
  background: transparent;
  color: var(--ipl-muted);
  border-color: var(--ipl-border);
  padding: 8px 12px;
}
.ipl-me:hover {
  color: var(--ipl-text);
  border-color: var(--ipl-accent);
}

/* Status message (loading / error), under the search bar. */
.ipl-msg {
  position: absolute;
  z-index: 3;
  top: calc(clamp(16px, 4vw, 40px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  max-width: min(640px, calc(100vw - 32px));
  padding: 8px 16px;
  border-radius: var(--r-full, 999px);
  font-size: 13px;
  font-weight: 600;
  background: var(--ipl-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ipl-border);
}
.ipl-msg[data-kind="err"] {
  color: #ff9da6;
  border-color: rgba(255, 90, 100, 0.5);
}
.ipl-msg[data-kind="load"] {
  color: var(--ipl-accent);
  border-color: rgba(248, 249, 4, 0.35);
}

/* "Your IP address" banner: inside the card, above the IP, on self-lookups. */
.ipl-myip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 9px;
}
.ipl-myip[hidden] {
  display: none;
}
.ipl-myip-label {
  font-family: var(--ipl-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ipl-muted);
}
.ipl-myip-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--ipl-border);
  border-radius: var(--r-full, 999px);
  background: transparent;
  color: var(--ipl-accent);
  font-family: var(--ipl-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.ipl-myip-copy svg {
  width: 13px;
  height: 13px;
  color: var(--ipl-accent);
}
.ipl-myip-copy:hover {
  border-color: var(--ipl-accent);
  background: rgba(248, 249, 4, 0.08);
  box-shadow: 0 0 10px var(--ipl-glow);
}

/* Details panel: glass card, bottom-left, slides up on result.
   z-index above the floating map-pin label cards (.ipl-tip is z-index 4). */
.ipl-panel {
  position: absolute;
  z-index: 5;
  left: clamp(14px, 3vw, 32px);
  bottom: clamp(14px, 3vw, 32px);
  /* Grow to fit the content so the two-column rows don't wrap a value onto a second
     line; clamped so it never gets tiny or wider than the viewport. (Mobile pins
     left+right below, which overrides this.) */
  width: fit-content;
  min-width: 340px;
  max-width: min(480px, calc(100vw - 28px));
  padding: 13px 15px;
  border: 1px solid var(--ipl-border-strong);
  border-radius: 14px;
  /* Sexy glass: a soft top sheen layered over the theme glass tint + a faint
     purple edge glow, matching the nitrosites overlay/glow tokens. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 42%),
    var(--ipl-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px var(--ipl-glow-2),
    0 24px 70px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.ipl-panel.is-in {
  opacity: 1;
  transform: translateY(0);
}
/* Hover: crisp 1px brand-yellow border + a slight yellow glow. */
.ipl-panel:hover {
  border-color: var(--ipl-accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px var(--ipl-accent),
    0 0 22px var(--ipl-glow),
    0 24px 70px rgba(0, 0, 0, 0.6);
}
.ipl-panel-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--ipl-border);
}
.ipl-flag {
  font-size: 26px;
  line-height: 1;
}
/* Flag + IP grouped on the left of the header (actions stay in the right column). */
.ipl-panel-id {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0; /* let the IP ellipsis inside the grid cell */
}
.ipl-panel-flag {
  flex: none;
  font-family:
    "Twemoji Country Flags", "Segoe UI Emoji", "Apple Color Emoji",
    "Noto Color Emoji", sans-serif;
  font-size: 21px; /* match the IP font height next to it */
  line-height: 1;
}
.ipl-panel-flag:empty {
  display: none; /* no flag (e.g. unknown country) → no gap */
}
.ipl-panel-ip {
  font-family: var(--ipl-display);
  font-weight: 800;
  font-size: 21px;
  color: var(--ipl-accent);
  letter-spacing: 0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ipl-panel-actions {
  display: inline-flex;
  gap: 6px;
}
/* Yellow icon buttons (Maps / Share / JSON). */
.ipl-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--ipl-border);
  border-radius: 8px;
  background: transparent;
  color: var(--ipl-accent);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.ipl-act svg {
  width: 16px;
  height: 16px;
  display: block;
}
.ipl-act:hover {
  border-color: var(--ipl-accent);
  background: rgba(248, 249, 4, 0.08);
  box-shadow: 0 0 12px var(--ipl-glow);
}
.ipl-panel.is-place [data-json] {
  display: none;
}

/* Two columns to keep the card compact: location spans the full width, then the
   rest pair up (postcode|timezone, coords|isp, asn|type). Place cards keep
   location/coords/about full-width since they've nothing to pair. */
.ipl-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
  row-gap: 8px;
  margin: 0;
}
.ipl-row--location,
.ipl-row--about {
  grid-column: 1 / -1;
}
.ipl-panel.is-place .ipl-row--coords {
  grid-column: 1 / -1;
}
.ipl-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: center;
}
.ipl-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ipl-muted);
  word-break: break-word;
}
.ipl-row a {
  color: var(--ipl-accent-2, #b026ff);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.ipl-row a:hover {
  border-bottom-color: currentColor;
}

/* Purple row icons, each with a tiny black tooltip on hover. */
.ipl-ic {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--ipl-accent-2);
}
.ipl-ic svg {
  width: 16px;
  height: 16px;
  display: block;
}
.ipl-ic::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(3px);
  padding: 2px 6px;
  background: #000;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 5;
}
.ipl-ic:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Floating tooltip over the pin, echoes the /network/ globe tip. */
.ipl-tip {
  position: fixed;
  top: 0;
  left: 0;
  /* The floating map-pin card sits BEHIND all the UI chrome (search, drawer,
     play/pause, details panel), just above the globe canvas. */
  z-index: 2;
  margin-top: -3rem;
  margin-left: 0.9rem;
  display: grid;
  white-space: nowrap;
  border: 1px solid var(--ipl-accent);
  border-radius: var(--ipl-radius);
  background: var(--ipl-glass);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 22px rgba(248, 249, 4, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ipl-tip[aria-hidden="false"] {
  opacity: 1;
}
.ipl-tip-body {
  display: grid;
  gap: 2px;
  padding: 5px 12px;
}
.ipl-tip-city {
  font-family: var(--ipl-display);
  font-weight: 800;
  font-size: 13px;
  color: var(--ipl-text);
}
.ipl-tip-meta {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ipl-muted);
}
.ipl-tip-band {
  display: block;
  text-align: center;
  padding: 3px 8px 2px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  color: #0a0a0a;
  background: var(--ipl-accent);
  border-bottom-left-radius: calc(var(--ipl-radius) - 1px);
  border-bottom-right-radius: calc(var(--ipl-radius) - 1px);
}
.ipl-tip-band-top {
  text-align: center;
  font-size: 15px;
  line-height: 1;
  padding: 5px 0 1px;
}

.ipl-hint {
  position: absolute;
  z-index: 3;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(12px, 2.5vw, 22px);
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ipl-muted);
  opacity: 0.6;
}

/* "Fly to fun places" quick-launch: small glass buttons up the right edge. */
.ipl-places {
  position: absolute;
  z-index: 3;
  top: clamp(82px, 14vh, 150px);
  right: clamp(14px, 3vw, 28px);
  width: 190px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ipl-places-title {
  font-family: var(--ipl-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ipl-accent-2);
  text-align: right;
  margin-bottom: 2px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.ipl-places-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ipl-place {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--ipl-border);
  border-radius: var(--r-full, 999px);
  background: var(--ipl-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ipl-text);
  font: inherit;
  font-size: 12px;
  padding: 6px 11px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease,
    background 0.16s ease;
}
.ipl-place:hover {
  border-color: var(--ipl-accent-2);
  background: var(--ipl-glass-strong);
  box-shadow: 0 0 16px var(--ipl-glow-2);
  transform: translateX(-3px);
}
.ipl-place-flag,
.ipl-tip-band-top {
  font-family:
    "Twemoji Country Flags", "Segoe UI Emoji", "Apple Color Emoji",
    "Noto Color Emoji", sans-serif;
}
.ipl-place-flag {
  font-size: 14px;
  line-height: 1;
  flex: none;
}
.ipl-place-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile-only toggle pill for the "fly to fun places" drawer (hidden on desktop,
   where the full list shows up the right edge). Sits just below the play/pause. */
.ipl-places-toggle {
  display: none;
  position: absolute;
  z-index: 4;
  top: calc(clamp(16px, 4vw, 30px) + 58px);
  right: clamp(14px, 3vw, 28px);
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 1px solid var(--ipl-border);
  border-radius: var(--r-full, 999px);
  background: var(--ipl-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ipl-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  transition:
    transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.2s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.ipl-places-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}
/* Open: the toggle slides off the right edge as the drawer slides in to take its
   place (the drawer's top is the same height as this button). */
.ipl-places-toggle[aria-expanded="true"] {
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  pointer-events: none;
}

.ipl-toast {
  position: fixed;
  z-index: 9999;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #0d1018;
  color: var(--ipl-text);
  border: 1px solid var(--ipl-border);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
}

@media (max-width: 640px) {
  /* Matching 12px gutters both sides (left+right defines width: no overflow). */
  .ipl-panel {
    left: 12px;
    right: 12px;
    width: auto;
  }
  /* Left-align the search pill and reserve room on the right so it no longer slides
     under the play/pause button (52px + its right offset + a gap). */
  .ipl-search {
    left: 12px;
    right: calc(clamp(14px, 3vw, 28px) + 62px);
    width: auto;
    transform: none;
  }
  .ipl-search:focus-within {
    transform: translateY(-1px);
  }
  /* The two-column row layout is now the default (see .ipl-rows). On small screens
     also trim the most technical rows (ASN + IP type) to keep the card short. */
  .ipl-rows .ipl-row--asn,
  .ipl-rows .ipl-row--type {
    display: none;
  }
  /* Slide the card off like a drawer to the left while the jet flies, so the
     model has the stage; it slides back when the jet lands. */
  .ipl-panel.is-flying {
    transform: translateX(calc(-100% - 24px)) !important;
  }
  .ipl-hint {
    display: none;
  }
  .ipl-me {
    display: none;
  }
  /* Fly-to-fun-places: a drawer that slides in from the right when the toggle is
     tapped, and slides away again once a destination is chosen. */
  .ipl-places-toggle {
    display: inline-flex;
  }
  .ipl-places {
    display: flex;
    z-index: 5; /* above the toggle + the map-pin cards as it slides in */
    top: calc(clamp(16px, 4vw, 30px) + 58px); /* exactly where the toggle sits */
    right: 0;
    width: min(64vw, 230px);
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px 12px 14px 14px;
    background: var(--ipl-glass-strong);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--ipl-border);
    border-right: none;
    border-radius: 14px 0 0 14px;
    box-shadow: -8px 0 26px rgba(0, 0, 0, 0.45);
    transform: translateX(calc(100% + 4px));
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .ipl-places.is-open {
    transform: translateX(0);
  }
}
