/* ============================================================
   AI Directory — Main Stylesheet
   Colors: #6366f1 (indigo), #f59e0b (amber), #ffffff base
   ============================================================ */

/* ---- RESET & BASE ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --surface: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 240px;
  --header-h: 64px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ---- HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -1px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.logo-text span {
  color: var(--primary);
}

/* Header search */
.header-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 9px 40px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
  color: var(--text);
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: var(--white);
}

.header-search input::placeholder {
  color: var(--text-light);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  display: flex;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 50%;
}

.search-clear:hover {
  color: var(--text);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.header-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.header-nav a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.btn-submit {
  background: var(--primary);
  color: white !important;
  padding: 7px 16px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.btn-submit:hover {
  background: var(--primary-dark) !important;
  color: white !important;
}

/* Mobile menu toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #fff7ed 100%);
  padding: 60px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.hero h1 span {
  color: var(--primary);
}

.hero p {
  font-size: clamp(16px, 2vw, 18px);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* Hero search */
.hero-search {
  max-width: 580px;
  margin: 0 auto 40px;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
  background: var(--white);
  color: var(--text);
}

.hero-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), var(--shadow);
}

.hero-search input::placeholder {
  color: var(--text-light);
}

.hero-search .search-icon {
  left: 18px;
}

.hero-search .search-clear {
  right: 14px;
}

/* Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

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

.stat-number {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- ADS ---- */
.adsense-banner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  text-align: center;
}

.adsense-banner ins {
  display: block;
}

/* ---- LAYOUT ---- */
.main-layout {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px;
  gap: 24px;
  align-items: flex-start;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.sidebar-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.sidebar-title {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

#category-list {
  display: flex;
  flex-direction: column;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  width: 100%;
  color: var(--text-secondary);
}

.category-btn:last-child {
  border-bottom: none;
}

.category-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.category-btn.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.category-btn.active .cat-icon {
  color: var(--primary);
}

.cat-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cat-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
}

.cat-count {
  font-size: 12px;
  color: var(--text-light);
  background: var(--border);
  padding: 1px 7px;
  border-radius: 50px;
  font-weight: 600;
  flex-shrink: 0;
}

.category-btn.active .cat-count {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary-dark);
}

/* Sidebar ad */
.sidebar-ad {
  text-align: center;
}

.sidebar-ad ins {
  display: block;
}

/* ---- MAIN CONTENT ---- */
.content-area {
  flex: 1;
  min-width: 0;
}

/* Toolbar */
.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

#results-count {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sort-select {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--primary);
}

/* ---- TOP PICKS SECTION ---- */
.top-picks-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 8px;
}

.top-picks-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.top-picks-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.top-picks-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.top-picks-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#top-picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

/* Top Pick Card */
.top-pick-card {
  background: var(--white);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  background-clip: padding-box;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.top-pick-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 2px;
  background: linear-gradient(135deg, #f59e0b, #6366f1, #ec4899);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}

.top-pick-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #6366f1, #ec4899);
}

.top-pick-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.top-pick-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 50px;
  width: fit-content;
}

.tool-avatar--lg {
  width: 52px;
  height: 52px;
  font-size: 22px;
  border-radius: 12px;
}

.top-pick-commission {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #059669;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 7px 10px;
  line-height: 1.4;
  font-weight: 500;
}

.top-pick-commission svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #059669;
}

.top-pick-cta {
  background: linear-gradient(135deg, var(--primary), #4338ca);
  font-size: 14px;
  padding: 11px 10px;
}

.top-pick-cta:hover {
  background: linear-gradient(135deg, #4f46e5, #3730a3);
}

.compare-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  font-weight: 500;
}

.compare-cta:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

/* Editor's Choice enhanced card */
.tool-card--editors-choice {
  border: 2px solid transparent;
  background-clip: padding-box;
}

.tool-card--editors-choice::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 2px;
  background: linear-gradient(135deg, #f59e0b, #6366f1, #ec4899);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}

.tool-card--editors-choice::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #6366f1, #ec4899);
}

.editors-choice-badge {
  background: linear-gradient(135deg, #f59e0b, #f97316) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
}

.new-badge {
  background: linear-gradient(135deg, #10b981, #059669) !important;
}

/* ---- RECENTLY ADDED SECTION ---- */
.recently-added-section {
  max-width: 1280px;
  margin: 40px auto 0;
  padding: 0 20px;
}

#recently-added-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.recent-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}

.recent-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: #d1d5db;
}

.recent-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ---- TOOL GRID ---- */
#tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---- TOOL CARD ---- */
.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: #d1d5db;
}

.tool-card--featured {
  border-color: var(--primary);
  border-width: 1.5px;
}

.tool-card--featured::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.featured-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 50px;
}

.tool-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -1px;
}

.tool-meta {
  min-width: 0;
}

.tool-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.tool-category-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 50px;
  white-space: nowrap;
}

.tool-description {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-pricing {
  font-size: 12px;
}

.pricing-label {
  color: var(--text-light);
  font-weight: 500;
  margin-right: 4px;
}

.pricing-value {
  color: var(--text-secondary);
}

.tool-rating {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stars {
  display: flex;
  gap: 1px;
}

.star {
  color: var(--text-light);
  display: flex;
  align-items: center;
}

.star.filled {
  color: var(--accent);
}

.star.half {
  color: var(--accent);
  opacity: 0.6;
}

.rating-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.tool-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--primary);
  color: white !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s, transform 0.15s;
  margin-top: 4px;
}

.tool-cta:hover {
  background: var(--primary-dark);
  text-decoration: none !important;
  transform: translateY(-1px);
}

/* ---- EMPTY STATE ---- */
#empty-state {
  display: none;
  text-align: center;
  padding: 64px 20px;
  color: var(--text-secondary);
}

#empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

#empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ---- FEATURED SECTION (homepage) ---- */
.featured-section {
  max-width: 1280px;
  margin: 40px auto 0;
  padding: 0 20px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.section-badge {
  background: linear-gradient(135deg, var(--accent), #f97316);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#featured-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

/* ---- CATEGORY PAGES HEADER ---- */
.page-header {
  background: linear-gradient(135deg, #f0f4ff, #fff);
  border-bottom: 1px solid var(--border);
  padding: 40px 20px;
}

.page-header-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.page-header p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 560px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ---- NEWSLETTER ---- */
.newsletter-section {
  background: linear-gradient(135deg, var(--primary), #4338ca);
  color: white;
  padding: 60px 20px;
  text-align: center;
}

.newsletter-inner {
  max-width: 500px;
  margin: 0 auto;
}

.newsletter-inner h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.newsletter-inner p {
  font-size: 15px;
  opacity: 0.85;
  margin-bottom: 28px;
  line-height: 1.6;
}

#newsletter-form {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

#newsletter-form input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

#newsletter-form button {
  padding: 12px 22px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#newsletter-form button:hover {
  background: var(--accent-dark);
}

/* ---- FOOTER ---- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 20px 24px;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 12px;
  line-height: 1.6;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col ul li a {
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-col ul li a:hover {
  color: var(--primary);
  text-decoration: none;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-light);
  flex-wrap: wrap;
  gap: 10px;
}

.footer-bottom a {
  color: var(--text-light);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--primary);
}

.footer-disclaimer {
  font-size: 12px;
  color: var(--text-light);
  max-width: 1280px;
  margin: 16px auto 0;
  padding-top: 12px;
  line-height: 1.5;
  text-align: center;
}

/* ---- SIDEBAR OVERLAY (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 149;
}

.sidebar-overlay.visible {
  display: block;
}

/* ---- ADSENSE SLOTS ---- */
.ad-slot {
  text-align: center;
  margin: 16px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 12px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .hero {
    padding: 40px 16px;
  }

  .header-search {
    display: none;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    background: white;
    padding-top: 16px;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-layout {
    padding: 16px;
    flex-direction: column;
  }

  #tools-grid {
    grid-template-columns: 1fr;
  }

  #featured-tools {
    grid-template-columns: 1fr;
  }

  #top-picks-grid {
    grid-template-columns: 1fr;
  }

  #recently-added-grid {
    grid-template-columns: 1fr;
  }

  .newsletter-section {
    padding: 40px 16px;
  }

  #newsletter-form {
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .hero-stats {
    gap: 32px;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .header-nav a:not(.btn-submit) {
    display: none;
  }

  .hero h1 {
    font-size: 26px;
  }

  .content-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- NETWORK FOOTER ---- */
.network-footer {
  background: #0f172a;
  padding: 32px 20px;
}

.network-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
}

.network-footer-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin-bottom: 16px;
}

.network-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.network-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8 !important;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.network-link:hover {
  background: #334155;
  border-color: #6366f1;
  color: #e2e8f0 !important;
  text-decoration: none;
}

.network-link-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
}

/* ---- BEEHIIV NEWSLETTER EMBED ---- */
.beehiiv-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #1e293b 100%);
  padding: 56px 20px;
  text-align: center;
}

.beehiiv-inner {
  max-width: 520px;
  margin: 0 auto;
}

.beehiiv-inner .beehiiv-eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #f59e0b;
  margin-bottom: 14px;
}

.beehiiv-inner h2 {
  font-size: 28px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.25;
}

.beehiiv-inner p {
  font-size: 15px;
  color: #94a3b8;
  margin-bottom: 28px;
  line-height: 1.6;
}

.beehiiv-perks {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.beehiiv-perk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 500;
}

.beehiiv-perk-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #10b981;
  font-size: 11px;
  font-weight: 800;
}

.beehiiv-form {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto 14px;
}

.beehiiv-form input {
  flex: 1;
  padding: 13px 16px;
  border: 1.5px solid #334155;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #1e293b;
  color: white;
  transition: border-color 0.2s;
}

.beehiiv-form input::placeholder {
  color: #64748b;
}

.beehiiv-form input:focus {
  border-color: #6366f1;
}

.beehiiv-form button {
  padding: 13px 22px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}

.beehiiv-form button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.beehiiv-fine-print {
  font-size: 12px;
  color: #475569;
}

@media (max-width: 768px) {
  .beehiiv-form {
    flex-direction: column;
  }

  .beehiiv-inner h2 {
    font-size: 22px;
  }

  .network-links {
    gap: 8px;
  }
}

/* ---- UTILITY ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* Smooth transition for category switches */
#tools-grid {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
