/* css/blog.css */
:root {
  --color-dark: #1C2B42;
  --color-dark-rgb: 28, 43, 66;
  --color-text: #2d3748;
  --color-text-light: #718096;
  --color-white: #ffffff;
  --color-light-blue: #7ba3c9;
  --color-accent-yellow: #f6e05e;
  --color-card-bg: #fdfdfe;
  --font-sans: 'Poppins', 'Inter', system-ui, sans-serif;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-btn: 12px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Hero section */
.blog-hero {
  position: relative;
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-dark);
  color: var(--color-white);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  text-align: center;
}

.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("../assets/images/house-cleaning-services-1024x789.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0.25;
  z-index: 1;
}

.blog-hero__content {
  position: relative;
  z-index: 2;
  max-width: 700px;
  padding: 0 24px;
}

.blog-hero__title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}

.blog-hero__subtitle {
  font-size: 16px;
  opacity: 0.9;
  line-height: 1.6;
}

/* Main content */
.blog-section {
  padding: 64px 0;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  margin-top: 32px;
}

/* Card Style */
.blog-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

.blog-card__image-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #e2e8f0;
  overflow: hidden;
}

.blog-card__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.blog-card:hover .blog-card__image {
  transform: scale(1.05);
}

.blog-card__content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.blog-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 12px;
}

.blog-card__tag {
  background: rgba(123, 163, 201, 0.15);
  color: #2b5b84;
  padding: 4px 10px;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.blog-card__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-dark);
  margin: 0 0 12px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__excerpt {
  font-size: 14px;
  color: var(--color-text-light);
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.blog-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.blog-card__read-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-dark);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s ease;
}

.blog-card:hover .blog-card__read-more {
  gap: 10px;
}

/* Skeleton Loading State */
.skeleton-card {
  background: var(--color-card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.04);
  height: 400px;
  display: flex;
  flex-direction: column;
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    #f3f4f6 25%,
    #e5e7eb 50%,
    #f3f4f6 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.skeleton-card__image {
  width: 100%;
  height: 200px;
}

.skeleton-card__content {
  padding: 24px;
  flex-grow: 1;
}

.skeleton-card__tag {
  width: 60px;
  height: 18px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton-card__title {
  width: 90%;
  height: 24px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-card__title-short {
  width: 60%;
  height: 24px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.skeleton-card__excerpt-1 {
  width: 100%;
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-card__excerpt-2 {
  width: 95%;
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-card__excerpt-3 {
  width: 80%;
  height: 14px;
  border-radius: 4px;
}

/* Modal Overlay for Native Reading */
.blog-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.blog-modal--open {
  opacity: 1;
  pointer-events: auto;
}

.blog-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
}

.blog-modal__container {
  position: relative;
  z-index: 1001;
  background: var(--color-white);
  width: 100%;
  max-width: 850px;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.blog-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1002;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow);
  color: var(--color-dark);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.blog-modal__close:hover {
  background: #f1f5f9;
  transform: rotate(90deg);
}

.blog-modal__hero {
  position: relative;
  width: 100%;
  padding-top: 50%; /* 2:1 aspect ratio */
  background: #e2e8f0;
}

.blog-modal__hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-modal__body {
  padding: 40px;
}

.blog-modal__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--color-text-light);
}

.blog-modal__title {
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.3;
  margin: 0 0 24px 0;
}

/* Rich text container styling for WordPress raw HTML */
.blog-modal__article {
  font-size: 16px;
  line-height: 1.8;
  color: #334155;
  font-family: 'Inter', sans-serif;
}

.blog-modal__article p {
  margin: 0 0 20px 0;
}

.blog-modal__article h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-dark);
  margin: 32px 0 16px 0;
}

.blog-modal__article h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-dark);
  margin: 24px 0 12px 0;
}

.blog-modal__article img {
  border-radius: var(--radius);
  max-width: 100%;
  height: auto;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.blog-modal__article ul, .blog-modal__article ol {
  margin: 0 0 24px 24px;
}

.blog-modal__article li {
  margin-bottom: 8px;
}

.blog-modal__article blockquote {
  border-left: 4px solid var(--color-light-blue);
  padding: 8px 0 8px 24px;
  margin: 24px 0;
  font-style: italic;
  color: var(--color-text-light);
}

/* Fallback/Error Alert Card */
.blog-alert {
  grid-column: 1 / -1;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.blog-alert__icon {
  background: #dcfce7;
  color: #166534;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.blog-alert__content {
  flex-grow: 1;
}

.blog-alert__title {
  font-weight: 700;
  color: #166534;
  margin: 0 0 4px 0;
  font-size: 15px;
}

.blog-alert__text {
  font-size: 14px;
  color: #14532d;
  margin: 0;
  line-height: 1.5;
}

/* Media Queries */
@media (max-width: 768px) {
  .blog-hero {
    height: 250px;
  }
  
  .blog-section {
    padding: 40px 0;
  }
  
  .blog-modal {
    padding: 10px;
  }
  
  .blog-modal__body {
    padding: 24px 16px;
  }
}
