/* ============================================================
   style.css — Design System
   ============================================================
   Palette, glassmorphism, responsive grid, animations.
   Only transform + opacity animated for GPU compositing.
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap");

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  --bg: #0b0f14;
  --panel: rgba(16, 23, 30, 0.65);
  --card: rgba(24, 32, 42, 0.65);
  --card-hover: rgba(30, 40, 54, 0.75);
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.18);
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.15);
  --accent-hover: #22c55e;
  --text: #e5e7eb;
  --text-secondary: #9ca3af;
  --muted: #6b7280;
  --danger: #f87171;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration: 0.4s;
  --duration-fast: 0.25s;
  --blur: 20px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --max-width: 1200px;
  --gap: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
  --gold: #d4a017;
  --gold-dim: rgba(212, 160, 23, 0.15);
  --gold-glow: 0 0 15px rgba(212, 160, 23, 0.18);
}

/* ── Base Reset ───────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ── Background Layer ─────────────────────────────────────── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.bg-layer::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: url("assets/bg.jpg") center / cover no-repeat;
  filter: blur(28px) saturate(0.6);
  transform: scale(1.1);
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 15, 20, 0.82) 0%,
    rgba(11, 15, 20, 0.7) 30%,
    rgba(11, 15, 20, 0.85) 100%
  );
}

/* ── Main Container ───────────────────────────────────────── */
.main-container {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── Hero Section ─────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 80px 0 48px;
  will-change: transform, opacity;
}

.hero-title {
  font-family: "Outfit", sans-serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.5;
}

.hero-categories {
  display: block;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.85;
  margin-top: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Glassmorphism Panel ──────────────────────────────────── */
.glass-panel {
  background: var(--panel);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Controls Section ─────────────────────────────────────── */
.controls {
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.search-wrapper {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition:
    border-color var(--duration-fast) var(--ease),
    background var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
  outline: none;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.result-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  padding-right: 8px;
}

/* ── Category Tabs ────────────────────────────────────────── */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.tab {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition:
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    transform 200ms var(--ease);
  white-space: nowrap;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tab-active {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
  border-color: rgba(74, 222, 128, 0.25);
}

/* ── Subcategory Chips ────────────────────────────────────── */
.subcategory-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  padding: 0 4px;
  will-change: transform, opacity;
}

.chip {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-active {
  background: rgba(74, 222, 128, 0.1);
  color: var(--accent);
  border-color: rgba(74, 222, 128, 0.2);
}

/* ── Resource Grid ────────────────────────────────────────── */
.resource-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
  min-height: 50px;
}

/* ── Featured Section ─────────────────────────────────────── */
.featured-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.featured-section:empty {
  display: none !important;
}

/* ── Resource Card ────────────────────────────────────────── */
.resource-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition:
    transform var(--duration) var(--ease),
    background var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  will-change: transform, opacity;
  outline: none;
}

.resource-card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.resource-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Featured Variant */
.resource-card.featured {
  border-color: var(--gold-dim);
  background: linear-gradient(135deg, rgba(24, 32, 42, 0.8) 0%, rgba(30, 40, 54, 0.7) 100%);
  position: relative;
  overflow: hidden;
}

.resource-card.featured::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, #f5d67a 0%, var(--gold) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.35;
  transition: opacity var(--duration) var(--ease);
}

.resource-card.featured:hover {
  box-shadow: var(--gold-glow), var(--shadow-hover);
}

.resource-card.featured:hover::before {
  opacity: 1;
}

.featured-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 3px 8px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #f5d67a 0%, var(--gold) 100%);
  color: #0b0f14;
  border-radius: 999px;
  z-index: 2;
  box-shadow: 0 2px 10px rgba(212, 160, 23, 0.4);
}

/* Card Hidden (for scroll-reveal & filter animation) */
.card-hidden {
  opacity: 0;
  transform: translateY(20px);
}

.card-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--duration) var(--ease),
    transform var(--duration) var(--ease);
}

/* ── Card Inner Elements ──────────────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-favicon-container {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.card-favicon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
  color: #fff;
}

.card-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Platforms */
.platforms {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.platform-item {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  opacity: 0.7;
  font-size: 16px;
  transition: opacity 0.2s;
}

.platform-item i {
  display: block;
}


.card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.card-tag {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  transition:
    transform var(--duration) var(--ease),
    background var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:hover {
  transform: translateY(-3px);
}

.btn:active {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon {
  flex-shrink: 0;
}

.btn-download {
  background: var(--accent);
  color: #0b0f14;
  box-shadow: 0 2px 12px rgba(74, 222, 128, 0.25);
}

.btn-download:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(74, 222, 128, 0.35);
}

.btn-official {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-official:hover {
  border-color: var(--text-secondary);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* ── No Results ───────────────────────────────────────────── */
.no-results {
  display: none;
  justify-content: center;
  align-items: center;
  padding: 60px 24px;
}

.no-results-content {
  text-align: center;
  max-width: 360px;
}

.no-results-icon {
  color: var(--muted);
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.no-results-content p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.no-results-content strong {
  color: var(--text-secondary);
}

.no-results-hint {
  margin-top: 8px;
  font-size: 0.82rem !important;
}

/* ── Modal Overlay ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    background var(--duration) var(--ease),
    backdrop-filter var(--duration) var(--ease);
}

.modal-overlay.modal-active {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  background: var(--panel);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  padding: 36px;
  max-width: 520px;
  width: 100%;
  position: relative;
  will-change: transform, opacity;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal-header {
  margin-bottom: 16px;
  padding-right: 40px;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-category {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  color: var(--accent);
}

.modal-subcategory {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.modal-tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 40px 24px 32px;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--accent);
  transition: opacity var(--duration-fast) var(--ease);
}

.site-footer a:hover {
  opacity: 0.8;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    padding: 56px 0 32px;
  }

  .controls {
    padding: 16px;
    gap: 12px;
  }

  .resource-grid,
  .featured-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .featured-section {
    border-bottom: none;
    padding-bottom: 0;
  }

  .resource-card {
    padding: 20px;
  }

  .category-tabs {
    gap: 6px;
  }

  .tab {
    padding: 7px 14px;
    font-size: 0.8rem;
  }

  .modal-content {
    padding: 24px;
    margin: 0 8px;
  }

  .modal-title {
    font-size: 1.2rem;
  }

  .card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .result-count {
    width: 100%;
    text-align: right;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.7rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .main-container {
    padding: 0 12px 60px;
  }

  .tab {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .btn {
    padding: 8px 14px;
    font-size: 0.78rem;
  }
}

@media (min-width: 1024px) {
  .resource-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

/* ── Accessibility: Reduced Motion ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .card-hidden {
    opacity: 1;
    transform: none;
  }
}

/* ── Selection ────────────────────────────────────────────── */
::selection {
  background: var(--accent-dim);
  color: var(--text);
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
