/* ============ منصة الأستاذ أحمد مجاهد: واجهة المتجر ============
   الفكرة: سبورة الفصل بخط الرقعة + ورق الكراسة بخط هامشها */
:root{
  --ink:#17213A;
  --ink-2:#4B5568;
  --paper:#FAFBF8;
  --surface:#FFFFFF;
  --rule:#DCE3EA;
  --rule-2:#EEF2F6;
  --board:#1F3D34;
  --board-2:#28493F;
  --chalk:#F1F3EC;
  --chalk-y:#EADFA6;
  --wood:#7A5A3A;
  --arabic:#2B4C8C;
  --arabic-soft:#E9EEF8;
  --islamic:#0E6E5C;
  --islamic-soft:#E3F1EC;
  --red:#C3372C;
  --ok:#1E7A45; --ok-soft:#E6F4EA;
  --warn:#9A5A0C; --warn-soft:#FBF1DF;
  --bad:#B42318; --bad-soft:#FCEBEA;
  --info:#2B4C8C; --info-soft:#E9EEF8;
  --f-display:"Aref Ruqaa","Noto Naskh Arabic","Times New Roman",serif;
  --f-ui:"IBM Plex Sans Arabic","Segoe UI",Tahoma,"Noto Sans Arabic","Geeza Pro",system-ui,sans-serif;
  --r:12px;
  --wrap:1160px;
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--f-ui);font-size:16px;line-height:1.75;text-rendering:optimizeLegibility}
img{max-width:100%;display:block}
a{color:var(--arabic);text-underline-offset:3px}
a:hover{color:var(--ink)}
h1,h2,h3{line-height:1.35;margin:0 0 .5em}
p{margin:0 0 1em}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid #E0B341;outline-offset:2px;border-radius:6px}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip{position:absolute;inset-inline-start:12px;top:-60px;background:var(--ink);color:#fff;padding:8px 14px;border-radius:8px;z-index:20}
.skip:focus{top:12px}
.wrap{max-width:var(--wrap);margin-inline:auto;padding-inline:20px}
.muted{color:var(--ink-2)}
.small{font-size:14px}
.mt{margin-top:12px}
.inline{display:inline}
.ic{width:20px;height:20px;flex:none}

/* ---------- الشريط العلوي ---------- */
.topbar{background:var(--surface);border-bottom:1px solid var(--rule);position:sticky;top:0;z-index:10}
.topbar__in{display:flex;align-items:center;gap:20px;min-height:68px}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);min-width:0}
.brand__mark{width:40px;height:40px;border-radius:10px;background:var(--board);color:var(--chalk-y);display:grid;place-items:center;flex:none}
.brand__mark .ic{width:24px;height:24px}
.brand__logo{width:44px;height:44px;object-fit:contain;flex:none}
.brand__text{display:flex;flex-direction:column;line-height:1.3;min-width:0}
.brand__name{font-weight:700;font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand__sub{font-size:13px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.nav{display:flex;gap:4px;margin-inline-start:auto}
.nav a{padding:8px 12px;border-radius:8px;text-decoration:none;color:var(--ink);font-weight:500;white-space:nowrap}
.nav a:hover{background:var(--rule-2)}
.nav a[aria-current="page"]{background:var(--rule-2);box-shadow:inset 0 -2px 0 var(--board)}
.cartlink{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--ink);font-weight:600;padding:8px 12px;border:1px solid var(--rule);border-radius:10px}
.cartlink:hover{border-color:var(--ink-2);color:var(--ink)}
.cartlink__n{min-width:22px;height:22px;border-radius:11px;background:var(--red);color:#fff;font-size:13px;display:grid;place-items:center;padding-inline:6px}

/* ---------- السبورة ---------- */
.board{position:relative;background:
  radial-gradient(1200px 400px at 85% -10%,rgba(255,255,255,.07),transparent 60%),
  radial-gradient(700px 300px at 10% 110%,rgba(255,255,255,.05),transparent 60%),
  linear-gradient(180deg,var(--board-2),var(--board));
  color:var(--chalk);padding:64px 0 86px;overflow:hidden;border-bottom:14px solid var(--wood)}
.board::before{content:"";position:absolute;inset:0;pointer-events:none;opacity:.35;
  background-image:repeating-linear-gradient(115deg,rgba(255,255,255,.025) 0 2px,transparent 2px 9px)}
.board__in{position:relative}
.board__title{font-family:var(--f-display);font-weight:700;font-size:clamp(42px,7.2vw,84px);line-height:1.2;margin:0;
  letter-spacing:0;text-shadow:0 0 1px rgba(241,243,236,.7),0 0 14px rgba(241,243,236,.12)}
.board__tagline{font-family:var(--f-display);font-size:clamp(24px,3.6vw,38px);color:var(--chalk-y);margin:.15em 0 0;line-height:1.4}
.board__lead{max-width:46ch;font-size:18px;color:rgba(241,243,236,.86);margin:22px 0 0}
.board__paths{display:grid;grid-template-columns:repeat(2,minmax(0,330px));gap:16px;margin-top:34px}
.path{display:flex;align-items:center;gap:14px;padding:18px 20px;color:var(--chalk);text-decoration:none;
  border:1.5px solid rgba(241,243,236,.62);border-radius:16px 11px 15px 10px;background:rgba(0,0,0,.08);transition:background .2s,border-color .2s}
.path:hover{background:rgba(255,255,255,.07);border-color:var(--chalk);color:var(--chalk)}
.path__icon{width:48px;height:48px;border-radius:50%;border:1.5px dashed rgba(234,223,166,.8);display:grid;place-items:center;color:var(--chalk-y);flex:none}
.path__icon .ic{width:26px;height:26px}
.path__text{display:flex;flex-direction:column;line-height:1.45}
.path__text strong{font-family:var(--f-display);font-size:28px;font-weight:700}
.path__text small{font-size:15px;color:rgba(241,243,236,.8)}
.board__tray{position:absolute;bottom:-1px;inset-inline-start:8%;display:flex;gap:10px}
.board__tray span{display:block;width:46px;height:9px;border-radius:5px 5px 2px 2px;background:#F4F4EE;box-shadow:0 1px 0 rgba(0,0,0,.25)}
.board__tray span:nth-child(2){width:30px;background:#EADFA6}
.board__tray span:nth-child(3){width:22px;background:#E8B4A8}
.board--compact{padding:30px 0 40px}
.board--compact .board__title{font-size:clamp(30px,4.5vw,46px)}
.board--compact .board__tagline{font-size:clamp(20px,2.6vw,26px)}
@media (prefers-reduced-motion:no-preference){
  .board:not(.board--compact) .board__title{animation:chalkwrite 1.5s cubic-bezier(.55,.1,.25,1) .1s both}
  .board:not(.board--compact) .board__tagline{animation:chalkwrite 1s cubic-bezier(.55,.1,.25,1) 1.2s both}
}
@keyframes chalkwrite{from{clip-path:inset(0 0 0 100%)}to{clip-path:inset(0 0 0 0)}}

/* ---------- قائمة الملفات ---------- */
.catalog{padding-top:40px;padding-bottom:30px;scroll-margin-top:80px}
.catalog__head{display:flex;align-items:baseline;gap:14px;margin-bottom:14px}
.sechead,.related h2{font-family:var(--f-display);font-size:34px;font-weight:700;margin:0;line-height:1.3}
.catalog__count{color:var(--ink-2)}
.filters{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:14px 0 20px;border-bottom:1px solid var(--rule);margin-bottom:26px}
.seg{display:flex;border:1px solid var(--rule);border-radius:10px;padding:3px;margin:0;background:var(--surface)}
.seg label{cursor:pointer;position:relative}
.seg input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.seg span{display:block;padding:6px 14px;border-radius:7px;font-weight:500;white-space:nowrap}
.seg input:checked+span{background:var(--ink);color:#fff}
.seg--arabic input:checked+span{background:var(--arabic)}
.seg--islamic input:checked+span{background:var(--islamic)}
.seg input:focus-visible+span{outline:3px solid #E0B341}
.sel select,.search input{height:42px;border:1px solid var(--rule);border-radius:10px;background:var(--surface);padding:0 12px}
.sel select{padding-inline-end:30px}
.search{position:relative;flex:1 1 220px;display:flex}
.search .ic{position:absolute;inset-inline-start:12px;top:11px;color:var(--ink-2);width:19px;height:19px}
.search input{width:100%;padding-inline-start:40px}
.filters__reset{font-size:15px}
.js .filters__go{display:none}

.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:22px}
.card{background:var(--surface);border:1px solid var(--rule);border-radius:var(--r);overflow:hidden;display:flex;flex-direction:column;--subj:var(--islamic);--subj-soft:var(--islamic-soft)}
.card--arabic{--subj:var(--arabic);--subj-soft:var(--arabic-soft)}
.card__cover{display:block;aspect-ratio:4/3;background:var(--subj-soft);border-bottom:1px solid var(--rule)}
.card__cover img{width:100%;height:100%;object-fit:cover}
.card__body{position:relative;padding:14px 30px 16px 16px;display:flex;flex-direction:column;flex:1}
.card__body::before{content:"";position:absolute;inset-block:0;inset-inline-start:16px;width:2px;background:var(--subj);opacity:.55}
.card__subject{font-size:13px;font-weight:600;color:var(--subj)}
.card__title{font-size:17px;font-weight:600;margin:2px 0 8px;line-height:1.55}
.card__title a{color:var(--ink);text-decoration:none}
.card__title a:hover{text-decoration:underline}
.card__foot{margin-top:auto;display:flex;align-items:center;justify-content:space-between;gap:10px;padding-top:12px}
.tags{list-style:none;padding:0;margin:0;display:flex;flex-wrap:wrap;gap:6px}
.tags li{font-size:13px;color:var(--ink-2);background:var(--rule-2);border-radius:6px;padding:1px 8px}
.price{font-weight:700;font-size:19px;color:var(--red);white-space:nowrap}
.price s{color:var(--ink-2);font-weight:400;font-size:14px;margin-inline-start:4px}

/* بطاقة بلا غلاف */
.ph{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;height:100%;min-height:120px;color:#fff;background:var(--islamic);text-align:center;padding:12px;
  background-image:repeating-linear-gradient(0deg,rgba(255,255,255,.09) 0 1px,transparent 1px 26px)}
.ph--arabic{background-color:var(--arabic)}
.ph--islamic{background-color:var(--islamic)}
.ph__icon{width:54px;height:54px;border-radius:50%;border:1.5px solid rgba(255,255,255,.6);display:grid;place-items:center;margin-bottom:6px}
.ph__icon .ic{width:28px;height:28px}
.ph__type{font-family:var(--f-display);font-size:26px;line-height:1.3}
.ph__grade{font-size:14px;opacity:.9}
.ph--sm{min-height:0;padding:4px;gap:0}
.ph--sm .ph__icon{width:auto;height:auto;border:0;margin:0}
.ph--sm .ph__type,.ph--sm .ph__grade{display:none}
.ph--lg{min-height:320px}
.ph--lg .ph__type{font-size:40px}

/* ---------- الأزرار ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 20px;border-radius:10px;border:1px solid var(--board);
  background:var(--board);color:#fff;font-weight:600;text-decoration:none;cursor:pointer;white-space:nowrap}
.btn:hover{background:#163029;color:#fff}
.btn--sm{min-height:36px;padding:0 12px;font-size:14px}
.btn--sm .ic{width:17px;height:17px}
.btn--ghost{background:transparent;color:var(--ink);border-color:var(--rule)}
.btn--ghost:hover{background:var(--rule-2);color:var(--ink)}
.btn--wide{width:100%}
.btn--dl{background:var(--red);border-color:var(--red)}
.btn--dl:hover{background:#A42E25}
.btn[disabled]{opacity:.5;cursor:not-allowed}
.iconbtn{display:inline-grid;place-items:center;width:38px;height:38px;border-radius:9px;border:1px solid var(--rule);background:var(--surface);cursor:pointer;color:var(--ink-2)}
.iconbtn:hover{color:var(--bad);border-color:var(--bad)}
.textlink{background:none;border:0;padding:0;color:var(--arabic);text-decoration:underline;cursor:pointer;font-size:15px}

/* ---------- الصفحات ---------- */
.page{padding-top:30px;padding-bottom:60px}
.narrow{max-width:820px}
.page__title{font-size:28px;font-weight:700;margin-bottom:16px}
.section-title{font-size:20px;font-weight:700;margin:30px 0 12px}
.crumbs{display:flex;gap:8px;flex-wrap:wrap;font-size:14px;color:var(--ink-2);margin-bottom:18px}
.crumbs a{color:var(--ink-2)}
.empty{text-align:center;padding:50px 20px;border:1px dashed var(--rule);border-radius:var(--r);background:var(--surface)}
.empty p{color:var(--ink-2);font-size:17px}

/* صفحة المنتج */
.product__grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:40px;align-items:start}
.product__cover{border-radius:var(--r);overflow:hidden;border:1px solid var(--rule);background:var(--surface)}
.product__cover img{width:100%}
.product__h{font-size:18px;font-weight:700;margin:26px 0 10px}
.previews{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.previews__item{display:block;border:1px solid var(--rule);border-radius:8px;overflow:hidden;aspect-ratio:16/10;background:var(--surface)}
.previews__item img{width:100%;height:100%;object-fit:cover}
.product__subject{font-weight:600;color:var(--islamic)}
.product--arabic .product__subject{color:var(--arabic)}
.product__title{font-size:30px;font-weight:700;margin:4px 0 12px;line-height:1.45}
.product__aud{color:var(--ink-2);margin:10px 0 18px}
.buybox{border:1px solid var(--rule);border-radius:var(--r);background:var(--surface);padding:20px;position:relative}
.buybox::before{content:"";position:absolute;inset-block:14px;inset-inline-start:0;width:3px;border-radius:2px;background:var(--islamic)}
.product--arabic .buybox::before{background:var(--arabic)}
.buybox .price{font-size:30px;display:block;margin-bottom:14px}
.buybox__actions{display:grid;gap:10px}
.buybox__actions form{margin:0}
.buybox__facts{list-style:none;padding:0;margin:16px 0 0;display:grid;gap:8px;font-size:15px;color:var(--ink-2)}
.buybox__facts li{display:flex;align-items:center;gap:8px}
.buybox__facts .ic{width:18px;height:18px;color:var(--ink)}
.product__desc{font-size:16.5px;max-width:65ch}
.related{margin-top:56px}
.related h2{margin-bottom:18px}

/* السلة والطلب */
.lines{list-style:none;padding:0;margin:0;border:1px solid var(--rule);border-radius:var(--r);background:var(--surface);overflow:hidden}
.line{display:flex;align-items:center;gap:14px;padding:14px 16px;border-bottom:1px solid var(--rule-2)}
.line:last-child{border-bottom:0}
.line__thumb{width:64px;height:48px;border-radius:7px;overflow:hidden;flex:none;display:block;background:var(--rule-2)}
.line__thumb img{width:100%;height:100%;object-fit:cover}
.line__main{flex:1;min-width:0;display:flex;flex-direction:column}
.line__title{font-weight:600;color:var(--ink);text-decoration:none}
.line__meta{font-size:14px;color:var(--ink-2)}
.line__price{font-weight:700;color:var(--red);white-space:nowrap}
.line__act{display:flex;flex-direction:column;align-items:flex-end;gap:4px;text-align:end}
.line__act form{margin:0}
.lockd{display:inline-flex;align-items:center;gap:6px;color:var(--ink-2);font-size:14px}
.lockd .ic{width:17px;height:17px}
.done{display:inline-flex;align-items:center;gap:6px;color:var(--ok);font-weight:600}
.totalbar{display:flex;justify-content:space-between;align-items:center;padding:16px 4px;font-size:18px}
.totalbar strong{font-size:24px;color:var(--red)}
.actions{display:grid;grid-template-columns:2fr 1fr;gap:10px}
.note{display:flex;gap:8px;align-items:flex-start;color:var(--warn);background:var(--warn-soft);padding:12px 14px;border-radius:10px}
.orderhead{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.orderhead .page__title{margin-bottom:0}
.savelink{background:var(--surface);border:1px dashed var(--ink-2);border-radius:var(--r);padding:14px 16px;margin:18px 0}
.savelink p{display:flex;gap:8px;align-items:center;margin:0 0 10px;font-weight:500}
.savelink__row{display:flex;gap:8px}
.savelink__row input{flex:1;min-width:0;height:38px;border:1px solid var(--rule);border-radius:8px;padding:0 10px;background:var(--paper);font-size:14px}
.panel{border:1px solid var(--rule);border-radius:var(--r);background:var(--surface);padding:20px;margin:18px 0}
.panel h2{font-size:20px}
.panel--pay{border-color:var(--board);box-shadow:inset 0 3px 0 var(--board)}
.panel--wait{background:var(--warn-soft);border-color:#EBD3A8}
.panel--bad{background:var(--bad-soft);border-color:#F2C4C0}
.bank{background:var(--paper);border:1px solid var(--rule);border-radius:10px;padding:14px 16px;margin:10px 0 12px;font-size:17px;line-height:2;
  background-image:repeating-linear-gradient(180deg,transparent 0 33px,var(--rule-2) 33px 34px)}
.upload{display:grid;gap:10px;margin-top:14px}
.drop{position:relative;display:flex;align-items:center;justify-content:center;gap:10px;min-height:64px;padding:12px;border:1.5px dashed var(--ink-2);border-radius:10px;background:var(--paper);cursor:pointer;text-align:center;color:var(--ink-2)}
.drop:hover{border-color:var(--board);color:var(--ink)}
.drop input{position:absolute;inset:0;opacity:0;cursor:pointer}
.drop:focus-within{outline:3px solid #E0B341}

/* النماذج */
.form{display:grid;gap:14px}
.form__group{border:1px solid var(--rule);border-radius:var(--r);padding:16px 18px 18px;margin:0;background:var(--surface);display:grid;gap:14px}
.form__group legend{font-weight:700;padding:0 6px}
.field{display:grid;gap:6px}
.field>span{font-weight:500}
.field small{color:var(--ink-2);font-weight:400}
.field input,.field select,.field textarea{width:100%;min-height:44px;border:1px solid var(--rule);border-radius:10px;padding:8px 12px;background:var(--surface)}
.field input:focus,.field select:focus,.field textarea:focus,.search input:focus,.sel select:focus{outline:none;border-color:var(--board);box-shadow:0 0 0 3px rgba(31,61,52,.15)}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{position:relative}
.chip input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.chip span{display:block;padding:6px 14px;border:1px solid var(--rule);border-radius:20px;cursor:pointer;background:var(--surface)}
.chip input:checked+span{background:var(--ink);color:#fff;border-color:var(--ink)}
.chip input:focus-visible+span{outline:3px solid #E0B341}
.option{display:flex;gap:12px;align-items:flex-start;padding:12px 14px;border:1px solid var(--rule);border-radius:10px;cursor:pointer}
.option:has(input:checked){border-color:var(--board);background:#F3F7F5}
.option input{margin-top:6px;accent-color:var(--board);width:18px;height:18px}
.option span{display:flex;flex-direction:column}
.option small{color:var(--ink-2)}
.agree{display:flex;gap:10px;align-items:flex-start;font-size:15px}
.agree input{margin-top:6px;accent-color:var(--board);width:18px;height:18px;flex:none}
.checkout{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:26px;align-items:start}
.summary{border:1px solid var(--rule);border-radius:var(--r);background:var(--surface);padding:18px;position:sticky;top:90px}
.summary h2{font-size:18px}
.summary ul{list-style:none;padding:0;margin:0 0 10px;display:grid;gap:8px}
.summary li{display:flex;justify-content:space-between;gap:10px;font-size:15px}
.summary li b{white-space:nowrap}
.summary__total{display:flex;justify-content:space-between;border-top:1px solid var(--rule);padding-top:12px;font-size:17px}
.summary__total strong{color:var(--red);font-size:21px}

/* رسائل وحالات */
.flashes{max-width:var(--wrap);margin:16px auto 0;padding-inline:20px;display:grid;gap:8px}
.flash{padding:12px 16px;border-radius:10px;border:1px solid transparent;margin:0 0 10px}
.flash--ok{background:var(--ok-soft);border-color:#BFE3CB;color:#14532D}
.flash--bad{background:var(--bad-soft);border-color:#F2C4C0;color:#7A1A12}
.flash--warn{background:var(--warn-soft);border-color:#EBD3A8;color:#6B3F08}
.flash--info{background:var(--info-soft);border-color:#C9D5EE;color:#1E3566}
.badge{display:inline-block;padding:3px 10px;border-radius:20px;font-size:13px;font-weight:600;background:var(--rule-2);color:var(--ink-2);white-space:nowrap}
.badge--ok{background:var(--ok-soft);color:var(--ok)}
.badge--warn{background:var(--warn-soft);color:var(--warn)}
.badge--bad{background:var(--bad-soft);color:var(--bad)}
.badge--info{background:var(--info-soft);color:var(--info)}

/* خطوات الشراء */
.steps{padding-top:30px;padding-bottom:64px}
.steps .sechead{margin-bottom:18px}
.steps__list{list-style:none;counter-reset:s;padding:0;margin:0;display:grid;grid-template-columns:repeat(3,1fr);gap:22px}
.steps__list li{counter-increment:s;position:relative;padding:18px 18px 18px 18px;padding-top:58px;border-top:2px solid var(--ink)}
.steps__list li::before{content:counter(s,arabic-indic);position:absolute;top:6px;inset-inline-start:0;font-family:var(--f-display);font-size:38px;line-height:1;color:var(--red)}
.steps__list strong{display:block;font-size:18px;margin-bottom:4px}
.steps__list span{color:var(--ink-2)}
.prose{max-width:760px}
.terms{display:grid;gap:10px;padding-inline-start:22px;font-size:17px}

/* الصفحات والتذييل */
.pager{display:flex;gap:6px;justify-content:center;margin:30px 0}
.pager a,.pager span{min-width:40px;height:40px;display:grid;place-items:center;border-radius:9px;border:1px solid var(--rule);text-decoration:none;color:var(--ink);background:var(--surface)}
.pager span[aria-current]{background:var(--ink);color:#fff;border-color:var(--ink)}
.pager__gap{border:0!important;background:none!important}
.foot{border-top:1px solid var(--rule);background:var(--surface);padding:28px 0 18px;margin-top:20px}
.foot__in{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap}
.foot__brand{display:flex;flex-direction:column}
.foot__brand span{color:var(--ink-2)}
.foot__links{display:flex;gap:18px;flex-wrap:wrap;align-items:center}
.foot__links a{color:var(--ink)}
.foot__copy{color:var(--ink-2);font-size:14px;margin-top:16px}
.wa-float{position:fixed;inset-inline-end:18px;bottom:18px;display:flex;align-items:center;gap:8px;background:#1E7A45;color:#fff;text-decoration:none;
  padding:11px 16px;border-radius:30px;font-weight:600;box-shadow:0 6px 20px rgba(23,33,58,.22);z-index:9}
.wa-float:hover{color:#fff;background:#17683A}

/* المعاينة المكبرة */
.lightbox{position:fixed;inset:0;background:rgba(10,16,26,.88);display:grid;place-items:center;z-index:50;padding:20px;cursor:zoom-out}
.lightbox img{max-height:92vh;max-width:96vw;border-radius:8px}


/* ---------- رف الصفوف ---------- */
.grades{padding-top:44px}
.grades .sechead{margin-bottom:18px}
.shelf{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:18px}
.shelf__item{display:flex;flex-direction:column;gap:2px;text-decoration:none;color:var(--ink);border-radius:var(--r)}
.shelf__item img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px 4px 4px 10px;box-shadow:0 1px 0 rgba(23,33,58,.08),0 8px 18px -10px rgba(23,33,58,.35);
  transition:transform .25s ease,box-shadow .25s ease;margin-bottom:8px}
.shelf__item:hover img{transform:translateY(-4px) rotate(-.6deg);box-shadow:0 1px 0 rgba(23,33,58,.08),0 16px 26px -12px rgba(23,33,58,.45)}
.shelf__item:hover{color:var(--ink)}
.shelf__name{font-weight:700;font-size:16.5px}
.shelf__count{font-size:14px;color:var(--ink-2)}
.shelf__item:focus-visible{outline-offset:4px}

/* رأس صفحة الصف */
.gradehead{background:var(--g,var(--board));color:#fff;padding:34px 0;border-bottom:6px solid rgba(0,0,0,.18);
  background-image:linear-gradient(180deg,rgba(255,255,255,.08),rgba(0,0,0,.12))}
.gradehead__in{display:flex;align-items:center;gap:26px}
.gradehead__cover{width:210px;aspect-ratio:4/3;object-fit:cover;border-radius:10px 4px 4px 10px;box-shadow:0 12px 28px -12px rgba(0,0,0,.55);flex:none}
.gradehead__title{font-family:var(--f-display);font-size:clamp(36px,5.6vw,60px);margin:0;line-height:1.25}
.gradehead__sub{margin:6px 0 0;font-size:17px;opacity:.92;max-width:52ch}

/* أزرار الصفوف السريعة */
.gradechips{display:flex;align-items:center;gap:6px;overflow-x:auto;padding-top:18px;padding-bottom:4px;scrollbar-width:thin}
.gradechips__label{font-weight:600;color:var(--ink-2);margin-inline-end:4px;white-space:nowrap}
.gradechips a{flex:none;min-width:42px;height:40px;padding:0 10px;display:grid;place-items:center;border:1px solid var(--rule);border-radius:9px;
  text-decoration:none;color:var(--ink);background:var(--surface);font-weight:600;position:relative}
.gradechips a::after{content:"";position:absolute;inset-inline:10px;bottom:5px;height:3px;border-radius:2px;background:var(--g,transparent);opacity:.9}
.gradechips a[aria-current="page"]{background:var(--g,var(--ink));border-color:var(--g,var(--ink));color:#fff}
.gradechips a[aria-current="page"]::after{display:none}

/* الأقسام */
.sections{display:flex;gap:4px;overflow-x:auto;border-bottom:1px solid var(--rule);margin-bottom:4px;scrollbar-width:thin}
.sections a{flex:none;display:flex;align-items:center;gap:7px;padding:10px 14px;text-decoration:none;color:var(--ink-2);font-weight:600;
  border-bottom:3px solid transparent;margin-bottom:-1px;white-space:nowrap}
.sections a .ic{width:19px;height:19px}
.sections a b{font-weight:500;font-size:13px;background:var(--rule-2);border-radius:10px;padding:0 7px;color:var(--ink-2)}
.sections a:hover{color:var(--ink)}
.sections a[aria-current="page"]{color:var(--ink);border-bottom-color:var(--red)}
.sections a[aria-current="page"] b{background:var(--red);color:#fff}

/* غلاف الصف داخل بطاقة المنتج */
.gcover{position:relative;display:block;width:100%;height:100%}
.gcover img{width:100%;height:100%;object-fit:cover}
.gcover__type{position:absolute;inset-inline-start:10px;bottom:10px;display:inline-flex;align-items:center;gap:6px;background:rgba(23,33,58,.82);color:#fff;
  font-size:13.5px;font-weight:600;padding:4px 10px 4px 12px;border-radius:7px;backdrop-filter:blur(2px)}
.gcover__type .ic{width:16px;height:16px}
.gcover--lg .gcover__type{font-size:16px;padding:6px 14px;inset-inline-start:16px;bottom:16px}
@media (max-width:720px){
  .shelf{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 10px}
  .shelf__name{font-size:14px;line-height:1.4}
  .shelf__count{font-size:12.5px}
  .grades{padding-top:30px}
  .gradehead{padding:22px 0}
  .gradehead__in{gap:16px}
  .gradehead__cover{width:110px}
  .gradehead__sub{font-size:15px}
  .gcover__type{font-size:12px;padding:3px 8px;inset-inline-start:6px;bottom:6px}
}
@media (prefers-reduced-motion:reduce){.shelf__item:hover img{transform:none}}


/* ---------- الفصول الدراسية داخل صفحة الصف ---------- */
.termtabs{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:4px 0 18px}
.termtabs a{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 16px;border:1.5px solid var(--rule);border-radius:12px;
  background:var(--surface);text-decoration:none;color:var(--ink);font-weight:700}
.termtabs a b{font-weight:600;font-size:13px;min-width:26px;height:26px;padding:0 6px;border-radius:13px;display:grid;place-items:center;background:var(--rule-2);color:var(--ink-2)}
.termtabs a:hover{border-color:var(--g,var(--ink));color:var(--ink)}
.termtabs a[aria-current="page"]{background:var(--g,var(--ink));border-color:var(--g,var(--ink));color:#fff}
.termtabs a[aria-current="page"] b{background:rgba(255,255,255,.25);color:#fff}
.termsec{margin:10px 0 36px}
.termsec__head{display:flex;align-items:baseline;gap:12px;border-bottom:2px solid var(--g,var(--ink));padding-bottom:8px;margin-bottom:16px}
.termsec__head h3{font-family:var(--f-display);font-size:28px;font-weight:700;margin:0;line-height:1.3}
.termsec__empty{color:var(--ink-2);background:var(--surface);border:1px dashed var(--rule);border-radius:var(--r);padding:16px;text-align:center;margin:0}
@media (max-width:720px){
  .termtabs{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .termtabs a{padding:11px 12px;font-size:14.5px}
  .termsec__head h3{font-size:23px}
}

/* ---------- الجوال ---------- */
@media (max-width:900px){
  .product__grid,.checkout{grid-template-columns:1fr}
  .summary{position:static;order:-1}
  .steps__list{grid-template-columns:1fr}
}
@media (max-width:720px){
  .topbar__in{flex-wrap:wrap;gap:8px 12px;padding-block:10px}
  .nav{order:3;width:100%;margin:0;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
  .nav::-webkit-scrollbar{display:none}
  .nav a{padding:6px 10px;font-size:15px}
  .cartlink{margin-inline-start:auto}
  .cartlink__label{display:none}
  .brand__sub{display:none}
  .board{padding:40px 0 64px}
  .board__paths{grid-template-columns:1fr}
  .board__lead{font-size:16.5px}
  .filters{gap:8px}
  .seg{width:100%;overflow-x:auto}
  .seg label{flex:1}
  .seg span{text-align:center;padding:6px 8px}
  .sel{flex:1 1 30%}
  .sel select{width:100%}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .card__body{padding:10px 22px 12px 10px}
  .card__body::before{inset-inline-start:10px}
  .card__title{font-size:15px}
  .card__foot{flex-direction:column;align-items:stretch}
  .card__foot .btn,.card__foot form{width:100%}
  .card__foot form .btn{width:100%}
  .tags li{font-size:12px}
  .price{font-size:17px}
  .actions{grid-template-columns:1fr}
  .line{flex-wrap:wrap}
  .line__act{width:100%;align-items:stretch;text-align:start}
  .previews{grid-template-columns:repeat(2,1fr)}
  .wa-float span{display:none}
  .wa-float{padding:12px}
}
@media (max-width:380px){
  .grid{grid-template-columns:1fr}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
