/* TheSansArabic is the approved interface typeface. Place the supplied licensed
   original OTF files in assets/fonts/ using the exact filenames below. */
@font-face {
  font-family: 'TheSansArabic';
  src: url('assets/fonts/THESANSARABIC-LIGHT(1).OTF') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'TheSansArabic';
  src: url('assets/fonts/THESANSARABIC-SEMIBOLD(1).OTF') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'TheSansArabic';
  src: url('assets/fonts/THESANSARABIC-BOLD(1).OTF') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --green: #086440;
  --green-dark: #064a30;
  --ink: #162a21;
  --muted: #728078;
  --surface: #f5f7f4;
  --border: #e2eae3;
  --shadow: 0 22px 58px rgba(21,50,32,.16),0 5px 14px rgba(21,50,32,.10);
  --ease: cubic-bezier(.18,.73,.28,1);
  font-family: 'TheSansArabic', Tahoma, Arial, sans-serif;
  font-weight: 600;
}
*,*::before,*::after{box-sizing:border-box}
html{height:100%;overflow:hidden;-webkit-text-size-adjust:100%}
body{margin:0;height:100%;min-height:100dvh;background:var(--surface);color:var(--ink);overflow:hidden}
button,input{font:inherit}
button{cursor:pointer}
button:disabled{cursor:default;opacity:.3}
a{color:inherit;text-decoration:none}
svg{height:21px;width:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.icon-defs{position:absolute;width:0;height:0;overflow:hidden}
button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #52bb83;outline-offset:3px}
[hidden]{display:none!important}
.app-shell{height:100dvh;min-height:0;display:flex;flex-direction:column;isolation:isolate}
.topbar{background:#fff;border-bottom:1px solid var(--border);flex-shrink:0;position:relative;z-index:4}
.topbar-inner{height:77px;max-width:1600px;margin:auto;padding:0 clamp(22px,4.2vw,76px);display:flex;align-items:center;justify-content:space-between;gap:20px}
.brand{display:flex;align-items:center;gap:16px;min-width:0}
.brand-logo{position:relative;background:linear-gradient(147deg,#0b7650,#075437);color:#fff;min-width:94px;height:42px;border-radius:10px;display:grid;place-items:center;font-size:16px;font-weight:700;letter-spacing:-.6px;box-shadow:0 4px 9px rgba(5,79,48,.12)}
.brand-logo i{position:absolute;width:6px;height:6px;background:#b6e0c7;border-radius:50%;top:8px;left:8px}
.brand-copy{display:flex;flex-direction:column;gap:3px;white-space:nowrap}
.brand-copy strong{font-size:16px;font-weight:700;letter-spacing:-.4px}
.brand-copy small{color:var(--muted);font-size:11px;font-weight:600}
.header-actions{display:flex;align-items:center;gap:8px}
.icon-button{height:43px;width:43px;border:1px solid transparent;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;background:transparent;color:#34473b;transition:background .18s,color .18s,border-color .18s;touch-action:manipulation}
.icon-button:hover,.toolbar-button:hover{background:#eaf2ec;color:var(--green)}
.header-button{border-color:#e6eee8}
.header-button:hover{border-color:#cde2d3}
.action-separator{height:27px;width:1px;background:#e2e8e4;margin:0 7px}
.reader{width:100%;flex:1;display:flex;flex-direction:column;min-height:0;position:relative}
.reader-heading{max-width:1400px;width:100%;margin:0 auto;padding:20px clamp(25px,5vw,80px) 0;display:flex;align-items:center;justify-content:space-between;gap:15px;flex-shrink:0}
.edition-pill{display:inline-flex;align-items:center;gap:8px;direction:rtl;border:1px solid #d9e9dc;color:#32604a;background:#e9f3eb;padding:7px 12px;border-radius:100px;font-size:11px;font-weight:700;white-space:nowrap}
.edition-dot{width:7px;height:7px;border-radius:50%;background:#159a5c;box-shadow:0 0 0 4px #d2ead7}
.edition-divider{opacity:.35}
.reader-hint{font-size:11px;letter-spacing:.05px;color:#7d8e83;font-weight:300}
.mobile-hint{display:none}
.reader-canvas{container-type:size;min-height:0;flex:1;display:flex;justify-content:center;align-items:center;position:relative;gap:clamp(22px,3.2vw,57px);padding:12px 24px 0;overflow:hidden}
.reader-canvas::before{content:"";position:absolute;inset:5% 8% -25%;pointer-events:none;background:radial-gradient(ellipse 45% 49% at 50% 53%,#e0eae1 0%,rgba(234,241,232,.7) 48%,transparent 100%)}
.reader-canvas::after{content:"";position:absolute;inset:0;pointer-events:none;background-image:radial-gradient(#d7e3d8 0.7px,transparent .7px);background-size:23px 23px;opacity:.52;mask-image:radial-gradient(ellipse 53% 65% at 50% 55%,#000 0,transparent 100%)}
.canvas-glow{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:min(75vw,850px);height:min(45vw,390px);background:rgba(14,91,56,.05);filter:blur(65px);pointer-events:none}
.book-outer{position:relative;flex-shrink:0;z-index:1;filter:drop-shadow(0 24px 23px rgba(16,55,32,.07));}
.book-frame{position:relative;z-index:1;width:min(calc(100vw - 205px),calc((100cqh - 24px) * 1.41421356));aspect-ratio:1.41421356 / 1;perspective:1900px;touch-action:pan-y;user-select:none;-webkit-user-select:none}
.book-stage{position:absolute;inset:0;transform-style:preserve-3d;z-index:2}
.spread{position:absolute;inset:0;display:flex;direction:rtl;align-items:stretch;transform-style:preserve-3d;backface-visibility:hidden}
.spread-current{z-index:2}
.paper{display:block;flex:0 0 50%;max-width:50%;min-width:0;height:100%;position:relative;padding:0;border:0;background:#fff;overflow:hidden;cursor:zoom-in;box-shadow:var(--shadow)}
.paper--right{border-radius:2px 0 0 2px}
.paper--left{border-radius:0 2px 2px 0}
.paper--right::after{position:absolute;content:"";inset:0 0 0 auto;width:10%;background:linear-gradient(90deg,transparent,rgba(10,34,24,.045));pointer-events:none}
.paper--left::after{position:absolute;content:"";inset:0 auto 0 0;width:10%;background:linear-gradient(-90deg,transparent,rgba(10,34,24,.05));pointer-events:none}
.paper img{height:100%;width:100%;object-fit:fill;display:block;pointer-events:none;-webkit-user-drag:none}
.spread--cover .paper--left{box-shadow:var(--shadow);border-radius:3px}
.spread--back .paper--right{box-shadow:var(--shadow);border-radius:3px}
.spread:not(.spread--cover):not(.spread--back) .paper--left{box-shadow:8px 16px 34px rgba(20,47,31,.14),inset -3px 0 6px rgba(0,0,0,.045)}
.spread:not(.spread--cover):not(.spread--back) .paper--right{box-shadow:-8px 16px 34px rgba(20,47,31,.14),inset 3px 0 6px rgba(0,0,0,.045)}
.spread:not(.spread--mobile):not(.spread--cover):not(.spread--back)::after{content:"";position:absolute;z-index:3;top:0;bottom:0;left:calc(50% - 2px);width:4px;background:linear-gradient(90deg,rgba(12,47,30,.12),rgba(255,255,255,.5),rgba(12,47,30,.10));pointer-events:none}
.initial-loader{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;font-size:12px;color:#638772}
.loading-ring{width:34px;height:34px;border:3px solid #dbece0;border-top-color:#087a49;border-radius:50%;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.spread.enter-next{animation:enter-next .43s var(--ease) both;z-index:2}
.spread.exit-next{animation:exit-next .43s var(--ease) both;z-index:1;pointer-events:none}
.spread.enter-prev{animation:enter-prev .43s var(--ease) both;z-index:2}
.spread.exit-prev{animation:exit-prev .43s var(--ease) both;z-index:1;pointer-events:none}
@keyframes enter-next{from{opacity:.55;transform:translateX(-27px) rotateY(5deg) scale(.987)}to{opacity:1;transform:none}}
@keyframes exit-next{to{opacity:0;transform:translateX(28px) rotateY(-7deg) scale(.992)}}
@keyframes enter-prev{from{opacity:.55;transform:translateX(27px) rotateY(-5deg) scale(.987)}to{opacity:1;transform:none}}
@keyframes exit-prev{to{opacity:0;transform:translateX(-28px) rotateY(7deg) scale(.992)}}
.turn-arrow{z-index:2;flex-shrink:0;border:1px solid #dce7dc;background:#fff;color:#125b3b;width:51px;height:51px;border-radius:50%;display:flex;align-items:center;justify-content:center;box-shadow:0 7px 20px rgba(14,58,37,.06);transition:transform .18s,box-shadow .18s,background .18s}
.turn-arrow svg{width:24px;height:24px;stroke-width:2.1}
.turn-arrow:hover:not(:disabled){transform:scale(1.06);background:#ecf7ee;box-shadow:0 9px 22px rgba(14,58,37,.11)}
.reader-toolbar{width:min(690px,calc(100% - 48px));margin:5px auto 7px;display:grid;grid-template-columns:1fr minmax(210px,320px) 1fr;align-items:center;gap:16px;flex-shrink:0;position:relative;z-index:2;min-height:69px}
.toolbar-side{display:flex;align-items:center}
.toolbar-side--left{justify-content:flex-end}
.toolbar-button{background:transparent;border:0;border-radius:10px;display:flex;align-items:center;justify-content:center;gap:9px;padding:11px 13px;font-size:12px;font-weight:700;color:#46634e;transition:background .18s;white-space:nowrap}
.toolbar-button svg{width:18px;height:18px}
.pagination-box{align-items:center;display:flex;flex-direction:column;gap:7px}
.page-numbers{display:flex;gap:7px;align-items:baseline;justify-content:center;color:#1d4932;min-height:22px;white-space:nowrap}
.page-numbers strong{font-size:15px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:.4px}
.page-numbers-suffix{font-size:11px;color:#89958a}
.slider-row{display:flex;gap:10px;align-items:center;width:100%;direction:rtl}
.range-edge{font-size:10px;color:#89998d;font-variant-numeric:tabular-nums}
input[type=range]{appearance:none;-webkit-appearance:none;background:linear-gradient(to left,var(--green) var(--progress,0%),#dfe8e1 var(--progress,0%));height:5px;border-radius:5px;outline-offset:7px;flex:1;min-width:0;cursor:pointer}
input[type=range]::-webkit-slider-thumb{appearance:none;width:14px;height:14px;border-radius:50%;background:var(--green);border:3px solid #fff;box-shadow:0 1px 8px #58816888}
input[type=range]::-moz-range-thumb{width:10px;height:10px;border-radius:50%;background:var(--green);border:3px solid #fff;box-shadow:0 1px 8px #58816888}
.app-footer{flex-shrink:0;height:33px;display:flex;align-items:center;justify-content:space-between;max-width:1600px;width:100%;margin:auto;padding:0 clamp(22px,4.2vw,76px);font-size:10px;color:#899b8e;border-top:1px solid transparent}
.footer-middle{opacity:.8}
.app-footer a{display:inline-flex;align-items:center;gap:6px;color:#44715a}
.app-footer svg{width:13px;height:13px}
.drawer-backdrop{position:fixed;z-index:10;inset:0;background:rgba(9,26,16,.42);backdrop-filter:blur(3px);animation:fade-in .2s both}
@keyframes fade-in{from{opacity:0}to{opacity:1}}
.thumb-drawer{position:fixed;z-index:11;right:0;top:0;bottom:0;width:min(410px,100%);background:#fff;box-shadow:-14px 0 60px rgba(0,0,0,.13);display:flex;flex-direction:column;animation:slide-in .28s var(--ease) both}
@keyframes slide-in{from{transform:translateX(100%)}to{transform:translateX(0)}}
.drawer-header{padding:29px 25px 22px;display:flex;align-items:start;justify-content:space-between;border-bottom:1px solid #eaf0eb;gap:10px}
.drawer-eyebrow{font-size:11px;font-weight:700;color:#3a8e5e}
.drawer-header h2{font-size:22px;letter-spacing:-.5px;margin:5px 0 7px}
.drawer-header p{font-size:11px;color:#7b8a7e;margin:0}
.close-button{border:1px solid #dfe8e2;background:#f6f8f6}
.thumb-grid{padding:20px 22px 26px;overflow-y:auto;overscroll-behavior:contain;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:17px 13px;align-content:start;scrollbar-color:#a9c2ac transparent}
.thumb-item{background:transparent;border:0;padding:0;min-width:0;display:flex;flex-direction:column;gap:7px;align-items:center;color:#60756a;transition:transform .2s}
.thumb-item:hover{transform:translateY(-3px)}
.thumb-image-box{width:100%;aspect-ratio:595.276 / 841.89;position:relative;background:#f3f5f1;border:2px solid transparent;border-radius:5px;overflow:hidden;box-shadow:0 4px 12px rgba(12,47,26,.12)}
.thumb-image-box img{display:block;width:100%;height:100%;object-fit:cover}
.thumb-item.is-active .thumb-image-box{border-color:#138152;box-shadow:0 0 0 3px #c6e6ce,0 4px 16px #164f302e}
.thumb-label{font-size:11px;font-weight:700}
.thumb-item.is-active .thumb-label{color:#087445}
.drawer-footer{border-top:1px solid #eaf0eb;text-align:center;font-size:11px;padding:14px;color:#849287}
.zoom-modal{position:fixed;z-index:20;inset:0;background:#16221b;display:flex;flex-direction:column;touch-action:manipulation}
.zoom-header{background:#17271f;color:#fff;flex-shrink:0;min-height:64px;padding:7px clamp(17px,4vw,44px);display:flex;align-items:center;justify-content:space-between;gap:12px}
.zoom-header-title{display:flex;align-items:center;gap:14px}
.zoom-header-title strong{font-size:14px}
.zoom-header-title span{font-size:11px;color:#bccac0}
.zoom-close{color:#fff;border:1px solid #445349}
.zoom-close:hover{background:#2c4534;color:#fff}
.zoom-viewport{flex:1;min-height:0;position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center;touch-action:none;cursor:grab;overscroll-behavior:contain}
.zoom-viewport:active{cursor:grabbing}
.zoom-viewport img{display:block;width:auto;height:auto;max-width:calc(100% - 32px);max-height:calc(100% - 22px);object-fit:contain;transform-origin:center center;will-change:transform;pointer-events:none;user-select:none;-webkit-user-drag:none;box-shadow:0 15px 40px rgba(0,0,0,.3)}
.zoom-controls{flex-shrink:0;display:flex;align-items:center;justify-content:center;gap:12px;padding:8px 12px max(8px,env(safe-area-inset-bottom));height:68px;background:#17271f;color:#fff}
.zoom-controls .icon-button{border:1px solid #435447;color:#f2f8f3}
.zoom-controls .icon-button:hover{background:#31483b}
#zoomPercent{font-size:12px;min-width:46px;text-align:center;direction:ltr}
.zoom-control-divider{height:22px;width:1px;background:#435447;margin:0 8px}
.zoom-reset{border:0;color:#d5e6d8;background:transparent;font-size:12px;padding:9px;white-space:nowrap}
.zoom-reset:hover{color:#fff}
.toast{position:fixed;z-index:30;left:50%;bottom:83px;transform:translate(-50%,12px);background:#153c29;color:#fff;border-radius:12px;padding:12px 18px;font-size:12px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .22s,transform .22s;max-width:min(88vw,420px);text-align:center;box-shadow:0 10px 30px #0e392730}
.toast.visible{opacity:1;transform:translate(-50%,0)}
@media(min-width:1500px){.book-frame{width:min(calc(100vw - 245px),calc((100cqh - 24px) * 1.41421356))}}
@media(max-width:1090px) and (min-width:901px){.reader-canvas{gap:20px}.book-frame{width:min(calc(100vw - 165px),calc((100cqh - 24px) * 1.41421356))}.turn-arrow{width:43px;height:43px}}
@media(max-width:900px){
  .topbar-inner{height:68px;padding:0 20px}
  .brand-logo{min-width:88px;height:40px;font-size:15px}
  .brand{gap:12px}
  .brand-copy strong{font-size:13px}
  .brand-copy small{font-size:10px}
  .header-actions{gap:4px}
  .header-button{width:40px;height:40px}
  .action-separator,.fullscreen-button{display:none}
  .reader-heading{padding:14px 22px 0}
  .reader-hint{font-size:10px}
  .desktop-hint{display:none}
  .mobile-hint{display:inline}
  .reader-canvas{padding:12px 14px 0;gap:0}
  .book-frame{width:min(calc(100vw - 34px),calc((100cqh - 76px) * .70710678));aspect-ratio:595.276 / 841.89}
  .spread--mobile{display:block;transform-style:flat}
  .spread--mobile .paper{display:block;width:100%;height:100%;max-width:none;flex:none;border-radius:3px!important}
  .spread--mobile .paper::after{content:none!important}
  .turn-arrow{position:absolute;bottom:6px;border:1px solid #e2ebe2;box-shadow:0 4px 16px #12462d13;height:42px;width:42px;background:#fffefa}
  .turn-arrow--prev{right:18px}
  .turn-arrow--next{left:18px}
  .turn-arrow svg{width:20px;height:20px}
  .reader-toolbar{width:min(100% - 38px,480px);margin:5px auto 6px;min-height:65px;gap:4px;grid-template-columns:1fr minmax(145px,240px) 1fr}
  .toolbar-button{padding:9px 8px;font-size:11px;gap:6px}
  .toolbar-button svg{width:18px;height:18px}
  .app-footer{height:29px;padding:0 19px;font-size:9px}
  .footer-middle{display:none}
}
@media(max-width:490px){
  .topbar-inner{height:61px;padding:0 13px;gap:8px}
  .brand{gap:8px}
  .brand-logo{min-width:77px;height:36px;border-radius:8px;font-size:13px}
  .brand-copy strong{font-size:12px}
  .brand-copy small{font-size:9px}
  .header-actions{gap:2px}
  .header-button{width:36px;height:36px;border:0}
  .header-button svg{width:20px;height:20px}
  .reader-heading{padding:11px 16px 0;gap:5px}
  .edition-pill{font-size:9px;padding:5px 8px;gap:6px}
  .reader-hint{font-size:9px}
  .reader-canvas{padding:6px 10px 0}
  .book-frame{width:min(calc(100vw - 25px),calc((100cqh - 76px) * .70710678))}
  .turn-arrow{bottom:5px;height:38px;width:38px}
  .turn-arrow--prev{right:9px}.turn-arrow--next{left:9px}
  .reader-toolbar{width:calc(100% - 24px);min-height:60px;margin:3px auto 3px;gap:5px;grid-template-columns:1fr minmax(142px,200px) 1fr}
  .page-numbers strong{font-size:13px}
  .toolbar-button{gap:5px;font-size:10px}
  .app-footer{height:28px}
  .thumb-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:15px 12px}
}
@media(max-width:350px){.brand-copy small{display:none}.brand-logo{min-width:70px}.header-actions{gap:0}.reader-hint{display:none}.toolbar-button span{display:none}}
@media(max-height:650px){.reader-heading{padding-top:6px}.book-frame{width:min(calc(100vw - 170px),calc((100cqh - 24px) * 1.41421356))}.reader-toolbar{min-height:55px;margin:0 auto}.app-footer{height:24px}}
@media(max-width:900px) and (max-height:650px){.book-frame{width:min(calc(100vw - 26px),calc((100cqh - 70px) * .70710678))}.topbar-inner{height:51px}.reader-heading{padding-top:4px}.reader-toolbar{min-height:49px}.app-footer{height:20px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}

/* Keep all reading surfaces above decoration and prevent interactive overflow. */
.book-outer{max-width:100%;min-width:0}
.paper{touch-action:pan-y}
.paper:focus-visible{outline:3px solid #23a970;outline-offset:-4px;z-index:4}
.paper-image-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;background:#fff;color:#225841;padding:20px;text-align:center;font-size:13px}
.paper-image-error a{text-decoration:underline;font-weight:700}
@media(max-height:430px){.reader-heading{display:none}.reader-toolbar{min-height:46px}.app-footer{display:none}}

/* A single front/back cover must be centered; don't draw a fake gutter on mobile. */
@media(min-width:901px){
  .spread--cover,.spread--back{justify-content:center}
}
.spread--mobile::after{content:none!important;display:none!important}

/* Brand typography and mobile paint-performance refinements */
body, button, input, a, .page-numbers, .brand-logo {font-family:'TheSansArabic',Tahoma,Arial,sans-serif}
.brand-copy strong, .brand-logo, .drawer-header h2, .page-numbers strong {font-weight:700}
.brand-copy small,.reader-hint,.app-footer,.drawer-header p,.drawer-eyebrow,.page-numbers-suffix,.range-edge,.drawer-footer{font-weight:300}
.reader-heading,.toolbar-button,.thumb-label,.zoom-reset,.toast{line-height:1.45}
/* This decoration never competes with interactive paper layers. */
.canvas-glow {pointer-events:none}
@media(max-width:900px){
  .canvas-glow,.reader-canvas::after{display:none!important}
  .reader-canvas::before{background:none}
}
