/* 
 Theme Name:   Jannah Child
 Theme URI:    https://tielabs.com/
 Description:  Child theme for Jannah – News SEO + Performance tweaks
 Author:       Abu Maram
 Author URI:   https://alyemenalghad.news/
 Template:     jannah
 Version:      1.0.0
 Text Domain:  jannah-child
*/

/* =========================
 * 0) RTL SAFEGUARD
 * ========================= */
html:lang(ar), html[dir="rtl"] { direction: rtl; unicode-bidi: isolate; }
body { direction: rtl; }

/* =========================
 * 1) Fonts: Readex Pro (400/600/700)
 * ========================= */
@font-face {
  font-family: "Readex Pro";
  src: url("/wp-content/themes/jannah-child/assets/fonts/subset-ReadexPro-Regular.woff2") format("woff2"),
       url("/wp-content/themes/jannah-child/assets/fonts/subset-ReadexPro-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Readex Pro";
  src: url("/wp-content/themes/jannah-child/assets/fonts/subset-ReadexPro-SemiBold.woff2") format("woff2"),
       url("/wp-content/themes/jannah-child/assets/fonts/subset-ReadexPro-SemiBold.woff") format("woff");
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Readex Pro";
  src: url("/wp-content/themes/jannah-child/assets/fonts/subset-ReadexPro-Bold.woff2") format("woff2"),
       url("/wp-content/themes/jannah-child/assets/fonts/subset-ReadexPro-Bold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* =========================
 * 2) Root Design Tokens (Balanced)
 * ========================= */
:root{
  --font-base: "Readex Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Kufi Arabic", Arial, sans-serif;

  /* أحجام متوازنة */
  --fs-base: clamp(14.5px, 0.22vw + 13.8px, 16px);

  --fs-small: .93rem;
  --fs-body: 1rem;
  --fs-lead: 1.02rem;

  /* عناوين هادئة */
  --fs-h1: clamp(1.60rem, 1.60vw + 1.10rem, 2.10rem);
  --fs-h2: clamp(1.28rem, 1.10vw + 0.95rem, 1.60rem);
  --fs-h3: clamp(1.14rem, 0.80vw + 0.90rem, 1.35rem);
  /* ألوان وهوية */
  --brand:#0b2f55; --brand-strong:#09243f;
  --accent:#B31217; --accent-2:#7f0c10;
  --ink:#0F172A; --ink-2:#1f2937; --muted:#4b5563;
  --line:#e6eaf1; --line-soft:#eef2f7; --border-soft:#e9ecef;
  --bg:#ffffff; --bg-soft:#f7f9fc; --header-bg:#ffffff; --footer-bg:#f9fafb;
  --nav-link:#1f2937; --nav-hover: var(--brand);
  --focus:#0b2f55; --tap-size:44px;
  --logo-w:177; --logo-h:70;
  --breaking-top:0px;

  /* بطاقة الميتا */
  --meta-card-bg:#ffffff; --meta-card-line:#e6e9f1; --meta-card-ink:#2b3442; --meta-card-muted:#5b6472; --meta-card-accent: var(--accent);
}

/* موبايل ضيق جداً */
@media (max-width:360px){
  :root{ --fs-base: 15px; --lh-base: 1.9; --fs-h1: 1.6rem; }
}

/* تفضيلات الوصول */
@media (prefers-contrast: more){ :root{ --line:#d8dee9; --meta-card-line:#d8dee9; } }
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; scroll-behavior:auto!important; }
}

/* =========================
 * 3) Base & Typography
 * ========================= */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; font-synthesis:none; }
body {
  font-family: var(--font-base); font-size: var(--fs-base); line-height: var(--lh-base); font-weight: 400;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.entry, .entry-content, .single-post .entry { font-size: var(--fs-body); }
.entry p { margin: 0 0 1.05em; }
.entry p:first-of-type { font-size: var(--fs-lead); font-weight: 600; }
.entry b, .entry strong, b, strong { font-weight: 700 !important; }
em, i { font-style: normal; text-decoration: underline dotted rgba(0,0,0,.25); }
@media (prefers-color-scheme: dark){ em, i { text-decoration-color: rgba(255,255,255,.35); } }

/* Focus */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px;
}

/* عرض القراءة */
.single .entry, .single .entry-content, .single .post-content { max-width: 760px; margin-inline: auto; }

/* مهم: لا نغيّر ألوان الروابط — نحترم الثيم */
.entry-content a,
.entry a { text-decoration: inherit; }

/* =========================
 * 4) Headings
 * ========================= */
h1 { font-weight: 700; font-size: var(--fs-h1); line-height: 1.35; margin: 0 0 8px; color: var(--ink); }
h1::after { content:""; display:block; margin-block-start:6px; inline-size:56px; block-size:3px; background: var(--accent); border-radius:2px; }
@media (max-width:768px){ h1 { margin-bottom:8px; } }

body.single h2, body.single .entry h2 {
  font: 700 var(--fs-h2)/1.55 var(--font-base); color: var(--ink);
  margin: 22px 0 10px; padding-inline-start:12px; border-inline-start:4px solid color-mix(in srgb, var(--accent) 85%, transparent);
  scroll-margin-top: 90px;
}
body.single h3, body.single .entry h3 {
  font: 600 var(--fs-h3)/1.6 var(--font-base); color: var(--ink-2);
  margin:16px 0 8px; padding-inline-start:10px; border-inline-start:3px solid var(--line);
}
body.single h2 + p, body.single h3 + p { margin-top: 6px; }

/* =========================
 * 5) Media & CLS
 * ========================= */
.single-post .featured-area .post-thumb img { aspect-ratio: 1200/675; width: 100%; height: auto; object-fit: cover; background: #f3f4f6; }
.post-thumb img, .tie-thumb img, .mag-box .post-thumb img { aspect-ratio: 16/9; width:100%; height:auto; object-fit:cover; background:#f3f4f6; }
.single .entry-content img { max-width:100%; height:auto; display:block; background:#f3f4f6; }

.single figure figcaption { color:#64748b; font: 600 0.9rem/1.6 var(--font-base); margin-top:6px; }

/* =========================
 * 6) Mobile Topics Bar — Global News Style
 * ========================= */
@media (min-width:993px){ .gmcat{display:none!important} }

.gmcat {
  position:fixed;
  top:max(var(--gm-top,0px), env(safe-area-inset-top,0px));
  inset-inline:0;
  z-index:9999;
  background:#fff;
  border-bottom:1px solid #e5e7eb;
  box-shadow:0 2px 6px rgba(0,0,0,.06);
  transform:translateY(-100%);
  opacity:0; visibility:hidden;
  transition:transform .25s ease,opacity .25s ease,visibility 0s linear .25s;
}
.gmcat.is-visible{ transform:translateY(0); opacity:1; visibility:visible }

.gmcat-track { overflow-x:auto; -webkit-overflow-scrolling:touch }
.gmcat-list { display:flex; list-style:none; margin:0; padding:0; white-space:nowrap; }
.gmcat-item { flex:0 0 auto; position:relative }

/* فاصل */
.gmcat-item + .gmcat-item::before {
  content:""; position:absolute; top:25%; bottom:25%; left:0; width:1px; background:#e5e7eb;
}

/* الروابط */
.gmcat-link {
  display:inline-flex; align-items:center;
  padding:12px 16px;
  font:700 14px/1 var(--font-base);
  color:inherit;                 /* نحترم ألوان الثيم */
  text-decoration:none;
  transition:color .2s ease, background .2s ease;
}
.gmcat-link:hover {
  background:rgba(179,18,23,.06);
}

/* الرئيسية */
.gmcat .home-item .gmcat-link { font-weight:800; }

/* سهم صغير ▾ */
.gmcat-link::after { content:"▾"; font-size:11px; margin-inline-start:.35em; opacity:.4; }
.gmcat .home-item .gmcat-link::after { content:none }

/* دارك مود */
@media (prefers-color-scheme: dark) {
  .gmcat { background:#111; border-bottom-color:#222 }
  .gmcat-item + .gmcat-item::before { background:#333 }
  .gmcat-link { color:inherit }
  .gmcat-link:hover { background:rgba(255,255,255,.08) }
}

/* =========================
 * 7) Article Meta Card (inside content)
 * ========================= */
body.single .entry-content .yal-meta-bottom{
  background: var(--meta-card-bg);
  border:1px solid var(--meta-card-line);
  border-radius:12px;
  padding:10px 12px;
  margin:10px 0 12px;
  color:var(--meta-card-ink);
  box-shadow:0 1px 2px rgba(17,24,39,.05);
  display:flex; align-items:center; flex-wrap:wrap; gap:.45em .65em;
  direction: rtl;
  font:600 clamp(12px,2.6vw,14px)/1.8 var(--font-base);
  position:relative; isolation:isolate;
}
body.single .entry-content .yal-meta-bottom::before{
  content:""; position:absolute; inset-block:6px; inset-inline-start:-1px; width:4px;
  border-radius:10px; background: color-mix(in srgb, var(--meta-card-accent) 88%, transparent);
}
body.single .entry-content .yal-meta-bottom br,
body.single .entry-content .yal-meta-bottom .yal-sep{ display:none; }
body.single .entry-content .yal-publisher,
body.single .entry-content .yal-author{ white-space:nowrap; }
body.single .entry-content .yal-author::before{ content:"•"; opacity:.35; margin:0 .35em; }
body.single .entry-content .yal-updated{ margin-inline-start:auto; color:var(--meta-card-muted); font-weight:700; white-space:nowrap; }

/* تاريخ أعلى العنوان + شارة القسم */
.yal-article-meta{ margin:8px 0 8px; }
.yal-date-top{
  display:flex; justify-content:center; align-items:center; gap:.45em;
  font:600 clamp(12px, 2.4vw, 13.5px)/1.7 var(--font-base);
  color:var(--meta-card-muted); text-align:center; margin:2px 0 6px;
}
.yal-date-top time{ white-space:nowrap; }
.yal-section{ display:flex; justify-content:center; margin:.35em 0 .2em; }

/* ✅ شارة القسم تتبنّى لون التصنيف عبر --cat-color إن وُجد */
.yal-section__link{
  display:inline-flex; align-items:center; gap:.35em;
  font:700 clamp(11px, 2.4vw, 12.5px)/1 var(--font-base);
  padding:.4em .9em;
  color: var(--cat-color, #9a1111);
  background:#fff;
  border:1px solid var(--meta-card-line);
  border-radius:999px;
  text-decoration:none;
}
.yal-section__link::before{ content:"▣"; transform:scale(.9); opacity:.7; }
.yal-section__link:hover{ background: color-mix(in srgb, var(--cat-color, #9a1111) 8%, #fff); }

/* دارك مود */
@media (prefers-color-scheme: dark){
  body.single .entry-content .yal-meta-bottom{
    background: var(--meta-card-bg);
    border-color: var(--meta-card-line);
    color: var(--meta-card-ink);
  }
  .yal-section__link{ background:#0e1216; border-color:#1f2a38; }
  .yal-section__link:hover{ background:#121820; }
}

/* =========================
 * 8) Article Footer (Tags + Share)
 * ========================= */
.single .post-footer .tags,
.single .post-footer .tagcloud,
.single .post-footer .share-links,
.single .post-footer .share-buttons,
.single .share-post,
.single #share-post-bottom { display:none !important; }

.yal-article-footer{
  margin:14px 0 18px; padding:14px 16px; border:1px solid var(--line);
  border-radius:14px; background:#fff; box-shadow:0 1px 2px rgba(17,24,39,.05);
}
.yal-tags{ display:flex; flex-wrap:wrap; gap:.45rem; margin-bottom:10px; }
.yal-chip{
  display:inline-block; padding:.45rem .7rem; border:1px solid var(--line);
  border-radius:999px; background:#f8fafc; color:var(--ink); text-decoration:none; font-weight:600; font-size:.93rem;
}
.yal-chip:hover{ background:#eef2ff; border-color:#c7d2fe; color:var(--brand); }

.yal-share{ display:flex; flex-wrap:wrap; gap:.5rem; margin:.2rem 0 .6rem; }
.yal-share-btn{
  appearance:none; border:1px solid var(--line); background:#fff; color:var(--ink);
  padding:.52rem .9rem; border-radius:999px; font-weight:700; font-size:.95rem;
  text-decoration:none; display:inline-flex; align-items:center; justify-content:center;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; min-height: var(--tap-size);
}
.yal-share-btn:hover{ transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15,23,42,.08); }
.yal-share-btn.is-copy.ok{ background:#ecfdf5; border-color:#34d399; color:#065f46; }

.yal-foot-note{ margin-top:.2rem; display:flex; align-items:center; gap:.6rem; color:#475569; font-weight:600; font-size:.92rem; }
.yal-foot-note .yal-foot-report{ margin-inline-start:auto; text-decoration:none; border-bottom:2px solid #e2e8f0; padding-bottom:2px; }

/* =========================
 * 9) Related Posts (cards)
 * ========================= */
.yal-related{ margin:24px 0 6px; }
.yal-related__title{ font:700 var(--fs-h2)/1.5 var(--font-base); color:var(--ink); margin:0 0 12px; padding-inline-start:12px; border-inline-start:4px solid var(--accent); }
.yal-related__grid{ display:grid; gap:12px; grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width:900px){ .yal-related__grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width:560px){ .yal-related__grid{ grid-template-columns: 1fr; } }
.yal-card{
  display:block; text-decoration:none; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.yal-card:hover{ transform: translateY(-1px); border-color:#c7d2fe; box-shadow:0 8px 24px rgba(15,23,42,.08); }
.yal-card img{ display:block; width:100%; height:auto; aspect-ratio:16/9; object-fit:cover; background:#f3f4f6; }
.yal-card h3{ margin:10px 10px 12px; color:var(--ink-2); font:700 clamp(1rem, 1.1vw + .2rem, 1.1rem)/1.5 var(--font-base); }

/* =========================
 * 10) Ads (CLS zero)
 * ========================= */
.yal-ad--in1{ margin:14px 0; }
.yal-ad--in1 .adsbygoogle{ display:block; width:100%; min-height:280px; background:#f6f7f9; border:0; }
@media (min-width:768px){ .yal-ad--in1 .adsbygoogle{ min-height:250px; } }
.yal-ad{ margin:16px auto; text-align:center; }
.yal-ad--inpost .adsbygoogle{ display:block; min-height:300px; }
@media (min-width:768px){ .yal-ad--inpost .adsbygoogle{ min-height:250px; } }
.yal-ad--top .adsbygoogle, .yal-ad--bottom .adsbygoogle{ min-height:90px; }

/* =========================
 * 11) Icons width stabilization
 * ========================= */
.fab, .far, .fas{ display:inline-block; width:1em; text-align:center; }

/* =========================
 * 12) Mobile micro-tweaks
 * ========================= */
@media (max-width:768px){ body.single .entry-content .yal-meta-bottom { padding:9px 10px; border-radius:12px; } }
@media (max-width:420px){
  body.single .entry-content .yal-meta-bottom { gap:.35em .55em; }
  body.single .entry-content .yal-meta-bottom .yal-updated { flex-basis:100%; margin-inline-start:0; text-align:start; }
}

/* =========================
 * 13) Print tweaks
 * ========================= */
@media print {
  .site-header, #main-nav, .breaking-bar, .gmcat, .yal-article-footer, .comments-area, .sidebar, .site-footer { display:none !important; }
  body { color:#000; background:#fff; }
  a { color:#000; text-decoration:none; }
  img { max-width:100%; }
}

/* Caption colors for featured image only */
.single-post .featured-area figcaption,
.single-post .featured-area .wp-caption-text,
.single-post .featured-area .yal-hero-credit{
  color:#ffffff !important; font-weight:600; font-size:14px; text-align:center;
  background: rgba(0,0,0,.55); padding:4px 8px; border-radius:4px;
}
/* Reset caption inside article */
.single-post .entry-content figcaption,
.single-post .entry-content .wp-caption-text{
  color: inherit !important; background: transparent !important;
}

/* الروابط العادية */
a {
  color: #b31217; /* أحمر غامق */
  text-decoration: underline; /* يفضل لإبراز الرابط */
  font-weight: 600; /* زيادة وضوح النص */
}

/* عند التمرير */
a:hover,
a:focus {
  color: #ff6600; /* لون مميز عند التمرير */
  text-decoration: underline;
}

/* الروابط التي تم زيارتها */
a:visited {
  color: #800000; /* كحلي أو أحمر غامق إضافي */
}

