/* --- Variables & Core Layout --- */
:root {
  --blog-background: var(--bg-color);
  --blog-foreground: var(--text-color);
  --blog-border: rgba(0, 0, 0, 0.12);
  --blog-secondary: rgba(0, 0, 0, 0.08);
  --blog-secondary-foreground: var(--text-color);
  --blog-muted-foreground: rgba(0, 0, 0, 0.6);
  --blog-radius: 999px;
}

[data-theme="dark"] {
  --blog-border: rgba(255, 255, 255, 0.16);
  --blog-secondary: rgba(255, 255, 255, 0.12);
  --blog-muted-foreground: rgba(255, 255, 255, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blog-border: rgba(255, 255, 255, 0.16);
    --blog-secondary: rgba(255, 255, 255, 0.12);
    --blog-muted-foreground: rgba(255, 255, 255, 0.7);
  }
}

.site-header {
  margin-bottom: 0rem;
}

.writing-index-page {
  margin-top: 2.5rem;
}

@media (min-width: 1024px) {
  .writing-index-page {
    margin-top: 1.5rem;
  }
}

.blog-index {
  background-color: var(--blog-background);
  color: var(--blog-foreground);
  min-height: 100vh;
  padding: 48px 0 64px;
}

.blog-index__content {
  width: 100%;
  padding: 0 24px;
  margin: 0 auto;
}

.blog-index__header {
  margin-bottom: 56px;
  text-align: center;
}

.blog-index__title {
  font-family: var(--font-heading);
  font-weight: bold;
  font-size: 1.5rem;
  font-variant: small-caps;
  margin-bottom: 1rem;
  margin-top: 0;
  
}

.blog-index__subtitle {
  font-size: var(--base-font-size);
  line-height: var(--base-line-height);
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

/* --- Tabs --- */
.tabs-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 64px;
  flex-wrap: wrap;
}

.filter-tab.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background-color: var(--blog-secondary);
  color: var(--blog-secondary-foreground);
  border-radius: var(--blog-radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--blog-border);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-tab.tab:hover {
  border-color: var(--blog-muted-foreground);
}

.filter-tab.tab.active {
  background-color: var(--blog-foreground);
  color: var(--blog-background);
  border-color: var(--blog-foreground);
}

.tab-icon-wrapper {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon-wrapper svg {
  width: 100%;
  height: 100%;
}

.tab-label {
  white-space: nowrap;
}

/* --- List --- */
.list-container {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--blog-border);
}

.list-item:last-child {
  border-bottom: none;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

/* --- Grid Layout for Articles --- */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}

@media (min-width: 640px) {
  .articles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (min-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.article-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background-color: var(--bg-color);
  border: 1px solid var(--blog-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.article-card:hover {
  border-color: var(--blog-muted-foreground);
}


.article-card.aspect-single {
  grid-column: span 1;
  aspect-ratio: 1 / 1;
}

.article-card.aspect-double {
  aspect-ratio: 2 / 1;
}

@media (min-width: 640px) {
  .article-card.aspect-double {
    grid-column: span 2;
  }
}

@media (max-width: 639px) {
  .article-card.aspect-double {
    grid-column: span 1;
  }
}

.card-link {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: 100%;
  text-decoration: none;
  padding: 18px 18px 8px 18px;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  line-height: 1.2;
  margin-bottom: 6px;
}

.card-meta {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-arrow {
  color: var(--accent-color);
  font-size: 0.9rem;
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: 0.85;
}

/* Make the arrow a small circular badge on hover */
.card-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background-color: transparent;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.article-card:hover .card-arrow {
  background-color: var(--accent-color);
  color: var(--bg-color);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(var(--accent-color-rgb, 0,0,0), 0.12);
  opacity: 1;
}

/* Prevent the global link pseudo-icon (° or ↗) from being appended
   to the card link. The top-right `.card-arrow` is used instead. */
.article-card .card-link::after,
.article-card .card-link a::after {
  content: none !important;
}

/* Disable global link hover styling inside article cards so the card
   doesn't get the accent hover background on link hover. */
.article-card .card-link:hover {
  background-color: transparent !important;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  margin-top: auto;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 4px 0;
  color: var(--blog-foreground);
  word-break: break-word;
}

.article-card.aspect-double .card-title {
  font-size: 1.5rem;
}

.card-date {
  font-size: 0.75rem;
  color: var(--blog-muted-foreground);
  font-style: normal;
  display: block;
  margin-bottom: 6px;
}

.card-excerpt {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--blog-muted-foreground);
  margin: 0 0 2px 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.article-card.aspect-double .card-excerpt {
  -webkit-line-clamp: 5;
}

.diamond-bullet {
  width: 6px;
  height: 6px;
  background-color: var(--blog-muted-foreground);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.item-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--blog-foreground);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.item-title::after {
  content: none;
}

.item-date {
  font-size: 0.9rem;
  color: var(--blog-muted-foreground);
  font-style: italic;
  white-space: nowrap;
  margin-left: 24px;
}

.empty-state {
  padding: 4rem 0;
  text-align: center;
  color: var(--blog-muted-foreground);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .blog-index {
    padding: 32px 0 48px;
  }

  .blog-index__header {
    margin-bottom: 40px;
  }

  .tabs-container {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }

  .filter-tab.tab {
    flex: 0 1 calc(33.333% - 10px);
    min-width: 0;
    padding: 6px 8px;
    gap: 6px;
    font-size: 0.68rem;
    justify-content: center;
  }

  .tab-icon-wrapper {
    width: 12px;
    height: 12px;
  }

  .tab-label {
    letter-spacing: 0;
  }

  .articles-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .article-card.aspect-single {
    aspect-ratio: auto;
    min-height: 280px;
  }

  .article-card.aspect-double {
    aspect-ratio: auto;
    min-height: 280px;
    grid-column: span 1;
  }

  .card-title {
    font-size: 1.2rem;
  }

  .card-excerpt {
    font-size: 0.85rem;
    -webkit-line-clamp: 3;
  }
}

