/* ==========================================================================
   BADIL & DEVIT SHOWCASE - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

:root {
  /* Color Palette Tokens */
  --bg-primary: #07090e;
  --bg-secondary: #0e121a;
  --bg-card: rgba(16, 22, 34, 0.7);
  --bg-card-hover: rgba(22, 30, 48, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.4);
  --border-glow: rgba(56, 189, 248, 0.3);

  /* Brand Accents */
  --color-primary: #6366f1;
  --color-primary-glow: rgba(99, 102, 241, 0.35);
  --color-cyan: #06b6d4;
  --color-cyan-glow: rgba(6, 182, 212, 0.35);
  --color-emerald: #10b981;
  --color-emerald-glow: rgba(16, 185, 129, 0.35);
  --color-amber: #f59e0b;
  --color-amber-glow: rgba(245, 158, 11, 0.35);
  --color-pink: #ec4899;
  --color-pink-glow: rgba(236, 72, 153, 0.35);
  --color-purple: #a855f7;

  /* Typography */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #030712;

  /* Elevation & Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
  --shadow-glow-indigo: 0 0 35px -5px rgba(99, 102, 241, 0.25);
  --shadow-glow-cyan: 0 0 35px -5px rgba(6, 182, 212, 0.25);
  --shadow-glow-emerald: 0 0 35px -5px rgba(16, 185, 129, 0.25);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark light;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: inherit;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* Background Ambient Glow & Grid */
.glow-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: floatOrb 20s ease-in-out infinite alternate;
}

.glow-orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #6366f1 0%, rgba(99, 102, 241, 0) 70%);
  top: -150px;
  left: 10%;
}

.glow-orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #06b6d4 0%, rgba(6, 182, 212, 0) 70%);
  top: 35%;
  right: -100px;
  animation-duration: 25s;
  animation-delay: -5s;
}

.glow-orb-3 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0) 70%);
  bottom: -150px;
  left: 20%;
  animation-duration: 28s;
  animation-delay: -10s;
}

.glow-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 0%, rgba(0,0,0,0.2) 80%);
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* App Wrapper */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  position: sticky;
  top: 16px;
  z-index: 100;
  margin-bottom: 32px;
  background: transparent;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(14, 18, 26, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.logo-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0d14;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.25);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.brand-logo:hover .logo-badge {
  transform: scale(1.05) rotate(2deg);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  border-color: rgba(99, 102, 241, 0.5);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html[data-theme='light'] .logo-badge {
  border-color: rgba(15, 23, 42, 0.15);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.1;
}

.brand-dot {
  color: var(--color-cyan);
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: #34d399;
}

.live-pulse {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-play-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
  transition: var(--transition-normal);
}

.btn-play-header:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}

.btn-play-header .btn-icon {
  width: 16px;
  height: 16px;
}

/* Hero Section */
.hero-section {
  padding: 48px 0 64px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 24px;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: 3.8rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #ffffff;
  margin-bottom: 20px;
}

.gradient-text {
  display: inline-block;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #38bdf8;
}

html[data-theme='light'] .gradient-text,
html[data-theme='light'] .hero-headline .gradient-text {
  background: linear-gradient(135deg, #1e1b4b 0%, #1d4ed8 45%, #4338ca 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: #1e1b4b !important;
}

.hero-subline {
  max-width: 720px;
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 40px;
}

/* Search Bar */
.search-container {
  width: 100%;
  max-width: 680px;
  margin-bottom: 48px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(14, 18, 28, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 6px 16px 6px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: var(--transition-normal);
}

.search-input-wrapper:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 12px 35px rgba(0, 0, 0, 0.5);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  margin-right: 12px;
  flex-shrink: 0;
}

.search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  color: #ffffff;
  padding: 12px 0;
}

.search-input-wrapper input::placeholder {
  color: var(--text-dim);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.search-clear-btn:hover {
  color: #ffffff;
}

.search-clear-btn svg {
  width: 18px;
  height: 18px;
}

.search-shortcut {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: 8px;
  user-select: none;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 960px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  text-align: left;
  transition: var(--transition-normal);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
  background: var(--bg-card-hover);
}

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.stat-icon-wrap.emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-wrap.cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.stat-icon-wrap.violet { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.stat-icon-wrap.amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Sections Shared Headers */
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 48px;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--color-cyan);
  margin-bottom: 8px;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 12px;
}

.section-subtext {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Flagship Platforms Section */
.featured-section {
  padding: 40px 0 80px;
}

.flagship-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.flagship-card {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 26, 42, 0.8) 0%, rgba(12, 16, 26, 0.95) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.flagship-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.2);
}

.flagship-games:hover {
  box-shadow: 0 20px 50px -10px rgba(16, 185, 129, 0.2);
}

.flagship-easytech:hover,
.flagship-biziflow:hover {
  box-shadow: 0 20px 50px -10px rgba(234, 88, 12, 0.3);
}

.flagship-siya9a:hover {
  box-shadow: 0 20px 50px -10px rgba(37, 99, 235, 0.25);
}

.flagship-glow {
  position: absolute;
  top: -80px;
  right: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.2;
  pointer-events: none;
}

.flagship-games .flagship-glow { background: #10b981; }
.flagship-easytech .flagship-glow,
.flagship-biziflow .flagship-glow { background: #ea580c; }
.flagship-siya9a .flagship-glow { background: #2563eb; }

.flagship-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.pulse-dot.green { background: #10b981; box-shadow: 0 0 8px #10b981; }
.pulse-dot.cyan { background: #06b6d4; box-shadow: 0 0 8px #06b6d4; }
.pulse-dot.orange { background: #ea580c; box-shadow: 0 0 8px #ea580c; }
.pulse-dot.blue { background: #3b82f6; box-shadow: 0 0 8px #3b82f6; }

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

.flagship-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.flagship-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.flagship-meta {
  display: flex;
  flex-direction: column;
}

.flagship-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.flagship-url {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-cyan);
}

.flagship-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 24px;
  flex: 1;
}

.flagship-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: #cbd5e1;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tag:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
}

.flagship-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-flagship {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition-normal);
}

.btn-games {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
}

.btn-games:hover {
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.55);
  transform: translateY(-2px);
}

.btn-easytech,
.btn-biziflow {
  background: linear-gradient(135deg, #c2410c, #ea580c);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(234, 88, 12, 0.35);
}

.btn-easytech:hover,
.btn-biziflow:hover {
  box-shadow: 0 6px 25px rgba(234, 88, 12, 0.55);
  transform: translateY(-2px);
}

.btn-siya9a {
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(29, 78, 216, 0.35);
}

.btn-siya9a:hover {
  box-shadow: 0 6px 25px rgba(29, 78, 216, 0.55);
  transform: translateY(-2px);
}

.btn-icon-action {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: #ffffff;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-icon-action svg {
  width: 20px;
  height: 20px;
}

/* Projects Directory Section */
.projects-section {
  padding: 40px 0 90px;
}

.section-header-compact {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 24px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 4px;
}

.category-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.category-pill svg {
  width: 16px;
  height: 16px;
}

.category-pill:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.category-pill.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.pill-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 24px;
  font-size: 0.875rem;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 32px;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.view-btn:hover, .view-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.view-btn svg {
  width: 16px;
  height: 16px;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.projects-grid.list-view {
  grid-template-columns: 1fr;
}

/* Project Card */
.project-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-5px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.15);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.app-icon-box {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
  background: #1e293b;
}

.app-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title-wrap {
  flex: 1;
}

.card-category-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-cyan);
  margin-bottom: 4px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 4px;
}

.card-package {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  word-break: break-word;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 20px;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.card-tag {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.card-tag:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
  color: #ffffff;
  transform: translateY(-1px);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 16px;
}

.btn-primary-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary-action:hover {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary-action svg {
  width: 16px;
  height: 16px;
}

.btn-card-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-card-icon:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-card-icon svg {
  width: 16px;
  height: 16px;
}

/* Empty Search State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xl);
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.empty-icon-wrap svg {
  width: 32px;
  height: 32px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.empty-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 24px;
}

.btn-clear-filters {
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border: none;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-clear-filters:hover {
  opacity: 0.9;
  transform: scale(1.02);
}


/* Footer */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 60px 0 30px;
  margin-top: 40px;
}

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

.footer-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 16px 0 24px;
  line-height: 1.6;
  max-width: 380px;
}

.footer-socials {
  display: flex;
  gap: 10px;
}

.social-link {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.social-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.social-link svg {
  width: 18px;
  height: 18px;
}

.footer-links-col h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 18px;
}

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

.footer-links-col a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.footer-links-col a:hover {
  color: var(--color-cyan);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-vps-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  position: relative;
  background: #0f1523;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
  animation: scaleIn 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-detail-card {
  max-width: 600px;
}

@keyframes scaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.modal-close-btn svg {
  width: 16px;
  height: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.modal-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.modal-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-header-text h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

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

.qr-code-box {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  width: fit-content;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.qr-code-box #qrcode-canvas img {
  display: block;
}

.modal-link-box {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  margin-bottom: 20px;
}

.modal-link-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 8px;
}

.btn-copy-url {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-copy-url:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-copy-url svg {
  width: 14px;
  height: 14px;
}

.btn-modal-direct {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  padding: 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.btn-modal-direct:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}

.btn-modal-direct svg {
  width: 16px;
  height: 16px;
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid #38bdf8;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  font-size: 0.88rem;
  font-weight: 600;
  animation: toastSlide 300ms ease;
}

.toast-icon {
  width: 18px;
  height: 18px;
  color: #38bdf8;
}

@keyframes toastSlide {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .hero-headline {
    font-size: 3rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .flagship-grid {
    grid-template-columns: 1fr;
  }
  .footer-container {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .hero-headline {
    font-size: 2.3rem;
  }
  .hero-subline {
    font-size: 1rem;
  }
  .footer-container {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ==========================================================================
   ENHANCEMENTS - theming, accessibility, polish
   ========================================================================== */

/* --- Light theme -------------------------------------------------------- */

html[data-theme='light'] {
  --bg-primary: #f5f7fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(15, 23, 42, 0.035);
  --border-subtle: rgba(15, 23, 42, 0.11);
  --border-active: rgba(79, 70, 229, 0.45);
  --border-glow: rgba(8, 145, 178, 0.35);

  --color-primary: #4f46e5;
  --color-cyan: #0891b2;
  --color-emerald: #059669;
  --color-amber: #b45309;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-inverse: #ffffff;

  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, 0.16);
  --shadow-lg: 0 22px 44px -18px rgba(15, 23, 42, 0.22);
  --shadow-glow-indigo: 0 0 30px -8px rgba(79, 70, 229, 0.28);
  --shadow-glow-cyan: 0 0 30px -8px rgba(8, 145, 178, 0.26);
  --shadow-glow-emerald: 0 0 30px -8px rgba(5, 150, 105, 0.26);

  color-scheme: light;
}

html[data-theme='light'] .glow-orb {
  opacity: 0.14;
}

html[data-theme='light'] .glow-grid {
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
}



html[data-theme='light'] .app-icon-box,
html[data-theme='light'] .flagship-icon,
html[data-theme='light'] .modal-icon-wrap {
  background: #ffffff;
}

/* --- Skip link ---------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -140%);
  z-index: 200;
  padding: 12px 22px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--color-primary);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
}

/* --- Visible focus for keyboard users ----------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.btn-play-header:focus-visible,
.btn-flagship:focus-visible,
.btn-primary-action:focus-visible,
.category-pill:focus-visible,
.nav-link:focus-visible {
  outline-offset: 4px;
}

/* Pointer users keep the clean look */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- Theme toggle ------------------------------------------------------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast),
              background var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text-main);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.theme-toggle .theme-icon {
  width: 18px;
  height: 18px;
}

html[data-theme='dark'] .theme-icon-sun { display: block; }
html[data-theme='dark'] .theme-icon-moon { display: none; }
html[data-theme='light'] .theme-icon-sun { display: none; }
html[data-theme='light'] .theme-icon-moon { display: block; }

/* --- Detail modal (styles moved out of inline attributes) --------------- */

.detail-icon-wrap {
  width: 64px;
  height: 64px;
}

.detail-package {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.detail-block {
  margin-bottom: 22px;
}

.detail-subheading {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.detail-body {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.detail-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  list-style: none;
}

.detail-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.detail-feature i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--color-emerald);
}

.detail-actions {
  display: flex;
  gap: 10px;
}

.detail-primary {
  flex: 1;
}

.detail-share {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.qr-fallback {
  padding: 24px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Polish ------------------------------------------------------------- */

/* Sticky header would otherwise cover anchored sections */
#hero, #featured, #projects, #web-platforms, #main-content {
  scroll-margin-top: 96px;
}

.hero-headline,
.section-heading {
  text-wrap: balance;
}

.hero-subline,
.section-subtext {
  text-wrap: pretty;
}

::selection {
  background: var(--color-primary);
  color: #ffffff;
}

/* Images never overflow their box, and keep their ratio while loading */
img {
  max-width: 100%;
  height: auto;
}

/* A quieter scrollbar that follows the theme */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
  background-clip: content-box;
}

/* Cards settle a little more deliberately */
.project-card,
.flagship-card,
.stat-card {
  transition: transform var(--transition-smooth), border-color var(--transition-normal),
              box-shadow var(--transition-smooth), background var(--transition-normal);
  will-change: transform;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
}

/* Tables of tags wrap rather than overflow on narrow screens */
.card-tags,
.flagship-tags {
  flex-wrap: wrap;
}

/* --- Reduced motion ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .glow-orb {
    animation: none;
  }

  .project-card:hover,
  .flagship-card:hover,
  .stat-card:hover {
    transform: none;
  }
}

/* --- Forced colours (Windows high-contrast) ----------------------------- */

@media (forced-colors: active) {
  .glow-bg {
    display: none;
  }

  .project-card,
  .flagship-card,
  .stat-card,
  .modal-card {
    border: 1px solid CanvasText;
  }
}

/* The hidden attribute must win over component display rules */
[hidden] {
  display: none !important;
}

/* ==========================================================================
   LIGHT THEME CORRECTIONS
   The base sheet hardcodes #ffffff for text that sits on the page background,
   and uses white-translucent fills for glass surfaces. Both disappear on a
   light canvas, so they are re-pointed at theme tokens here.
   ========================================================================== */

/* Text that sits directly on the page background */
html[data-theme='light'] .brand-title,
html[data-theme='light'] .hero-headline,
html[data-theme='light'] .stat-number,
html[data-theme='light'] .section-heading,
html[data-theme='light'] .flagship-title,
html[data-theme='light'] .card-title,
html[data-theme='light'] .empty-title,
html[data-theme='light'] .footer-links-col h4,
html[data-theme='light'] .modal-header-text h3,
html[data-theme='light'] .detail-subheading,
html[data-theme='light'] .search-input-wrapper input {
  color: var(--text-main);
}

/* Glass surfaces: swap white-translucent for ink-translucent */
html[data-theme='light'] .nav-link:hover,
html[data-theme='light'] .nav-link.active,
html[data-theme='light'] .view-btn:hover,
html[data-theme='light'] .view-btn.active {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.07);
}

html[data-theme='light'] .btn-icon-action,
html[data-theme='light'] .btn-card-icon {
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.04);
}

html[data-theme='light'] .btn-icon-action:hover,
html[data-theme='light'] .btn-card-icon:hover,
html[data-theme='light'] .modal-close-btn:hover,
html[data-theme='light'] .social-link:hover,
html[data-theme='light'] .search-clear-btn:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.08);
}

/* The active filter pill needs a solid fill to carry white text */
html[data-theme='light'] .category-pill.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-cyan));
  border-color: transparent;
}

html[data-theme='light'] .category-pill:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.05);
}

html[data-theme='light'] .category-pill.active:hover {
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-cyan));
}

html[data-theme='light'] .pill-count {
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
}

html[data-theme='light'] .category-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.25);
}

/* Badges and chips */
html[data-theme='light'] .hero-badge,
html[data-theme='light'] .live-pill,
html[data-theme='light'] .flagship-badge,
html[data-theme='light'] .card-tag,
html[data-theme='light'] .tag,
html[data-theme='light'] .search-shortcut {
  background: rgba(15, 23, 42, 0.05);
  border-color: var(--border-subtle);
}

html[data-theme='light'] .card-package,
html[data-theme='light'] .flagship-url {
  color: var(--text-dim);
}

/* Search field */
html[data-theme='light'] .search-input-wrapper {
  background: #ffffff;
  border-color: var(--border-subtle);
}

html[data-theme='light'] .search-input-wrapper input::placeholder {
  color: var(--text-dim);
}

/* Modals sit on a dark scrim in both themes; lighten the scrim for light mode */
html[data-theme='light'] .modal-backdrop {
  background: rgba(15, 23, 42, 0.45);
}

html[data-theme='light'] .modal-card {
  background: #ffffff;
}

/* Footer and separators */
html[data-theme='light'] .footer,
html[data-theme='light'] .footer-bottom {
  border-color: var(--border-subtle);
}

/* --- Surfaces whose colour was hardcoded dark in the base sheet ---------- */

html[data-theme='light'] .header-container {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--border-subtle);
}

html[data-theme='light'] .flagship-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 253, 0.98) 100%);
}

html[data-theme='light'] .project-card {
  background: rgba(255, 255, 255, 0.9);
}

html[data-theme='light'] .app-icon-box {
  background: #f1f5f9;
}

html[data-theme='light'] .live-pill {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.25);
}

html[data-theme='light'] .results-bar {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--border-subtle);
}

/* --- Badge no longer collides with the flagship title -------------------- */

.flagship-badge {
  white-space: nowrap;
  z-index: 2;
}

.flagship-header {
  padding-right: 150px;
}

@media (max-width: 640px) {
  .flagship-badge {
    position: static;
    align-self: flex-start;
    margin-bottom: 16px;
  }

  .flagship-header {
    padding-right: 0;
  }
}

/* --- Light-theme contrast corrections (WCAG AA) -------------------------- */

/* The card CTA is a glass button with white text in dark mode; on a light
   canvas that is invisible, so it gets ink text until it is hovered. */
html[data-theme='light'] .btn-primary-action {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.05);
  border-color: var(--border-subtle);
}

html[data-theme='light'] .btn-primary-action:hover,
html[data-theme='light'] .btn-primary-action:hover span {
  color: #ffffff;
}

/* Accent text tuned for a light background */
html[data-theme='light'] .hero-badge,
html[data-theme='light'] .hero-badge span {
  color: var(--color-primary);
}

html[data-theme='light'] .live-text {
  color: #047857;
}

html[data-theme='light'] .section-tag,
html[data-theme='light'] .card-category-badge {
  color: #0e7490;
}

html[data-theme='light'] .tag,
html[data-theme='light'] .card-tag,
html[data-theme='light'] .flagship-url,
html[data-theme='light'] .footer-bottom p,
html[data-theme='light'] .footer-vps-badge {
  color: var(--text-muted);
}

html[data-theme='light'] .search-shortcut {
  color: var(--text-dim);
}

/* --- Dark-theme contrast corrections (WCAG AA) --------------------------- */

/* --text-dim sat at 4.18:1 on the page background; nudged to clear 4.5:1 */
:root,
html[data-theme='dark'] {
  --text-dim: #7d8da4;
}

/* White on --color-primary was 4.47:1; a deeper indigo clears AA */
.skip-link {
  background: #4338ca;
}

/* --- Header fits small screens without horizontal overflow -------------- */

@media (max-width: 768px) {
  /* The project count is repeated in the directory below; drop it here */
  .live-pill {
    display: none;
  }

  .header-container {
    gap: 10px;
  }

  .brand-logo {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  /* Collapse the store button to its icon */
  .btn-play-header span {
    display: none;
  }

  .btn-play-header {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
  }

  .brand-sub {
    font-size: 0.55rem;
  }
}

/* Sub-Apps Preview in Card */
.card-subapps-preview {
  margin: 12px 0 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subapps-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.subapps-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subapp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-full);
  padding: 3px 10px 3px 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
  text-decoration: none;
  transition: var(--transition-fast);
}

.subapp-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
  transform: translateY(-1px);
}

html[data-theme='light'] .subapp-chip {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.12);
  color: #1e293b;
}

html[data-theme='light'] .subapp-chip:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: #4338ca;
}

.subapp-chip img {
  border-radius: 50%;
  display: block;
}

/* Modal Sub-Apps Grid (DevIt Wallpapers Suite) */
.modal-subapps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.modal-subapp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

.modal-subapp-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.modal-subapp-icon {
  border-radius: 10px;
  flex-shrink: 0;
}

.modal-subapp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.modal-subapp-info strong {
  font-size: 0.85rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-subapp-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-subapp-play {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.btn-subapp-play svg {
  width: 12px;
  height: 12px;
}

/* Modal Sub-Apps List (Wallpaper Apps Chooser Dialog) */
.modal-subapps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.modal-subapp-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition-fast);
}

.modal-subapp-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
}

.modal-subapp-row .modal-subapp-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.modal-subapp-row .modal-subapp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-subapp-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-subapp-title-row strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-subapp-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

.modal-subapp-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.btn-subapp-install {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  flex-shrink: 0;
  transition: var(--transition-fast);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-subapp-install:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
  color: #ffffff;
  transform: scale(1.03);
}

.btn-subapp-install svg {
  width: 14px;
  height: 14px;
}

/* Light mode overrides for subapps dialog */
html[data-theme='light'] .modal-subapp-row {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme='light'] .modal-subapp-row:hover {
  background: #f1f5f9;
  border-color: rgba(99, 102, 241, 0.35);
}

html[data-theme='light'] .modal-subapp-title-row strong {
  color: #0f172a;
}

html[data-theme='light'] .modal-subapp-tag {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.2);
}

html[data-theme='light'] .modal-subapp-desc {
  color: #475569;
}

html[data-theme='light'] .modal-subapp-card {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme='light'] .modal-subapp-card:hover {
  background: #f1f5f9;
  border-color: rgba(99, 102, 241, 0.35);
}

html[data-theme='light'] .modal-subapp-info strong {
  color: #0f172a;
}

@media (max-width: 600px) {
  .modal-subapp-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .btn-subapp-install {
    width: 100%;
    justify-content: center;
  }
}

/* Modal Platforms Grid (Siya9a Maroc multi-platform links) */
.modal-platforms-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.modal-platform-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

.modal-platform-card:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateX(4px);
}

.modal-platform-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  flex-shrink: 0;
}

.modal-platform-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-platform-info strong {
  font-size: 0.9rem;
  color: #ffffff;
}

.modal-platform-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modal-platform-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.modal-platform-card:hover .modal-platform-arrow {
  color: #ffffff;
  transform: translate(2px, -2px);
}

@media (max-width: 640px) {
  .modal-subapps-grid {
    grid-template-columns: 1fr;
  }
}
