@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

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

:root {
  --void: #06080d;
  --deep: #0a0e18;
  --ink: #0f1422;
  --slate: #1a2035;
  --mist: #8892a8;
  --silver: #c4cce0;
  --white: #eef1f7;
  --blue-dim: #2a2e36;
  --blue: #5a6070;
  --blue-bright: #8890a0;
  --blue-glow: #a0a8b8;
  --cyan: #9ca3b0;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--void);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ========== HEADER ========== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  background: rgba(6, 8, 13, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(26, 32, 53, 0.6);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--white);
}

.logo span {
  color: var(--blue-bright);
}

.header-tagline {
  font-size: 0.75rem;
  color: var(--mist);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ========== FILTER BAR ========== */

.filter-bar {
  padding: 1.5rem 2.5rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 1px solid var(--slate);
  background: var(--slate);
  color: var(--mist);
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.filter-pill:hover {
  border-color: var(--blue);
  color: var(--white);
  background: rgba(90, 96, 112, 0.3);
}

.filter-pill.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

/* ========== MASONRY GRID ========== */

.masonry-grid {
  column-count: 3;
  column-gap: 1.5rem;
  padding: 2rem 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1100px) {
  .masonry-grid {
    column-count: 2;
  }
}

@media (max-width: 680px) {
  .masonry-grid {
    column-count: 1;
    padding: 1.5rem 1rem;
  }

  .filter-bar {
    padding: 1rem;
  }

  .site-header {
    padding: 1rem 1.25rem;
  }
}

/* ========== ARTICLE CARD ========== */

.card {
  break-inside: avoid;
  background: var(--ink);
  border: 1px solid var(--slate);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--blue-dim);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(136, 144, 160, 0.15);
}

.card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 1.25rem;
}

.card-category {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue-bright);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--white);
  margin-bottom: 0.6rem;
}

.card-excerpt {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--mist);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-date {
  font-size: 0.7rem;
  color: var(--blue-dim);
  border-top: 1px solid rgba(26, 32, 53, 0.8);
  padding-top: 0.75rem;
}

/* ========== EMPTY STATE ========== */

.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--mist);
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--silver);
}

.empty-state p {
  font-size: 0.9rem;
}

/* ========== LOADING STATE ========== */

.loading-grid {
  column-count: 3;
  column-gap: 1.5rem;
  padding: 2rem 2.5rem;
}

@media (max-width: 1100px) {
  .loading-grid { column-count: 2; }
}

@media (max-width: 680px) {
  .loading-grid { column-count: 1; }
}

.skeleton-card {
  break-inside: avoid;
  background: var(--ink);
  border: 1px solid var(--slate);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
}

.skeleton-line {
  background: linear-gradient(90deg, var(--slate) 25%, var(--deep) 50%, var(--slate) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 12px;
  margin-bottom: 0.6rem;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.full { width: 100%; }
.skeleton-line.title { height: 20px; width: 85%; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========== FOOTER ========== */

.site-footer {
  text-align: center;
  padding: 2.5rem;
  color: var(--mist);
  font-size: 0.78rem;
  border-top: 1px solid rgba(26, 32, 53, 0.5);
  margin-top: 2rem;
}

/* ========== ARTICLE PAGE ========== */

.article-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem 2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--mist);
  margin-bottom: 2rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--blue-bright);
}

.article-category {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-bright);
  margin-bottom: 1rem;
  font-weight: 500;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.2;
  color: var(--white);
  margin-bottom: 1rem;
}

.article-meta {
  font-size: 0.78rem;
  color: var(--mist);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--slate);
}

.article-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--silver);
}

/* Article typography */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-family: var(--font-display);
  color: var(--white);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-content h1 { font-size: 2rem; }
.article-content h2 { font-size: 1.5rem; }
.article-content h3 { font-size: 1.25rem; }
.article-content h4 { font-size: 1.1rem; }

.article-content p {
  margin-bottom: 1.25rem;
}

.article-content ul,
.article-content ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

.article-content li {
  margin-bottom: 0.4rem;
}

.article-content blockquote {
  border-left: 3px solid var(--blue);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--mist);
  font-style: italic;
}

.article-content code {
  background: var(--slate);
  color: var(--cyan);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'Courier New', Courier, monospace;
}

.article-content pre {
  background: var(--deep);
  border: 1px solid var(--slate);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: 0.88em;
}

.article-content a {
  color: var(--blue-bright);
  text-decoration: underline;
  text-decoration-color: rgba(136, 144, 160, 0.3);
  transition: text-decoration-color 0.2s;
}

.article-content a:hover {
  text-decoration-color: var(--blue-bright);
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--slate);
  margin: 2rem 0;
}

/* Article loading / error states */
.article-loading {
  max-width: 720px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
  color: var(--mist);
}

.article-not-found {
  max-width: 720px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
}

.article-not-found h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--white);
  margin-bottom: 1rem;
}

.article-not-found p {
  color: var(--mist);
  margin-bottom: 2rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  background: var(--blue);
  color: var(--white);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-back:hover {
  background: var(--blue-bright);
}
