:root{
  --void:#0a0908;
  --panel:#131110;
  --panel-raised:#1a1615;
  --line:#2a2220;
  --line-soft:#1f1a18;
  --red:#9c2b2b;
  --red-bright:#c8433a;
  --red-deep:#4a1414;
  --ink:#ece7e3;
  --ink-dim:#a89c96;
  --ink-faint:#6f6560;
  --sidebar-w:272px;
}

*{box-sizing:border-box; margin:0; padding:0;}
html{scroll-behavior:smooth;}
body{
  background:var(--void);
  color:var(--ink);
  font-family:'Tajawal', sans-serif;
  font-weight:400;
  line-height:1.75;
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
}
h1,h2,h3,.brand-name{font-family:'Almarai', sans-serif;}

body::before{
  content:"";
  position:fixed; inset:0;
  background-image:
    radial-gradient(ellipse 900px 500px at 85% -10%, rgba(156,43,43,.16), transparent 60%),
    radial-gradient(ellipse 700px 500px at -10% 110%, rgba(156,43,43,.08), transparent 60%);
  pointer-events:none;
  z-index:0;
}

a{color:inherit; text-decoration:none;}
::selection{background:var(--red); color:#fff;}

/* ---------- SIDEBAR ---------- */
.sidebar{
  position:fixed;
  top:0; right:0;
  width:var(--sidebar-w);
  height:100vh;
  background:linear-gradient(180deg, var(--panel), #0f0d0c);
  border-left:1px solid var(--line);
  display:flex;
  flex-direction:column;
  z-index:100;
  transition:transform .35s ease;
}
.sidebar-top{
  padding:34px 28px 26px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  border-bottom:1px solid var(--line-soft);
}
.sidebar-top img{
  width:74px; height:74px;
  filter:drop-shadow(0 6px 18px rgba(156,43,43,.35));
}
.brand-name{font-size:19px; font-weight:800; letter-spacing:.5px;}
.brand-name span{color:var(--red-bright);}
.brand-tag{font-size:11.5px; color:var(--ink-faint); letter-spacing:.3px;}

nav.side-nav{
  flex:1;
  padding:22px 14px;
  display:flex;
  flex-direction:column;
  gap:4px;
  overflow-y:auto;
}
.side-nav a{
  position:relative;
  display:flex;
  align-items:center;
  gap:12px;
  padding:13px 16px;
  border-radius:8px;
  font-size:14.5px;
  color:var(--ink-dim);
  transition:background .2s ease, color .2s ease;
}
.side-nav a .dash{
  width:4px; height:4px;
  border-radius:1px;
  background:var(--ink-faint);
  flex-shrink:0;
  transition:all .25s ease;
}
.side-nav a:hover{background:rgba(255,255,255,.03); color:var(--ink);}
.side-nav a[aria-current="page"]{background:rgba(156,43,43,.13); color:var(--ink);}
.side-nav a[aria-current="page"] .dash{width:16px; height:4px; background:var(--red-bright);}

.sidebar-bottom{
  padding:20px 28px 26px;
  border-top:1px solid var(--line-soft);
  font-size:11.5px;
  color:var(--ink-faint);
  line-height:1.9;
}

.menu-toggle{
  display:none;
  position:fixed;
  top:16px; right:16px;
  z-index:200;
  width:44px; height:44px;
  border-radius:8px;
  background:var(--panel-raised);
  border:1px solid var(--line);
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:5px;
  cursor:pointer;
}
.menu-toggle span{width:20px; height:2px; background:var(--ink);}

/* ---------- MAIN ---------- */
main{margin-right:var(--sidebar-w); position:relative; z-index:1;}

/* Hero (home page only) */
.hero{
  position:relative;
  min-height:56vh;
  display:flex;
  align-items:flex-end;
  background-size:cover;
  background-position:center 30%;
  clip-path:polygon(0 0, 100% 0, 100% 88%, 0 100%);
}
.hero::after{
  content:"";
  position:absolute; inset:0;
  background:linear-gradient(180deg, rgba(8,7,6,.55) 0%, rgba(8,7,6,.35) 35%, rgba(8,7,6,.95) 100%);
}
.hero-inner{position:relative; z-index:2; padding:60px 64px 70px; max-width:760px;}
.hero-mark{display:flex; gap:6px; margin-bottom:22px;}
.hero-mark i{width:14px; height:14px; background:var(--red);}
.hero h1{font-size:44px; font-weight:800; line-height:1.25; margin-bottom:18px; color:#f4efec;}
.hero h1 em{font-style:normal; color:var(--red-bright);}
.hero p{font-size:16px; color:#cbc0ba; max-width:560px;}

/* Compact page header (category pages) */
.page-header{
  padding:70px 64px 40px;
  border-bottom:1px solid var(--line-soft);
  background:linear-gradient(180deg, rgba(156,43,43,.07), transparent 70%);
}
.page-header .crumb{
  display:flex; align-items:center; gap:8px;
  font-size:12.5px; color:var(--ink-faint); margin-bottom:18px;
}
.page-header .crumb a:hover{color:var(--ink-dim);}
.page-header .crumb i{width:4px; height:4px; background:var(--red); display:inline-block;}
.page-header h1{font-size:32px; font-weight:800; color:#f4efec; margin-bottom:12px;}
.page-header p{font-size:15px; color:var(--ink-dim); max-width:600px;}

.content{padding:50px 64px 40px;}

/* Home category cards */
.card-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:16px;
}
.category-card{
  display:block;
  padding:28px 26px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:12px;
  transition:border-color .2s ease, transform .2s ease, background .2s ease;
}
.category-card:hover{border-color:var(--red-deep); background:var(--panel-raised); transform:translateY(-2px);}
.category-card .card-index{
  width:34px; height:34px;
  background:var(--panel-raised);
  border:1px solid var(--line);
  border-right:3px solid var(--red);
  display:flex; align-items:center; justify-content:center;
  font-family:'Almarai', sans-serif; font-weight:700; font-size:13px;
  color:var(--ink-dim);
  margin-bottom:16px;
}
.category-card h3{font-size:18px; font-weight:700; margin-bottom:8px; color:var(--ink);}
.category-card p{font-size:14px; color:var(--ink-dim); margin-bottom:16px;}
.category-card .card-cta{font-size:13px; color:var(--red-bright); font-weight:700;}

/* Rule list */
.rule-list{display:flex; flex-direction:column; gap:2px;}
.rule-item{
  display:grid;
  grid-template-columns:52px 1fr;
  gap:20px;
  padding:20px 18px;
  border-radius:10px;
  transition:background .2s ease;
}
.rule-item:hover{background:var(--panel);}
.rule-num{
  width:34px; height:34px;
  background:var(--panel-raised);
  border:1px solid var(--line);
  border-right:3px solid var(--red);
  display:flex; align-items:center; justify-content:center;
  font-family:'Almarai', sans-serif; font-weight:700; font-size:13px;
  color:var(--ink-dim);
}
.rule-body h3{font-size:16px; font-weight:700; margin-bottom:6px; color:var(--ink);}
.rule-body p{font-size:14.5px; color:var(--ink-dim); max-width:680px;}

.sub-heading{
  font-size:13px;
  font-weight:700;
  color:var(--red-bright);
  margin:36px 0 14px;
  padding-bottom:10px;
  border-bottom:1px solid var(--line-soft);
}
.sub-heading:first-child{margin-top:0;}

/* Concept definitions box (top of general rules page) */
.concept-intro{margin-bottom:8px;}
.concept-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:12px;
  margin-bottom:10px;
}
.concept-card{
  padding:20px 22px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
}
.concept-card .concept-tag{
  display:inline-block;
  font-family:'Almarai', sans-serif;
  font-size:11.5px;
  font-weight:700;
  letter-spacing:.5px;
  color:var(--red-bright);
  border:1px solid var(--red-deep);
  border-radius:5px;
  padding:3px 10px;
  margin-bottom:12px;
}
.concept-card p{font-size:14px; color:var(--ink-dim);}

/* Closing notice box */
.notice-box{
  margin-top:30px;
  padding:24px 26px;
  background:linear-gradient(180deg, rgba(156,43,43,.09), rgba(156,43,43,.02));
  border:1px solid var(--red-deep);
  border-radius:12px;
}
.notice-box p{font-size:14.5px; color:var(--ink); margin-bottom:8px;}
.notice-box p:last-child{margin-bottom:0; color:var(--ink-dim); font-size:13px;}

@media (max-width:900px){
  .concept-grid{grid-template-columns:1fr;}
}

/* Prev / next between category pages */
.page-nav{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:34px 64px 60px;
  border-top:1px solid var(--line-soft);
  margin-top:20px;
}
.page-nav a{
  flex:1;
  max-width:320px;
  padding:18px 20px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
  transition:border-color .2s ease, background .2s ease;
}
.page-nav a:hover{border-color:var(--red-deep); background:var(--panel-raised);}
.page-nav .pn-label{font-size:11.5px; color:var(--ink-faint); margin-bottom:6px;}
.page-nav .pn-title{font-size:14.5px; font-weight:700; color:var(--ink);}
.page-nav .next{text-align:left;}

footer{
  position:relative; z-index:1;
  margin-right:var(--sidebar-w);
  border-top:1px solid var(--line);
  background:var(--panel);
  padding:26px 0;
  overflow:hidden;
}
.ticker{
  display:flex; gap:40px; white-space:nowrap;
  animation:scroll-ticker 22s linear infinite;
  font-family:'Almarai', sans-serif;
  font-size:12.5px; letter-spacing:1.5px;
  color:var(--red); font-weight:700;
}
@keyframes scroll-ticker{from{transform:translateX(0);} to{transform:translateX(-50%);}}

@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  .ticker{animation:none;}
}

@media (max-width:900px){
  .sidebar{transform:translateX(100%);}
  .sidebar.open{transform:translateX(0);}
  .menu-toggle{display:flex;}
  main, footer{margin-right:0;}
  .hero-inner{padding:80px 26px 50px;}
  .hero h1{font-size:32px;}
  .page-header{padding:80px 22px 30px;}
  .content{padding:30px 22px 20px;}
  .card-grid{grid-template-columns:1fr;}
  .rule-item{grid-template-columns:40px 1fr; gap:14px; padding:16px 10px;}
  .page-nav{flex-direction:column; padding:24px 22px 50px;}
  .page-nav a{max-width:none;}
}
