
/* ================================
   ToolsHub — Global CSS
   Light, Modern, Mobile Responsive
================================= */

/* Google Fonts with font-display: swap for LCP optimization */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

/* ---- Variables ---- */
:root {
  --bg:         #f5f6fa;
  --surface:    #ffffff;
  --border:     #e8eaf0;
  --accent:     #4f46e5;
  --accent-light: #ede9fe;
  --accent-hover: #4338ca;
  --text-main:  #0f0f1a;
  --text-sub:   #6b7280;
  --text-muted: #9ca3af;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.07);
  --shadow-hover: 0 8px 28px rgba(79,70,229,0.13);
  --font-head:  'Syne', sans-serif;
  --font-body:  'DM Sans', sans-serif;
  --transition: 0.2s ease;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  content-visibility: auto;
  contain: layout style paint;
}

/* ---- Navbar ---- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 6px;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-sub);
  padding: 6px 14px;
  border-radius: 20px;
  transition: background var(--transition), color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-light);
  color: var(--accent);
}

/* ---- Hero ---- */
.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 20px 40px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.4px;
  margin-bottom: 20px;
  animation: fadeDown 0.5s ease both;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  color: var(--text-main);
  margin-bottom: 16px;
  animation: fadeDown 0.5s 0.1s ease both;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-sub);
  font-weight: 400;
  margin-bottom: 32px;
  animation: fadeDown 0.5s 0.2s ease both;
}

/* ---- Search ---- */
.search-wrap {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  animation: fadeDown 0.5s 0.3s ease both;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 14px 18px 14px 44px;
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 0.97rem;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

.search-wrap input::placeholder {
  color: var(--text-muted);
}

/* ---- Tools Section ---- */
.tools-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 60px;
  flex: 1;
}

.tools-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: 0.3px;
}

/* ---- Tool Grid ---- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ---- Tool Card ---- */
.tool-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.10s; }
.tool-card:nth-child(3) { animation-delay: 0.15s; }
.tool-card:nth-child(4) { animation-delay: 0.20s; }
.tool-card:nth-child(5) { animation-delay: 0.25s; }
.tool-card:nth-child(6) { animation-delay: 0.30s; }
.tool-card:nth-child(7) { animation-delay: 0.35s; }
.tool-card:nth-child(8) { animation-delay: 0.40s; }

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-icon {
  font-size: 1.8rem;
  min-width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.tool-info {
  flex: 1;
  position: relative;
  z-index: 1;
}

.tool-info h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text-main);
}

.tool-info p {
  font-size: 0.84rem;
  color: var(--text-sub);
  line-height: 1.5;
}

.tool-arrow {
  font-size: 1.1rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition: transform var(--transition), color var(--transition);
  align-self: center;
  flex-shrink: 0;
}

.tool-card:hover .tool-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

/* ---- Category Sections ---- */
.category-section {
  margin-bottom: 48px;
}

.category-title {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--accent-light);
}

/* ---- No Results ---- */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sub);
}

.no-results span {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

.no-results p {
  font-size: 1rem;
}

/* ---- Footer ---- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Animations ---- */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Mobile Responsive ---- */
@media (max-width: 600px) {
  .hero {
    padding: 36px 16px 28px;
  }

  .hero h1 {
    font-size: 2rem;
    letter-spacing: -1px;
  }

  .hero-sub {
    font-size: 0.95rem;
  }

  .tools-section {
    padding: 0 16px 48px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .nav-links a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .nav-logo {
    font-size: 1rem;
  }

  .tool-card {
    padding: 18px 16px;
  }
}
