/* ==========================================================================
   CatKeyLab - Modern Design System & Global Styles
   ========================================================================== */

:root {
  /* Dynamic Mouse Coordinates */
  --mouse-x: 50vw;
  --mouse-y: 50vh;

  /* Handcrafted Indie Dark Palette */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --glass-border: rgba(240, 246, 252, 0.1);
  --glass-bg: #161b22;

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --accent-primary: #10b981; /* Catnip Emerald */
  --accent-primary-hover: #059669;
  --accent-primary-glow: rgba(16, 185, 129, 0.25);
  
  --accent-cyan: #10b981; /* Catnip Emerald Accent */
  --accent-cyan-glow: rgba(16, 185, 129, 0.25);
  --accent-catnip: #10b981; /* Catnip Emerald */
  --accent-ginger: #f97316; /* Ginger Tabby Orange */
  --accent-pink: #fda4af; /* Soft Salmon Pink */
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --border-color: #30363d;
  --border-focus: #10b981;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.2);
  --shadow-cyan-glow: 0 0 20px rgba(57, 197, 187, 0.2);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.12s ease;
  --transition-normal: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Mode Overrides */
[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f6f8fa;
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-bg: #ffffff;

  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8c959f;

  --border-color: #d0d7de;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.15);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(650px circle at var(--mouse-x) var(--mouse-y), rgba(16, 185, 129, 0.08), transparent 80%),
    radial-gradient(800px circle at 15% 20%, rgba(249, 115, 22, 0.06), transparent 70%),
    radial-gradient(800px circle at 85% 75%, rgba(16, 185, 129, 0.06), transparent 70%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M25 15c-1.5 0-3 1.2-3 2.7 0 1.5 1.5 2.8 3 2.8s3-1.3 3-2.8c0-1.5-1.5-2.7-3-2.7zm-8 4c-1.5 0-3 1.2-3 2.7 0 1.5 1.5 2.8 3 2.8s3-1.3 3-2.8c0-1.5-1.5-2.7-3-2.7zm16 0c-1.5 0-3 1.2-3 2.7 0 1.5 1.5 2.8 3 2.8s3-1.3 3-2.8c0-1.5-1.5-2.7-3-2.7zm-14 8c-3.5 0-6.5 2.5-6.5 6 0 4.5 5.5 8 9.5 8s9.5-3.5 9.5-8c0-3.5-3-6-6.5-6h-6z' fill='%2310b981' fill-opacity='0.038'/%3E%3C/svg%3E"),
    linear-gradient(rgba(240, 246, 252, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 246, 252, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 60px 60px, 32px 32px, 32px 32px;
}

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

a:hover {
  color: var(--accent-primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Grid System */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: repeat(1, 1fr); }
}

/* Header & Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-normal);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.logo-text span {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.nav-link {
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-link-featured {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.35);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link-featured:hover {
  background: rgba(6, 182, 212, 0.22);
  color: #ffffff;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px var(--accent-cyan-glow);
}

.nav-badge-hot {
  background: linear-gradient(90deg, #f85149, #d29922);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.08rem 0.35rem;
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  opacity: 0.6;
  margin: 0 0.15rem;
}

/* Custom Dropdown Styling */
.dropdown {
  position: relative;
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.dropdown-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(100px);
  transition: all var(--transition-fast);
  z-index: 120;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item:hover, .dropdown-item.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Mobile Menu */
.hamburger-btn {
  display: none;
  padding: 0.5rem;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

@media (max-width: 900px) {
  .nav-desktop { display: none; }
  .hamburger-btn { display: flex; }
}

.mobile-drawer {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 99;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  overflow-y: auto;
}

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

.mobile-nav-link {
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-link.active {
  color: var(--accent-primary);
  background: var(--bg-secondary);
}

/* Main Content Wrapper */
main {
  flex: 1;
}

/* Hero Section */
.hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-primary-glow) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.hero-title-gradient {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 2.25rem;
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-align: center;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border: 1px solid #388bfd;
  box-shadow: 0 3px 0 #1f6beb;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #1f6beb;
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #1f6beb;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 3px 0 #161b22;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #161b22;
}

.btn-secondary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #161b22;
}

.btn-surprise {
  background: linear-gradient(135deg, #d29922, #b07d14);
  color: #ffffff;
  border: 1px solid #d29922;
  box-shadow: 0 3px 0 #855b08;
  font-weight: 700;
}

.btn-surprise:hover {
  background: linear-gradient(135deg, #e3a830, #c48c17);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #855b08;
}

.btn-surprise:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #855b08;
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-rose), #dc2626);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Section Headings */
.section {
  padding: 3.5rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Tool Cards Grid */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card-hover);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.tool-card-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
}

.tool-card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.tool-card-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.tool-card-footer {
  margin-top: auto;
}

/* Advertisements / Monetization Slots */
.ad-slot {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
}

.ad-label {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  padding: 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.ad-placeholder-box {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

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

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

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 1rem 0 1.5rem;
  max-width: 320px;
}

.footer-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--accent-primary);
}

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

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-emerald);
  font-weight: 600;
}
