/* ===========================================================
   FileVault - style.css
   Premium, responsive, themeable. No frameworks.
   =========================================================== */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow:    0 6px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 24px 48px rgba(0,0,0,.18), 0 8px 16px rgba(0,0,0,.08);

  --container: 1200px;
  --transition: 200ms cubic-bezier(.2,.8,.2,1);

  --grad-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --grad-2: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);

  /* DEFAULT = DARK (per spec). Variables below are the dark palette. */
  --bg:           #0b0d12;
  --bg-elev:      #11141b;
  --bg-elev-2:    #161a23;
  --bg-card:      #131724;
  --bg-card-hi:   #1a1f2e;
  --border:       #232938;
  --border-hi:    #2e3548;
  --text:         #e6e8ee;
  --text-dim:     #9aa3b2;
  --text-mute:    #6b7384;
  --primary:      #7c5cff;
  --primary-hi:   #9b85ff;
  --primary-soft: rgba(124,92,255,.16);
  --accent:       #22d3ee;
  --topbar-bg:    rgba(11,13,18,0.78);
}

/* LIGHT theme override */
[data-theme="light"] {
  --bg:           #f7f8fb;
  --bg-elev:      #ffffff;
  --bg-elev-2:    #f1f3f9;
  --bg-card:      #ffffff;
  --bg-card-hi:   #fafbff;
  --border:       #e6e8ef;
  --border-hi:    #d4d8e2;
  --text:         #0f172a;
  --text-dim:     #475569;
  --text-mute:    #94a3b8;
  --primary:      #5b3df5;
  --primary-hi:   #7c5cff;
  --primary-soft: rgba(91,61,245,.10);
  --accent:       #0891b2;
  --topbar-bg:    rgba(247,248,251,0.78);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(800px 400px at 80% -10%, rgba(124,92,255,.22), transparent 60%),
    radial-gradient(700px 400px at 0% 0%, rgba(34,211,238,.12), transparent 60%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}
[data-theme="light"] body {
  background-image:
    radial-gradient(800px 400px at 80% -10%, rgba(91,61,245,.10), transparent 60%),
    radial-gradient(700px 400px at 0% 0%, rgba(8,145,178,.08), transparent 60%);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }
::selection { background: var(--primary-soft); color: var(--text); }

/* ---------- Container ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex; align-items: center; gap: 16px;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: var(--text);
}
.brand__logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--grad-1);
  color: white;
  box-shadow: 0 6px 16px rgba(124,92,255,.35);
}
.brand__logo svg { width: 18px; height: 18px; }
.brand__name { font-weight: 800; }

.topbar__search {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  height: 40px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  transition: border-color var(--transition), background-color var(--transition);
  max-width: 520px;
  margin: 0 auto;
}
.topbar__search:focus-within {
  border-color: var(--primary);
  background: var(--bg-elev);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.topbar__search svg { width: 16px; height: 16px; flex-shrink: 0; }
.topbar__search input {
  flex: 1;
  background: transparent;
  border: 0; outline: 0;
  color: var(--text);
}
.topbar__search input::placeholder { color: var(--text-mute); }

.topbar__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all var(--transition);
  position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-hi); background: var(--bg-card-hi); }
.icon-btn svg { width: 18px; height: 18px; }

/* Sun/moon swap — controlled by data-theme on <html>.
   Default state (dark theme): show sun, hide moon.
   The icon you see means "click to switch to this theme". */
.theme-icon { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .2s; }
.theme-icon--sun  { opacity: 1; }
.theme-icon--moon { opacity: 0; }
[data-theme="light"] .theme-icon--sun  { opacity: 0; }
[data-theme="light"] .theme-icon--moon { opacity: 1; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 32px; position: relative; overflow: hidden; }
.eyebrow {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-hi);
  font-size: 12px; font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid var(--primary-soft);
  margin-bottom: 18px;
}
.hero__title {
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.grad {
  background: var(--grad-1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__sub {
  max-width: 640px;
  color: var(--text-dim);
  font-size: 17px;
  margin: 0 0 36px;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.stat { padding: 8px 12px; }
.stat__num {
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  background: var(--grad-2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}
.stat__label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 4px;
}

/* ---------- Filters ---------- */
.filters { padding: 24px 0 8px; }
.filters__row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.chip:hover { color: var(--text); border-color: var(--border-hi); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip__count {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--primary-soft);
  color: var(--primary-hi);
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-mono);
}
.chip.is-active .chip__count { background: rgba(127,127,127,.22); color: inherit; }

/* ---------- Grid ---------- */
.main { padding: 24px 0 80px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  min-height: 40px;
}

/* ---------- Card ----------
   Cards are visible by default. Any animation is layered ON TOP
   via opacity/transform; we never start from opacity: 0 in a way
   that the card can stay invisible. */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  overflow: hidden;
  opacity: 1;
  visibility: visible;
}

.card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 60%, var(--primary-soft) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow-lg);
}
.card:hover::before { opacity: .5; }

.card__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 14px;
}
.card__icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-hi);
  flex-shrink: 0;
}
.card__icon svg { width: 22px; height: 22px; }

/* Per-icon accent colors */
.icon-windows  { background: rgba(59,130,246,.14);  color: #3b82f6; }
.icon-office   { background: rgba(239,68,68,.14);   color: #ef4444; }
.icon-driver   { background: rgba(245,158,11,.14);  color: #f59e0b; }
.icon-tool     { background: rgba(124,92,255,.14);  color: #7c5cff; }
.icon-adobe    { background: rgba(236,72,153,.14);  color: #ec4899; }
.icon-video    { background: rgba(34,211,238,.14);  color: #22d3ee; }
.icon-audio    { background: rgba(34,197,94,.14);   color: #22c55e; }
.icon-disc     { background: rgba(168,85,247,.14);  color: #a855f7; }
.icon-game     { background: rgba(244,114,182,.14); color: #f472b6; }
.icon-linux    { background: rgba(251,191,36,.14);  color: #fbbf24; }
.icon-mac      { background: rgba(148,163,184,.18); color: #94a3b8; }
.icon-android  { background: rgba(132,204,22,.14);  color: #84cc16; }
.icon-pdf      { background: rgba(239,68,68,.14);   color: #ef4444; }
.icon-doc      { background: rgba(59,130,246,.14);  color: #3b82f6; }
.icon-ppt      { background: rgba(249,115,22,.14);  color: #f97316; }
.icon-xls      { background: rgba(34,197,94,.14);   color: #22c55e; }
.icon-archive  { background: rgba(245,158,11,.14);  color: #f59e0b; }
.icon-exec     { background: rgba(124,92,255,.14);  color: #7c5cff; }
.icon-file     { background: var(--primary-soft);   color: var(--primary-hi); }

.card__title {
  font-size: 16px; font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card__desc {
  font-size: 13.5px; line-height: 1.5;
  color: var(--text-dim);
  margin: 0 0 16px;
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.muted { color: var(--text-mute); font-style: italic; }

.card__meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: auto;
  padding: 12px 0 16px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.meta {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
}
.meta svg { width: 12px; height: 12px; opacity: .8; }
.dl-count { font-weight: 600; color: var(--text); }

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  border-radius: 6px;
  text-transform: uppercase;
}
.badge--new {
  background: var(--grad-1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,92,255,.35);
}
.badge--new { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(124,92,255,.35); }
  50%      { box-shadow: 0 4px 20px rgba(124,92,255,.55); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 13.5px; font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn--primary {
  background: var(--grad-1);
  color: #fff;
  box-shadow: 0 6px 16px rgba(124,92,255,.30);
}
.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(124,92,255,.42);
}
.btn--primary:active { transform: translateY(0); }

.card__btn { width: 100%; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 80px 20px; color: var(--text-dim); }
.empty svg { width: 56px; height: 56px; margin: 0 auto 16px; opacity: .4; }
.empty h3 { margin: 0 0 6px; color: var(--text); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-mute);
  font-size: 13px;
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar__search { margin: 0; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .topbar__inner { gap: 10px; }
  .brand__name { display: none; }
  .hero { padding: 48px 0 24px; }
  .hero__title { font-size: 34px; }
  .hero__sub { font-size: 15px; }
  .stat__num { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .filters__row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .chip-group { flex-wrap: nowrap; }
  .chip { flex-shrink: 0; }
}

/* Reduced motion: kill ALL animations, including the new-badge pulse. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
