:root{
  --bg:#ffffff;
  --surface:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --border:#e2e8f0;
  --soft:#f8fafc;
  --soft2:#f1f5f9;
  --primary:#0b5fff;
  --primaryHover:#0847c7;
  --accent:#f59e0b;
  --accentHover:#d97706;
  --shadow:0 10px 30px rgba(15,23,42,0.08);
  --shadowSoft:0 14px 36px rgba(15,23,42,0.08);
  --radius:16px;
  --maxw:980px;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,"Noto Naskh Arabic",Tahoma,sans-serif;
  line-height:1.9;
  direction:rtl;
  text-align:right;
}

/* Header */

.topbar{
  position:sticky;
  top:0;
  background:rgba(255,255,255,0.94);
  border-bottom:1px solid var(--border);
  backdrop-filter:blur(8px);
  z-index:10;
}

/* Title row */

.title-row{
  max-width:var(--maxw);
  margin:auto;
  padding:16px 18px 6px;
  display:flex;
  justify-content:flex-start;
}

.site-title{
  display:flex;
  flex-direction:column;
  gap:4px;
  text-align:right;
  margin-left:auto;
}

.site-title h1{
  margin:0;
  font-size:28px;
  font-weight:700;
  line-height:1.35;
}

.site-title p{
  margin:0;
  color:var(--muted);
  font-size:15px;
  line-height:1.6;
}

html[dir="ltr"] .site-title{
  text-align:left;
  margin-left:0;
  margin-right:auto;
}

/* Navigation */

.nav-row{
  max-width:var(--maxw);
  margin:auto;
  padding:0 18px 12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

nav{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.navlink{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid transparent;
  font-size:13px;
  text-decoration:none;
  color:var(--text);
  white-space:nowrap;
}

.navlink:hover{
  background:var(--soft2);
  border-color:var(--border);
}

.navlink.active{
  background:var(--primary);
  color:#fff;
  border-color:var(--primary);
  font-weight:600;
}

.navlink.active:hover{
  background:var(--primaryHover);
  border-color:var(--primaryHover);
}

.lang-btn{
  padding:9px 16px;
  border-radius:999px;
  border:none;
  background:var(--accent);
  color:#fff;
  cursor:pointer;
  white-space:nowrap;
  font-size:14px;
  transition:background 0.2s ease;
}

.lang-btn:hover{
  background:var(--accentHover);
}

/* Main layout */

.wrap{
  max-width:var(--maxw);
  margin:auto;
  padding:30px 18px 60px;
}

.hero{
  max-width:960px;
  margin:32px auto 0;
  background:#fff;
  border:1px solid var(--border);
  border-top:4px solid var(--primary);
  border-radius:var(--radius);
  box-shadow:var(--shadowSoft);
  padding:40px 48px;
}

/* Reading content */

.intro{
  font-size:17px;
  line-height:1.9;
}

.intro p{
  margin:0 0 0.85em 0;
}

.intro h2{
  margin:1.5em 0 0.4em 0;
  font-size:30px;
  font-weight:700;
  line-height:1.45;
  letter-spacing:-0.01em;
}

.intro h2:first-child{
  margin-top:0;
}

.intro h3{
  margin:1.2em 0 0.35em 0;
  font-size:23px;
  font-weight:700;
  line-height:1.5;
  letter-spacing:-0.01em;
}

.intro h3:first-child{
  margin-top:0;
}

.intro ul{
  margin:1em 0 1.2em 0;
  padding-inline-start:1.4em;
  line-height:1.9;
}

.intro li{
  margin-bottom:0.45em;
}

/* =========================
   TABLES
   ========================= */

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  margin-top:1.5rem;
  table-layout:fixed;
  font-size:15px;
  line-height:1.6;
}

th, td{
  padding:8px 16px;
  vertical-align:top;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:normal;
  text-align:right;
}

thead th{
  font-weight:700;
  border-bottom:2px solid #ddd;
}

tbody tr{
  border-bottom:1px solid #eee;
}

tbody tr:hover{
  background-color:#fafafa;
}

/* LTR tables */

html[dir="ltr"] th,
html[dir="ltr"] td{
  text-align:left;
}

/* Comparative constitution page tables */

.comparative-content table{
  width:100%;
  table-layout:fixed;
  margin-bottom:1.25rem;
}

.comparative-content th,
.comparative-content td{
  overflow-wrap:normal;
  word-break:normal;
}

.comparative-content table th:nth-child(1),
.comparative-content table td:nth-child(1){
  width:18%;
}

.comparative-content table th:nth-child(2),
.comparative-content table td:nth-child(2){
  width:18%;
}

.comparative-content table th:nth-child(3),
.comparative-content table td:nth-child(3){
  width:20%;
}

.comparative-content table th:nth-child(4),
.comparative-content table td:nth-child(4){
  width:26%;
}

.comparative-content table th:nth-child(5),
.comparative-content table td:nth-child(5){
  width:18%;
}

/* Notes and constitutional basis */

.page-notes{
  margin:0.15rem 0 1rem 0;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:12px;
  background:linear-gradient(180deg,#fbfdff 0%, #f8fafc 100%);
  font-size:0.8rem;
  line-height:1.75;
  color:var(--muted);
}

.page-notes strong{
  font-weight:600;
  color:var(--text);
}

.page-notes p{
  margin:0 0 0.4rem 0;
}

.constitutional-basis{
  margin:0.2rem 0 0.9rem 0;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--soft);
  font-size:0.78rem;
  line-height:1.55;
  color:var(--muted);
}

.constitutional-basis strong{
  font-weight:600;
  color:var(--text);
}

/* Footer note */

.lang-note{
  margin-top:22px;
  border-top:1px solid var(--border);
  padding-top:12px;
  font-size:11px;
  line-height:1.7;
  color:var(--muted);
  opacity:0.9;
}

/* Under construction blocks */

.uc{
  text-align:center;
  padding:22px 14px;
}

.uc h2{
  margin:0 0 8px 0;
  font-size:18px;
}

.uc p{
  margin:0;
  color:var(--muted);
  font-size:14px;
}

/* Language-specific refinement */

html[lang="fa"] .intro{
  line-height:2;
}

html[lang="fa"] .intro h2{
  line-height:1.6;
}

html[lang="fa"] .intro h3{
  line-height:1.65;
}

html[lang="en"] .intro{
  line-height:1.85;
}

html[lang="en"] .intro h2{
  line-height:1.35;
}

html[lang="en"] .intro h3{
  line-height:1.4;
}

/* Country data box */

.databox{
  border:1px solid var(--border);
  background:var(--soft);
  border-radius:10px;
  padding:16px 18px;
  margin:18px 0 28px 0;
}

.databox table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}

.databox th,
.databox td{
  padding:6px 10px;
}

.databox th{
  font-weight:600;
}

/* Country summary */

.country-summary{
  margin:12px 0 22px 0;
  font-size:14px;
}

.country-summary table{
  width:100%;
  border-collapse:collapse;
}

.country-summary th{
  font-weight:600;
  padding:6px 10px;
  border-bottom:1px solid #ddd;
}

.country-summary td{
  padding:6px 10px;
}

/* Back navigation link */

.back-link{
  display:inline-block;
  margin:8px 0 18px 0;
  padding:7px 12px;
  font-size:14px;
  line-height:1.4;
  text-decoration:none;
  border-radius:8px;
  background:#f3f4f6;
  color:var(--text);
  border:1px solid #e0e0e0;
  transition:background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.back-link:hover{
  background:#e9ecef;
  border-color:#d1d5db;
  color:var(--text);
}

/* Responsive */

@media (max-width:900px){

  table{
    font-size:14px;
  }

  th, td{
    padding:8px 14px;
  }

  .hero{
    padding:30px 28px;
  }

  .intro{
    font-size:16px;
  }

  .intro h2{
    font-size:28px;
  }

  .intro h3{
    font-size:21px;
  }
}

@media (max-width:640px){

  .title-row,
  .nav-row,
  .wrap{
    padding-left:14px;
    padding-right:14px;
  }

  .hero{
    padding:24px 18px;
    margin-top:22px;
  }

  .nav-row{
    flex-direction:column;
    align-items:stretch;
  }

  nav{
    justify-content:center;
  }

  .lang-btn{
    align-self:flex-start;
  }

  .intro{
    font-size:15.5px;
  }

  .intro h2{
    font-size:24px;
  }

  .intro h3{
    font-size:19px;
  }

  table{
    display:block;
    overflow-x:auto;
    white-space:nowrap;
  }
}

/* Comparison table */

.comparison-table{
  width:100%;
  table-layout:fixed;
  border-collapse:collapse;
  margin-top:0.45rem;
  margin-bottom:1rem;
}

.comparison-table th,
.comparison-table td{
  padding:9px 8px;
  vertical-align:top;
  border-bottom:1px solid #e5e7eb;
}

.comparison-table thead th{
  font-weight:700;
  text-align:center;
  font-size:0.94rem;
}

.comparison-table th:nth-child(1),
.comparison-table td:nth-child(1){
  width:54% !important;
  text-align:right;
  white-space:normal;
  overflow-wrap:break-word;
  word-break:normal;
  line-height:1.65;
  letter-spacing:-0.005em;
}

.comparison-table th:nth-child(n+2),
.comparison-table td:nth-child(n+2){
  width:5.75% !important;
  text-align:center;
  white-space:nowrap;
  font-size:0.95rem;
}

.comparison-table tbody tr:hover{
  background-color:#fafafa;
}

.comparison-table tbody tr td:first-child{
  color:var(--text);
}

.comparison-table tbody tr td:first-child strong{
  display:inline-block;
  margin-top:0.15rem;
  padding-top:0.35rem;
  font-weight:700;
  font-size:0.97rem;
  letter-spacing:-0.01em;
}

.comparison-table tbody tr td:first-child strong::after{
  content:"";
  display:block;
  width:100%;
  margin-top:0.35rem;
  border-bottom:1px solid #dbe4ee;
}

html[dir="ltr"] .comparison-table th:nth-child(1),
html[dir="ltr"] .comparison-table td:nth-child(1){
  text-align:left;
}

/* Comparison notes and guide */

.table-note{
  font-size:0.82rem;
  line-height:1.6;
  color:#334155;
  margin-top:0.35rem;
  margin-bottom:0.85rem;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--soft);
}

.table-note table{
  width:100%;
  margin-top:0.1rem;
  margin-bottom:0;
  border-collapse:collapse;
  table-layout:fixed;
  font-size:0.82rem;
}

.table-note th,
.table-note td{
  padding:3px 0;
  border-bottom:none;
  vertical-align:top;
}

.table-note tbody tr:hover{
  background:none;
}

html[dir="ltr"] .table-note th,
html[dir="ltr"] .table-note td{
  text-align:left;
}

/* Comparison section headings */

.comparison-table + h3,
.table-note + h3,
.comparative-content h3{
  font-size:1.18rem;
  line-height:1.45;
  margin-top:1rem;
  margin-bottom:0.25rem;
  letter-spacing:-0.01em;
}

html[lang="fa"] .comparative-content h3{
  line-height:1.6;
}

html[lang="en"] .comparative-content h3{
  line-height:1.4;
}

/* Slightly tighter spacing above the table after notes */

.table-note + .comparison-table{
  margin-top:0.3rem;
}

/* Constitution links and buttons */

.constitution-link{
  display:inline-block;
  margin-top:8px;
  font-weight:600;
  padding:10px 14px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  box-shadow:0 2px 8px rgba(15,23,42,0.04);
  text-decoration:none;
  color:var(--text);
  transition:all .15s ease;
}

.constitution-link:hover{
  background:var(--soft2);
  border-color:var(--primary);
  color:var(--primary);
  transform:translateY(-1px);
}

.constitution-links{
  margin-top:14px;
}

.constitution-row{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  margin:10px 0;
}

.doc-label{
  font-weight:600;
  width:95px;
  flex:0 0 95px;
  text-align:right;
  color:var(--text);
}

.doc-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.doc-btn{
  display:inline-block;
  padding:6px 12px;
  border-radius:8px;
  background:#fff;
  border:1px solid #e2e8f0;
  box-shadow:0 2px 8px rgba(15,23,42,0.04);
  font-size:0.9rem;
  text-decoration:none;
  color:#0f172a;
  transition:all .15s ease;
}

.doc-btn:hover{
  background:#eef4ff;
  border-color:var(--primary);
  color:var(--primary);
  transform:translateY(-1px);
}

/* Example links */

.example-buttons{
  margin-top:10px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.example-links.inline-examples{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  margin:12px 0 18px 0;
}

.example-links.inline-examples .example-label{
  display:inline;
  font-weight:600;
  margin-bottom:0;
  color:var(--text);
}

.example-links.inline-examples .example-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.example-btn{
  display:inline-block;
  padding:6px 12px;
  border-radius:8px;
  background:#fff;
  border:1px solid #e2e8f0;
  box-shadow:0 2px 8px rgba(15,23,42,0.04);
  text-decoration:none;
  font-size:0.9rem;
  color:#0f172a;
  transition:all .15s ease;
}

.example-btn:hover{
  background:#eef4ff;
  border-color:var(--primary);
  color:var(--primary);
  transform:translateY(-1px);
}

.example-btn.available{
  background:var(--primary);
  color:#fff;
  border-color:var(--primary);
  font-weight:600;
  box-shadow:0 8px 18px rgba(11,95,255,0.22);
}

.example-btn.available:hover{
  background:var(--primaryHover);
  border-color:var(--primaryHover);
  color:#fff;
}