/* ============================================================
   Fohama — فهماء | Modern design system (RTL, Persian)
   Brand color: #33787f (teal) — kept from original brand
   ============================================================ */

:root {
  --brand: #33787f;
  --brand-600: #2b6a71;
  --brand-700: #225357;
  --brand-800: #17393d;
  --brand-900: #10282b;
  --brand-50: #eef7f8;
  --brand-100: #dcf0f1;
  --brand-200: #b9e2e5;
  --accent: #4cd3e3;
  --accent-strong: #2bbccd;
  --gold: #eab308;

  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-soft: #edf2f4;
  --bg: #f6f9fa;
  --surface: #ffffff;

  --gradient: linear-gradient(135deg, #1e4f55 0%, #33787f 55%, #4c9aa3 100%);
  --gradient-soft: linear-gradient(135deg, #eef7f8 0%, #dceef0 100%);
  --gradient-accent: linear-gradient(135deg, #2bbccd, #4cd3e3);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 6px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .14);
  --shadow-brand: 0 10px 30px rgba(51, 120, 127, .28);

  --font: "Almarai", "Segoe UI", Tahoma, Arial, sans-serif;
  --header-h: 74px;
  --container: 1200px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--brand-600); }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.4;
  margin: 0 0 .5em;
  font-weight: 800;
}
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute;
  top: -100px;
  inset-inline-start: 12px;
  z-index: 2000;
  background: var(--brand-800);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
  font-weight: 700;
  transition: top .2s ease;
}
.skip-link:focus { top: 0; color: #fff; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.section { padding-block: 72px; }
.section-soft { background: var(--surface); }
.section-tint { background: var(--gradient-soft); }

.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-head .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .02em;
  background: var(--brand-100);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.section-head h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 12px; }
.section-head p { color: var(--muted); font-size: 17px; }
.section-head .rule {
  width: 64px; height: 4px;
  border-radius: 2px;
  background: var(--gradient-accent);
  margin: 18px auto 0;
  position: relative;
}
.section-head .rule::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: shimmer 2.4s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%);} 100% { transform: translateX(100%);} }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  padding: 14px 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, background .22s ease, color .22s ease;
  text-decoration: none;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 34px rgba(51,120,127,.4); }

.btn-accent { background: var(--gradient-accent); color: #07363d; box-shadow: 0 10px 24px rgba(43,188,205,.35); }
.btn-accent:hover { color: #07363d; transform: translateY(-2px); }

.btn-outline { background: transparent; border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-brand); }

.btn-white { background: #fff; color: var(--brand-800); box-shadow: var(--shadow); }
.btn-white:hover { color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--brand-50); color: var(--brand); }

.btn-sm { padding: 10px 18px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: box-shadow .3s ease;
}
.site-header.scrolled { box-shadow: var(--shadow); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.brand img { width: 108px; height: auto; }
.brand .brand-name { font-size: 20px; font-weight: 800; color: var(--ink); }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  position: relative;
}
.main-nav a:hover { color: var(--brand); background: var(--brand-50); }
.main-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-100); }
.main-nav a .nav-underline {
  position: absolute;
  bottom: 4px;
  inset-inline-start: 50%;
  width: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--gradient-accent);
  transition: width .25s ease, transform .25s ease;
  transform: translateX(-50%);
}
[dir="rtl"] .main-nav a .nav-underline { transform: translateX(50%); }
.main-nav a:hover .nav-underline, .main-nav a[aria-current="page"] .nav-underline { width: 60%; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--brand-50);
  color: var(--brand-800);
  transition: background .2s ease, transform .2s ease;
}
.icon-btn:hover { background: var(--brand-100); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; }

/* Mobile nav */
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: #fff;
  background-size: cover;
  background-position: center;
  isolation: isolate;
  padding-block: 110px 120px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, rgba(16,40,43,.92) 0%, rgba(34,83,87,.78) 55%, rgba(51,120,127,.55) 100%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 300px at 15% 20%, rgba(76,211,227,.28), transparent 60%),
    radial-gradient(500px 320px at 85% 80%, rgba(76,211,227,.16), transparent 60%);
}
.hero .container { position: relative; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(6px);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1;} 50% { transform: scale(1.5); opacity: .5;} }

.hero h1 {
  color: #fff;
  font-size: clamp(30px, 5.2vw, 54px);
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 18px;
  max-width: 22ch;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), #b7ecf2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead { color: rgba(255,255,255,.88); font-size: 18px; max-width: 60ch; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-wave { position: absolute; bottom: -1px; left: 0; right: 0; z-index: 1; line-height: 0; }
.hero-wave svg { width: 100%; height: 60px; }

/* Floating decorative shapes */
.hero-float { position: absolute; z-index: -1; border-radius: 50%; filter: blur(2px); opacity: .5; animation: floaty 7s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-18px);} }

/* ---------- Page banner (inner pages) ---------- */
.page-banner {
  position: relative;
  color: #fff;
  background-size: cover;
  background-position: center;
  padding-block: 72px;
  isolation: isolate;
}
.page-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, rgba(16,40,43,.92), rgba(34,83,87,.75));
}
.page-banner h1 { color: #fff; font-size: clamp(26px, 4vw, 40px); margin: 0; }
.page-banner p { color: rgba(255,255,255,.85); margin: 10px 0 0; }

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  margin-bottom: 12px;
}
.breadcrumbs a { color: rgba(255,255,255,.85); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { opacity: .6; }
.breadcrumbs [aria-current="page"] { color: var(--accent); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 26px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .3s ease, box-shadow .3s ease;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.card-media { position: relative; overflow: hidden; aspect-ratio: 16 / 10; background: var(--brand-100); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.06); }

.card-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 18px; margin-bottom: 8px; }
.card-body h3 a { color: var(--ink); }
.card-body h3 a:hover { color: var(--brand); }
.card-body p { color: var(--muted); font-size: 14.5px; flex: 1; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}
.card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.card-meta svg { width: 15px; height: 15px; color: var(--brand); }

.card-link {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  color: var(--brand);
}
.card-link svg { width: 16px; height: 16px; transition: transform .25s ease; }
.card:hover .card-link svg { transform: translateX(-4px); }
[dir="rtl"] .card:hover .card-link svg { transform: translateX(4px); }

/* Service card */
.service-card { text-align: center; align-items: center; padding-block: 12px; }
.service-icon {
  width: 76px; height: 76px;
  margin: 22px auto 6px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--gradient-soft);
  color: var(--brand);
  transition: transform .35s ease, background .35s ease, color .35s ease;
}
.service-card:hover .service-icon {
  background: var(--gradient);
  color: #fff;
  transform: rotate(-6deg) scale(1.06);
}
.service-icon svg { width: 36px; height: 36px; }

/* Team card */
.team-card .card-media { aspect-ratio: 1 / 1; }
.team-social { display: flex; gap: 8px; margin-top: 14px; }
.team-social a {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-700);
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.team-social a:hover { background: var(--brand); color: #fff; transform: translateY(-3px); }
.team-social svg { width: 16px; height: 16px; }

/* ---------- Carousel ---------- */
.carousel { position: relative; }
.carousel-viewport { overflow: hidden; }
.carousel-track {
  display: flex;
  gap: 26px;
  transition: transform .55s cubic-bezier(.25,.8,.35,1);
}
.carousel-track > * { flex: 0 0 calc((100% - 52px) / 3); min-width: 0; }

.carousel-nav { display: flex; justify-content: center; gap: 10px; margin-top: 30px; }
.carousel-arrow {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.carousel-arrow:hover { background: var(--brand); color: #fff; border-color: var(--brand); transform: translateY(-2px); }
.carousel-arrow:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.carousel-arrow svg { width: 20px; height: 20px; }

/* ---------- Ad item ---------- */
.ad-item { display: flex; gap: 18px; align-items: center; }
.ad-item .ad-thumb {
  width: 150px; height: 110px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: none;
  background: var(--brand-100);
}
.ad-item .ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-item h3 { font-size: 17px; margin-bottom: 6px; }
.ad-item p { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- Category pills ---------- */
.cat-pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  transition: all .22s ease;
}
.cat-pill:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.cat-pill.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.cat-pill .count { font-size: 12px; background: rgba(255,255,255,.25); border-radius: 999px; padding: 1px 9px; }
.cat-pill:not(.active) .count { background: var(--brand-100); color: var(--brand); }

/* ---------- Search ---------- */
.search-bar { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font);
  font-size: 15px;
  padding: 15px 22px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(51,120,127,.15); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.form-grid .span-2 { grid-column: span 2; }

.field { position: relative; }
.field input, .field textarea, .field select {
  width: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(51,120,127,.14);
}
.field label {
  display: block;
  font-weight: 800;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.field input::placeholder, .field textarea::placeholder { color: #9db1b3; }

.field .field-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  width: 20px; height: 20px;
  pointer-events: none;
}
.field .field-icon + input, .field .field-icon + select { padding-inline-start: 44px; }

input[type="file"] { padding: 12px 14px; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 38px;
}
.form-card h2 { font-size: 24px; margin-bottom: 6px; }
.form-card > p { color: var(--muted); margin-bottom: 28px; }

/* Animated submit button */
.btn-submit {
  position: relative;
  overflow: hidden;
  min-width: 180px;
}
.btn-submit .spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: inherit;
  border-radius: inherit;
}
.btn-submit.loading .spinner { display: flex; }
.btn-submit.loading .btn-text { visibility: hidden; }
.spinner-ring {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Validation messages */
.field .validation-msg, .text-danger { color: #dc2626; font-size: 13px; font-weight: 700; }
.input-invalid { border-color: #dc2626 !important; }

/* ---------- Contact info cards ---------- */
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.info-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
}
.info-item:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.info-item .info-icon {
  width: 52px; height: 52px;
  flex: none;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--gradient-soft);
  color: var(--brand);
}
.info-item .info-icon svg { width: 24px; height: 24px; }
.info-item h3 { font-size: 15.5px; margin-bottom: 4px; }
.info-item p { margin: 0; color: var(--muted); font-size: 14px; word-break: break-word; }
.info-item p a { color: var(--brand); font-weight: 700; }
.info-item p a:hover { color: var(--brand-600); text-decoration: underline; }

.map-wrap { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); line-height: 0; }
.map-wrap iframe { width: 100%; height: 420px; border: 0; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 44px; flex-wrap: wrap; }
.page-link {
  min-width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 14px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  transition: all .2s ease;
}
.page-link:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }
.page-link.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.page-link.disabled { opacity: .45; pointer-events: none; }

/* ---------- Article detail ---------- */
.article-hero .container { max-width: 860px; }
.article-hero h1 { font-size: clamp(24px, 3.6vw, 38px); margin: 12px 0 16px; }
.article-detail { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(24px, 4vw, 48px); }
.article-detail .featured-img { border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 26px; }
.article-detail .featured-img img { width: 100%; max-height: 480px; object-fit: cover; }
.article-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-block: 24px; }
.keywords { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.keyword {
  background: var(--brand-50);
  color: var(--brand-800);
  border: 1px solid var(--brand-100);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
}
.meta-table { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.meta-cell { background: var(--bg); border-radius: var(--radius-xs); padding: 14px 18px; }
.meta-cell dt { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.meta-cell dd { margin: 4px 0 0; font-weight: 800; color: var(--ink); font-size: 14.5px; word-break: break-word; }

/* ---------- Stats / counters ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-item { text-align: center; padding: 26px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line-soft); }
.stat-item .num { font-size: 38px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.stat-item .num .suffix { font-size: 22px; }
.stat-item .lbl { color: var(--muted); font-weight: 700; font-size: 14px; margin-top: 4px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state svg { width: 64px; height: 64px; color: var(--brand-200); margin: 0 auto 16px; }
.empty-state h3 { font-size: 20px; }
.empty-state p { color: var(--muted); }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  min-width: 300px;
  max-width: 380px;
  border-inline-start: 5px solid var(--brand);
  animation: toast-in .4s cubic-bezier(.25,.8,.35,1);
}
.toast.success { border-inline-start-color: #16a34a; }
.toast.warning { border-inline-start-color: #eab308; }
.toast.error { border-inline-start-color: #dc2626; }
.toast .toast-icon { width: 22px; height: 22px; flex: none; color: var(--brand); }
.toast.success .toast-icon { color: #16a34a; }
.toast.warning .toast-icon { color: #eab308; }
.toast.error .toast-icon { color: #dc2626; }
.toast p { margin: 0; font-weight: 700; font-size: 14.5px; color: var(--ink); flex: 1; }
.toast .toast-close { border: none; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; }
.toast .toast-close:hover { color: var(--ink); }
.toast.hide { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0;} to { transform: translateY(0); opacity: 1;} }
@keyframes toast-out { to { transform: translateY(16px); opacity: 0;} }

/* ---------- Back to top ---------- */
.back-top {
  position: fixed;
  bottom: 26px;
  inset-inline-start: 26px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-brand);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all .3s ease;
  z-index: 900;
}
.back-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { transform: translateY(-3px); }
.back-top svg { width: 20px; height: 20px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--brand-800);
  color: rgba(255,255,255,.75);
  margin-top: auto;
}
.footer-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.4fr;
  gap: 40px;
  padding-block: 60px 40px;
}
.footer-main h3 {
  color: #fff;
  font-size: 16.5px;
  margin-bottom: 18px;
  position: relative;
  padding-bottom: 10px;
}
.footer-main h3::after {
  content: "";
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 34px; height: 3px;
  border-radius: 2px;
  background: var(--gradient-accent);
}
.footer-main p { font-size: 14.5px; line-height: 2; }
.footer-links li { margin-bottom: 10px; }
.footer-links a {
  color: rgba(255,255,255,.75);
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color .2s ease, transform .2s ease;
}
.footer-links a::before {
  content: "‹";
  color: var(--accent);
  font-weight: 800;
}
.footer-links a:hover { color: #fff; transform: translateX(-4px); }
[dir="rtl"] .footer-links a:hover { transform: translateX(4px); }

.footer-contact li { display: flex; gap: 12px; margin-bottom: 14px; font-size: 14px; align-items: flex-start; }
.footer-contact svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: 5px; }
.footer-contact a { color: rgba(255,255,255,.8); word-break: break-word; }
.footer-contact a:hover { color: #fff; }

.footer-social { display: flex; gap: 10px; margin-top: 18px; }
.footer-social a {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.1);
  color: #fff;
  transition: background .25s ease, transform .25s ease;
}
.footer-social a:hover { background: var(--gradient-accent); color: var(--brand-900); transform: translateY(-4px); }
.footer-social svg { width: 18px; height: 18px; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-block: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
}
.footer-bottom a { color: var(--accent); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s cubic-bezier(.22,.9,.35,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: .08s; }
.reveal-delay-2 { transition-delay: .16s; }
.reveal-delay-3 { transition-delay: .24s; }
.reveal-delay-4 { transition-delay: .32s; }

/* ---------- Misc ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.gap-2 { gap: 1rem; }

.divider { height: 1px; background: var(--line-soft); border: none; margin-block: 40px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: 1fr 1fr; }
  .carousel-track > * { flex: 0 0 calc((100% - 26px) / 2); }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .main-nav {
    position: fixed;
    inset-block-start: var(--header-h);
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    background: #fff;
    border-bottom: 1px solid var(--line-soft);
    box-shadow: var(--shadow);
    padding: 18px 20px 26px;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease;
  }
  .main-nav.open { transform: translateY(0); opacity: 1; visibility: visible; }
  .main-nav a { padding: 13px 16px; font-size: 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .hero { padding-block: 80px 90px; }
}

@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr; }
  .carousel-track > * { flex: 0 0 100%; }
  .info-grid { grid-template-columns: 1fr; }
  .meta-table { grid-template-columns: 1fr; }
  .footer-main { grid-template-columns: 1fr; gap: 30px; }
  .section { padding-block: 52px; }
  .ad-item { flex-direction: column; align-items: flex-start; }
  .ad-item .ad-thumb { width: 100%; height: 170px; }
  .hero-actions .btn { width: 100%; }
  .form-card { padding: 26px 20px; }
}

/* ---------- Mobile polish ---------- */
/* Never let long words / flex items blow out the viewport on small screens */
.grid > *, .card { min-width: 0; }
.card-body p, .card-body h3 a, .meta-cell dd, .breadcrumbs { overflow-wrap: break-word; }

@media (max-width: 640px) {
  .container { padding-inline: 16px; }
  .grid { gap: 18px; }
  .page-banner { padding-block: 52px; }
  .page-banner h1 { font-size: 26px; }
  .cat-pill { padding: 8px 15px; font-size: 13px; }
  .card-body { padding: 18px; }
  .article-detail { padding: 20px 16px; }
  .article-actions { flex-direction: column; }
  .article-actions .btn { width: 100%; justify-content: center; }
  .pagination { gap: 6px; }
  .page-link { min-width: 40px; height: 40px; padding-inline: 10px; font-size: 13px; }
}

@media (max-width: 560px) {
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
