html {
  font-family: "IBM Plex Sans Arabic", sans-serif;
}

button,
a {
  font-family: inherit;
}

:root {
  --brand-gradient: linear-gradient(90deg, #1B4D3E 0%, #295240 7.14%, #365743 14.29%, #415C45 21.43%, #4C6147 28.57%, #576649 35.71%, #626B4B 42.86%, #6D704D 50%, #77754F 57.14%, #827A51 64.29%, #8D7F53 71.43%, #978455 78.57%, #A28957 85.71%, #AD8E58 92.86%, #B8935A 100%) ;
}

.book-read-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #F9F9F9;
  color: #333333;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.book-read-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #FFFFFF;
  border-bottom: 1px solid #E8E8E8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding-top: env(safe-area-inset-top);
}

.book-read-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 56rem;
  margin: 0 auto;
  padding: 0.875rem 1rem;
  min-width: 0;
}

.book-read-header__book {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.book-read-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  color: #333333;
}

.book-read-header__back svg {
  width: 1.125rem;
  height: 1.125rem;
}

.book-read-header__titles {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  text-align: right;
}

.book-read-header__book-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-read-header__chapter-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #777777;
  line-height: 1.4;
}

.book-read-header__tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.book-read-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #555555;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.book-read-tool-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.book-read-tool-btn:hover {
  background: #F3F4F6;
  color: #1B4D3E;
}

.book-read-main {
  flex: 1;
  background: #FFFFFF;
  padding: 2rem 1rem 2.5rem;
}

.book-read-content {
  max-width: 45rem;
  margin: 0 auto;
  min-width: 0;
}

.book-read-content__title {
  font-size: clamp(1.375rem, 3vw + 0.5rem, 1.75rem);
  font-weight: 700;
  color: #1F2937;
  line-height: 1.45;
  text-align: center;
  margin: 0 0 1.75rem;
}

.book-read-content p {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
  color: #3D3D3D;
  text-align: right;
  margin: 0 0 1.25rem;
}

.book-read-quote {
  margin: 1.5rem 0;
  padding: 0 1rem 0 0;
  border-right: 4px solid #B8935A;
  text-align: right;
}

.book-read-quote p {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.75;
  color: #3D3D3D;
  margin: 0 0 0.375rem;
}

.book-read-quote cite {
  display: block;
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 500;
  color: #777777;
}

.book-read-footer {
  background: #FFFFFF;
  border-top: 1px solid #E8E8E8;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
}

.book-read-footer__inner {
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-width: 0;
}

.book-read-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #777777;
  line-height: 1.4;
}

.book-read-progress-meta__pages {
  order: 1;
}

.book-read-progress-meta__percent {
  order: 2;
}

.book-read-progress-bar {
  height: 4px;
  background: #E8E8E8;
  border-radius: 9999px;
  overflow: hidden;
  direction: rtl;
}

.book-read-progress-bar__fill {
  height: 100%;
  background: #B8935A;
  border-radius: 9999px;
  transition: width 0.25s ease;
}

.book-read-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.book-read-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
  border: none;
  white-space: nowrap;
}

.book-read-nav__btn svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.book-read-nav__btn--secondary {
  background: #EFEFEF;
  color: #333333;
}

.book-read-nav__btn--secondary:hover:not(:disabled) {
  background: #E5E5E5;
}

.book-read-nav__btn--secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.book-read-nav__btn--primary {
  background: #1B4D3E;
  color: #FFFFFF;
}

.book-read-nav__btn--primary:hover {
  background: #236352;
}

@media (min-width: 640px) {
  .book-read-header__inner {
    padding: 1rem 1.5rem;
  }

  .book-read-main {
    padding: 2.5rem 1.5rem 3rem;
  }

  .book-read-footer {
    padding: 1.25rem 1.5rem calc(1.25rem + env(safe-area-inset-bottom));
  }

  .book-read-footer__inner {
    gap: 1rem;
  }

  .book-read-nav {
    gap: 1rem;
  }

  .book-read-nav__btn {
    padding: 0.75rem 1.25rem;
  }
}

@media (min-width: 1024px) {
  .book-read-header__inner,
  .book-read-footer__inner {
    max-width: 52rem;
  }

  .book-read-content {
    max-width: 42rem;
  }

  .book-read-main {
    padding: 3rem 2rem 3.5rem;
  }
}

@media (max-width: 767px) {
  .book-read-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-read-nav__btn {
    width: 100%;
    min-height: 48px;
    white-space: normal;
  }

  .book-read-nav__btn--primary {
    order: -1;
  }
}

@media (max-width: 639px) {
  .book-read-header__book-title {
    font-size: 0.875rem;
  }

  .book-read-header__chapter-label {
    font-size: 0.6875rem;
  }

  .book-read-main {
    padding: 1.5rem 0.875rem 2rem;
  }

  .book-read-content p,
  .book-read-quote p {
    font-size: 0.9375rem;
    line-height: 1.8;
  }
}

@media (max-width: 379px) {
  .book-read-header__inner {
    padding: 0.75rem 0.875rem;
    gap: 0.5rem;
  }

  .book-read-header__tools {
    gap: 0.125rem;
  }

  .book-read-tool-btn {
    width: 2rem;
    height: 2rem;
  }

  .book-read-tool-btn svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  .book-read-progress-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    font-size: 0.75rem;
  }

  .book-read-nav__btn {
    font-size: 0.8125rem;
    padding: 0.625rem 0.75rem;
  }
}

@media (min-width: 768px) {
  .book-read-nav__btn {
    white-space: nowrap;
  }
}

/* Hide default website header and footer on the book reading screen */
#navbar,
.bg-footer-gradient {
  display: none !important;
}

