/* ===== Design item #1 — homepage as a magazine (owner preview only) ===== */
:is(html.owner-preview,html.mag-live) {
  --mag-gold:#C79232;
  --mag-rule:#D8C8A6;
  --mag-serif:'Amiri','Tajawal',serif;
  --mag-sans:'Tajawal',system-ui,sans-serif;
}

:is(html.owner-preview,html.mag-live) #app:focus,
:is(html.owner-preview,html.mag-live) #app:focus-visible{outline:none}
:is(html.owner-preview,html.mag-live) #app *:focus{outline:none}
:is(html.owner-preview,html.mag-live) #app h1[tabindex]:focus,
:is(html.owner-preview,html.mag-live) #app h1[tabindex]:focus-visible{outline:none!important;outline-offset:0!important}
:is(html.owner-preview,html.mag-live) #app > .hero h1{border:0!important;box-shadow:none}

/* design #2 (reading comfort) is owner-preview only — visitors never see the panel */
html.mag-live:not(.owner-preview):not(.mag-preview) #ocPanel,
html.mag-live:not(.owner-preview):not(.mag-preview) #ocBar{display:none!important}

/* --- page rhythm: one column, magazine order --- */
:is(html.owner-preview,html.mag-live) #app{
  display:flex; flex-direction:column;
  max-width:1180px; margin:0 auto; padding:0 20px 40px;
}
:is(html.owner-preview,html.mag-live) #app > *{order:3}
:is(html.owner-preview,html.mag-live) #app > .hero{order:1}
:is(html.owner-preview,html.mag-live) #app > #discoverSection{order:2}
:is(html.owner-preview,html.mag-live) #app > #latestWritersInline{order:3}
:is(html.owner-preview,html.mag-live) #app > #dailyBest{order:4}
:is(html.owner-preview,html.mag-live) #app > #wowSection{order:5}
:is(html.owner-preview,html.mag-live) #app > #certSection{order:6}
:is(html.owner-preview,html.mag-live) #app > .home-podcast{order:7}

/* --- masthead --- */
:is(html.owner-preview,html.mag-live) #app > .hero{
  text-align:center;
  padding:20px 0 18px;
  margin:2px 0 18px;
  border-top:3px double var(--mag-gold);
  border-bottom:1px solid var(--mag-rule);
  background:linear-gradient(180deg,rgba(199,146,50,.06),rgba(199,146,50,0));
}
:is(html.owner-preview,html.mag-live) #app > .hero .hero-logo img,
:is(html.owner-preview,html.mag-live) #app > .hero .hero-logo{max-height:78px;height:auto}
:is(html.owner-preview,html.mag-live) #app > .hero h1{
  font-family:var(--mag-serif);
  font-weight:700;
  font-size:clamp(1.9rem,3.6vw,2.7rem);
  line-height:1.25;
  letter-spacing:0;
  margin:10px 0 8px;
  color:var(--navy-ink);
}
:is(html.owner-preview,html.mag-live) #app > .hero p{
  font-family:var(--mag-sans);
  font-size:1.02rem;
  line-height:1.9;
  max-width:60ch;
  margin-inline:auto;
  color:var(--muted);
}

/* --- section headers: small gold rule + serif title --- */
:is(html.owner-preview,html.mag-live) #app .section-title{
  font-family:var(--mag-serif);
  font-size:1.75rem;
  font-weight:700;
  color:var(--navy-ink);
  padding-bottom:10px;
  margin:30px 0 6px;
  border-bottom:1px solid var(--mag-rule);
  position:relative;
  display:block;
}
:is(html.owner-preview,html.mag-live) #app .section-title::after{
  content:""; position:absolute; bottom:-1px; inset-inline-start:0;
  width:74px; height:3px; background:var(--mag-gold);
}

/* --- lead story + most-read rail --- */
:is(html.owner-preview,html.mag-live) #discoverSection{
  display:grid;
  grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);
  gap:26px;
  align-items:start;
  margin-top:8px;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-feature{
  margin:0; padding:22px; border-radius:16px;
  background:linear-gradient(160deg,#FBF3E4,#FFFDF7 60%);
  border:1px solid var(--mag-rule);
  box-shadow:0 10px 28px rgba(31,69,104,.06);
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-feature .section-title{
  margin:2px 0 0; border-bottom:none; padding-bottom:0;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-feature .section-title::after{display:none}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-eyebrow{
  font-family:var(--mag-sans); font-size:.78rem; font-weight:700;
  letter-spacing:.16em; color:var(--mag-gold); margin:0 0 4px;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-feature .form-note{
  font-size:.82rem; line-height:1.8; color:var(--muted); margin:6px 0 14px;
}

/* most-read: same card grid and card style as «أحدث مشاركات الكتّاب» */
:is(html.owner-preview,html.mag-live) #discoverSection{display:block}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-feature{margin:0 0 30px}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-popular{margin:0}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-popular .form-note{font-size:.8rem;line-height:1.8}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid{
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px; margin-top:14px; align-items:stretch;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid article{
  position:relative; display:flex; flex-direction:column;
  padding:18px; border-radius:14px; border:1px solid var(--mag-rule);
  background:var(--paper); box-shadow:0 8px 22px rgba(31,69,104,.05);
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .piece-card{
  display:flex; flex-direction:column; flex:1; order:2;
  margin:0; padding:0; border:0; background:none; box-shadow:none;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .popular-rank{
  order:1; display:block; position:static; margin:0 0 10px;
  font-family:var(--mag-sans); font-size:.72rem; font-weight:700;
  letter-spacing:.05em; color:var(--mag-gold); line-height:1.6;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .writer-art-cover{
  width:100%; max-width:220px; margin:0 auto 12px; aspect-ratio:2/3;
  border-radius:10px; overflow:hidden; position:relative;
  background:#F2EADA; box-shadow:0 6px 18px rgba(31,69,104,.14);
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .writer-art-cover img{
  position:absolute; inset:0; width:100%!important; height:100%!important;
  object-fit:cover; display:block; border-radius:10px;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .piece-card > .excerpt{display:none!important}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .piece-card > h3{
  font-family:var(--mag-serif); font-size:1.18rem; line-height:1.5;
  margin:0 0 6px; color:var(--navy-ink); text-align:start;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .piece-meta{
  font-size:.78rem; color:var(--muted); display:flex; gap:10px; flex-wrap:wrap; margin-top:auto;
}
:is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid .piece-meta > span:nth-child(2){display:none}

/* --- latest writers: 3-up magazine grid --- */
:is(html.owner-preview,html.mag-live) #latestWritersInline .latest-writers-grid{
  grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px;
}
:is(html.owner-preview,html.mag-live) #latestWritersInline .latest-writer-card{
  border-radius:14px; border:1px solid var(--mag-rule);
  background:var(--paper);
  box-shadow:0 8px 22px rgba(31,69,104,.05);
}
:is(html.owner-preview,html.mag-live) #latestWritersInline .latest-writer-card h3{
  font-family:var(--mag-serif); font-size:1.22rem; line-height:1.5;
}

/* --- side boxes: daily pick + podcast --- */
:is(html.owner-preview,html.mag-live) #dailyBest, :is(html.owner-preview,html.mag-live) .home-podcast{
  border:1px solid var(--mag-rule); border-radius:16px;
  background:linear-gradient(180deg,#FFFDF7,#FBF6EA);
  padding:20px 22px;
}

/* --- narrow screens: back to one column --- */
@media (max-width:980px){
  :is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid{grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px}
  :is(html.owner-preview,html.mag-live) #latestWritersInline .latest-writers-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:620px){
  :is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid{grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px}
  :is(html.owner-preview,html.mag-live) #discoverSection .discovery-grid article{padding:14px}
  :is(html.owner-preview,html.mag-live) #app{padding:0 14px 30px}
  :is(html.owner-preview,html.mag-live) #latestWritersInline .latest-writers-grid{grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px}
  :is(html.owner-preview,html.mag-live) #app > .hero h1{font-size:1.9rem}
}

/* --- «عرض المزيد»: ٤ كروت ظاهرة ثم الباقي --- */
.mag-extra{display:none!important}
.mag-more-wrap{display:none}
:is(html.owner-preview,html.mag-live) .mag-more-wrap{display:flex;justify-content:center;margin:20px 0 0}
:is(html.owner-preview,html.mag-live) .mag-more-wrap .mag-more{display:inline-flex;align-items:center;gap:8px;border-radius:24px;padding:9px 26px;font-weight:700;border:1px solid var(--mag-rule);background:var(--paper);color:var(--navy-ink);cursor:pointer}
:is(html.owner-preview,html.mag-live) .mag-more-wrap .mag-more:hover{background:#F7EEDB}
:is(html.owner-preview,html.mag-live) #discoverSection.mag-open .discovery-grid .mag-extra{display:flex!important}
:is(html.owner-preview,html.mag-live) #latestWritersInline.mag-open .mag-extra{display:block!important}


/* ===== dark theme coverage for the magazine homepage (site dark theme = data-theme="dark") ===== */
[data-theme="dark"] html, html[data-theme="dark"]{--mag-rule:#3C4650;--mag-gold:#D6AA58}
html[data-theme="dark"].mag-live #app > .hero{background:linear-gradient(180deg,rgba(214,170,88,.08),rgba(214,170,88,0))}
html[data-theme="dark"].mag-live #discoverSection .discovery-feature{background:linear-gradient(160deg,#2A2F2F,#222B33 60%);border-color:#3C4650;box-shadow:none}
html[data-theme="dark"].mag-live #discoverSection .discovery-grid article,
html[data-theme="dark"].mag-live #latestWritersInline .latest-writer-card{background:#222B33;border-color:#3C4650;box-shadow:none}
html[data-theme="dark"].mag-live #discoverSection .discovery-grid .piece-card{background:none}
html[data-theme="dark"].mag-live #discoverSection .discovery-feature .piece-card,
html[data-theme="dark"].mag-live #discoverSection .discovery-feature .card{background:#222B33;border-color:#3C4650}
html[data-theme="dark"].mag-live #dailyBest,
html[data-theme="dark"].mag-live .home-podcast{background:linear-gradient(180deg,#222B33,#1D252C);border-color:#3C4650}
html[data-theme="dark"].mag-live .mag-more-wrap .mag-more{background:#222B33;color:var(--navy-ink);border-color:#3C4650}
html[data-theme="dark"].mag-live .mag-more-wrap .mag-more:hover{background:#2B3843}
html[data-theme="dark"].mag-live #app .section-title,
html[data-theme="dark"].mag-live #app h1,
html[data-theme="dark"].mag-live #app h3{color:var(--navy-ink)}
html[data-theme="dark"].mag-live .piece-card h3,html[data-theme="dark"].mag-live .latest-writer-card h3{color:#E8E7E1}
