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

:root {
  --primary:       #1a56db;
  --primary-dark:  #1341b0;
  --primary-light: #e8f0fe;
  --accent:        #f59e0b;
  --accent-dark:   #d97706;
  --success:       #10b981;
  --danger:        #ef4444;
  --text:          #1f2937;
  --text-muted:    #6b7280;
  --bg:            #f9fafb;
  --surface:       #ffffff;
  --border:        #e5e7eb;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.10);
  --shadow-md:     0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.15);
  --radius:        12px;
  --transition:    .25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============================
   Utilities
   ============================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ============================
   Navigation
   ============================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.navbar__brand svg { flex-shrink: 0; }

.navbar__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.navbar__links a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.navbar__cta {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary);
  color: #fff !important;
  padding: .45rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}

.navbar__cta:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.navbar__menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem;
  color: var(--text);
}

/* ============================
   Hero
   ============================ */
.hero {
  background: linear-gradient(135deg, #1341b0 0%, #1a56db 50%, #2563eb 100%);
  color: #fff;
  padding: 5rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='rgba(255,255,255,.05)' stroke-width='1'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}

.hero__eyebrow {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: .3rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.hero__title span { color: var(--accent); }

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 640px;
  margin: 0 auto 2rem;
  opacity: .9;
}

.hero__stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.hero__stat {
  text-align: center;
}

.hero__stat strong {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.hero__stat span {
  font-size: .85rem;
  opacity: .85;
}

.hero__search-wrap {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.hero__search-wrap svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: .85rem 1rem .85rem 2.75rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  background: rgba(255,255,255,.95);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition);
}

#search:focus {
  box-shadow: 0 0 0 3px rgba(245,158,11,.5), var(--shadow-md);
}

#search::placeholder { color: var(--text-muted); }

/* ============================
   Stats bar
   ============================ */
.stats-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}

.stats-bar__inner {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stats-bar__item {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  color: var(--text-muted);
}

.stats-bar__item svg { color: var(--primary); }

.stats-bar__item strong { color: var(--text); }

/* ============================
   Apps Section
   ============================ */
.apps-section {
  padding: 4rem 0;
}

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

.section-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  margin-bottom: .5rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.filter-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .4rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Category group */
.category-group {
  margin-bottom: 3.5rem;
}

.category-group[hidden] { display: none; }

.category-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--border);
}

.category-title__icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-badge {
  margin-left: auto;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 999px;
}

/* App grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* App card */
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.app-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--primary);
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
}

.app-card__header {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
}

.app-card__icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
}

.app-card__meta { flex: 1; min-width: 0; }

.app-card__name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  margin-bottom: .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card__repo {
  font-size: .75rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.app-card__description {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.app-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.app-card__tag {
  background: var(--primary-light);
  color: var(--primary);
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 999px;
}

.app-card__footer {
  display: flex;
  gap: .6rem;
  margin-top: .25rem;
}

.app-card__link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 600;
  padding: .45rem .85rem;
  border-radius: 7px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  flex: 1;
  justify-content: center;
}

.app-card__link--primary {
  background: var(--primary);
  color: #fff;
}

.app-card__link--primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.app-card__link--secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.app-card__link--secondary:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
}

.app-card[hidden] { display: none; }

/* No results */
#no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  display: none;
}

#no-results svg { margin-bottom: 1rem; opacity: .4; }

/* ============================
   About Section
   ============================ */
.about-section {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4rem 0;
}

.about-section .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about__content h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

.about__content p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: .95rem;
}

.about__features {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: 1.5rem;
}

.about__features li {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  font-weight: 500;
}

.about__features li svg { color: var(--success); flex-shrink: 0; }

.about__visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.about__stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.about__stat-card strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
}

.about__stat-card span {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ============================
   Footer
   ============================ */
footer {
  background: #111827;
  color: #9ca3af;
  padding: 2.5rem 0;
  text-align: center;
  font-size: .875rem;
}

footer a { color: #60a5fa; }
footer a:hover { color: #93c5fd; }

.footer__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f9fafb;
  margin-bottom: .75rem;
}

.footer__links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.footer__copy { opacity: .7; }

/* ============================
   Back to top
   ============================ */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px; height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background var(--transition), transform var(--transition);
  z-index: 50;
}

#back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

#back-to-top.visible { display: flex; }

/* ============================
   Responsive
   ============================ */
@media (max-width: 900px) {
  .about-section .container {
    grid-template-columns: 1fr;
  }
  .about__visual { display: none; }
  .navbar__links { display: none; }
  .navbar__menu-btn { display: block; }
  .navbar__links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-md);
    z-index: 99;
  }
}

@media (max-width: 600px) {
  .hero { padding: 3.5rem 0 3rem; }
  .hero__stats { gap: 1.5rem; }
  .app-grid { grid-template-columns: 1fr; }
  .about__features { grid-template-columns: 1fr; }
  .stats-bar__inner { gap: 1.25rem; }
}

/* ============================
   Animations
   ============================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-card {
  animation: fadeInUp .35s ease both;
}
