/* =========================================
   TOOLS.CSS — Page-Specific Styles
   Edu Tools Gallery | Vylex Nexys
   ========================================= */

/* ── Page Layout ── */
main {
  margin-top: var(--nav-height);
}

/* ── Hero Banner ── */
.tools-hero {
  background: linear-gradient(135deg, #071e4a 0%, #0d47a1 55%, #1565c0 100%);
  padding: 72px 0 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tools-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(126, 205, 232, 0.14) 0%, transparent 65%),
    radial-gradient(ellipse 40% 35% at 85% 90%, rgba(232, 73, 29, 0.09) 0%, transparent 55%);
  pointer-events: none;
}

.tools-hero .section-label {
  margin-bottom: 16px;
}

.tools-hero .section-title {
  color: #ffffff;
  font-size: clamp(2rem, 4.5vw, 3rem);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
  margin-bottom: 14px;
}

.tools-hero .section-subtitle {
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0;
}

/* ── Category Section Headers ── */
.category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2rem;
}

.category-header .category-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.category-header h3 {
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  color: var(--primary-dark);
  margin: 0;
  line-height: 1.2;
}

.category-header .category-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 50px;
  white-space: nowrap;
}

/* ── Tool Cards — Enhanced ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

/* Animated colour accent strip on top */
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card:hover {
  transform: translateY(-7px);
  box-shadow: var(--shadow);
  border-color: rgba(13, 71, 161, 0.16);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

/* Subtle glow on hover */
.tool-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 0 rgba(70, 130, 180, 0);
  transition: box-shadow 0.35s ease;
  pointer-events: none;
}

.tool-card:hover::after {
  box-shadow: inset 0 0 0 1px rgba(70, 130, 180, 0.14);
}

/* Tool Icon */
.tool-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 18px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.tool-card:hover .tool-icon {
  transform: scale(1.12) rotate(-5deg);
}

/* Tool Text */
.tool-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.tool-content h4 {
  font-size: 1.08rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
  transition: color 0.2s ease;
  line-height: 1.3;
}

.tool-card:hover .tool-content h4 {
  color: var(--accent);
}

.tool-content p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  flex-grow: 1;
  margin-bottom: 20px;
}

/* Tool Meta Tag */
.tool-meta {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-meta::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
  flex-shrink: 0;
}

/* ── New / Badge variant ── */
.tool-card--new .tool-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--accent);
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 50px;
}

/* ── Icon Colour Variants ── */
.icon-blue    { background: #eff6ff; color: #2563eb; }
.icon-emerald { background: #ecfdf5; color: #059669; }
.icon-purple  { background: #faf5ff; color: #9333ea; }
.icon-rose    { background: #fff1f2; color: #e11d48; }
.icon-steel   { background: rgba(70, 130, 180, 0.1);  color: var(--primary); }
.icon-dark    { background: rgba(13, 71, 161, 0.1);   color: var(--primary-dark); }
.icon-accent  { background: rgba(232, 73, 29, 0.1);   color: var(--accent); }
.icon-amber   { background: #fffbeb; color: #d97706; }
.icon-teal    { background: #f0fdfa; color: #0d9488; }

/* ── Section Divider ── */
.category-divider {
  width: 56px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

/* ── Empty State (if a category has no tools yet) ── */
.tools-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tools-empty i {
  display: block;
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ── Scroll Reveal Stagger ── */
.tools-grid .reveal:nth-child(1) { transition-delay: 0ms;  }
.tools-grid .reveal:nth-child(2) { transition-delay: 60ms; }
.tools-grid .reveal:nth-child(3) { transition-delay: 120ms;}
.tools-grid .reveal:nth-child(4) { transition-delay: 180ms;}
.tools-grid .reveal:nth-child(5) { transition-delay: 240ms;}
.tools-grid .reveal:nth-child(6) { transition-delay: 300ms;}

/* ── Header Controls (Desktop / Mobile) ── */
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.desktop-only-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.desktop-only-links a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.desktop-only-links a:hover {
  color: var(--primary-dark);
}

#theme-toggle {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  transition: var(--transition);
}

#theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: rgba(70, 130, 180, 0.07);
}

/* ── Mobile Navigation Drawer ── */
.mobile-nav {
  position: fixed;
  top: var(--nav-height);
  right: 0;
  bottom: 0;
  width: min(82vw, 340px);
  background: var(--bg-white);
  z-index: 999;
  overflow-y: auto;
  padding: 20px 0 40px;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.1);
}

.mobile-nav.open {
  transform: translateX(0);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 30, 74, 0.45);
  backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.nav-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile nav inner structure */
.mobile-nav-section {
  padding: 8px 20px;
}

.mobile-nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 10px 4px 6px;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-light);
  transition: background 0.2s, color 0.2s;
}

.mobile-nav a:hover {
  background: rgba(70, 130, 180, 0.07);
  color: var(--primary-dark);
}

.mobile-nav .nav-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.mobile-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 20px;
}

/* ── Dark Mode ── */
body.dark {
  --bg-body:    #0f172a;
  --bg-white:   #1e293b;
  --bg-alt:     #162033;
  --text-main:  #e2e8f0;
  --text-light: #94a3b8;
  --text-muted: #64748b;
  --border:     rgba(255, 255, 255, 0.08);
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow:     0 10px 30px -8px rgba(0, 0, 0, 0.45);
  --shadow-lg:  0 20px 50px -12px rgba(0, 0, 0, 0.55);
}

body.dark header {
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 20px rgba(0,0,0,0.2);
}

body.dark .logo {
  color: #e2e8f0;
}

body.dark .tool-card {
  background: var(--bg-white);
  border-color: var(--border);
}

body.dark .tool-content h4 {
  color: #cbd5e1;
}

body.dark .tool-card:hover .tool-content h4 {
  color: #fb7a4a;
}

body.dark .section-title {
  color: #cbd5e1;
}

body.dark .category-header h3 {
  color: #cbd5e1;
}

body.dark .icon-blue    { background: rgba(37,99,235,0.15); }
body.dark .icon-emerald { background: rgba(5,150,105,0.15); }
body.dark .icon-purple  { background: rgba(147,51,234,0.15); }
body.dark .icon-rose    { background: rgba(225,29,72,0.15); }
body.dark .icon-steel   { background: rgba(70,130,180,0.15); }
body.dark .icon-dark    { background: rgba(13,71,161,0.2); }
body.dark .icon-accent  { background: rgba(232,73,29,0.15); }
body.dark .icon-amber   { background: rgba(217,119,6,0.15); }
body.dark .icon-teal    { background: rgba(13,148,136,0.15); }

body.dark .mobile-nav {
  background: #1e293b;
}

body.dark .mobile-nav a {
  color: #94a3b8;
}

body.dark .mobile-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

body.dark .section-alt {
  background: #162033;
}

body.dark #theme-toggle {
  border-color: rgba(255,255,255,0.12);
  color: #94a3b8;
}

body.dark #theme-toggle:hover {
  border-color: var(--primary);
  color: #7ecde8;
  background: rgba(70,130,180,0.12);
}

body.dark .desktop-only-links a {
  color: #94a3b8;
}

body.dark .desktop-only-links a:hover {
  color: #e2e8f0;
}

body.dark .tool-meta {
  border-top-color: rgba(255,255,255,0.07);
}

body.dark .category-count {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.08);
  color: #64748b;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .desktop-only-links {
    display: none;
  }

  .burger {
    display: block;
  }

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }

  .category-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .category-header .category-count {
    margin-left: 0;
  }
}

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

  .tool-card {
    padding: 22px 18px;
  }
}