:root {
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --accent: #0ea5e9;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --header-bg: rgba(255, 255, 255, 0.92);
  --radius: 12px;
  --transition: 0.2s ease;
  --success: #16a34a;
  --danger: #dc2626;
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(15, 23, 42, 0.95);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
.container { width: min(1140px, 92%); margin: 0 auto; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--primary); color: #fff; padding: 0.5rem 1rem;
}
.skip-link:focus { left: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 1.25rem; color: var(--text);
}
.brand:hover { color: var(--primary); }
.brand-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: grid; place-items: center; font-size: 1.1rem;
}
.site-nav { display: flex; align-items: center; gap: 1.5rem; }
.nav-list { display: flex; list-style: none; gap: 1.25rem; align-items: center; }
.nav-list a {
  color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
  padding: 0.25rem 0; border-bottom: 2px solid transparent;
}
.nav-list a:hover, .nav-list a.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { font-size: 0.85rem; color: var(--text-muted); }
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 0.5rem;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--text); transition: var(--transition);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.65rem 1.25rem; border-radius: 8px; font-weight: 600;
  font-size: 0.95rem; border: none; cursor: pointer; transition: var(--transition);
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-icon {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; width: 40px; height: 40px;
  display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* Hero */
.hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 50%, #0f172a 100%);
  color: #fff; text-align: center;
}
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; opacity: 0.92; max-width: 640px; margin: 0 auto 2rem; }
.hero-search {
  max-width: 560px; margin: 0 auto 1rem; position: relative;
}
.hero-search input {
  width: 100%; padding: 1rem 1.25rem 1rem 3rem;
  border: none; border-radius: 999px; font-size: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.hero-search svg {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}
.search-results {
  max-width: 560px; margin: 0 auto; text-align: left;
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); display: none; overflow: hidden;
}
.search-results.active { display: block; }
.search-results a {
  display: block; padding: 0.75rem 1rem; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.search-results a:hover { background: var(--bg); }
.search-results .meta { font-size: 0.8rem; color: var(--text-muted); }

/* Sections */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--bg-card); border-block: 1px solid var(--border); }
.section-header { margin-bottom: 2rem; }
.section-header h2 { font-size: 1.75rem; margin-bottom: 0.35rem; }
.section-header p { color: var(--text-muted); }

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.tool-card {
  display: flex; flex-direction: column; gap: 0.5rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow); transition: transform var(--transition), box-shadow var(--transition);
  color: var(--text);
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.15);
  color: var(--text);
}
.tool-card-icon { font-size: 1.75rem; }
.tool-card-name { font-weight: 600; font-size: 1rem; }
.tool-card-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.tool-card-tag {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--primary); font-weight: 600;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.category-card h3 { color: var(--primary); margin-bottom: 1rem; font-size: 1.15rem; }
.category-card ul { list-style: none; }
.category-card li { margin-bottom: 0.5rem; }
.category-card a { color: var(--text-muted); font-size: 0.95rem; }
.category-card a:hover { color: var(--primary); }

/* About / Contact */
.about-block, .contact-block {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.about-block h2, .contact-block h2 { margin-bottom: 1rem; color: var(--primary); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 0.75rem 1rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 1rem;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .alert-success { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .alert-error { background: #7f1d1d; color: #fecaca; }

/* Tool page */
.tool-page { padding: 2rem 0 4rem; }
.breadcrumb {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem;
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
}
.breadcrumb a { color: var(--text-muted); }
.tool-header { margin-bottom: 2rem; }
.tool-header h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: 0.75rem; }
.tool-lead { color: var(--text-muted); font-size: 1.05rem; max-width: 720px; }
.tool-widget {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}
.calc-form { display: grid; gap: 1rem; max-width: 480px; }
.calc-result {
  margin-top: 1rem; padding: 1rem; background: var(--bg);
  border-radius: 8px; border-left: 4px solid var(--primary);
}
.calc-result strong { display: block; font-size: 1.25rem; color: var(--primary); }
.tool-embed {
  width: 100%; min-height: 600px; border: none; border-radius: 8px;
  background: var(--bg);
}
.tool-faq { margin-bottom: 2.5rem; }
.tool-faq h2 { margin-bottom: 1.25rem; font-size: 1.5rem; }
.faq-item {
  border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 0.75rem; background: var(--bg-card);
}
.faq-item summary {
  padding: 1rem 1.25rem; cursor: pointer; list-style: none;
  display: flex; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { font-size: 1rem; font-weight: 600; }
.faq-item p { padding: 0 1.25rem 1rem; color: var(--text-muted); font-size: 0.95rem; }
.related-tools h2 { margin-bottom: 1.25rem; font-size: 1.35rem; }

/* Auth */
.auth-page { padding: 3rem 0 4rem; min-height: 70vh; }
.auth-card {
  max-width: 440px; margin: 0 auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.auth-card .sub { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.auth-footer { margin-top: 1.25rem; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

/* Footer */
.site-footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  margin-top: auto; padding-top: 3rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem; padding-bottom: 2rem;
}
.footer-col h3, .footer-col h4 { margin-bottom: 0.75rem; font-size: 1rem; }
.footer-col p, .footer-col li { font-size: 0.9rem; color: var(--text-muted); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.4rem; }
.footer-bottom {
  border-top: 1px solid var(--border); padding: 1.25rem 0;
  text-align: center; font-size: 0.85rem; color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed; top: 64px; left: 0; right: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 1rem; gap: 1rem;
    transform: translateY(-120%); opacity: 0; pointer-events: none;
    transition: var(--transition); box-shadow: var(--shadow);
  }
  .site-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-list { flex-direction: column; width: 100%; align-items: stretch; }
  .nav-list a { padding: 0.5rem 0; }
  .nav-actions { width: 100%; justify-content: center; flex-wrap: wrap; }
  .hero { padding: 4rem 0 3rem; }
  .tool-embed { min-height: 500px; }
}
