/* ============================================================
   mikebrande.com — light "big-tech" theme
   White/soft-gray frosted glass, blue accents, system type.
   Sits above the WebGL background canvas (#bg3d) on main pages;
   body::before provides the static gradient fallback everywhere.
   ============================================================ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --bg: #f5f7fa;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.85);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  --text: #1d1d1f;
  --text-2: #515154;
  --text-3: #86868b;

  --accent: #1877f2;
  --accent-2: #4285f4;
  --accent-soft: #e7f0fe;
  --accent-grad: linear-gradient(135deg, #1877f2 0%, #4285f4 50%, #7c3aed 100%);

  --ok: #1e8e3e;
  --warn: #f29900;
  --danger: #d93025;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.10);
  --blur: saturate(180%) blur(20px);
  --radius: 16px;
  --radius-lg: 20px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  font-family: var(--font-sans);
  color: var(--text);
  padding: 0;
  box-sizing: border-box;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Static soft gradient — the universal background. The WebGL canvas
   (#bg3d) renders on top of this; without WebGL this is the look. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 55% 45% at 15% 12%, rgba(66, 133, 244, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 45% 40% at 85% 20%, rgba(124, 58, 237, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 70% 85%, rgba(24, 119, 242, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 25% 75%, rgba(56, 189, 248, 0.10) 0%, transparent 55%);
  filter: blur(60px);
  pointer-events: none;
}

/* WebGL background canvas (injected by site_header.php on main pages) */
#bg3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Header ---------- */
.site-header {
  width: 100%;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 28px;
  height: 28px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-icon svg {
  width: 100%;
  height: 100%;
}
.logo {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.logo .domain {
  color: var(--text-3);
  font-weight: 400;
}

/* Nav pills */
.header-nav {
  display: flex;
  gap: 4px;
  margin-left: 20px;
}
.header-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.header-nav a:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
}
.header-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Weather */
.weather {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.weather-icon {
  font-size: 18px;
}
.weather-temp {
  font-weight: 600;
  color: var(--accent);
}
.weather-desc {
  color: var(--text-3);
  font-size: 12px;
}
.weather-location {
  color: var(--text-3);
  font-size: 11px;
  margin-left: 4px;
}

/* ---------- Layout ---------- */
.main-content {
  padding: 1.5rem 1.25rem 2.5rem 2.25rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
}

/* Entrance reveal — staggered, content rises in softly */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.info-box,
.panel,
.tools-hero,
.tool-card {
  animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.info-box:nth-child(2),
.tool-card:nth-child(2) { animation-delay: 0.08s; }
.tool-card:nth-child(3) { animation-delay: 0.16s; }
.tool-card:nth-child(4) { animation-delay: 0.24s; }
.panel.trace-panel { animation-delay: 0.10s; }
.panel.map-panel   { animation-delay: 0.18s; }
.tools-section .card-grid .tool-card { animation-delay: 0.12s; }
.tools-section .card-grid .tool-card:nth-child(2) { animation-delay: 0.20s; }
.tools-section .card-grid .tool-card:nth-child(3) { animation-delay: 0.28s; }

/* Info boxes */
.info-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  max-width: 1200px;
  justify-content: flex-start;
  margin-bottom: 1rem;
}
.info-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  flex: 1 1 400px;
  max-width: 600px;
  min-width: 300px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.info-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.info-box-header {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.5vw, 19px);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.info-box-body {
  font-size: clamp(13px, 2vw, 15px);
  line-height: 1.6;
  color: var(--text-2);
}
.info-box-body strong {
  color: var(--text);
}
.info-box-body a {
  color: var(--accent);
}
.info-box-body a:visited {
  color: #6d4fc4;
}
.info-box-body a:hover {
  color: var(--accent-2);
}

/* Loading animation */
.loading-container {
  display: flex;
  align-items: center;
  gap: 10px;
}
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(24, 119, 242, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Trace summary stats */
.trace-summary {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.55);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.trace-summary-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.trace-summary-label {
  color: var(--text-3);
}
.trace-summary-value {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Panels (traceroute + map) ---------- */
.main-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  max-width: 1200px;
  justify-content: flex-start;
}
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.trace-panel {
  flex: 1 1 400px;
  max-width: 600px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}
.trace-panel h2,
.map-panel h2 {
  margin: 0;
  padding: 0.75rem 1rem;
  font-family: var(--font-display);
  font-size: clamp(14px, 2.5vw, 17px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid var(--border);
}
pre {
  margin: 0;
  padding: 1rem;
  flex: 1;
  height: 350px;
  overflow-y: auto;
  font-size: clamp(11px, 2vw, 12.5px);
  color: #334155;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  background: rgba(248, 250, 252, 0.6);
}
.trace-line {
  white-space: pre-wrap;
  line-height: 1.45;
}
.trace-ip {
  color: #1d6fd8;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  text-decoration-color: rgba(29, 111, 216, 0.5);
  transition: color 0.15s, text-decoration-color 0.15s;
}
.trace-ip:hover {
  color: #0b4fa8;
  text-decoration-style: solid;
  text-decoration-color: #0b4fa8;
}
.map-panel {
  flex: 1 1 400px;
  max-width: 600px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}
#map {
  flex: 1;
  min-height: 350px;
}
.hop-legend {
  padding: 0.5rem 1rem;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.55);
  border-top: 1px solid var(--border);
}
.hop-legend span {
  margin-right: 1rem;
}
.hop-legend .start { color: var(--ok); }
.hop-legend .hop   { color: var(--warn); }
.hop-legend .end   { color: var(--danger); }

/* ============================================================
   TOOLS / GAMES HUB  (tools.php, games.php)
   ============================================================ */

/* --- Hero --- */
.tools-hero {
  width: 100%;
  max-width: 1200px;
  margin: 0.5rem 0 1.75rem;
  padding: 2.25rem 2rem 2rem;
  box-sizing: border-box;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
  overflow: hidden;
}
.tools-hero::after {
  content: '';
  position: absolute;
  left: 2rem;
  right: 2rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(66, 133, 244, 0.45), transparent);
}
.tools-hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: -0.02em;
  line-height: 1.08;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: var(--accent); /* fallback when background-clip:text unsupported */
  -webkit-text-fill-color: transparent;
}
.tools-hero-subtitle {
  margin: 0.7rem 0 0;
  font-size: clamp(14px, 2.2vw, 17px);
  line-height: 1.5;
  color: var(--text-2);
  max-width: 60ch;
}

/* --- Section header --- */
.tools-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 0 1.75rem;
}
.tools-section-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(15px, 2.6vw, 18px);
  letter-spacing: -0.01em;
  color: var(--text);
}
.tools-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* --- Card grid ---
   Track widths come from the CONTAINER, never from card content or hover
   state, so cards never widen or reflow on hover. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

/* --- Tool card (entire card is the <a>) --- */
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.4rem;
  box-sizing: border-box;
  border-radius: var(--radius);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  /* Animate ONLY transform / shadow / border-color — never width/padding. */
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}
.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(66, 133, 244, 0.45);
  box-shadow: var(--shadow-md);
  outline: none;
}
.tool-card:focus-visible {
  box-shadow: var(--shadow-md), 0 0 0 2px rgba(24, 119, 242, 0.45) inset;
}
.tool-card:active {
  transform: translateY(-1px);
}

/* --- Icon chip --- */
.tool-card-icon,
.icon-chip {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--accent-soft);
  border: none;
  transition: background 0.2s ease;
}
.tool-card-icon svg {
  width: 40px;
  height: 40px;
  display: block;
}
.tool-card:hover .tool-card-icon,
.tool-card:focus-visible .tool-card-icon {
  background: #d8e7fd;
}

/* --- Card text --- */
.tool-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(15px, 2.4vw, 18px);
  letter-spacing: -0.01em;
  color: var(--text);
}
.tool-card-desc {
  margin: 0;
  font-size: clamp(12px, 2vw, 14px);
  line-height: 1.55;
  color: var(--text-2);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #bg3d { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .main-content { padding: 0.75rem; }
  .main-container { flex-direction: column; width: calc(100% - 1.5rem); }
  .trace-panel, .map-panel { max-width: 100%; min-width: 0; }
  .info-sections { width: calc(100% - 1.5rem); }
  .info-box { min-width: 0; max-width: 100%; }

  .site-header {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  .logo-container {
    flex-wrap: wrap;
    gap: 6px;
  }
  .logo {
    font-size: 15px;
  }
  .logo-icon {
    width: 24px;
    height: 24px;
  }
  .header-nav {
    margin-left: 8px;
  }
  .header-nav a {
    padding: 5px 11px;
    font-size: 13px;
  }
  .weather {
    font-size: 11px;
    gap: 4px;
  }
  .weather-icon {
    font-size: 16px;
  }
  .weather-desc, .weather-location {
    display: none;
  }

  .info-sections {
    gap: 0.75rem;
  }
  .info-box {
    padding: 1rem;
    border-radius: 12px;
  }

  #map {
    min-height: 280px;
  }
  pre {
    height: 280px;
    padding: 0.75rem;
    font-size: 12px;
  }
  .hop-legend {
    font-size: 10px;
    padding: 0.4rem 0.75rem;
  }
  .hop-legend span {
    margin-right: 0.5rem;
  }

  .tools-hero { padding: 1.4rem 1.25rem 1.25rem; margin-bottom: 1.25rem; }
  .tools-section { margin-bottom: 1.25rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
  .tool-card { padding: 1.1rem; }
}

@media (max-width: 400px) {
  .logo .domain {
    display: none;
  }
  .header-nav {
    margin-left: 4px;
  }
  .info-box {
    padding: 0.75rem;
  }
  .info-box-header {
    font-size: 15px;
  }
  .info-box-body {
    font-size: 13px;
  }
  .card-grid { grid-template-columns: 1fr; }
  .tools-hero { padding: 1.1rem 1rem 1rem; border-radius: var(--radius); }
  .tool-card { padding: 1rem; }
  .tool-card-icon, .icon-chip { width: 48px; height: 48px; }
  .tool-card-icon svg { width: 34px; height: 34px; }
}
