/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&family=Plus+Jakarta+Sans:wght@400;600;800&display=swap');

/* Color & Variable System */
:root {
  --bg-dark: #020617;
  --card-bg: rgba(15, 23, 42, 0.9);
  --card-bg-subtle: rgba(15, 23, 42, 0.4);
  --card-border: #1e293b;
  --border-subtle: rgba(30, 41, 59, 0.6);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-emerald: #34d399;
  --accent-emerald-hover: #6ee7b7;
  --accent-blue: #60a5fa;
  --btn-bg: #1e293b;
  --btn-hover: #334155;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
}

@media (min-width: 640px) {
  body {
    padding: 1.5rem;
  }
}

.mono {
  font-family: var(--font-mono);
}

/* Layout Containers */
.max-w-5xl { max-width: 64rem; }
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }

/* Typography Helpers */
h1 {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #fff;
  margin-bottom: 1rem; /* Reduced gap on mobile */
}

@media (min-width: 640px) {
  h1 { 
    font-size: 3rem; 
    margin-bottom: 1.25rem; /* Reduced gap on desktop */
  }
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-top: -0.3rem;
  margin-bottom: 1rem;
}

h3 {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.625;
}

/* Header & Navigation */
header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  gap: 1rem;
}

@media (min-width: 640px) {
  header {
    flex-direction: row;
  }
}

header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

header nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

header nav a:hover {
  color: var(--accent-emerald);
}



/* Logo */
header img {
  height: 3rem;
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
  filter: brightness(1.25);
  transition: transform 0.2s;
}

header a.group:hover img {
  transform: scale(1.05);
}

@media (min-width: 640px) {
  header img { height: 4rem; }
}

/* Hero Section */
main {
  margin-top: auto;
  margin-bottom: auto;
  padding-bottom: 2.5rem;
  text-align: center;
}

main > p:first-of-type {
  color: var(--accent-emerald);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Hero Cards (IPv4 & IPv6) */
.grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.grid > div {
  min-width: 0;            /* Prevents grid items from exceeding screen width */
  word-break: normal;      /* Keeps normal English words intact */
  overflow-wrap: break-word; /* Allows long strings (like IPv6) to break safely */
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.bg-slate-900\/90 {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}

/* Badges & Labels */
.text-\[10px\] {
  font-size: 10px;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.bg-emerald-500\/10 {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.bg-blue-500\/10 {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Buttons */
button, .btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background-color: #0f172a;
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  transition: all 0.2s;
}

button:hover {
  background-color: var(--btn-hover);
}

/* Card Action Buttons */
.bg-slate-900\/90 button {
  width: 100%;
  background-color: var(--btn-bg);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid #334155;
  margin-top: 1rem;
}

.bg-slate-900\/90 button:active {
  transform: scale(0.95);
}

/* Telemetry Grid Cards */
.bg-slate-900\/50 {
  background-color: var(--card-bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem;
  border-radius: 1rem;
  text-align: left;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.border-b { border-bottom-width: 1px; }
.border-slate-800\/50 { border-color: rgba(30, 41, 59, 0.5); }
.pb-2 { padding-bottom: 0.5rem; }

.text-slate-500 { color: var(--text-muted); }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: var(--text-secondary); }
.text-emerald-400 { color: var(--accent-emerald); }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-w-\[140px\] { max-width: 140px; }

/* User Agent Section */
#user-agent-string {
  background-color: rgba(2, 6, 23, 0.8);
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #0f172a;
  word-break: break-all;
}

/* Grid Spanning */
@media (min-width: 640px) {
  .sm\:col-span-2 { grid-column: span 2 / span 2; }
}
@media (min-width: 768px) {
  .md\:col-span-1 { grid-column: span 1 / span 1; }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
}

/* FAQ Details Accordion */
details {
  background-color: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 1rem;
}

details summary {
  list-style: none;
  cursor: pointer;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary span:last-child {
  transition: transform 0.2s ease;
}

details[open] summary span:last-child {
  transform: rotate(180deg);
}

details p {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
}

/* Footer */
footer {
  max-width: 64rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 1px solid #0f172a;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--accent-emerald);
}

.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }

/* Code tags */
code {
  font-family: var(--font-mono);
  color: var(--accent-emerald);
}

/* SVG icons */
svg {
  display: inline-block;
  vertical-align: middle;
}

/* Fix for SVG Copy Icon inside buttons */
button svg {
  width: 1rem !important;  /* 16px */
  height: 1rem !important; /* 16px */
  flex-shrink: 0;
}

/* Fix for Facebook Logo in Footer */
footer img {
  width: 1rem !important;  /* 16px */
  height: 1rem !important; /* 16px */
  object-fit: contain;
  display: inline-block;
}

/* Footer Container Spacing */
footer {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding-top: 2rem !important;
  padding-bottom: 2rem !important;
  gap: 1rem !important;
}

/* Fix for the links container */
footer > div:first-of-type {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 1.5rem !important; /* Proper spacing between each link */
  width: 100% !important;
}

/* Ensure links & facebook icon stay spaced inline */
footer a {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

/* Footer Container Spacing */
footer {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding-top: 2rem !important;
  padding-bottom: 2rem !important;
  gap: 1rem !important;
}

/* Fix for the links container */
footer > div:first-of-type {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 1.5rem !important; /* Proper spacing between each link */
  width: 100% !important;
}

/* Ensure links & facebook icon stay spaced inline */
footer a {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

/* --- Mobile/Desktop View Toggle Utilities --- */
.block { display: block; }
.hidden { display: none; }

@media (min-width: 640px) {
  .sm\:block { display: block !important; }
  .sm\:hidden { display: none !important; }
  .sm\:flex-row { flex-direction: row !important; }
  .sm\:items-center { align-items: center !important; }
  .sm\:w-auto { width: auto !important; }
}

/* --- Responsive Layout & Flex Helpers --- */
.flex-col { flex-direction: column; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.shrink-0 { flex-shrink: 0; }
.break-all { word-break: break-all; }
.whitespace-nowrap { white-space: nowrap; }

/* --- Table Styling Fixes --- */
table {
  width: 100%;
  border-collapse: collapse;
}
.w-20 { width: 5rem; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Search Form Responsiveness */
form {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

@media (min-width: 640px) {
  form {
    flex-direction: row;
  }
}

form input[type="text"] {
  width: 100%;
}

form button[type="submit"] {
  width: 100%;
  margin-top: 0;
}

@media (min-width: 640px) {
  form button[type="submit"] {
    width: auto;
  }
}

/* --- Search Form Fix --- */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: #0f172a; /* Dark container background */
  padding: 0.5rem;
  border-radius: 1rem;
  border: 1px solid #1e293b;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .search-form {
    flex-direction: row;
    align-items: center;
  }
}

/* Input Field Styling */
.search-input {
  background-color: #020617 !important; /* Dark background so it isn't solid white */
  color: #ffffff !important;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #1e293b;
  width: 100%;
  font-size: 0.875rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-emerald);
}

/* Button Styling */
.search-btn {
  background-color: var(--accent-emerald) !important;
  color: #020617 !important;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  border: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 0 !important; /* Overrides global button margin */
  width: 100%;
}

@media (min-width: 640px) {
  .search-btn {
    width: auto;
  }
}

.search-btn:hover {
  background-color: var(--accent-emerald-hover) !important;
}

/* --- FORCE FORM CLEARANCE & PREVENT OVERLAP --- */
main {
  display: block !important; /* Prevents flex collapse pulling elements together */
  margin-top: 0rem !important;
  margin-bottom: 2rem !important;
}

/* Form Container */
form.search-form, 
form[action="dns-lookup"] {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  background-color: #0f172a !important;
  padding: 0.5rem !important;
  border-radius: 1rem !important;
  border: 1px solid #1e293b !important;
  margin-bottom: 2.5rem !important; /* Forces 40px gap above the results box */
  width: 100% !important;
  clear: both !important;
  position: relative !important;
  z-index: 10 !important;
}

@media (min-width: 640px) {
  form.search-form,
  form[action="dns-lookup"] {
    flex-direction: row !important;
    align-items: center !important;
  }
}

/* Text Input Box */
form[action="dns-lookup"] input[type="text"] {
  background-color: #020617 !important;
  color: #ffffff !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.75rem !important;
  border: 1px solid #1e293b !important;
  width: 100% !important;
  font-size: 0.875rem !important;
  outline: none !important;
  box-sizing: border-box !important;
}

/* Submit Button */
form[action="dns-lookup"] button[type="submit"] {
  background-color: var(--accent-emerald, #34d399) !important;
  color: #020617 !important;
  font-weight: 700 !important;
  padding: 0.75rem 1.5rem !important;
  border-radius: 0.75rem !important;
  font-size: 0.75rem !important;
  border: none !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  margin-top: 0 !important;
  width: 100% !important;
}

@media (min-width: 640px) {
  form[action="dns-lookup"] button[type="submit"] {
    width: auto !important;
  }
}

/* Results Box Spacing */
.bg-slate-900\/90 {
  margin-top: 1.5rem !important;
  clear: both !important;
  position: relative !important;
  z-index: 1 !important;
}

