/* VORTEX — الرئيسية v4: بطل متعدد الشرائح وأقسام مرتبة (طبقة أخيرة، تحل محل v3) */
[data-page="home"] { --h4-bg: #05080c; --h4-card: #0c1217; --h4-line: rgba(255,255,255,.08); --h4-mute: #8a96a3; --h4-ac: #13abd2; }
[data-page="home"] body, body[data-page="home"] { background: var(--h4-bg); }
[data-page="home"] .container, [data-page="home"] main.h4 { padding-inline: 0; }
.h4 { display: block; }

/* ===== البطل ===== */
.h4-hero { position: relative; height: min(72vh, 620px); min-height: 460px; overflow: hidden; background: var(--h4-bg); border-bottom: 1px solid var(--h4-line); }
.h4-slides { position: absolute; inset: 0; }
.h4-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility .7s; display: flex; align-items: center; }
.h4-slide.on { opacity: 1; visibility: visible; }
.h4-bg { position: absolute; inset: 0; background-size: cover; background-position: center 25%; transform: scale(1.06); transition: transform 8s ease; filter: saturate(1.05); }
.h4-slide.on .h4-bg { transform: scale(1); }
.h4-slide::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(0deg, var(--h4-bg) 2%, rgba(5,8,12,.55) 55%, rgba(5,8,12,.2) 100%), linear-gradient(90deg, rgba(5,8,12,.95) 0%, rgba(5,8,12,.55) 55%, rgba(5,8,12,.2) 100%); }
.h4-inner { position: relative; z-index: 2; width: min(1200px, 100% - 40px); margin: 0 auto; display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr); gap: clamp(22px, 4vw, 56px); align-items: center; }
.h4-poster { aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; border: 1px solid var(--h4-line); box-shadow: 0 30px 70px -20px rgba(0,0,0,.9); background: #111820; }
.h4-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h4-copy { min-width: 0; max-width: 640px; }
.h4-kind { display: inline-block; font: 700 12px/1 monospace; letter-spacing: .18em; color: var(--h4-ac); }
.h4-copy h1 { margin: 14px 0 6px; font-size: clamp(32px, 4.8vw, 58px); font-weight: 900; line-height: 1.12; text-shadow: 0 8px 30px rgba(0,0,0,.5); }
.h4-sub { margin: 0 0 12px; font-size: 14px; color: var(--h4-mute); }
.h4-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.h4-chips span { padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--h4-line); font-size: 12.5px; color: #d4dbe2; }
.h4-desc { margin: 16px 0 0; font-size: clamp(15px, 1.5vw, 17px); line-height: 1.9; color: #cfd7df; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.h4-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.h4-btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 26px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #fff; font-weight: 700; text-decoration: none; background: rgba(255,255,255,.04); transition: background .2s, border-color .2s; }
.h4-btn:hover { background: rgba(255,255,255,.1); }
.h4-btn.primary { background: var(--h4-ac); border-color: transparent; color: #04151c; box-shadow: 0 12px 30px -12px var(--h4-ac); }
.h4-btn.primary:hover { filter: brightness(1.06); }

.h4-dots { position: absolute; z-index: 3; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%); display: flex; gap: 8px; }
.h4-dots button { width: 28px; height: 4px; border: 0; border-radius: 4px; background: rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.h4-dots button[aria-selected="true"] { background: #fff; width: 44px; }

/* ===== الأقسام ===== */
.h4-wrap { width: min(1200px, 100% - 40px); margin: 0 auto; padding-bottom: 40px; }
.h4-sec { margin-top: 56px; }
.h4-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.h4-head h2 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; position: relative; padding-inline-start: 14px; }
.h4-head h2::before { content: ""; position: absolute; inset-block: 3px; inset-inline-start: 0; width: 4px; border-radius: 4px; background: var(--h4-ac); }
.h4-more { color: var(--h4-mute); text-decoration: none; font-size: 14px; }
.h4-more:hover { color: #fff; }
.h4-nav { display: flex; gap: 8px; }
.h4-nav button { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--h4-line); background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.h4-nav button:hover { border-color: var(--h4-ac); color: var(--h4-ac); }
.h4-nav .icon { width: 18px; height: 18px; }
#shelf-prev .icon { transform: scaleX(-1); }

/* آخر الفصول: صف أفقي */
.h4-latest { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 240px); gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.h4-lcard { display: block; color: inherit; text-decoration: none; min-width: 0; }
.h4-lcover { position: relative; aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; background: #111820; border: 1px solid var(--h4-line); transition: transform .3s, border-color .3s; }
.h4-lcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h4-lcard:hover .h4-lcover { transform: translateY(-3px); border-color: rgba(118,229,253,.35); }
.h4-lcard h3 { margin: 10px 0 2px; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h4-lcard small { color: var(--h4-mute); font-size: 12.5px; }

/* شارة جديد */
.h4-new { position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2; padding: 2px 9px; border-radius: 999px; background: var(--h4-ac); color: #04151c; font-size: 11px; font-weight: 800; line-height: 1.7; }

/* المانغا: رف */
.h4-shelf { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 170px); gap: 16px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; scrollbar-width: none; }
.h4-shelf::-webkit-scrollbar { display: none; }
.h4-mcard { display: block; color: inherit; text-decoration: none; scroll-snap-align: start; transition: transform .3s; }
.h4-mcard:hover { transform: translateY(-5px); }
.h4-mcover { position: relative; aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; background: #111820; border: 1px solid var(--h4-line); box-shadow: 0 16px 36px -18px rgba(0,0,0,.9); }
.h4-mcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h4-mcard:hover .h4-mcover { border-color: rgba(118,229,253,.35); box-shadow: 0 28px 50px -20px rgba(118,229,253,.35); }
.h4-mcard h3 { margin: 12px 0 2px; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h4-mcard small { color: var(--h4-mute); font-size: 12.5px; }

/* الأنمي: شبكة */
.h4-anime { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.h4-acard { display: block; color: inherit; text-decoration: none; transition: transform .3s; }
.h4-acard:hover { transform: translateY(-5px); }
.h4-aposter { position: relative; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, color-mix(in srgb, var(--ac, #13abd2) 45%, #111820), #07090d); border: 1px solid var(--h4-line); box-shadow: 0 18px 40px -20px rgba(0,0,0,.9); display: grid; place-items: center; }
.h4-aposter img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.h4-aposter > span { font-size: 56px; font-weight: 900; color: rgba(255,255,255,.85); }
.h4-kind-badge { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 2; font-style: normal; padding: 3px 10px; border-radius: 999px; background: rgba(5,8,12,.75); border: 1px solid var(--h4-line); font-size: 12px; font-weight: 700; color: #fff; }
.h4-kind-badge.movie { background: #f5c451; color: #1b1405; border-color: transparent; }
.h4-acard:hover .h4-aposter { border-color: rgba(118,229,253,.35); }
.h4-acard h3 { margin: 12px 0 2px; font-size: 15px; font-weight: 700; line-height: 1.5; }
.h4-acard small { color: var(--h4-mute); font-size: 12.5px; }

/* الداتا بوك */
.h4-db .h4-db-band { display: grid; gap: 6px; padding: clamp(20px, 3vw, 30px); border-radius: 20px; border: 1px solid var(--h4-line); background: radial-gradient(120% 120% at 100% 0%, rgba(19,171,210,.2), transparent 60%), #0c1217; color: inherit; text-decoration: none; margin-bottom: 18px; }
.h4-db-band strong { font-size: clamp(24px, 3vw, 34px); font-weight: 900; }
.h4-db-band span:not(.h4-db-eyebrow):not(.h4-db-go) { color: var(--h4-mute); }
.h4-db-eyebrow { font: 700 11px/1 monospace; letter-spacing: .18em; color: var(--h4-ac); }
.h4-db-go { margin-top: 8px; color: var(--h4-ac) !important; font-weight: 700; }
.h4-db .db-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

/* الجوال */
@media (max-width: 860px) {
    .h4-inner { grid-template-columns: 1fr; text-align: center; }
    .h4-poster { width: min(170px, 46vw); margin: 0 auto; }
    .h4-copy { margin: 0 auto; }
    .h4-chips, .h4-actions { justify-content: center; }
    .h4-desc { -webkit-line-clamp: 2; }
    .h4-hero { height: auto; min-height: 560px; }
    .h4-slide { align-items: flex-end; padding-bottom: 56px; }
    .h4-slide .h4-inner { padding-top: 24px; }
}
@media (max-width: 560px) {
    .h4-hero { min-height: 600px; }
    .h4-slide { padding-bottom: 48px; }
    .h4-copy h1 { font-size: 30px; }
    .h4-actions .h4-btn { flex: 1; padding: 0 14px; }
    .h4-sec { margin-top: 44px; }
    .h4-latest { grid-auto-columns: 72vw; }
    .h4-shelf { grid-auto-columns: 40vw; }
    .h4-anime { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .h4-nav { display: none; }
}

/* أحدث الفصول: أغلفة عمودية + بيانات تحكم بها الإدارة */
.h4-lcard h3 { margin: 10px 2px 2px; font-size: 14.5px; font-weight: 700; color: #fff; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.h4-lcard small { display: block; margin: 0 2px; font-size: 12px; color: var(--h4-mute); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.h4-lnocover { position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; font-weight: 800; color: rgba(118,229,253,.35); }
.h4-latest { grid-auto-columns: minmax(150px, 176px); }
@media (min-width: 900px) { .h4-latest { grid-auto-columns: minmax(184px, 200px); } }
