/* ===== Direction-aware variables ===== */
html {
  --diag: -70deg; /* خلفية البطاقة الأساسية */
  --tilt-odd: 4deg; /* ميل الشريط الفاصل للبطاقة الفردية */
  --tilt-even: -4deg; /* ميل الشريط الفاصل للبطاقة الزوجية */
  --soft-angle: -30deg; /* زوايا تدرّج ألوان الثيم */
  --soft-angle-inv: 30deg; /* عكس الزاوية */
  --soft-angle-lg: -80deg;
  --soft-angle-lg-inv: 80deg;
}
html[dir='rtl'] {
  --diag: 70deg;
  --tilt-odd: -4deg;
  --tilt-even: 4deg;
  --soft-angle: 30deg;
  --soft-angle-inv: -30deg;
  --soft-angle-lg: 80deg;
  --soft-angle-lg-inv: -80deg;
}

/* Font Family */
* {
  font-family: 'Tajawal', sans-serif;
}

/* أساسيات الخلفيات */
.light {
  background: #fff;
}

a,
a:hover {
  text-decoration: none;
  transition: color 0.3s ease-in-out;
}

#pageHeaderTitle {
  margin: 2rem 0;
  text-transform: uppercase;
  text-align: center;
  font-size: 2.5rem;
}

/* ===== Cards ===== */
.postcard {
  display: flex;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  margin: 0 0 2rem 0;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 4px 21px -12px rgba(0, 0, 0, 0.66);
}
.postcard.dark {
  background-color: #18151f;
}
.postcard.light {
  background-color: #e1e5ea;
}
.postcard .t-dark {
  color: #18151f;
}

.postcard a {
  color: inherit;
}
.postcard h1,
.postcard .h1 {
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
}
.postcard .small {
  font-size: 80%;
}

.postcard .postcard__title {
  font-size: 1.75rem;
}

.postcard .postcard__img {
  max-height: 180px;
  width: 100%;
  object-fit: cover;
  position: relative;
  transition: transform 0.3s ease;
}
.postcard .postcard__img_link {
  display: contents;
}

.postcard .postcard__bar {
  width: 50px;
  height: 10px;
  margin: 10px 0;
  border-radius: 5px;
  background-color: #424242;
  transition: width 0.2s ease;
}
.postcard:hover .postcard__bar {
  width: 100px;
}

.postcard .postcard__text {
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
}
.postcard .postcard__preview-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: justify;
  height: 100%;
}
.postcard .postcard__tagbox {
  display: flex;
  flex-flow: row wrap;
  font-size: 14px;
  margin: 20px 0 0;
  padding: 0;
  justify-content: center;
}
.postcard .postcard__tagbox .tag__item {
  display: inline-block;
  user-select: none;
  cursor: default;
  background: rgba(83, 83, 83, 0.4);
  border-radius: 3px;
  padding: 2.5px 10px;
  margin: 0 5px 5px 0;
  transition: background-color 0.3s;
}
.postcard .postcard__tagbox .tag__item:hover {
  background: rgba(83, 83, 83, 0.8);
}

/* خلفية مائلة عامة للبطاقة */
.postcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--diag), #424242, transparent 50%);
  opacity: 1;
  border-radius: 10px;
}

@media (min-width: 769px) {
  .postcard {
    flex-wrap: inherit;
  }
  .postcard .postcard__title {
    font-size: 2rem;
  }
  .postcard .postcard__tagbox {
    justify-content: start;
  }

  .postcard .postcard__img {
    max-width: 650px;
    max-height: 100%;
  }
  .postcard:hover .postcard__img {
    transform: scale(1.1);
  }

  /* ترتيب البطاقات: فردي يسار/يميني حسب LTR/RTL عبر flex-direction */
  .postcard:nth-of-type(odd) {
    flex-direction: row;
  }
  .postcard:nth-of-type(even) {
    flex-direction: row-reverse;
  }

  /* الشريط الفاصل بين الصورة والنص */
  .postcard .postcard__text::before {
    content: '';
    position: absolute;
    display: block;
    top: -20%;
    height: 130%;
    width: 55px;
  }
  .postcard.dark .postcard__text::before {
    background: #18151f;
  }
  .postcard.light .postcard__text::before {
    background: #e1e5ea;
  }

  /* موضع وزاوية الشريط حسب ترتيب البطاقة (بدون left/right الثابتة) */
  .postcard:nth-of-type(odd) .postcard__text::before {
    inset-inline-start: -4px;
    inset-inline-end: auto;
    transform: rotate(var(--tilt-odd));
  }
  .postcard:nth-of-type(even) .postcard__text::before {
    inset-inline-end: -4px;
    inset-inline-start: auto;
    transform: rotate(var(--tilt-even));
  }

  .postcard .postcard__text {
    padding: 65px;
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .postcard__text {
    padding: 2rem 3.5rem;
  }
}

/* ===== Theme colors (tint gradients) ===== */
.postcard.green {
  --tint: rgba(121, 221, 9, 0.1);
}
.postcard.blue {
  --tint: rgba(0, 118, 189, 0.1);
}
.postcard.red {
  --tint: rgba(189, 21, 11, 0.1);
}
.postcard.yellow {
  --tint: rgba(189, 187, 73, 0.1);
}

.postcard .postcard__tagbox .green.play:hover {
  background: #79dd09;
  color: #000;
}
.green .postcard__title:hover {
  color: #79dd09;
}
.green .postcard__bar {
  background-color: #79dd09;
}

.postcard .postcard__tagbox .blue.play:hover {
  background: #0076bd;
}
.blue .postcard__title:hover {
  color: #0076bd;
}
.blue .postcard__bar {
  background-color: #0076bd;
}

.postcard .postcard__tagbox .red.play:hover {
  background: #bd150b;
}
.red .postcard__title:hover {
  color: #bd150b;
}
.red .postcard__bar {
  background-color: #bd150b;
}

.postcard .postcard__tagbox .yellow.play:hover {
  background: #bdbb49;
  color: #000;
}
.yellow .postcard__title:hover {
  color: #bdbb49;
}
.yellow .postcard__bar {
  background-color: #bdbb49;
}

/* تدرجات التينت: فردي وزوجي، مع احترام RTL/LTR عبر المتغيرات */
.postcard.green::before {
  background-image: linear-gradient(
    var(--soft-angle),
    var(--tint),
    transparent 50%
  );
}
.postcard.blue::before {
  background-image: linear-gradient(
    var(--soft-angle),
    var(--tint),
    transparent 50%
  );
}
.postcard.red::before {
  background-image: linear-gradient(
    var(--soft-angle),
    var(--tint),
    transparent 50%
  );
}
.postcard.yellow::before {
  background-image: linear-gradient(
    var(--soft-angle),
    var(--tint),
    transparent 50%
  );
}

.postcard.green:nth-of-type(even)::before {
  background-image: linear-gradient(
    var(--soft-angle-inv),
    var(--tint),
    transparent 50%
  );
}
.postcard.blue:nth-of-type(even)::before {
  background-image: linear-gradient(
    var(--soft-angle-inv),
    var(--tint),
    transparent 50%
  );
}
.postcard.red:nth-of-type(even)::before {
  background-image: linear-gradient(
    var(--soft-angle-inv),
    var(--tint),
    transparent 50%
  );
}
.postcard.yellow:nth-of-type(even)::before {
  background-image: linear-gradient(
    var(--soft-angle-inv),
    var(--tint),
    transparent 50%
  );
}

@media (min-width: 769px) {
  .postcard.green::before {
    background-image: linear-gradient(
      var(--soft-angle-lg),
      var(--tint),
      transparent 50%
    );
  }
  .postcard.blue::before {
    background-image: linear-gradient(
      var(--soft-angle-lg),
      var(--tint),
      transparent 50%
    );
  }
  .postcard.red::before {
    background-image: linear-gradient(
      var(--soft-angle-lg),
      var(--tint),
      transparent 50%
    );
  }
  .postcard.yellow::before {
    background-image: linear-gradient(
      var(--soft-angle-lg),
      var(--tint),
      transparent 50%
    );
  }

  .postcard.green:nth-of-type(even)::before {
    background-image: linear-gradient(
      var(--soft-angle-lg-inv),
      var(--tint),
      transparent 50%
    );
  }
  .postcard.blue:nth-of-type(even)::before {
    background-image: linear-gradient(
      var(--soft-angle-lg-inv),
      var(--tint),
      transparent 50%
    );
  }
  .postcard.red:nth-of-type(even)::before {
    background-image: linear-gradient(
      var(--soft-angle-lg-inv),
      var(--tint),
      transparent 50%
    );
  }
  .postcard.yellow:nth-of-type(even)::before {
    background-image: linear-gradient(
      var(--soft-angle-lg-inv),
      var(--tint),
      transparent 50%
    );
  }
}
