:root{
  --bg:#0b0b0c;
  --panel: rgba(16,16,18,.84);
  --panel2: rgba(20,20,23,.72);
  --text:#f4f1ea;
  --muted: rgba(244,241,234,.72);
  --line: rgba(214,179,106,.20);
  --gold:#d6b36a;
  --gold2:#b88b3d;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
  --shadow2: 0 14px 40px rgba(0,0,0,.42);
  --r: 18px;
  --r2: 24px;
}

*{box-sizing:border-box}
html,body{height:100%; max-width:100%; overflow-x:hidden}
body.blog{
  margin:0;
  font-family:"Cairo", system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background:
    radial-gradient(1100px 650px at 80% 0%, rgba(214,179,106,.14), transparent 60%),
    radial-gradient(900px 520px at 12% 20%, rgba(214,179,106,.08), transparent 60%),
    var(--bg);
  overflow-x:hidden;
}

a{color:inherit;text-decoration:none}
img{max-width:100%;height:auto;display:block}
::selection{ background: rgba(214,179,106,.25); }

/* Container */
.blog-container{
  width: min(1120px, calc(100% - 24px));
  margin-inline:auto;
}

/* =========================
   Header
   ========================= */
.blog-nav{
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  background: rgba(11,11,12,.55);
  border-bottom: 1px solid rgba(214,179,106,.12);
  max-width:100%;
  overflow-x:hidden;
}

.blog-nav__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 0;
  min-width:0;
}

.blog-brand{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width:0;
  max-width: 75%;
}
.blog-brand__logo{
  width: 42px; height: 42px; object-fit: contain;
  flex: 0 0 auto;
}
.blog-brand__text{min-width:0}
.blog-brand__name{
  font-weight: 900;
  font-family: "Noto Kufi Arabic","Cairo",system-ui;
  font-size: 14px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.blog-brand__sub{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.blog-menu{
  display:flex;
  gap: 16px;
  align-items:center;
}
.blog-menu a{
  color: rgba(244,241,234,.88);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 12px;
}
.blog-menu a:hover{
  background: rgba(214,179,106,.08);
  color: var(--gold);
}

/* Burger */
.blog-burger{
  display:none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(214,179,106,.18);
  background: rgba(214,179,106,.08);
  align-items:center;
  justify-content:center;
  gap: 5px;
  flex-direction: column;
}
.blog-burger span{
  width: 18px; height: 2px;
  background: rgba(244,241,234,.92);
  border-radius: 99px;
}

/* Mobile menu */
.blog-mobile{
  border-top: 1px solid rgba(214,179,106,.10);
  background: rgba(11,11,12,.72);
}
.blog-mobile[hidden]{ display:none !important; }
.blog-mobile a{
  display:block;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(214,179,106,.08);
  color: rgba(244,241,234,.90);
}
.blog-mobile a:hover{
  background: rgba(214,179,106,.08);
  color: var(--gold);
}

/* Responsive header */
@media (max-width: 860px){
  .blog-menu{ display:none; }
  .blog-burger{ display:inline-flex; }
}

/* fallback لو المتصفح اعتبر الصفحة Desktop (الـ viewport يصير كبير)
   بس الجهاز فعلياً تلفون */
@media (max-device-width: 860px){
  .blog-menu{ display:none; }
  .blog-burger{ display:inline-flex; }
}

/* =========================
   Main blocks
   ========================= */
.blog-main{ padding: 18px 0 42px; }

.blog-hero{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow:hidden;
}
.blog-hero h1{
  margin:0 0 10px;
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  font-size: clamp(20px, 2.8vw, 34px);
  line-height: 1.35;
}
.blog-hero p{
  margin:0;
  color: var(--muted);
  line-height: 1.9;
  max-width: 80ch;
  font-size: 15.5px;
}

/* =========================
   Blog grid
   ========================= */
.blog-grid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-width:0;
}

@media (max-width: 980px){
  .blog-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px){
  .blog-grid{ grid-template-columns: 1fr; }
}

@media (max-device-width: 680px){
  .blog-grid{ grid-template-columns: 1fr; }
}

@media (max-device-width: 680px){
  .blog-grid{ grid-template-columns: 1fr; }
}

/*
  FIX: لو المتصفح اعتبر الصفحة "Desktop site" فـ media queries حسب (max-width)
  ممكن ما تشتغل لأن viewport يصير ~980px. هنا نضيف max-device-width حتى
  نضمن موبايل فعلاً ياخذ ستايل الموبايل.
*/
@media (max-device-width: 680px){
  .blog-grid{ grid-template-columns: 1fr; }
  .blog-menu{ display:none; }
  .blog-burger{ display:inline-flex; }
}

/* Card */
.blog-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  box-shadow: var(--shadow2);
  overflow:hidden;
  min-width:0;
  transition: transform .18s ease, border-color .18s ease;
}
.blog-card:hover{
  transform: translateY(-4px);
  border-color: rgba(214,179,106,.34);
}

/* Cover */
.blog-card__cover{
  display:block;
  min-height: 160px;
  background:
    radial-gradient(circle at 75% 0%, rgba(214,179,106,.22), transparent 55%),
    radial-gradient(circle at 18% 75%, rgba(214,179,106,.10), transparent 60%),
    rgba(0,0,0,.28);
  border-bottom: 1px solid rgba(214,179,106,.12);
}
.blog-card__coverInner{
  min-height: 160px;
  display:grid;
  place-items:center;
  padding: 16px;
  text-align:center;
}
.blog-card__coverInner span{
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  font-size: 16.5px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(0,0,0,.46);
  border: 1px solid rgba(214,179,106,.22);
  max-width: 100%;
}

.blog-card__body{ padding: 14px; min-width:0; }
.blog-card__title{
  margin: 0 0 10px;
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  font-size: 16px;
  line-height: 1.6;
}
.blog-card__desc{
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 14.5px;
}
.blog-card__cta{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(214,179,106,.20);
  background: rgba(214,179,106,.08);
  color: var(--gold);
  font-weight: 900;
  font-size: 14px;
}
.blog-card__cta::before{ content:"←"; opacity:.9; transform: translateY(-1px); }
.blog-card__cta:hover{ background: rgba(214,179,106,.12); color: var(--gold2); }

/* =========================
   Post page
   ========================= */
.post{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
  padding: 16px;
}

.post-head{
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(214,179,106,.12);
  margin-bottom: 14px;
}

.post-bc{
  margin: 0 0 10px;
  color: rgba(244,241,234,.70);
  font-size: 13px;
}
.post-bc a{ color: rgba(214,179,106,.95); }
.post-bc a:hover{ color: var(--gold2); }

.post-title{
  margin: 0 0 12px;
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  font-size: clamp(20px, 3.0vw, 38px);
  line-height: 1.35;
}

.post-thumb{
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(214,179,106,.14);
  background: rgba(0,0,0,.25);
}
.post-thumb img{ width:100%; height:auto; display:block; opacity:.96; }

.post-thumb--auto{
  min-height: 200px;
  display:grid;
  place-items:center;
  padding: 14px;
  background:
    radial-gradient(circle at 75% 0%, rgba(214,179,106,.22), transparent 55%),
    radial-gradient(circle at 18% 75%, rgba(214,179,106,.10), transparent 60%),
    rgba(0,0,0,.28);
}
.post-thumb__auto span{
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  font-size: 18px;
  line-height: 1.6;
  text-align:center;
  padding: 14px 14px;
  border-radius: 18px;
  background: rgba(0,0,0,.46);
  border: 1px solid rgba(214,179,106,.22);
  max-width: 100%;
}

/* content safe */
.post-content{
  font-size: 16.5px;
  line-height: 2.05;
  overflow-wrap:anywhere;
  word-break: break-word;
  min-width:0;
}
.post-content p{ margin: 12px 0; color: rgba(244,241,234,.92); }
.post-content h2, .post-content h3, .post-content h4{
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  line-height: 1.55;
  margin: 22px 0 10px;
}
.post-content a{
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.post-content pre{
  margin: 14px 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(214,179,106,.18);
  overflow:auto;
  direction:ltr;
  max-width:100%;
}
.post-content table{
  display:block;
  max-width:100%;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid rgba(214,179,106,.16);
}

/* pager + CTA */
.post-pager{ margin-top: 14px; }
.post-pager a{
  display:inline-flex;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(214,179,106,.18);
  background: rgba(214,179,106,.08);
  color: rgba(244,241,234,.92);
  font-weight: 900;
}
.post-pager a:hover{ color: var(--gold); }

.post-cta{
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(214,179,106,.18);
  background: rgba(214,179,106,.08);
}
.post-cta h2{
  margin:0 0 8px;
  font-family:"Noto Kufi Arabic","Cairo",system-ui;
  font-weight: 900;
  font-size: 18px;
}
.post-cta p{
  margin:0 0 12px;
  color: rgba(244,241,234,.78);
  line-height: 1.9;
}
.post-cta__btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(214,179,106,.24);
  background: linear-gradient(180deg, rgba(214,179,106,.18), rgba(214,179,106,.08));
  font-weight: 900;
  color: #f4f1ea;
}
.post-cta__btn:hover{
  background: linear-gradient(180deg, rgba(214,179,106,.24), rgba(214,179,106,.10));
}

/* =========================
   Mobile polish (sizes + no weird scaling)
   ========================= */
@media (max-width: 520px){
  .blog-container{ width: calc(100% - 16px); }
  .blog-hero{ padding: 14px; border-radius: 18px; }
  .blog-hero p{ font-size: 14px; }

  .blog-card__cover,
  .blog-card__coverInner{ min-height: 130px; }
  .blog-card__coverInner{ padding: 12px; }
  .blog-card__coverInner span{ font-size: 14.5px; padding: 10px 12px; }

  .blog-card__body{ padding: 12px; }
  .blog-card__title{ font-size: 15px; }
  .blog-card__desc{ font-size: 13.5px; }
  .blog-card__cta{ width: 100%; justify-content:center; }

  .post{ padding: 14px; border-radius: 18px; }
  .post-thumb--auto{ min-height: 165px; }
  .post-content{ font-size: 15.5px; line-height: 2.0; }
  .post-cta__btn{ width: 100%; }
}

/* نفس Mobile polish لكن على max-device-width حتى يشتغل حتى لو المتصفح مسوي Desktop site */
@media (max-device-width: 520px){
  .blog-container{ width: calc(100% - 16px); }
  .blog-hero{ padding: 14px; border-radius: 18px; }
  .blog-hero p{ font-size: 14px; }

  .blog-card__cover,
  .blog-card__coverInner{ min-height: 130px; }
  .blog-card__coverInner{ padding: 12px; }
  .blog-card__coverInner span{ font-size: 14.5px; padding: 10px 12px; }

  .blog-card__body{ padding: 12px; }
  .blog-card__title{ font-size: 15px; }
  .blog-card__desc{ font-size: 13.5px; }
  .blog-card__cta{ width: 100%; justify-content:center; }

  .post{ padding: 14px; border-radius: 18px; }
  .post-thumb--auto{ min-height: 165px; }
  .post-content{ font-size: 15.5px; line-height: 2.0; }
  .post-cta__btn{ width: 100%; }
}
html, body {
  width: 100%;
  overflow-x: hidden;
}

.blog-container {
  width: 100%;
  max-width: 100%;
  padding-inline: 12px;
}
.skip-link{
  position:absolute;
  left:-999px;
  top:auto;
}
.skip-link:focus{
  left:12px;
  top:12px;
  background:#000;
  color:#fff;
  padding:10px 12px;
  border-radius:12px;
  z-index:9999;
}
/* ===== Skip to content FIX (FINAL) ===== */
.skip-link,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* يظهر فقط لو المستخدم ضغط Tab */
.skip-link:focus {
  position: fixed !important;
  top: 12px !important;
  right: 12px !important;
  width: auto !important;
  height: auto !important;
  padding: 10px 14px !important;
  background: #000 !important;
  color: #fff !important;
  border-radius: 12px !important;
  z-index: 99999 !important;
}
