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

:root {
  --bg: #000000;
  --surface: #0a0a0a;
  --card-bg: #111111;
  --card-hover: #1a1a1a;
  --border: #1f1f1f;
  --text-primary: #ededed;
  --text-secondary: #a1a1a1;
  --text-muted: #666666;
  --accent: #ededed;
  --radius: 12px;
  --font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Navbar ── */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 32px;
}

.nav-logo {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text-primary); }

/* ── Bento Grid ── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 180px;
  gap: 12px;
}

/* Repeating pattern — 7-card cycle */
/* Card 1: col 1-2, row span 2 (tall-wide) */
.blog-card:nth-child(7n+1) { grid-column: span 2; grid-row: span 2; }
/* Card 2: col 3-4, row span 1 */
.blog-card:nth-child(7n+2) { grid-column: span 2; grid-row: span 1; }
/* Card 3: col 5-6, row span 1 */
.blog-card:nth-child(7n+3) { grid-column: span 2; grid-row: span 1; }
/* Card 4: col 3-4, row span 2 */
.blog-card:nth-child(7n+4) { grid-column: span 2; grid-row: span 2; }
/* Card 5: col 5-6, row span 2 */
.blog-card:nth-child(7n+5) { grid-column: span 2; grid-row: span 2; }
/* Card 6: col 1-2, row span 1 */
.blog-card:nth-child(7n+6) { grid-column: span 2; grid-row: span 1; }
/* Card 7: col 3-6, row span 1 (wide) */
.blog-card:nth-child(7n+7) { grid-column: span 4; grid-row: span 1; }

.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, background 0.2s;
}

.blog-card:hover {
  border-color: #333;
  background: var(--card-hover);
}

.blog-card:hover .card-img {
  transform: scale(1.03);
}

.card-img-wrap {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
}

/* Wide card (7n+7) — horizontal layout */
.blog-card:nth-child(7n+7) {
  flex-direction: row;
}

.blog-card:nth-child(7n+7) .card-img-wrap {
  width: 260px;
  flex-shrink: 0;
}

.blog-card:nth-child(7n+7) .card-footer {
  flex: 1;
  border-top: none;
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 16px;
}

.blog-card:nth-child(7n+7) .card-title {
  font-size: 14px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Skeleton ── */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border: 1px solid var(--border);
}

.skeleton-grid {
  display: contents;
}

.skeleton.card-large  { grid-column: span 2; grid-row: span 2; }
.skeleton.card-tall   { grid-column: span 2; grid-row: span 2; }
.skeleton.card-medium { grid-column: span 2; grid-row: span 2; }
.skeleton.card-small  { grid-column: span 2; grid-row: span 1; }
.skeleton.card-wide   { grid-column: span 4; grid-row: span 1; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 24px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #111111;
  border: 1px solid #222;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 24px 64px rgba(0,0,0,0.6);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px 0;
  flex-shrink: 0;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  transition: color 0.15s;
}

.visit-link:hover { color: var(--text-primary); }

.modal-cover {
  width: 100%;
  height: 240px;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 12px;
}

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

.modal-body {
  padding: 20px 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-body h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.modal-body p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 200px;
  }

  .blog-card:nth-child(7n+1),
  .blog-card:nth-child(7n+2),
  .blog-card:nth-child(7n+3),
  .blog-card:nth-child(7n+4),
  .blog-card:nth-child(7n+5),
  .blog-card:nth-child(7n+6) {
    grid-column: span 1;
    grid-row: span 1;
  }

  .blog-card:nth-child(7n+7) {
    grid-column: span 2;
    grid-row: span 1;
    flex-direction: column;
  }

  .blog-card:nth-child(7n+7) .card-img-wrap { width: 100%; }
  .blog-card:nth-child(7n+7) .card-footer {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .modal-cover { height: 180px; }
}

@media (max-width: 480px) {
  .page-wrapper { padding: 16px 16px 48px; }
  .bento-grid { grid-template-columns: 1fr; }
  .blog-card:nth-child(7n+7) { grid-column: span 1; }
}
