/* ====== Design Tokens ====== */
:root {
  --background: #f4f6f9;
  --foreground: #13171f;
  --card: #ffffff;
  --muted: #e7eaf0;
  --muted-foreground: #6a7280;
  --border: #dde1e8;
  --primary: #10b981;
  --primary-foreground: #ffffff;
  --secondary: #e7eaf0;
  --secondary-foreground: #13171f;
  --destructive: #ef4444;
  --radius: 0.75rem;
  --font-heading: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow-xl: 0 20px 40px -10px rgba(16, 24, 40, 0.12);
}

html.dark {
  --background: #0b0f18;
  --foreground: #e5e9f0;
  --card: #131826;
  --muted: #1e2434;
  --muted-foreground: #8a93a6;
  --border: #222a3c;
  --secondary: #1e2434;
  --secondary-foreground: #e5e9f0;
  --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-heading);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
a.link { color: var(--primary); }
a.link:hover { text-decoration: underline; }

code {
  background: var(--secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

strong { color: var(--foreground); font-weight: 600; }

/* ====== Header ====== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.125rem;
}
.logo svg { width: 20px; height: 20px; }

.nav { display: none; align-items: center; gap: 0.25rem; }
@media (min-width: 768px) { .nav { display: flex; } }
.nav a {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  color: var(--muted-foreground);
  transition: color 0.15s;
}
.nav a:hover { color: var(--foreground); }
.nav a.active { color: var(--primary); font-weight: 500; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--foreground);
  padding: 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--secondary); }
.icon-btn svg { width: 18px; height: 18px; }

.mobile-controls { display: flex; align-items: center; gap: 0.5rem; }
@media (min-width: 768px) { .mobile-controls { display: none; } }
.desktop-controls { display: none; }
@media (min-width: 768px) { .desktop-controls { display: inline-flex; } }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--background);
  padding: 0.75rem 1rem;
  flex-direction: column;
  gap: 0.25rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}
.mobile-nav a.active {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-weight: 500;
}

/* ====== Main / Container ====== */
main { flex: 1; }
.container { max-width: 896px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

.section { padding: 3rem 0; }
@media (min-width: 640px) { .section { padding: 5rem 0; } }
.section-sm { padding: 2rem 0; }
.section.bordered { border-top: 1px solid var(--border); }

.text-center { text-align: center; }

h1, h2, h3 { font-family: var(--font-heading); letter-spacing: -0.02em; }
h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
@media (min-width: 640px) { h1 { font-size: 3rem; } }
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) { h2 { font-size: 1.875rem; } }
h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.hero-sub {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  max-width: 36rem;
  margin: 0 auto 2.5rem;
}
@media (min-width: 640px) { .hero-sub { font-size: 1rem; } }

.prose { color: var(--muted-foreground); font-size: 0.9375rem; line-height: 1.7; }
.prose > * + * { margin-top: 1rem; }
.prose h2 { color: var(--foreground); font-size: 1.25rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
@media (min-width: 640px) { .prose h2 { font-size: 1.5rem; } }
.prose h3 { color: var(--foreground); font-size: 1.0625rem; margin-top: 1.25rem; margin-bottom: 0.25rem; }

/* ====== IP Card ====== */
.ip-card {
  max-width: 32rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  text-align: center;
}
.card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted-foreground);
  font-weight: 500;
  margin-bottom: 1rem;
}
.ip-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  word-break: break-all;
}
@media (min-width: 640px) { .ip-value { font-size: 2.5rem; } }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.96); }
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ====== Spinner ====== */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 0;
}
.loading-state p { color: var(--muted-foreground); font-size: 0.875rem; }

/* ====== Info Cards Grid ====== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
@media (min-width: 640px) { .info-grid { grid-template-columns: 1fr 1fr; } }

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: left;
}
.info-card .info-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted-foreground);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  margin-bottom: 0.375rem;
}
.info-card .info-label svg { width: 14px; height: 14px; }
.info-card .info-value { font-size: 0.9375rem; font-weight: 500; word-break: break-word; }

/* ====== CTA Grid (3-card internal links) ====== */
.cta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) { .cta-grid { grid-template-columns: repeat(3, 1fr); } }

.cta-card {
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
  display: block;
}
.cta-card:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.cta-card h3 { font-size: 0.875rem; margin-bottom: 0.25rem; }
.cta-card:hover h3 { color: var(--primary); }
.cta-card p { font-size: 0.75rem; color: var(--muted-foreground); }

/* ====== Feature Grid (privacy page) ====== */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.15s;
}
.feature-card:hover { border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.feature-card .icon { color: var(--primary); margin-bottom: 0.75rem; }
.feature-card .icon svg { width: 20px; height: 20px; }
.feature-card h3 { font-size: 0.875rem; margin-bottom: 0.25rem; }
.feature-card p { font-size: 0.75rem; color: var(--muted-foreground); line-height: 1.6; }

/* ====== Tools Grid ====== */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  text-align: left;
}
@media (min-width: 640px) { .tools-grid { grid-template-columns: 1fr 1fr; } }
.tool-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.15s, background 0.15s;
  display: block;
}
.tool-card.active:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.tool-card.inactive { opacity: 0.6; cursor: default; }
.tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.tool-head .icon { color: var(--primary); }
.tool-head .icon svg { width: 20px; height: 20px; }
.tag {
  font-size: 0.625rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}
.tag.popular { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.tag.soon { background: var(--secondary); color: var(--muted-foreground); }
.tag.guide { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.tool-card h3 { font-size: 0.875rem; }
.tool-card p { font-size: 0.75rem; color: var(--muted-foreground); line-height: 1.6; }

/* ====== Lookup input ====== */
.lookup-row {
  display: flex;
  gap: 0.5rem;
  max-width: 32rem;
  margin: 0 auto;
}
.lookup-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  outline: none;
  transition: box-shadow 0.15s;
}
.lookup-input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 50%, transparent); }
.lookup-input::placeholder { color: var(--muted-foreground); }

.error-msg { color: var(--destructive); font-size: 0.875rem; margin-top: 1rem; text-align: center; }

/* ====== Blog ====== */
.post-list { display: flex; flex-direction: column; gap: 1rem; }
.post-card {
  display: block;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  transition: border-color 0.15s, background 0.15s;
}
.post-card:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.post-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; font-size: 0.75rem; color: var(--muted-foreground); }
.post-meta .cat { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 500; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 0.625rem; }
.post-meta .read { display: inline-flex; align-items: center; gap: 0.25rem; }
.post-meta svg { width: 12px; height: 12px; }
.post-card h2 { font-size: 1rem; margin-bottom: 0.5rem; transition: color 0.15s; }
@media (min-width: 640px) { .post-card h2 { font-size: 1.125rem; } }
.post-card:hover h2 { color: var(--primary); }
.post-card p { font-size: 0.875rem; color: var(--muted-foreground); line-height: 1.6; margin-bottom: 0.75rem; }
.read-more { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--primary); font-weight: 500; transition: gap 0.15s; }
.post-card:hover .read-more { gap: 0.5rem; }
.read-more svg { width: 12px; height: 12px; }

/* ====== Article ====== */
.article { max-width: 48rem; margin: 0 auto; padding: 3rem 1rem; }
@media (min-width: 640px) { .article { padding: 5rem 1.5rem; } }
.back-link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 2rem; transition: color 0.15s; }
.back-link:hover { color: var(--foreground); }
.back-link svg { width: 16px; height: 16px; }
.article h1 { font-size: 1.5rem; margin: 0 0 2rem; }
@media (min-width: 640px) { .article h1 { font-size: 2.25rem; } }
.article .prose h2 { color: var(--foreground); font-size: 1.25rem; margin-top: 1.5rem; }
@media (min-width: 640px) { .article .prose h2 { font-size: 1.5rem; } }

.tag-row { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.tag-row h3 { font-size: 0.875rem; margin-bottom: 1rem; }
.tag-row .tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--secondary);
  color: var(--secondary-foreground);
  transition: background 0.15s, color 0.15s;
}
.pill:hover {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

/* ====== Badge ====== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}
.badge svg { width: 14px; height: 14px; }

/* ====== FAQ ====== */
.faq { padding: 3rem 0; border-top: 1px solid var(--border); }
.faq h2 { text-align: left; margin-bottom: 1.5rem; }
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--muted-foreground);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-body {
  padding: 0 1.25rem 1.25rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.65;
}

/* ====== Footer ====== */
.footer { border-top: 1px solid var(--border); margin-top: 2rem; }
.footer-inner { max-width: 1024px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer h3 { font-size: 0.875rem; margin-bottom: 0.75rem; }
.footer .col p { font-size: 0.75rem; color: var(--muted-foreground); line-height: 1.6; }
.footer .col .links { display: flex; flex-direction: column; gap: 0.5rem; }
.footer .col .links a {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  transition: color 0.15s;
}
.footer .col .links a:hover { color: var(--foreground); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
@media (min-width: 640px) { .footer-bottom { flex-direction: row; } }
.footer-bottom .foot-links { display: flex; gap: 1rem; }
.footer-bottom a:hover { color: var(--foreground); }

/* ====== 404 ====== */
.notfound {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.notfound h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.notfound p { color: var(--muted-foreground); margin-bottom: 1rem; font-size: 1.125rem; }

/* Utilities */
.hidden { display: none !important; }
.mt-sm { margin-top: 1rem; }
.mt-md { margin-top: 1.5rem; }
.mt-lg { margin-top: 2rem; }
