.py-blog {
  --py-bg: #f8fafc;
  --py-card: #ffffff;
  --py-text: #0f172a;
  --py-muted: #475569;
  --py-border: rgba(15, 23, 42, 0.10);
  --py-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 18px 50px rgba(15, 23, 42, 0.08);
  --py-accent: #2563eb;
  --py-accent-2: #0ea5e9;

  background: var(--py-bg);
  color: var(--py-text);
}

.py-blog a {
  color: inherit;
  text-decoration: none;
}

.py-blog a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
  border-radius: 10px;
}

.py-blog__container {
  max-width: 1160px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 768px) {
  .py-blog__container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.py-blog__hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--py-border);
  background:
    radial-gradient(1200px 500px at 20% 0%, rgba(14, 165, 233, 0.18), rgba(14, 165, 233, 0) 60%),
    radial-gradient(900px 450px at 90% 10%, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0) 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.70), rgba(248, 250, 252, 1));
}

.py-blog__hero-inner {
  padding-top: 28px;
  padding-bottom: 18px;
}

@media (min-width: 768px) {
  .py-blog__hero-inner {
    padding-top: 42px;
    padding-bottom: 22px;
  }
}

.py-blog__breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-top: 14px;
  color: rgba(15, 23, 42, 0.70);
  font-size: 13px;
}

.py-blog__breadcrumb a {
  color: rgba(15, 23, 42, 0.75);
}

.py-blog__breadcrumb a:hover {
  color: var(--py-accent);
}

.py-blog__title {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.05;
}

.py-blog__subtitle {
  margin-top: 10px;
  margin-bottom: 0;
  color: rgba(15, 23, 42, 0.70);
  font-size: 15px;
  line-height: 1.6;
  max-width: 70ch;
}

.py-blog__chips {
  display: flex;
  gap: 8px;
  padding-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.py-blog__chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--py-border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  color: rgba(15, 23, 42, 0.80);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  animation: pyChipDrift 7.5s ease-in-out infinite;
  will-change: transform;
}

.py-blog__chip:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--py-accent);
  background: rgba(255, 255, 255, 0.92);
  animation-play-state: paused;
}

.py-blog__chip.is-active {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
}

.py-blog__chips .py-blog__chip:nth-child(2) { animation-duration: 8.2s; animation-delay: .25s; }
.py-blog__chips .py-blog__chip:nth-child(3) { animation-duration: 7.1s; animation-delay: .5s; }
.py-blog__chips .py-blog__chip:nth-child(4) { animation-duration: 8.8s; animation-delay: .75s; }
.py-blog__chips .py-blog__chip:nth-child(5) { animation-duration: 7.7s; animation-delay: .35s; }
.py-blog__chips .py-blog__chip:nth-child(6) { animation-duration: 8.4s; animation-delay: .6s; }

@keyframes pyChipDrift {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(4px); }
  65% { transform: translateX(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .py-blog__chip {
    animation: none !important;
  }
}

.py-blog__body {
  padding-top: 22px;
  padding-bottom: 56px;
}

.py-blog__grid {
  display: grid;
  gap: 18px;
}

.py-blog__grid.py-blog__grid--single {
  grid-template-columns: minmax(0, 1fr) !important;
}

@media (min-width: 992px) {
  .py-blog__grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 28px;
    align-items: start;
  }
}

.py-blog__stack {
  display: grid;
  gap: 18px;
}

.py-blog-card {
  border-radius: 20px;
  overflow: hidden;
  background: var(--py-card);
  border: 1px solid var(--py-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.py-blog-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: var(--py-shadow);
}

.py-blog-card__media {
  position: relative;
  display: block;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(14, 165, 233, 0.10));
  overflow: hidden;
}

.py-blog-card__media::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

.py-blog-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 320ms ease;
}

.py-blog-card:hover .py-blog-card__media img {
  transform: scale(1.05);
}

.py-blog-card__content {
  padding: 18px 18px 20px 18px;
}

@media (min-width: 768px) {
  .py-blog-card__content {
    padding: 22px 22px 24px 22px;
  }
}

.py-blog-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: rgba(15, 23, 42, 0.60);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.py-blog-card__title {
  margin: 10px 0 0 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-size: clamp(20px, 2.1vw, 28px);
}

.py-blog-card__title a:hover {
  color: var(--py-accent);
}

.py-blog-card__excerpt {
  margin-top: 12px;
  margin-bottom: 0;
  color: var(--py-muted);
  font-size: 15px;
  line-height: 1.75;
}

.py-blog-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-weight: 700;
  font-size: 14px;
  color: var(--py-accent);
}

.py-blog-card__cta:hover {
  color: #1d4ed8;
}

.py-blog-card__cta svg {
  width: 16px;
  height: 16px;
  transition: transform 220ms ease;
}

.py-blog-card__cta:hover svg {
  transform: translateX(3px);
}

.py-blog-empty {
  padding: 28px;
  border-radius: 20px;
  border: 1px dashed rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(15, 23, 42, 0.70);
}

.py-blog-panel {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--py-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.py-blog-panel__header {
  padding: 16px 16px 12px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.py-blog-panel__title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, 0.75);
}

.py-blog-panel__body {
  padding: 14px 16px 16px 16px;
}

.py-blog-categories {
  display: grid;
  gap: 8px;
}

.py-blog-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.80);
  color: rgba(15, 23, 42, 0.85);
  font-weight: 650;
}

.py-blog-category:hover {
  border-color: rgba(37, 99, 235, 0.28);
  color: var(--py-accent);
  background: rgba(255, 255, 255, 0.95);
}

.py-blog-category.is-active {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
}

.py-blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.py-blog-tag {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.86);
  color: rgba(15, 23, 42, 0.72);
  font-size: 13px;
  font-weight: 650;
}

.py-blog-tag:hover {
  color: var(--py-accent);
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(255, 255, 255, 0.98);
}

/* Auto-extracted floating topic tags */
.py-blog-topic-cloud {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--py-border);
  background:
    radial-gradient(900px 240px at 15% 0%, rgba(14, 165, 233, 0.12), rgba(14, 165, 233, 0) 60%),
    radial-gradient(900px 280px at 85% 100%, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0) 58%),
    #ffffff;
  overflow: hidden;
}

.py-blog-topic-cloud__head {
  margin-bottom: 10px;
}

.py-blog-topic-cloud__title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, 0.75);
}

.py-blog-topic-cloud__subtitle {
  margin: 6px 0 0 0;
  color: rgba(15, 23, 42, 0.58);
  font-size: 13px;
}

.py-blog-topic-cloud__wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.py-tag-float {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(255, 255, 255, 0.88);
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.09);
  animation: pyTagFloat 5.8s ease-in-out infinite;
  will-change: transform;
}

.py-tag-float--1 { animation-duration: 5.4s; animation-delay: 0.1s; }
.py-tag-float--2 { animation-duration: 6.6s; animation-delay: 0.35s; }
.py-tag-float--3 { animation-duration: 5.9s; animation-delay: 0.22s; }
.py-tag-float--4 { animation-duration: 6.1s; animation-delay: 0.5s; }
.py-tag-float--5 { animation-duration: 5.6s; animation-delay: 0.75s; }
.py-tag-float--6 { animation-duration: 6.8s; animation-delay: 0.42s; }

@keyframes pyTagFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  40% { transform: translateY(-3px) rotate(-0.45deg); }
  65% { transform: translateY(1px) rotate(0.35deg); }
}

/* Testimonials module (existing markup) scoped to blog page */
.py-blog .sidebar-widget {
  margin: 0;
}

.py-blog #advertisement.advertisement {
  padding: 0;
  background: transparent;
}

.py-blog #advertisement .item {
  padding: 0;
}

.py-blog #advertisement .avatar {
  display: flex;
  justify-content: flex-start;
}

.py-blog #advertisement .avatar img {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.90);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.py-blog #advertisement .testimonials {
  margin-top: 12px;
  color: rgba(15, 23, 42, 0.70);
  font-size: 14px;
  line-height: 1.65;
}

.py-blog #advertisement .clients_author {
  margin-top: 10px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.86);
}

.py-blog #advertisement .clients_author span {
  display: block;
  margin-top: 2px;
  font-weight: 650;
  color: rgba(15, 23, 42, 0.60);
}

/* Blog pagination (custom view) */
.py-pagination {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.py-pagination__list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.py-pagination__link,
.py-pagination__span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.80);
  color: rgba(15, 23, 42, 0.86);
  font-weight: 750;
  font-size: 14px;
}

.py-pagination__link:hover {
  border-color: rgba(37, 99, 235, 0.30);
  background: rgba(255, 255, 255, 0.98);
  color: var(--py-accent);
}

.py-pagination__item.is-active .py-pagination__span {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(15, 23, 42, 0.92);
  color: #ffffff;
}

.py-pagination__item.is-disabled .py-pagination__span {
  opacity: 0.55;
}

/* RTL handling (Arabic) */
body.arabic-lang .py-blog__breadcrumb {
  justify-content: flex-end;
}

body.arabic-lang .py-blog-card__meta {
  justify-content: flex-end;
}

body.arabic-lang .py-blog-card__cta svg {
  transform: rotate(180deg);
}
