:root {
  --blue: #2575fc;
  --blue-dark: #164fae;
  --ink: #183247;
  --muted: #66758a;
  --paper: #ffffff;
  --canvas: #f5f8fc;
  --line: #dfe7f1;
  --green: #168653;
  --shadow: 0 14px 36px rgba(31, 55, 85, .11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(20px, 5vw, 72px);
  color: #fff;
  background: var(--blue);
  border-bottom: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 3px 14px rgba(22, 79, 174, .2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.03em;
  white-space: nowrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.promo-banner {
  overflow: hidden;
  padding: 4px 18px;
  color: #15803d;
  background: transparent;
  border: 0;
  text-align: center;
  font-size: clamp(.98rem, 1.35vw, 1.1rem);
  font-weight: 850;
  line-height: 1.25;
  letter-spacing: .01em;
}

.home-page .promo-banner {
  color: #86efac;
  background: transparent;
  text-shadow: none;
}

.promo-banner__content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  animation: promo-alert-sway 3.2s ease-in-out infinite;
}

.promo-banner__icon {
  display: inline-grid;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: .72rem;
  line-height: 1;
  animation: promo-icon-pulse 1.6s ease-in-out infinite;
}

@keyframes promo-alert-sway {
  0%,
  100% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
}

@keyframes promo-icon-pulse {
  0%,
  100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.site-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-navigation a {
  padding: 10px 14px;
  color: #fff;
  font-weight: 650;
  border-radius: 8px;
}

.site-navigation a:hover,
.site-navigation a[aria-current="page"] {
  background: rgba(255, 255, 255, .18);
}

.site-navigation .cart-nav {
  color: var(--blue);
  background: #fff;
}

.site-navigation .cart-nav:hover {
  color: var(--blue-dark);
  background: #eaf1ff;
}

.mobile-menu-toggle {
  display: none;
  padding: 9px 12px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.ui-language-switcher {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 9px;
}

.ui-language-switcher button {
  min-width: 32px;
  padding: 6px 7px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 850;
  cursor: pointer;
}

.ui-language-switcher button:hover,
.ui-language-switcher button.active {
  color: var(--blue-dark);
  background: #fff;
}

.ui-language-switcher button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .45);
  outline-offset: 2px;
}

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .language-section[data-lang="en"],
html[dir="rtl"] .language-section[data-lang="fr"] {
  direction: ltr;
}

.language-section[data-lang="ar"] {
  direction: rtl;
}

html[dir="rtl"] .cart-link {
  margin-right: auto;
  margin-left: 0;
}

html[dir="rtl"] .search-icon {
  right: auto;
  left: 18px;
}

html[dir="rtl"] .top-search input {
  padding-right: 20px;
  padding-left: 56px;
}

/* Home page fallback styles; the current homepage adds its own layout refinements. */
#hero {
  position: relative;
  min-height: calc(100vh - 76px);
  display: grid;
  align-items: center;
  padding: clamp(72px, 12vw, 150px) clamp(20px, 10vw, 150px);
  color: #fff;
  background: linear-gradient(135deg, rgba(106, 17, 203, .72), rgba(37, 117, 252, .78)), url("images/Wallpaper.jpg") center / cover no-repeat;
}

.hero-content {
  position: relative;
  z-index: 1;
}

/* Catalog */
.catalog-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 84px;
}

.catalog-heading {
  max-width: 720px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.catalog-heading h1 {
  margin: 0;
  color: #142d42;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.catalog-heading > p:last-child {
  max-width: 640px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.kids-heading {
  max-width: 820px;
  padding: clamp(26px, 5vw, 48px);
  background: linear-gradient(135deg, #fff8d9, #edf7ff 62%, #f4edff);
  border: 1px solid #e8dfbc;
  border-radius: 26px;
  box-shadow: 0 12px 35px rgba(31, 55, 85, .08);
}

.kids-heading > p:last-of-type {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.collection-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.collection-stats span {
  padding: 8px 12px;
  color: #1f4c70;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(37, 117, 252, .16);
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 800;
}

.top-bar {
  position: sticky;
  top: 92px;
  z-index: 20;
  padding: 8px;
  background: rgba(245, 248, 252, .88);
  border: 1px solid rgba(223, 231, 241, .9);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(31, 55, 85, .08);
  backdrop-filter: blur(14px);
}

.language-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.language-item {
  padding: 10px 14px;
  color: #526478;
  border-radius: 10px;
  font-weight: 750;
  transition: color .2s ease, background .2s ease;
}

.language-item:hover {
  color: var(--blue-dark);
  background: #eaf1ff;
}

.language-item.active {
  color: #fff;
  background: var(--blue);
}

.language-item:focus-visible,
.cart-link:focus-visible,
.read-more-btn:focus-visible,
.buy-btn:focus-visible {
  outline: 3px solid rgba(37, 117, 252, .3);
  outline-offset: 3px;
}

.cart-link {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 9px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 750;
}

.cart-link:hover {
  color: var(--blue-dark);
  border-color: #b8cdf4;
}

#cart-count {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  padding: 2px 6px;
  color: #fff;
  background: var(--blue);
  border-radius: 999px;
  font-size: .78rem;
}

.top-search {
  position: relative;
  width: min(680px, 100%);
  margin: 28px auto 38px;
}

.top-search input {
  width: 100%;
  min-height: 56px;
  padding: 0 56px 0 20px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(31, 55, 85, .07);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.top-search input::placeholder {
  color: #8492a6;
}

.top-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 117, 252, .12), 0 6px 20px rgba(31, 55, 85, .07);
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 21px;
  height: 21px;
  color: var(--blue);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.language-section {
  margin-top: 18px;
}

.language-section h2 {
  margin: 0 0 22px;
  color: #1f3b53;
  font-size: 1.35rem;
}

.category-jump-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  gap: 14px;
}

.category-jump-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 76px;
  padding: 16px 14px;
  color: #fff;
  background: #2164d7;
  border: 2px solid #2164d7;
  border-radius: 15px;
  box-shadow: 0 5px 12px rgba(33, 100, 215, .14);
  font-size: 1.04rem;
  font-weight: 750;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.category-jump-link:hover {
  color: #fff;
  background: #174eae;
  border-color: #174eae;
  box-shadow: 0 7px 16px rgba(33, 100, 215, .23);
}

.category-jump-link.active {
  color: #fff;
  background: #123d88;
  border-color: #123d88;
  box-shadow: inset 0 0 0 2px #fff, 0 5px 12px rgba(33, 100, 215, .18);
}

.category-picker {
  padding: clamp(18px, 2.4vw, 28px);
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff, #edf4ff);
  border: 1px solid #d5e2f7;
  border-radius: 22px;
}

.catalog-basket-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.catalog-basket-bar .catalog-basket {
  gap: 14px;
  min-height: 76px;
  margin: 0;
  padding: 12px 22px;
  color: #174eae;
  background: #fff;
  border: 2px solid #2164d7;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(33, 100, 215, .13);
  font-size: 1.15rem;
}

.catalog-basket-bar .catalog-basket:hover {
  background: #edf4ff;
}

.catalog-basket-icon {
  display: block;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.catalog-basket #cart-count {
  min-width: 30px;
  min-height: 30px;
  font-size: .9rem;
}

.category-picker .category-prompt {
  margin: 0 0 6px;
  color: #142d42;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 750;
}

.category-picker-intro {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.catalog-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.catalog-tools .top-search {
  width: auto;
  flex: 1;
  min-width: 0;
  margin: 0;
}

.catalog-tools .cart-link {
  flex-shrink: 0;
  margin: 0;
  min-height: 56px;
}

.catalog-by-category {
  display: grid;
  gap: 34px;
}

.category-picker-hint {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: clamp(28px, 5vw, 52px) 20px;
  color: var(--muted);
  text-align: center;
  background: linear-gradient(135deg, #fff, #edf4ff);
  border: 1px dashed #b8cdf4;
  border-radius: 22px;
}

.category-picker-hint strong {
  color: #142d42;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
}

.category-section {
  scroll-margin-top: 170px;
  padding: clamp(20px, 3vw, 34px);
  background: rgba(255, 255, 255, .76);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(31, 55, 85, .07);
}

.category-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.category-section__title {
  margin: 0;
  color: #142d42;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  letter-spacing: -.025em;
}

.category-section__count {
  flex: 0 0 auto;
  color: var(--blue-dark);
  font-size: .88rem;
  font-weight: 800;
}

.category-language-instruction {
  margin: 22px 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.category-language-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.category-language-choice {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  color: #25425b;
  background: #fff;
  border: 1px solid #cfdceb;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  text-align: start;
  transition: transform .2s ease, color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.category-language-choice:hover {
  color: var(--blue-dark);
  border-color: #8eb2ef;
  box-shadow: 0 8px 20px rgba(31, 55, 85, .09);
  transform: translateY(-2px);
}

.category-language-choice.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(37, 117, 252, .24);
}

.category-language-choice small {
  display: inline-grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  padding: 3px 7px;
  color: var(--blue-dark);
  background: #eaf1ff;
  border-radius: 999px;
  font-size: .78rem;
}

.category-language-choice.active small {
  color: var(--blue-dark);
  background: #fff;
}

.category-language-choice:focus-visible,
.category-jump-link:focus-visible {
  outline: 3px solid rgba(37, 117, 252, .28);
  outline-offset: 3px;
}

.category-language-list {
  display: grid;
  gap: 28px;
  margin-top: 24px;
}

.catalog-by-category.is-searching .category-language-instruction,
.catalog-by-category.is-searching .category-language-choices {
  display: none;
}

.category-language-block {
  min-width: 0;
}

.category-language-block + .category-language-block {
  padding-top: 24px;
  border-top: 1px dashed #cbd7e5;
}

.category-language-title {
  width: fit-content;
  margin: 0 0 16px;
  padding: 7px 12px;
  color: var(--blue-dark);
  background: #eaf1ff;
  border-radius: 9px;
  font-size: 1rem;
}

.category-language-empty {
  margin: 0;
  padding: 18px 20px;
  color: var(--muted);
  background: #f7f9fc;
  border: 1px dashed #cbd7e5;
  border-radius: 12px;
  font-size: .95rem;
}

.category-books-grid {
  /* Exact-book links land on a visible, focused catalogue card. */
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
}

.book-card.is-linked-book {
  outline: 3px solid #2164d7;
  outline-offset: 4px;
  scroll-margin-top: 130px;
  box-shadow: 0 0 0 8px rgba(33, 100, 215, .12);
}

.books-grid,
.arabic-books-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.book-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 14px;
  overflow: hidden;
  text-align: start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(31, 55, 85, .07);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.book-card:hover {
  border-color: #c8d7e9;
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.book-card > img {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: block;
  object-fit: cover;
  background: #e9eef5;
  border-radius: 11px;
}

.generated-cover-card > img,
.modified-cover-card > img {
  object-fit: contain;
  background: #fff;
  image-rendering: auto;
  transition: transform .2s ease;
}

.generated-cover-card:hover > img,
.modified-cover-card:hover > img {
  transform: scale(1.01);
}

.book-title {
  margin: 16px 0 7px;
  color: #142d42;
  font-size: 1.05rem;
  line-height: 1.35;
}

.book-code {
  align-self: flex-start;
  margin-top: 13px;
  padding: 4px 8px;
  color: var(--blue-dark);
  background: #eaf1ff;
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .04em;
}

.imported-book-card .book-title {
  margin-top: 9px;
}

.book-desc {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.6;
}

.read-more-btn {
  align-self: flex-start;
  margin-top: 8px;
  color: var(--blue-dark);
  font-size: .9rem;
  font-weight: 750;
}

.read-more-btn:hover {
  text-decoration: underline;
}

.book-price {
  display: block;
  margin-top: auto;
  padding-top: 18px;
  color: #142d42;
  font-size: 1.08rem;
  font-weight: 850;
}

.buy-btn {
  width: 100%;
  margin-top: 9px;
  padding: 11px 16px;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.buy-btn:hover {
  background: #0f7044;
}

.buy-btn.unavailable,
.buy-btn.unavailable:hover {
  color: #7a8796;
  background: #e5eaf0;
  cursor: not-allowed;
}

.book-price.unavailable {
  color: #7a8796;
  font-size: .9rem;
}

.buy-btn:active {
  transform: scale(.98);
}

.no-results {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed #b9c8da;
  border-radius: 16px;
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  max-width: min(390px, calc(100% - 44px));
  padding: 14px 18px 14px 46px;
  color: #155f3b;
  background: #effcf5;
  border: 1px solid #95d8b5;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 700;
  animation: toast-in .25s ease both;
}

#toast::before {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 17px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  transform: translateY(-50%);
}

/* Basket */
.basket-shell {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 90px;
}

.basket-heading {
  margin-bottom: 32px;
}

.basket-heading h1 {
  margin: 0;
  color: #142d42;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.basket-heading > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
}

.basket-list {
  display: grid;
  gap: 12px;
}

.basket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(31, 55, 85, .05);
}

.basket-item h2 {
  margin: 0 0 5px;
  color: #183247;
  font-size: 1rem;
}

.basket-item p {
  margin: 0;
  color: var(--green);
  font-weight: 800;
}

.remove-btn,
.clear-cart-btn {
  padding: 8px 12px;
  color: #a23333;
  background: transparent;
  border: 1px solid #e8bcbc;
  border-radius: 8px;
  font-weight: 750;
  cursor: pointer;
}

.remove-btn:hover,
.clear-cart-btn:hover {
  background: #fff1f1;
}

.basket-summary {
  margin-top: 22px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.basket-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 1.2rem;
}

.basket-summary strong {
  color: #142d42;
  font-size: 1.55rem;
}

.basket-summary > .basket-breakdown-row {
  margin-bottom: 8px;
  font-size: 1rem;
}

.basket-summary > .basket-breakdown-row strong {
  font-size: 1rem;
}

.discount-row,
.discount-row strong {
  color: var(--green) !important;
}

.basket-summary > .basket-grand-total {
  margin-top: 13px;
  padding-top: 14px;
  border-top: 2px solid #cdd9e8;
  font-weight: 850;
}

.basket-summary p {
  margin: 7px 0 20px;
  color: var(--muted);
  font-size: .9rem;
}

.delivery-fee-notice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  color: #714c00;
  background: #fff4cb;
  border: 1px solid #ead589;
  border-radius: 9px;
  font-size: .88rem;
  font-weight: 850;
}

.basket-summary .delivery-fee-notice {
  margin: 0 0 14px;
  color: #714c00;
}

.checkout-btn,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 9px;
  font-weight: 800;
  cursor: pointer;
}

.checkout-btn:hover,
.primary-link:hover {
  background: var(--blue-dark);
}

.clear-cart-btn {
  margin-left: 8px;
}

.empty-basket {
  padding: 54px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.empty-basket > span {
  font-size: 2.5rem;
}

.empty-basket h2 {
  margin: 14px 0 6px;
}

.empty-basket p {
  margin: 0 0 22px;
  color: var(--muted);
}

/* Contact */
.contact-shell {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 84px;
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(320px, 1fr);
  gap: clamp(32px, 7vw, 84px);
  align-items: start;
}

.contact-intro h1 {
  margin: 0;
  color: #142d42;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -.045em;
}

.contact-intro .contact-description {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.instagram-profile-link,
.instagram-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
}

.instagram-profile-link {
  margin-top: 14px;
  padding: 11px 15px;
  color: var(--blue-dark);
  background: #edf4ff;
  border: 1px solid #cfe0fb;
  border-radius: 10px;
}

.instagram-profile-link:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.instagram-profile-link svg,
.instagram-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

.contact-form {
  display: grid;
  gap: 10px;
  padding: clamp(22px, 4vw, 34px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.contact-form label {
  margin-top: 7px;
  color: #243e54;
  font-size: .9rem;
  font-weight: 800;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 117, 252, .12);
}

.contact-form button {
  margin-top: 10px;
  padding: 13px 18px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.contact-form button:hover {
  background: var(--blue-dark);
}

.form-status {
  margin: 4px 0 0;
  color: var(--green);
  font-weight: 750;
}

/* Book requests */
.book-request {
  width: min(1120px, calc(100% - 40px));
  margin: 64px auto 80px;
  padding: clamp(24px, 5vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
  background: linear-gradient(135deg, #f7faff 0%, #e7f0ff 100%);
  border: 1px solid #cadcf8;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(31, 86, 166, .1);
}

.catalog-main > .book-request {
  width: 100%;
  margin: 58px 0 0;
}

.book-request-copy .eyebrow {
  margin-bottom: 10px;
  color: var(--blue-dark);
}

.book-request h2 {
  margin: 0;
  color: #142d42;
  font-size: clamp(1.7rem, 3.3vw, 2.55rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}

.book-request-copy > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.book-request-form {
  display: grid;
  gap: 9px;
}

.book-request-form label {
  color: #243e54;
  font-size: .9rem;
  font-weight: 800;
}

.book-request-controls {
  display: flex;
  gap: 10px;
}

.book-request-controls input {
  min-width: 0;
  flex: 1 1 auto;
  padding: 13px 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b9cce8;
  border-radius: 10px;
  outline: none;
}

.book-request-controls input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 117, 252, .12);
}

.book-request-controls button {
  flex: 0 0 auto;
  padding: 13px 18px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.book-request-controls button:hover {
  background: var(--blue-dark);
}

.book-request-note {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}

/* Academia */
.academia-shell {
  width: min(960px, calc(100% - 40px));
  min-height: calc(100vh - 230px);
  margin: 0 auto;
  padding: 72px 0 84px;
  display: grid;
  place-items: center;
}

.academia-placeholder {
  position: relative;
  width: min(760px, 100%);
  overflow: hidden;
  padding: clamp(42px, 8vw, 76px) clamp(24px, 7vw, 70px);
  text-align: center;
  background:
    radial-gradient(circle at 10% 0%, rgba(106, 17, 203, .12), transparent 38%),
    linear-gradient(145deg, #ffffff, #f4f8ff);
  border: 1px solid rgba(37, 117, 252, .18);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(22, 79, 174, .14);
}

.academia-mark {
  width: 94px;
  height: 76px;
  margin: 0 auto 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
}

.academia-mark span {
  display: block;
  width: 22px;
  border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 5px 5px 2px 2px;
  box-shadow: 0 7px 16px rgba(22, 79, 174, .18);
}

.academia-mark span:nth-child(1) {
  height: 55px;
  background: #6a11cb;
}

.academia-mark span:nth-child(2) {
  height: 70px;
  background: #2575fc;
}

.academia-mark span:nth-child(3) {
  height: 48px;
  background: #164fae;
}

.academia-placeholder h1 {
  margin: 0;
  color: #142d42;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -.05em;
}

.academia-description {
  max-width: 600px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.75;
}

.academia-soon {
  display: inline-flex;
  margin: 28px 0 0;
  padding: 10px 16px;
  color: var(--blue-dark);
  background: #eaf1ff;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 800;
}

/* Shared footer */
.site-footer {
  padding: 25px 20px;
  color: #fff;
  background: #142d42;
}

.site-footer-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-footer p {
  margin: 0;
  color: rgba(255, 255, 255, .78);
}

.instagram-link {
  padding: 9px 12px;
  color: #fff;
  border-radius: 9px;
}

.instagram-link:hover {
  background: rgba(255, 255, 255, .12);
}

/* Checkout */
.checkout-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 84px;
}

.checkout-heading {
  max-width: 760px;
  margin-bottom: 34px;
}

.checkout-heading h1 {
  margin: 0;
  color: #142d42;
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

.checkout-heading > p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr);
  gap: 24px;
  align-items: start;
}

.checkout-form {
  display: grid;
  gap: 24px;
}

.checkout-card {
  padding: clamp(20px, 4vw, 30px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 9px 28px rgba(31, 55, 85, .08);
}

.checkout-card h2 {
  margin: 0 0 22px;
  color: #17344c;
  font-size: 1.25rem;
}

.checkout-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.checkout-fields label {
  display: grid;
  gap: 8px;
  color: #29445b;
  font-size: .9rem;
  font-weight: 800;
}

.checkout-fields .full-field {
  grid-column: 1 / -1;
}

.checkout-fields input,
.checkout-fields textarea {
  width: 100%;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  resize: vertical;
}

.checkout-fields input:focus,
.checkout-fields textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 117, 252, .12);
}

.payment-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 12px;
  padding: 16px;
  background: #f9fbfe;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.payment-option.selected {
  background: #f0fbf6;
  border-color: rgba(22, 134, 83, .42);
}

.payment-option.disabled {
  cursor: not-allowed;
  opacity: .72;
}

.payment-option input {
  margin-top: 4px;
  accent-color: var(--green);
}

.payment-option span {
  display: grid;
  gap: 4px;
}

.payment-option strong {
  color: #183247;
}

.payment-option small {
  color: var(--muted);
  line-height: 1.5;
}

.payment-option em {
  margin-inline-start: auto;
  padding: 4px 8px;
  color: #5e4c1f;
  background: #fff4cb;
  border-radius: 999px;
  font-size: .7rem;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.whatsapp-checkout-btn {
  width: 100%;
  margin-top: 20px;
  padding: 14px 18px;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 11px;
  font-weight: 850;
  cursor: pointer;
}

.payment-card .delivery-fee-notice {
  width: 100%;
  margin: 18px 0 0;
}

.delivery-fee-notice + .whatsapp-checkout-btn {
  margin-top: 12px;
}

.whatsapp-checkout-btn:hover {
  background: #0f7044;
}

.checkout-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.order-summary {
  position: sticky;
  top: 104px;
}

.order-summary ul {
  display: grid;
  gap: 13px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.order-summary li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  color: #334e65;
  border-bottom: 1px solid var(--line);
}

.order-summary li strong {
  flex: 0 0 auto;
  color: #17344c;
  direction: ltr;
  unicode-bidi: isolate;
}

.order-total {
  display: flex;
  justify-content: space-between;
  margin-top: 13px;
  padding-top: 14px;
  border-top: 2px solid #cdd9e8;
  font-size: 1.15rem;
  font-weight: 850;
}

.order-breakdown {
  display: grid;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #dce5f0;
}

.order-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.order-breakdown strong {
  color: #17344c;
  direction: ltr;
  unicode-bidi: isolate;
}

.order-total strong,
.basket-item p,
#basketSubtotal,
#basketTotal {
  direction: ltr;
  unicode-bidi: isolate;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .site-header {
    min-height: 68px;
    padding: 12px 20px;
  }

  .brand {
    gap: 8px;
    font-size: 1.15rem;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .site-navigation {
    position: absolute;
    top: 100%;
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 10px;
    background: var(--blue);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(22, 79, 174, .25);
  }

  .site-navigation.is-open {
    display: flex;
  }

  .site-navigation a {
    padding: 12px 14px;
  }

  .ui-language-switcher {
    width: 100%;
    justify-content: center;
    margin: 4px 0;
  }

  .ui-language-switcher button {
    flex: 1;
    min-height: 38px;
  }
}

@media (max-width: 700px) {
  .site-header {
    min-height: 68px;
    padding: 12px 20px;
  }

  .brand {
    gap: 8px;
    font-size: 1.15rem;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .site-navigation {
    position: absolute;
    top: 100%;
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 10px;
    background: var(--blue);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(22, 79, 174, .25);
  }

  .site-navigation.is-open {
    display: flex;
  }

  .site-navigation a {
    padding: 12px 14px;
  }

  .ui-language-switcher {
    width: 100%;
    justify-content: center;
    margin: 4px 0;
  }

  .ui-language-switcher button {
    flex: 1;
    min-height: 38px;
  }

  .catalog-main {
    width: min(100% - 24px, 1180px);
    padding: 42px 0 60px;
  }

  .basket-shell {
    width: min(100% - 24px, 920px);
    padding: 42px 0 60px;
  }

  .contact-shell {
    width: min(100% - 24px, 620px);
    grid-template-columns: 1fr;
    padding: 42px 0 60px;
  }

  .academia-shell {
    width: min(100% - 24px, 620px);
    min-height: calc(100vh - 210px);
    padding: 42px 0 60px;
  }

  .academia-placeholder {
    border-radius: 20px;
  }

  .checkout-shell {
    width: min(100% - 24px, 680px);
    padding: 42px 0 60px;
  }

  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .checkout-fields {
    grid-template-columns: 1fr;
  }

  .book-request {
    width: min(100% - 24px, 1120px);
    margin: 44px auto 58px;
    grid-template-columns: 1fr;
  }

  .catalog-main > .book-request {
    width: 100%;
    margin-top: 44px;
  }

  .book-request-controls {
    flex-direction: column;
  }

  .book-request-controls button {
    width: 100%;
  }

  .site-footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .checkout-fields .full-field {
    grid-column: auto;
  }

  .order-summary {
    position: static;
  }

  .basket-item {
    align-items: flex-start;
    padding: 16px;
  }

  .checkout-btn,
  .clear-cart-btn {
    width: 100%;
  }

  .clear-cart-btn {
    margin: 9px 0 0;
  }

  .top-bar {
    top: 80px;
  }

  .language-container {
    flex-wrap: wrap;
  }

  .language-item {
    flex: 1 1 auto;
    padding: 9px 10px;
    text-align: center;
  }

  .cart-link {
    width: 100%;
    justify-content: center;
  }

  .books-grid,
  .arabic-books-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .book-card {
    padding: 10px;
    border-radius: 14px;
  }

  .book-title {
    font-size: .96rem;
  }

  .book-desc {
    font-size: .84rem;
  }
}

@media (max-width: 420px) {
  .books-grid,
  .arabic-books-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .book-card {
    padding: 8px;
    border-radius: 12px;
  }

  .book-card > img {
    border-radius: 8px;
  }

  .book-title {
    margin: 11px 0 5px;
    font-size: .86rem;
    line-height: 1.32;
  }

  .book-desc {
    font-size: .76rem;
    line-height: 1.45;
  }

  .read-more-btn {
    font-size: .78rem;
  }

  .book-price {
    padding-top: 12px;
    font-size: .94rem;
  }

  .buy-btn {
    min-height: 44px;
    padding: 9px 7px;
    font-size: .82rem;
  }
}

@media (max-width: 720px) {
  .category-jump-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .category-jump-link {
    min-height: 68px;
    padding: 12px 10px;
    font-size: .94rem;
  }

  .catalog-tools {
    flex-wrap: wrap;
    gap: 10px;
  }

  .catalog-tools .top-search {
    flex-basis: 100%;
  }

  .catalog-tools .cart-link {
    min-height: 44px;
    margin-inline-start: auto;
  }

  .category-section {
    padding: 18px;
    border-radius: 18px;
  }

  .category-section__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .category-language-choices {
    grid-template-columns: 1fr;
  }

  .category-language-choice {
    min-height: 62px;
    padding: 13px 15px;
  }

  .category-books-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Keep every catalogue in pairs on phone screens, including category views. */
@media (max-width: 720px) {
  .books-grid,
  .arabic-books-container,
  .category-books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .book-card {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .book-card > img {
    max-width: 100%;
  }
}
