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

:root {
  --bg: #0d0d0f;
  --surface: #18181b;
  --surface2: #27272a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --border: #3f3f46;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,15,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.brand p  { font-size: 0.75rem; color: var(--text-muted); }

nav { display: flex; gap: 1.5rem; }
nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}
nav a:hover { color: var(--text); }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #0d0d0f 60%);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #fff 30%, var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ── Main / Toolbar ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

#search {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
#search:focus { border-color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.filter-btn {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

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

.loading {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 0;
}

.empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 0;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 0.25rem;
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.tag {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--surface2);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.card-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-hover); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow);
  transform: scale(0.96);
  transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: scale(1); }

.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); }

.modal h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.modal p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer a { color: var(--accent-hover); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 540px) {
  .header-inner { flex-direction: column; height: auto; padding: 0.75rem 1rem; gap: 0.25rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  #search { min-width: unset; }
}
