/* ESM Practical Digital Solutions — public site.
   Mobile-first. Uses logical properties (margin-inline, padding-inline, inset-inline) so the
   same rules work for Arabic (RTL) and English (LTR). */
:root {
  --navy: #003366;
  --navy-dark: #00264d;
  --navy-soft: #e8eef6;
  --yellow: #ffc209;
  --yellow-dark: #b38600;
  --yellow-soft: #fff6d6;
  --coral: #ff705e;
  --ink: #12213a;
  --muted: #55657a;
  --border: #dfe5ee;
  --bg: #f6f8fb;
  --card: #ffffff;
  --ok: #0f7a50;
  --ok-bg: #e6f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 51, 102, 0.07);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Montserrat', 'Inter', system-ui, sans-serif;
}
html[lang="ar"] {
  --font: 'Cairo', 'Noto Naskh Arabic', system-ui, 'Segoe UI', Tahoma, sans-serif;
  --font-head: 'Cairo', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65; color: var(--ink); background: var(--bg); }
html[lang="ar"] body { font-size: 17px; line-height: 1.8; }
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-underline-offset: 3px; }
a:hover { color: var(--navy-dark); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.3; color: var(--navy); margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 3.6vw, 1.6rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; color: #fff; }
.wrap { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: 16px; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
main { display: block; min-height: 60vh; }
main:focus { outline: none; }

/* ---- Header */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); }
.brand img { width: 46px; height: 32px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--font-head); font-size: .98rem; }
.brand-text small { color: var(--muted); font-size: .75rem; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; width: 44px; height: 44px; cursor: pointer; padding: 0; }
.burger, .burger::before, .burger::after { display: block; width: 20px; height: 2px; background: var(--navy); margin: 0 auto; position: relative; content: ''; }
.burger::before { position: absolute; top: -6px; }
.burger::after { position: absolute; top: 6px; }
.main-nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.main-nav a { text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.main-nav a:hover, .main-nav a.is-active { background: var(--navy-soft); color: var(--navy); }
.main-nav .lang-switch { border: 1px solid var(--border); }
html[lang="en"] .main-nav .lang-switch { font-family: 'Cairo', sans-serif; }

@media (max-width: 860px) {
  html.js .nav-toggle { display: block; }
  html.js .main-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  html.js .main-nav.is-open { display: flex; }
  .main-nav a { padding: 12px; }
}

/* ---- Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 12px; border: 2px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; text-align: center; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); color: #fff; }
.btn-accent { background: var(--yellow); color: var(--navy-dark); }
.btn-accent:hover { background: #f0b400; color: var(--navy-dark); }
.btn-outline { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-outline:hover { background: var(--navy-soft); }
.btn-whatsapp { background: #1f8a4c; color: #fff; }
.btn-whatsapp:hover { background: #17703d; color: #fff; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.form-grid { display: grid; gap: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: .85rem; color: var(--muted); margin: 2px 0 0; }
input[type=text], input[type=email], input[type=tel], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--ink);
  border: 1px solid #c5cfdc; border-radius: 10px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: 3px solid rgba(255, 194, 9, .5); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .875rem; margin: 4px 0 0; }
.hp-field { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
input[type=tel], input[type=email] { direction: ltr; }
html[dir="rtl"] input[type=tel], html[dir="rtl"] input[type=email] { text-align: right; }

.alert { margin: 16px 0 0; padding: 12px 16px; border-radius: 12px; border: 1px solid; }
.alert-success { background: var(--ok-bg); border-color: #b5e3cb; color: var(--ok); }
.alert-error { background: var(--bad-bg); border-color: #f5c2bd; color: var(--bad); }
.alert-warning, .alert-info { background: var(--warn-bg); border-color: #f1d79a; color: var(--warn); }

/* ---- Hero & sections */
.hero { background: linear-gradient(135deg, var(--navy) 0%, #0b4a86 100%); color: #fff; padding: 48px 0 56px; }
.hero h1 { color: #fff; max-width: 820px; }
.hero p { font-size: 1.08rem; max-width: 760px; color: #e3ecf7; }
.hero .btn-outline { border-color: #fff; color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,.1); }
.hero-search { display: flex; gap: 8px; margin: 22px 0 18px; max-width: 640px; }
.hero-search input { flex: 1; border: 0; }
.section { padding: 44px 0; }
.section-alt { background: #fff; border-block: 1px solid var(--border); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.page-head { padding-block: 32px 8px; }
.page-head p { color: var(--muted); max-width: 760px; }
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }

.points { display: grid; gap: 14px; }
.point { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.point h3 { margin-bottom: 4px; }
.point p { margin: 0; color: var(--muted); }
.point .num { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; background: var(--yellow); color: var(--navy-dark); font-weight: 800; align-items: center; justify-content: center; margin-bottom: 8px; }

/* ---- Cards */
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } .points { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 980px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; position: relative; }
.card h3 { margin: 0; font-size: 1.08rem; }
.card h3 a { text-decoration: none; color: var(--navy); }
.card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible::after { outline: 3px solid var(--yellow); }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .meta { margin-top: auto; padding-top: 8px; }
.cat-card { border-top: 4px solid var(--yellow); }
.cat-card .count { font-size: .85rem; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--navy-soft); color: var(--navy); text-decoration: none; }
.tag-yellow { background: var(--yellow-soft); color: #6b5000; }
.tag-coral { background: #ffe9e6; color: #a1301f; }
.price { font-weight: 800; color: var(--navy); }

/* ---- Filters */
.filters { display: grid; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 20px; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { text-decoration: none; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--ink); font-size: .9rem; }
.chip.is-active, .chip:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 28px 0 0; flex-wrap: wrap; }
.empty { text-align: center; background: #fff; border: 1px dashed #c5cfdc; border-radius: var(--radius); padding: 32px 16px; }

/* ---- Article (tutorial page) */
.article-layout { display: grid; gap: 24px; padding-bottom: 48px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .article-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } .article-aside { position: sticky; top: 84px; } }
.article { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
@media (min-width: 640px) { .article { padding: 32px; } }
.article .summary { font-size: 1.1rem; color: var(--muted); }
.article-body h2 { margin-top: 1.6em; padding-top: .4em; border-top: 1px solid var(--border); }
.article-body h3 { margin-top: 1.3em; }
.article-body ul, .article-body ol { padding-inline-start: 1.4em; }
.article-body li { margin-bottom: .4em; }
.article-body code { background: var(--navy-soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
.article-body .note { background: var(--yellow-soft); border-inline-start: 4px solid var(--yellow); padding: 12px 16px; border-radius: 8px; margin: 0 0 1em; }
.table-scroll { overflow-x: auto; margin: 0 0 1em; -webkit-overflow-scrolling: touch; }
.article-body table { border-collapse: collapse; min-width: 100%; font-size: .93rem; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 10px; text-align: start; vertical-align: top; }
.article-body th { background: var(--navy-soft); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 18px 0; padding: 0; list-style: none; }
.facts li { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.facts span { display: block; font-size: .8rem; color: var(--muted); }
.facts strong { font-size: .95rem; }
.limitations { background: var(--warn-bg); border: 1px solid #f1d79a; border-radius: 12px; padding: 16px; margin: 20px 0; }
.limitations h2 { font-size: 1.05rem; margin: 0 0 6px; border: 0; padding: 0; color: var(--warn); }
.limitations p:last-child { margin: 0; }
.toc { background: var(--bg); border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.toc ol { margin: 6px 0 0; padding-inline-start: 1.3em; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin: 16px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.aside-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.aside-card h2 { font-size: 1.05rem; }
.aside-card.highlight { border-top: 4px solid var(--yellow); }
.translation-note { font-size: .9rem; background: var(--navy-soft); padding: 8px 12px; border-radius: 8px; }

/* ---- Detail pages (workshop / course / template) */
.detail { display: grid; gap: 24px; padding-bottom: 48px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .detail { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.detail-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; }
dl.kv dt { color: var(--muted); font-size: .9rem; }
dl.kv dd { margin: 0; font-weight: 600; }
.date-badge { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; padding: 6px 8px; border-radius: 12px; background: var(--yellow-soft); color: var(--navy-dark); line-height: 1.1; }
.date-badge b { font-size: 1.4rem; }
.date-badge span { font-size: .75rem; }
.card-row { display: flex; gap: 14px; align-items: flex-start; }

/* ---- CTA band & footer */
.cta-band { background: var(--yellow); padding: 36px 0; }
.cta-band .wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.cta-band h2 { margin: 0 0 4px; color: var(--navy-dark); }
.cta-band p { margin: 0; color: var(--navy-dark); max-width: 640px; }
.site-footer { background: var(--navy-dark); color: #cfdbea; padding: 40px 0 0; font-size: .95rem; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 24px; }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1.2fr; } }
.footer-logo { background: #fff; border-radius: 10px; padding: 8px; width: 160px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid rgba(255,255,255,.15); margin-top: 28px; padding-block: 16px; font-size: .85rem; }
.footer-bottom a { color: #9fb3cc; }

.error-page { text-align: center; padding: 64px 16px; }
.error-page .code { font-size: 4rem; font-weight: 800; color: var(--yellow-dark); font-family: var(--font-head); }

@media print {
  .site-header, .site-footer, .article-aside, .cta-band { display: none; }
  body { background: #fff; }
}

/* ---- Utilities */
.mt-32 { margin-top: 32px; }
.pb-48 { padding-bottom: 48px; }
.article, .detail-box, .card { min-width: 0; }
.article { overflow-wrap: break-word; }
.grid > * { min-width: 0; }
.card .tag { position: relative; z-index: 1; }
