@font-face {
  font-family: Tajawal;
  src: url("material/assets/Tajawal-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("material/assets/Tajawal-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("material/assets/Tajawal-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

.chapter-library {
  --arabic: Tajawal, Arial, sans-serif;
  --library-blue: #345fc8;
  --library-navy: #203e90;
  --library-line: #d9e4f8;
  color: #202e43;
  background: #f4f8ff;
  font-weight: 500;
}
.library-header { position: static; border-color: var(--library-line); }
.library-header .site-bar, .library-main {
  width: min(1060px, calc(100% - 48px));
  margin-inline: auto;
}
.library-header .brand-icon {
  color: #244ba9;
  background: #e4eeff;
}
.library-instructor {
  color: #314a76;
  font-size: .92rem;
  font-weight: 700;
}
.library-main { padding-block: clamp(24px, 5vw, 54px); }
.library-hero {
  padding: clamp(22px, 4vw, 40px);
  border-block-end: 3px solid #ffc533;
  border-radius: 16px;
  color: #fff;
  background:
    linear-gradient(#ddebff14 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, #ddebff14 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(104deg, #456fda, #264caa 68%);
}
.library-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.3rem);
  font-weight: 800;
  line-height: 1.2;
}
.library-hero p { margin-top: .4rem; color: #eff5ff; font-size: 1.05rem; }

.chapter-grid, .resource-grid {
  display: grid;
  gap: 1rem;
  margin-block: 1.4rem 0;
  padding: 0;
  list-style: none;
}
.chapter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chapter-card, .resource-card {
  display: block;
  height: 100%;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--library-line);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px #26477608;
}
.chapter-card {
  position: relative;
  padding-inline-end: 3.9rem;
}
.chapter-card:hover, .resource-card-link:hover {
  border-color: #90afea;
  background: #fafdff;
}
.chapter-order {
  color: var(--library-navy);
  font-size: .9rem;
  font-weight: 700;
}
.chapter-card h2 {
  margin-block: .2rem .25rem;
  font-size: clamp(1.24rem, 2.8vw, 1.55rem);
  line-height: 1.35;
  font-weight: 800;
}
.chapter-status { color: #536581; font-size: .86rem; }
.chapter-status-ready { color: #244ba9; font-weight: 700; }
.chapter-arrow {
  position: absolute;
  top: 50%;
  inset-inline-end: 1.2rem;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eaf1ff;
  color: var(--library-blue);
  transform: translateY(-50%);
}
.chapter-arrow::before {
  width: 8px;
  height: 8px;
  margin-left: 3px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
  content: "";
}
.chapter-card:hover .chapter-arrow {
  background: var(--library-blue);
  color: #fff;
}

.library-back { margin-block-end: 1rem; }
.library-back a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--library-navy);
  font-weight: 700;
  text-decoration: none;
}
.library-back a:hover { text-decoration: underline; }
.chapter-hero .hero-order {
  margin: 0 0 .4rem;
  color: #e6efff;
  font-size: .95rem;
  font-weight: 700;
}
.resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.resource-card { padding: clamp(18px, 3vw, 28px); }
.resource-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-block-end: .9rem;
  border-radius: 10px;
  background: #e7efff;
  color: var(--library-blue);
}
.resource-card h2 { font-size: 1.5rem; font-weight: 800; }
.resource-card p { margin-block-start: .2rem; color: #536581; }
.resource-action {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-block-start: 1rem;
  color: var(--library-navy);
  font-weight: 700;
}
.resource-card-link:hover .resource-action { text-decoration: underline; }

@media (max-width: 830px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 530px) {
  .library-header .site-bar, .library-main { width: calc(100% - 32px); }
  .library-instructor { font-size: .8rem; }
  .chapter-grid, .resource-grid { grid-template-columns: 1fr; gap: .7rem; }
}
