@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --navy: #183044;
  --navy-deep: #112736;
  --navy-soft: #315064;
  --ink: #263b47;
  --cream: #f5f0e5;
  --cream-deep: #ebe2d0;
  --paper: #fffdf8;
  --gold: #a77c37;
  --gold-bright: #c4a160;
  --gold-pale: #e8d9b8;
  --muted: #62727a;
  --line: #e4dccd;
  --serif: 'Amiri', Georgia, serif;
  --sans: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  --container: 1160px;
  --shadow-soft: 0 18px 50px rgba(29, 48, 58, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible { outline: 3px solid #9a6b22; outline-offset: 3px; }
::selection { color: var(--navy-deep); background: var(--gold-pale); }

.skip-link {
  position: fixed;
  z-index: 30;
  top: 10px;
  right: 12px;
  padding: 9px 16px;
  transform: translateY(-160%);
  background: var(--navy-deep);
  color: white;
  border-radius: 4px;
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 82px;
  background: rgba(255, 253, 248, .96);
  border-bottom: 1px solid rgba(24, 48, 68, .09);
  backdrop-filter: blur(14px);
}
.header-inner {
  width: min(100%, var(--container));
  height: 100%;
  margin: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--navy); flex-shrink: 0; }
.brand-mark, .about-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--gold-bright);
  border-radius: 50%;
  color: var(--gold);
  font: 700 29px/1 var(--serif);
  box-shadow: inset 0 0 0 4px rgba(196, 161, 96, .08);
}
.brand strong { display: block; font: 700 23px/1.1 var(--serif); }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.main-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 37px); color: #53636b; font-size: 13px; }
.main-nav a { position: relative; padding: 8px 0; transition: color .2s ease; }
.main-nav a::after { position: absolute; right: 0; bottom: 1px; width: 0; height: 1px; background: var(--gold); content: ''; transition: width .2s ease; }
.main-nav a:hover, .main-nav a:focus-visible { color: var(--navy); }
.main-nav a:hover::after, .main-nav a:focus-visible::after { width: 100%; }
.header-cta { display: inline-flex; align-items: center; gap: 10px; padding: 9px 0; color: var(--navy); font-size: 12px; font-weight: 600; white-space: nowrap; }
.header-cta span { color: var(--gold); font-size: 18px; transition: transform .2s ease; }
.header-cta:hover span { transform: translateX(-4px); }

.hero {
  position: relative;
  isolation: isolate;
  min-height: 575px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: 50px;
  padding: 68px max(calc((100vw - var(--container))/2 + 28px), 7vw) 80px;
  background:
    radial-gradient(ellipse at 87% 4%, rgba(196, 161, 96, .13), transparent 36%),
    linear-gradient(110deg, #f8f4eb 0%, #f2ecde 100%);
  color: var(--navy);
}
.hero::before {
  position: absolute;
  z-index: -1;
  right: -155px;
  top: -285px;
  width: 660px;
  height: 660px;
  border: 1px solid rgba(167, 124, 55, .13);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(167, 124, 55, .035), 0 0 0 75px rgba(167, 124, 55, .025);
  content: '';
}
.hero::after { position: absolute; right: 0; bottom: 0; left: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-bright), transparent); content: ''; }
.hero-content, .hero-side { position: relative; z-index: 1; }
.hero-content { max-width: 555px; }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.hero .eyebrow span { display: inline-block; width: 28px; height: 1px; margin-left: 9px; vertical-align: middle; background: var(--gold); }
.hero h1 { margin: 0 0 12px; color: var(--navy); font: 400 clamp(49px, 6vw, 74px)/1.22 var(--serif); letter-spacing: -.025em; }
.hero h1 em { color: var(--gold); font-style: normal; font-weight: 700; }
.hero-intro { max-width: 465px; margin: 0 0 26px; color: #4a5d65; font-size: 14px; line-height: 2.1; }
.button { display: inline-flex; min-height: 47px; align-items: center; justify-content: center; gap: 24px; padding: 10px 19px; font-size: 13px; font-weight: 600; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.button-gold { background: var(--navy); color: white; box-shadow: 0 8px 20px rgba(24, 48, 68, .13); }
.button-gold span { color: var(--gold-pale); font-size: 18px; }
.button-gold:hover { transform: translateY(-2px); background: var(--navy-soft); box-shadow: 0 12px 26px rgba(24, 48, 68, .18); }
.hero-note { display: flex; align-items: center; gap: 9px; margin-top: 25px; color: #627078; font-size: 11px; }
.note-icon { color: var(--gold); }
.hero-side { min-height: 390px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px; padding-right: 35px; }
.hero-illustration { position: absolute; z-index: -1; top: -18px; left: -55px; width: min(360px, 94%); opacity: .9; }
.hero-illustration svg { display: block; width: 100%; overflow: visible; }
.illustration-stem { fill: none; stroke: #8c9a72; stroke-width: 2; stroke-linecap: round; }
.illustration-leaf { fill: #a8b195; stroke: #8c9a72; stroke-width: 1.4; stroke-linejoin: round; }
.illustration-ground { fill: none; stroke: #b89a60; stroke-width: 1.4; }
.illustration-book { stroke: #8b6a36; stroke-width: 1.5; stroke-linejoin: round; }
.book-back { fill: #dfcfaa; }
.book-front { fill: #f9f4e8; }
.book-detail { fill: none; stroke: #c4a160; stroke-width: 1.4; stroke-linecap: round; }
.illustration-spark { fill: #c4a160; }
.ministry-placeholder {
  width: 218px;
  min-height: 76px;
  display: grid;
  grid-template-columns: 39px 1fr;
  align-content: center;
  align-items: center;
  padding: 10px 13px;
  border: 1px dashed #aa915f;
  border-radius: 4px;
  background: rgba(255, 253, 248, .88);
  color: var(--navy);
  box-shadow: 0 7px 25px rgba(47, 54, 46, .06);
}
.placeholder-symbol { grid-row: span 2; color: var(--gold); font-size: 23px; }
.ministry-placeholder strong { font-size: 11px; }
.ministry-placeholder small { color: #53656c; font-size: 10px; }
.school-card {
  width: min(360px, 100%);
  padding: 21px 25px 19px;
  border: 1px solid rgba(167, 124, 55, .22);
  border-right: 3px solid var(--gold-bright);
  background: rgba(255, 253, 248, .96);
  box-shadow: var(--shadow-soft);
}
.card-kicker { color: #826638; font-size: 10px; }
.school-card h2 { margin: 2px 0 0; color: var(--navy); font: 700 25px/1.45 var(--serif); }
.school-card > p { margin: 0; color: #52646d; font-size: 11px; }
.pending-note { display: block; color: #6b5b39; font-size: 10px; }
.school-divider { height: 1px; margin: 13px 0 10px; background: var(--line); }
.school-card dl { display: grid; gap: 6px; margin: 0; }
.school-card dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.school-card dt { color: #607078; }
.school-card dd { margin: 0; color: var(--navy); font-weight: 600; }
.hero-orbit { position: absolute; width: 250px; height: 250px; border: 1px solid rgba(167, 124, 55, .2); border-radius: 50%; pointer-events: none; }
.orbit-one { right: -105px; bottom: -165px; }
.orbit-two { right: -75px; bottom: -135px; width: 190px; height: 190px; }
.hero-footer { position: absolute; right: max(calc((100vw - var(--container))/2 + 28px), 7vw); bottom: 13px; left: max(calc((100vw - var(--container))/2 + 28px), 7vw); display: flex; justify-content: space-between; color: #53636b; font-size: 10px; letter-spacing: .04em; }

.section-wrap { width: min(100%, var(--container)); margin: auto; padding-right: 28px; padding-left: 28px; }
.categories { padding-top: 82px; padding-bottom: 88px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2 { margin: 0; color: var(--navy); font: 700 37px/1.35 var(--serif); }
.section-heading > p { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.category-card {
  position: relative;
  min-height: 137px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: linear-gradient(135deg, #fffdf8, #faf6ed);
  color: var(--navy);
  text-align: right;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.category-card::after { position: absolute; left: -21px; bottom: -38px; width: 110px; height: 110px; border: 1px solid rgba(167, 124, 55, .13); border-radius: 50%; box-shadow: 0 0 0 11px rgba(167, 124, 55, .035); content: ''; }
.category-card:hover { transform: translateY(-3px); border-color: #c5ab78; background: #f6f0e2; box-shadow: 0 12px 26px rgba(29, 48, 58, .08); }
.category-number { position: absolute; top: 12px; left: 15px; color: #6b7474; font-size: 10px; }
.category-icon { margin-bottom: 8px; color: var(--gold); font: 26px/1 var(--serif); }
.category-card strong { position: relative; z-index: 1; font-size: 14px; font-weight: 600; }
.category-arrow { position: absolute; z-index: 1; left: 17px; bottom: 17px; color: var(--gold); font-size: 18px; opacity: 0; transform: translate(4px, 2px); transition: opacity .2s ease, transform .2s ease; }
.category-card:hover .category-arrow, .category-card:focus-visible .category-arrow { opacity: 1; transform: translate(0); }

.library-section { padding: 78px 0 88px; background: #f5f1e8; border-top: 1px solid #eee7d9; border-bottom: 1px solid #eee7d9; }
.library-heading { margin-bottom: 24px; }
.library-tools { display: grid; grid-template-columns: minmax(200px, 1fr) auto 210px auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); box-shadow: 0 8px 24px rgba(29, 48, 58, .035); }
.search-box { min-width: 0; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid #ddd6c9; border-radius: 3px; color: var(--gold); }
.search-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(167, 124, 55, .12); }
.search-box > span { font-size: 23px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-box input::placeholder { color: #65747a; }
.search-box kbd { padding: 0 5px; border: 1px solid #dcd5c9; border-radius: 3px; color: #596970; font: 10px var(--sans); }
.filter-label { color: #465a63; font-size: 11px; }
.library-tools select { height: 46px; padding: 0 11px; border: 1px solid #ddd6c9; border-radius: 3px; background: var(--paper); color: var(--navy); font-size: 11px; }
.clear-filter { min-height: 40px; padding: 0 8px; border: 0; background: transparent; color: #785b2a; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.clear-filter:hover { color: var(--navy); }
.results-line { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 19px 0 13px; }
.results-line p { margin: 0; color: var(--navy); font-size: 12px; font-weight: 600; }
.dataset-note { color: #5c6b70; font-size: 10px; }
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.book-card { min-width: 0; overflow: hidden; border: 1px solid #e3dccf; border-radius: 4px; background: var(--paper); box-shadow: 0 4px 14px rgba(29, 48, 58, .035); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.book-card:hover { transform: translateY(-4px); border-color: #cbb98e; box-shadow: 0 14px 28px rgba(29, 48, 58, .1); }
.book-cover { position: relative; height: 184px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(140deg, #f1e9d8, #e8dfcd); }
.book-cover::before, .book-cover::after { position: absolute; width: 132px; height: 132px; border: 1px solid rgba(139, 106, 54, .24); border-radius: 50%; content: ''; }
.book-cover::after { width: 102px; height: 102px; }
.book-card:nth-child(3n + 2) .book-cover { background: linear-gradient(140deg, #e8ece3, #dce5d8); }
.book-card:nth-child(3n) .book-cover { background: linear-gradient(140deg, #efe5dc, #e7d8ca); }
.book-cover.has-cover::before, .book-cover.has-cover::after { display: none; }
.book-cover-image { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: contain; }
.book-index { position: absolute; z-index: 1; top: 10px; right: 11px; color: #52616a; font-size: 9px; }
.cover-inner { z-index: 1; padding: 10px; text-align: center; }
.book-cover.has-cover .cover-inner { display: none; }
.cover-glyph { display: block; color: #8d6e36; font: 44px/1 var(--serif); }
.cover-label { display: block; margin-top: 10px; color: #554a35; font-size: 10px; line-height: 1.6; }
.book-info { padding: 13px 14px 14px; }
.book-category { margin: 0 0 4px; color: #785a27; font-size: 9px; }
.book-info h3 { min-height: 51px; margin: 0; color: var(--navy); font: 700 18px/1.45 var(--serif); }
.book-author { margin: 5px 0 13px; color: #586970; font-size: 10px; }
.read-button { width: 100%; min-height: 36px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #d5d0c5; border-radius: 3px; background: #f1eee8; color: #55636a; font-size: 10px; }
button.read-button:disabled { cursor: not-allowed; opacity: 1; }
.read-link { border-color: var(--navy); background: var(--navy); color: white; cursor: pointer; }
.read-link:hover { border-color: var(--gold); background: var(--gold); color: var(--navy-deep); }
.empty-state { padding: 62px 20px; color: var(--muted); text-align: center; }
.empty-state > span { color: var(--gold); font-size: 35px; }
.empty-state h3 { margin: 0; color: var(--navy); font: 700 24px var(--serif); }
.empty-state p { font-size: 12px; }

.about { display: grid; grid-template-columns: 70px 1fr 1.15fr auto; align-items: center; gap: 24px; padding-top: 72px; padding-bottom: 72px; }
.about-mark { width: 64px; height: 64px; font-size: 40px; }
.about h2 { margin: 0; color: var(--navy); font: 700 32px/1.3 var(--serif); }
.about .eyebrow { margin-bottom: 5px; }
.about-copy { max-width: 390px; margin: 0; color: #53656c; font-size: 12px; line-height: 2.1; }
.back-top { color: #765821; font-size: 10px; white-space: nowrap; }
.back-top span { margin-right: 8px; font-size: 16px; }
.site-footer { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px max(calc((100vw - var(--container))/2 + 28px), 7vw); border-top: 1px solid var(--line); color: #5b6b70; }
.footer-brand { color: var(--navy); font: 700 20px var(--serif); }
.footer-brand span { margin-right: 5px; color: #5b6b70; font: 10px var(--sans); }
.site-footer p { margin: 0; font-size: 9px; }
.footer-flourish { color: var(--gold); }

@media (max-width: 900px) {
  .hero { gap: 22px; padding-right: 6vw; padding-left: 6vw; }
  .hero-side { padding-right: 8px; }
  .hero-illustration { left: -35px; width: 310px; }
  .main-nav { gap: 18px; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .about { grid-template-columns: 60px 1fr 1.2fr; }
  .back-top { grid-column: 2 / -1; justify-self: start; }
  .library-tools { grid-template-columns: minmax(160px, 1fr) auto 190px; }
  .search-box { grid-column: 1; grid-row: 1; }
  .filter-label { grid-column: 2; grid-row: 1; }
  .library-tools select { grid-column: 3; grid-row: 1; }
  .clear-filter { grid-column: 3; grid-row: 2; justify-self: end; }
}

@media (max-width: 620px) {
  html { scroll-padding-top: 70px; }
  .site-header { height: 70px; }
  .header-inner { gap: 10px; padding: 0 18px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand strong { font-size: 21px; }
  .main-nav { display: none; }
  .header-cta { gap: 6px; font-size: 11px; }
  .hero { display: flex; min-height: 0; flex-direction: column; align-items: stretch; gap: 23px; padding: 45px 23px 67px; }
  .hero h1 { font-size: clamp(46px, 12vw, 58px); }
  .hero-intro { font-size: 14px; }
  .hero-side { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 11px; padding: 0; }
  .hero-illustration { top: -13px; left: -24px; width: min(260px, 75vw); opacity: .72; }
  .ministry-placeholder { grid-column: 2; grid-row: 1; width: 145px; min-height: 70px; grid-template-columns: 27px 1fr; padding: 8px; }
  .placeholder-symbol { font-size: 19px; }
  .ministry-placeholder strong { font-size: 9px; }
  .ministry-placeholder small { font-size: 9px; }
  .school-card { grid-column: 1 / -1; grid-row: 2; width: 100%; padding: 17px 19px; }
  .school-card h2 { font-size: 23px; }
  .hero-orbit { display: none; }
  .hero-footer { right: 23px; left: 23px; font-size: 9px; }
  .section-wrap { padding-right: 20px; padding-left: 20px; }
  .categories { padding-top: 61px; padding-bottom: 65px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 4px; margin-bottom: 20px; }
  .section-heading h2 { font-size: 32px; }
  .section-heading > p { font-size: 11px; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .category-card { min-height: 125px; padding: 17px 14px; }
  .category-card strong { max-width: 95%; font-size: 12px; line-height: 1.65; }
  .category-number { top: 9px; left: 10px; }
  .category-arrow { left: 10px; bottom: 12px; }
  .library-section { padding: 59px 0 66px; }
  .library-tools { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 10px; }
  .search-box { grid-column: 1 / -1; grid-row: 1; }
  .filter-label { grid-column: 1; grid-row: 2; font-size: 10px; }
  .library-tools select { width: 155px; grid-column: 2; grid-row: 2; }
  .clear-filter { grid-column: 2; grid-row: 3; justify-self: end; }
  .results-line { align-items: flex-start; flex-direction: column; gap: 3px; margin-top: 15px; }
  .dataset-note { font-size: 9px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .book-cover { height: 150px; }
  .book-info { padding: 11px 10px 12px; }
  .book-info h3 { min-height: 47px; font-size: 16px; }
  .book-author { font-size: 9px; }
  .read-button { font-size: 9px; }
  .about { grid-template-columns: 50px 1fr; gap: 15px; padding-top: 51px; padding-bottom: 52px; }
  .about-mark { width: 48px; height: 48px; font-size: 30px; }
  .about h2 { font-size: 27px; }
  .about-copy, .back-top { grid-column: 1 / -1; }
  .about-copy { font-size: 11px; }
  .site-footer { flex-wrap: wrap; padding: 14px 20px; }
  .site-footer p { order: 3; width: 100%; }
  .footer-flourish { margin-right: auto; }
}

@media (max-width: 370px) {
  .hero { padding-right: 18px; padding-left: 18px; }
  .hero h1 { font-size: 44px; }
  .hero-footer { right: 18px; left: 18px; font-size: 9px; }
  .section-wrap { padding-right: 16px; padding-left: 16px; }
  .book-grid { gap: 8px; }
  .book-cover { height: 132px; }
  .book-info { padding-right: 8px; padding-left: 8px; }
  .category-card strong { font-size: 11px; }
  .library-tools select { width: 135px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
