/* Ensure custom tags behave as normal block elements */
quran, sura, aya {
  display: block;
}

/* Force proper horizontal text flow for Arabic */
quran, sura, aya, aya::before {
  writing-mode: horizontal-tb;   /* enforce horizontal layout */
  direction: rtl;                /* right-to-left text direction */
  unicode-bidi: embed;
}
/* === Quran Layout Styles === */

quran {
  display: block;
  max-width: 900px;
  margin: 30px auto;
  padding: 30px 40px;
  font-family: "Amiri", "Scheherazade New", serif;
  font-size: 1.25rem;
  line-height: 2;
  background: #fafafa;
  color: #111;
  direction: rtl;
  unicode-bidi: embed;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
}

/* Sura (chapter) container */
sura {
  display: block;
  margin: 20px 0;
  padding: 20px 25px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e6e6e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Sura header (chapter title) */
sura::before {
  content: attr(name);
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: #2b6ca3;
  margin-bottom: 20px;
  border-bottom: 2px solid #e3e3e3;
  padding-bottom: 10px;
}

/* === Aya (verse) block === */
aya {
  display: flex;
  flex-direction: row-reverse;     /* right-to-left layout */
  align-items: flex-start;         /* align top of text and badge */
  justify-content: space-between;
  position: relative;
  margin: 8px 0;
  padding: 10px 0;
  font-size: 1.25rem;
  line-height: 1.9;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  background: transparent;
  transition: background 0.15s ease;
}

/* Aya text content */
aya::before {
  content: attr(text);
  flex: 1 1 auto;
  display: block;
  direction: rtl;
  unicode-bidi: embed;
  text-align: justify;
  padding-right: 50px;  /* leave room for the badge */
  word-break: break-word;
}

/* Aya number badge */
aya::after {
  content: attr(index);
  flex: 0 0 auto;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  color: #222;
  padding: 6px 10px;
  border-radius: 18px;
  font-size: 0.85rem;
  min-width: 34px;
  text-align: center;
  margin-right: 10px;
  margin-left: 8px;
  align-self: center;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

/* Hover highlighting */
aya:hover {
  background: rgba(43,108,163,0.03);
}

/* === Responsive tweaks === */
@media (max-width: 700px) {
  quran {
    font-size: 1.1rem;
    padding: 20px;
  }
  sura {
    padding: 15px 18px;
  }
  aya::after {
    font-size: 0.8rem;
    min-width: 28px;
    padding: 4px 8px;
  }
}
