/* ================================================= */
/* SHALOM LINK MISSION – FULL BLOG CSS (2025)        */
/* 3 Posts Per Row | Modern | Responsive | Premium   */
/* ================================================= */

@tailwind base;
@tailwind components;
@tailwind utilities;

/* =============== DESIGN TOKENS =============== */
:root {
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #222222;
  --color-primary: #0092d7;
  --color-accent: #f97316;
  --color-muted: #777777;
  --color-border: #e5e7eb;
  --color-shadow: rgba(0, 0, 0, 0.08);

  --font-base: 'Inter', 'Helvetica Neue', sans-serif;
  --font-size-base: 16px;
  --line-height-base: 1.7;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 4px 15px var(--color-shadow);
  --shadow-elevated: 0 10px 35px rgba(0, 0, 0, 0.15);

  --transition-fast: 0.2s ease;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Support */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-text: #f1f5f9;
  --color-muted: #94a3b8;
  --color-border: #334155;
  --color-shadow: rgba(0, 0, 0, 0.4);
}

/* =============== GLOBAL RESET & BASE =============== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: var(--font-size-base); }
body {
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============== BLOG LAYOUT =============== */
.blog-wrapper {
  display: flex;
  max-width: 1400px;
  margin: 3rem auto;
  gap: 3rem;
  padding: 0 1.5rem;
}

.blog-sidebar {
  flex: 0 0 220px;
  font-size: 0.95rem;
}

.blog-main {
  flex: 1;
  min-width: 0;
}

/* Responsive: Stack on tablet & mobile */
@media (max-width: 992px) {
  .blog-wrapper {
    flex-direction: column;
    gap: 2rem;
  }
  .blog-sidebar {
    order: -1;
    flex: none;
  }
}

/* =============== TYPOGRAPHY =============== */
h1.page-title {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: var(--space-xl);
  text-align: center;
}

/* =============== POSTS GRID – 3 PER ROW =============== */
.posts-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 auto;
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }
}

/* =============== POST CARD – PREMIUM DESIGN =============== */
.post-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-smooth);
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--color-border);
}

.post-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-elevated);
  border-color: transparent;
}

/* Image */
.post-card .aspect-video {
  position: relative;
  height: 230px;
  overflow: hidden;
  background: #f1f5f9;
}

.post-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover img {
  transform: scale(1.1);
}

/* Content */
.post-card > div {
  padding: 1.6rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Category Badge */
.post-card .post-cat {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.8rem;
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .post-cat {
  background: #1e40af;
  color: #dbeafe;
}

/* Title */
.post-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1rem 0 0.75rem;
  line-height: 1.4;
  color: inherit;
}

.post-card h3 a {
  color: inherit;
  transition: color var(--transition-fast);
}

.post-card h3 a:hover {
  color: var(--color-primary);
}

/* Excerpt */
.post-card .post-excerpt {
  color: #4b5563;
  font-size: 0.975rem;
  line-height: 1.65;
  margin-bottom: 1rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .post-card .post-excerpt {
  color: #cbd5e1;
}

/* Read More – Always at bottom */
.post-card .read-more-wrapper {
  margin-top: auto;
  padding-top: 1.2rem;
  text-align: right;
}

.post-card .read-more {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.post-card .read-more:hover {
  color: var(--color-accent);
  gap: 0.6rem;
}

.post-card .read-more svg {
  width: 1.1em;
  height: 1.1em;
  transition: transform 0.3s ease;
}

.post-card .read-more:hover svg {
  transform: translateX(5px);
}

/* =============== SIDEBAR =============== */
.blog-sidebar .sidebar-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--color-accent);
  display: inline-block;
}

.cat-list {
  list-style: none;
}

.cat-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  color: var(--color-text);
  font-weight: 500;
  border-bottom: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

.cat-link:hover,
.cat-link.active {
  color: var(--color-accent);
  padding-left: 0.5rem;
}

.cat-link .count {
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  min-width: 28px;
  text-align: center;
}

/* =============== LOAD MORE =============== */
.load-more-wrap {
  text-align: center;
  margin-top: var(--space-2xl);
}

.btn-load-more {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(0, 146, 215, 0.3);
}

.btn-load-more:hover {
  background: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(249, 115, 22, 0.3);
}

.btn-load-more:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

/* =============== DARK MODE =============== */
[data-theme="dark"] .post-card,
[data-theme="dark"] .blog-sidebar,
[data-theme="dark"] .blog-main {
  background: var(--color-surface);
  border-color: var(--color-border);
}

[data-theme="dark"] h1.page-title {
  color: #e2e8f0;
}

[data-theme="dark"] .btn-load-more {
  background: var(--color-accent);
}

/* =============== RESPONSIVE TWEAKS =============== */
@media (max-width: 480px) {
  h1.page-title { font-size: 2.2rem; }
  .post-card .aspect-video { height: 200px; }
  .post-card > div { padding: 1.2rem; }
}

/* =============== ACTIVE CATEGORY – GORGEOUS & CLEAR =============== */
.cat-link {
    position: relative;
    overflow: hidden;
}

.cat-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 0;
    background: white;
    border-radius: 0 4px 4px 0;
    transition: height 0.4s ease;
}

.cat-link.active::before {
    height: 60%;
}

.cat-link.active {
    transform: translateX(6px);
    box-shadow: 0 8px 25px rgba(0, 146, 215, 0.25) !important;
}

.cat-link:hover:not(.active) {
    transform: translateX(4px);
}

/* Optional: Pulse animation on active */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 8px 25px rgba(0, 146, 215, 0.25); }
    50% { box-shadow: 0 8px 35px rgba(0, 146, 215, 0.4); }
}
.cat-link.active {
    animation: pulseGlow 4s infinite;
}