/* ===========================================================
   Unified Stylesheet (Arabic + English)
   Author: Elias Idris Saeed Naji
   =========================================================== */

/* ---------- Design tokens ---------- */
:root{
  --fg-strong:#0f172a;--fg-body:#1f2937;--fg-muted:#4b5563;--fg-faint:#5a6a7d;--accent-text:#0e7490;--field-bg:#ffffff;--field-border:#64748b;--on-dark-body:#cbd5e1;--on-dark-muted:#a5b4c8;--on-dark-link:#7dd3fc;

  /* Slate palette */
  --slate-50:#f8fafc;
  --slate-100:#f1f5f9;
  --slate-200:#e2e8f0;
  --slate-300:#cbd5e1;
  --slate-400:#94a3b8;
  --slate-500:#64748b;
  --slate-600:#334155;   /* upgraded for AAA contrast against white */
  --slate-700:#1e293b;
  --slate-800:#0f172a;
  --slate-900:#020617;
  --white:#ffffff;
  --black:#000;
  --card:var(--white);
  --line:var(--slate-200);
  --danger:#b91c1c;
  --dark-bg:#0b1120;
  --dark-surface:#111a2e;
  --focus:#0e7490;
  --header-h:4.6rem;
  --accent:#22d3ee;
  --accent-ink:#04121a;
  --ok:#047857;
  --warn:#c2410c;
  --ring:#0f172a33;
  --radius-md:.5rem;
  --radius-lg:.75rem;
  --radius-xl:1rem;
  --shadow-sm:0 1px 2px rgba(15,23,42,.06);
  --shadow-md:0 4px 16px rgba(15,23,42,.08);
  --shadow-lg:0 12px 32px rgba(15,23,42,.12);
  --container:1120px;
  --transition:.25s cubic-bezier(.4,0,.2,1);
  --font-ui:'Cairo','Cairo Fallback',ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --font-ui-en:'Inter','Inter Fallback','Cairo','Cairo Fallback',ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
}

/* ---------- Reset ---------- */
*,*::before,*::after{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%;scroll-padding-top:calc(var(--header-h) + 1rem);-webkit-tap-highlight-color:rgba(14,116,144,.18)}
body{margin:0;font-family:var(--font-ui);color:var(--slate-800);background:var(--white);line-height:1.7;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow-x:hidden;width:100%;max-width:100vw;font-size:16px}
img,svg,video,canvas{max-width:100%;display:block}
a{color:inherit;text-decoration:none;transition:color var(--transition)}
ul,ol{margin:0;padding:0;list-style:none}
h1,h2,h3,h4,h5,p{margin:0}
button{font-family:inherit;cursor:pointer;background:none;border:0;color:inherit}
input,textarea,select{font-family:inherit;font-size:inherit;color:inherit}
hr{border:0;border-top:1px solid var(--slate-200);margin:2rem 0}

/* ---------- Layout primitives ---------- */
.container{width:100%;max-width:var(--container);margin-inline:auto;padding-inline:1.5rem}
.skip-link{position:absolute;inset-inline-start:1rem;top:1rem;transform:translateY(-250%);background:var(--slate-800);color:var(--white);padding:.6rem 1rem;border-radius:var(--radius-md);z-index:999;transition:transform .2s;font-weight:700}
.skip-link:focus{transform:none;outline:3px solid var(--focus);outline-offset:2px}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* ---------- Focus visible (accessibility) ---------- */
:where(a,button,input,textarea,select,[tabindex]):focus-visible{
  outline:3px solid var(--focus);
  outline-offset:2px;
  border-radius:var(--radius-md);
}

/* ---------- Header ---------- */
.site-header{position:sticky;top:0;z-index:100;background:rgba(255,255,255,.85);backdrop-filter:saturate(180%) blur(10px);-webkit-backdrop-filter:saturate(180%) blur(10px);border-bottom:1px solid var(--slate-200)}
.header-inner{display:flex;align-items:center;justify-content:space-between;padding-block:.9rem;gap:1rem}
.brand{font-weight:700;font-size:1.125rem;color:var(--slate-800);white-space:nowrap;flex-shrink:0}
.brand:hover{color:var(--slate-900)}
.main-nav{display:flex;align-items:center;gap:2rem;flex-grow:1;justify-content:flex-end;min-width:0}
.nav-links{display:flex;gap:1.4rem;align-items:center;flex-wrap:wrap}
.nav-links a{font-size:.875rem;color:var(--slate-600);font-weight:600;transition:color var(--transition);white-space:nowrap}
.nav-links a:hover{color:var(--slate-900);text-decoration:underline;text-underline-offset:4px}
.nav-links a.is-active{color:var(--slate-900);font-weight:800}
.nav-toggle{display:none;width:42px;height:42px;border-radius:var(--radius-md);border:1px solid var(--slate-300);background:var(--white);align-items:center;justify-content:center;flex-shrink:0;color:var(--slate-700)}
.nav-toggle:hover{border-color:var(--slate-500)}
.nav-toggle svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round}
@media(max-width:1279px){
  .nav-toggle{display:flex}
  .nav-links{display:none;position:absolute;top:100%;inset-inline:0;flex-direction:column;background:var(--white);border-bottom:1px solid var(--slate-200);padding:1.25rem 1.5rem;gap:1rem;box-shadow:var(--shadow-md)}
  .nav-links.open{display:flex}
}
.lang-switch{font-weight:700}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding:.8rem 1.5rem;border-radius:var(--radius-md);font-weight:700;font-size:1rem;border:1px solid transparent;transition:transform var(--transition),box-shadow var(--transition),background var(--transition),color var(--transition),border-color var(--transition);white-space:nowrap;cursor:pointer}
.btn:active{transform:translateY(1px)}
.btn-primary{background:var(--slate-800);color:var(--white)}
.btn-primary:hover{background:var(--slate-700);box-shadow:var(--shadow-md)}
.btn-outline{background:var(--white);color:var(--slate-800);border-color:var(--slate-300)}
.btn-outline:hover{background:var(--slate-100);border-color:var(--slate-400)}
.btn-block{width:100%}
.btn-sm{padding:.5rem 1rem;font-size:.875rem}

/* ---------- Hero ---------- */
.hero{padding-block:4.5rem 3.5rem;background:linear-gradient(180deg,var(--white) 0%,var(--slate-50) 100%);text-align:center}
.hero-avatar{width:150px;height:150px;border-radius:50%;margin-inline:auto;margin-bottom:1.5rem;border:4px solid var(--white);box-shadow:var(--shadow-lg);object-fit:cover;background:var(--slate-200)}
.badge{display:inline-block;padding:.4rem 1rem;border-radius:999px;background:var(--slate-100);border:1px solid var(--slate-200);font-size:.8125rem;color:var(--slate-600);margin-bottom:1.25rem;font-weight:700}
.hero h1{font-size:clamp(2rem,5vw,3rem);font-weight:800;color:var(--slate-900);letter-spacing:-.02em;margin-bottom:.85rem}
.hero .role{font-size:clamp(1rem,2.4vw,1.25rem);color:var(--slate-600);font-weight:600;max-width:760px;margin-inline:auto;margin-bottom:1.25rem}
.hero blockquote{max-width:640px;margin:0 auto 2rem;color:var(--slate-600);font-size:1rem;line-height:1.9;border-inline-start:3px solid var(--slate-300);padding-inline-start:1rem;font-style:italic}
.hero-stats{display:flex;flex-wrap:wrap;justify-content:center;gap:2.5rem;margin:2.25rem 0 2rem}
.stat{text-align:center}
.stat .num{font-size:1.875rem;font-weight:800;color:var(--slate-900)}
.stat .label{font-size:.8125rem;color:var(--fg-muted);margin-top:.2rem}
.hero-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:.85rem}
.hero-meta{font-size:.875rem;color:var(--fg-muted);margin-bottom:1.5rem}
.hero-availability{display:inline-flex;align-items:center;gap:.4rem;font-size:.8125rem;font-weight:700;color:var(--ok);background:#ecfdf5;border:1px solid #a7f3d0;padding:.3rem .8rem;border-radius:999px;margin-bottom:1rem}
.hero-availability::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--ok);box-shadow:0 0 0 0 rgba(4,120,87,.5);animation:pulse 2s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(4,120,87,.5)}70%{box-shadow:0 0 0 10px rgba(4,120,87,0)}100%{box-shadow:0 0 0 0 rgba(4,120,87,0)}}

/* ---------- Sections ---------- */
section{padding-block:5rem}
.section-alt{background:var(--slate-50)}
.section-head{text-align:center;margin-bottom:3rem}
.section-eyebrow{display:inline-block;font-size:.8125rem;font-weight:800;color:var(--fg-muted);text-transform:uppercase;letter-spacing:.08em;margin-bottom:.6rem}
.section-head h2{font-size:clamp(1.5rem,3vw,2rem);font-weight:800;color:var(--slate-900)}
.section-head p{color:var(--fg-muted);max-width:620px;margin:.85rem auto 0}
.section-divider{width:64px;height:4px;background:var(--slate-800);border-radius:99px;margin:1rem auto 0}

/* ---------- About ---------- */
.about-grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:3.5rem;align-items:start}
.about-card{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-xl);padding:2rem;box-shadow:var(--shadow-sm)}
.about-card p{color:var(--slate-600);margin-bottom:1rem}
.about-card p:last-child{margin-bottom:0}
.about-card strong{color:var(--slate-900)}
.about-card a{color:var(--slate-900);font-weight:700;text-decoration:underline;text-underline-offset:3px}
.about-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.fact{background:var(--slate-50);border:1px solid var(--slate-200);border-radius:var(--radius-md);padding:.9rem 1rem}
.fact .k{font-size:.8125rem;color:var(--fg-muted);margin-bottom:.25rem}
.fact .v{font-size:1rem;font-weight:700;color:var(--slate-900);overflow-wrap:break-word}
@media(max-width:880px){.about-grid{grid-template-columns:minmax(0,1fr);gap:2rem}}

/* ---------- Achievements ---------- */
.achievements-section{padding-block:3.5rem;background:var(--slate-900);color:var(--white)}
.achievements-section .section-head h2{color:var(--white)}
.achievements-section .section-head p{color:var(--on-dark-body)}
.achievements-section .section-divider{background:var(--white)}
.achievements-section .section-eyebrow{color:var(--on-dark-muted)}
.ach-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr));gap:1rem;text-align:center}
.ach-card{background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);border-radius:1rem;padding:1.4rem 1rem;transition:transform var(--transition),background var(--transition)}
.ach-card:hover{background:rgba(255,255,255,.09);transform:translateY(-3px)}
.ach-card .num{font-size:1.875rem;font-weight:800;color:var(--white)}
.ach-card .label{font-size:.875rem;color:var(--on-dark-muted)}

/* ---------- Education ---------- */
.edu-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.5rem}
@media(max-width:820px){.edu-grid{grid-template-columns:minmax(0,1fr)}}
.edu-card{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-xl);padding:1.75rem;box-shadow:var(--shadow-sm);transition:box-shadow var(--transition),transform var(--transition)}
.edu-card:hover{box-shadow:var(--shadow-md);transform:translateY(-3px)}
.edu-head{display:flex;align-items:flex-start;gap:1rem;margin-bottom:1rem}
.edu-icon{width:44px;height:44px;border-radius:var(--radius-md);background:var(--slate-800);color:var(--white);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.edu-icon svg{width:22px;height:22px;stroke:var(--white);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.edu-card h3{font-size:1rem;font-weight:800;color:var(--slate-900);line-height:1.5}
.edu-card .inst{font-size:.875rem;font-weight:700;color:var(--slate-700)}
.edu-card .yr{display:inline-block;font-size:.8125rem;font-weight:800;color:var(--white);background:var(--slate-800);padding:.2rem .65rem;border-radius:999px;margin-top:.3rem}
.edu-card ul li{font-size:1rem;color:var(--slate-600);padding-inline-start:1.1rem;position:relative;margin-bottom:.45rem}
.edu-card ul li::before{content:'';position:absolute;inset-inline-start:0;top:.6em;width:5px;height:5px;border-radius:50%;background:var(--slate-400)}
.edu-card ul li:last-child{margin-bottom:0}
.courses-wrap{margin-top:2.5rem;text-align:center}
.courses-wrap h3{font-size:1.125rem;font-weight:800;color:var(--slate-900);margin-bottom:.35rem}
.courses-wrap>p{color:var(--fg-muted);font-size:1rem;margin-bottom:1.4rem}
.course-tags{display:flex;flex-wrap:wrap;justify-content:center;gap:.6rem}
.course-tags .tag{font-size:.875rem;padding:.45rem 1rem;background:var(--white);border:1px solid var(--slate-200);border-radius:999px;color:var(--slate-700);font-weight:700;transition:background-color var(--transition),border-color var(--transition),color var(--transition)}
.course-tags .tag:hover{border-color:var(--slate-400);box-shadow:var(--shadow-sm)}

/* ---------- Timeline ---------- */
.timeline{position:relative;padding-inline-start:2rem;max-width:820px;margin-inline:auto}
.timeline::before{content:'';position:absolute;inset-inline-start:6px;top:6px;bottom:6px;width:2px;background:var(--slate-200)}
.timeline-item{position:relative;padding-bottom:2.2rem}
.timeline-item:last-child{padding-bottom:0}
.timeline-item::before{content:'';position:absolute;inset-inline-start:-2rem;top:.45rem;width:14px;height:14px;border-radius:50%;background:var(--white);border:3px solid var(--slate-800)}
.timeline-year{display:inline-block;font-size:.8125rem;font-weight:800;color:var(--white);background:var(--slate-800);padding:.2rem .65rem;border-radius:999px;margin-bottom:.5rem}
.timeline-item h4{font-size:1.125rem;font-weight:800;color:var(--slate-900);margin-bottom:.35rem}
.timeline-item .role-line{font-size:.875rem;color:var(--fg-muted);font-weight:600;margin-bottom:.4rem}
.timeline-item p{color:var(--slate-600);font-size:1rem;margin-bottom:.4rem}
.timeline-item ul{margin-top:.5rem}
.timeline-item ul li{color:var(--slate-600);font-size:1rem;padding-inline-start:1.1rem;position:relative;margin-bottom:.4rem}
.timeline-item ul li::before{content:'';position:absolute;inset-inline-start:0;top:.6em;width:5px;height:5px;border-radius:50%;background:var(--slate-400)}
.timeline-item .sub-heading{font-weight:700;font-size:1rem;color:var(--slate-800);margin:.75rem 0 .35rem}

/* ---------- Skills ---------- */
.skills-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.5rem}
@media(max-width:1000px){.skills-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.skills-grid{grid-template-columns:1fr}}
.skill-card.skill-card-wide{grid-column:1 / -1}
.skill-card{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-xl);padding:1.75rem;transition:box-shadow var(--transition),transform var(--transition)}
.skill-card:hover{box-shadow:var(--shadow-md);transform:translateY(-3px)}
.skill-card .icon{width:44px;height:44px;border-radius:var(--radius-md);background:var(--slate-800);color:var(--white);display:flex;align-items:center;justify-content:center;margin-bottom:1rem}
.skill-card .icon svg{width:22px;height:22px;stroke:var(--white);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.skill-card h3{font-size:1.125rem;font-weight:800;margin-bottom:.75rem;color:var(--slate-900)}
.skill-tags{display:flex;flex-wrap:wrap;gap:.5rem}
.skill-tags .tag{font-size:.8125rem;padding:.35rem .75rem;color:var(--slate-600);background:var(--slate-50);border:1px solid var(--slate-200);border-radius:.4rem;font-weight:700}
.skill-subgroup{margin-bottom:1.1rem}
.skill-subgroup:last-child{margin-bottom:0}
.skill-subgroup .sub-label{font-size:.8125rem;font-weight:800;color:var(--fg-muted);margin-bottom:.6rem;text-transform:uppercase;letter-spacing:.04em}
.skill-card ul li{font-size:1rem;color:var(--slate-600);padding-inline-start:1.1rem;position:relative;margin-bottom:.5rem}
.skill-card ul li::before{content:'';position:absolute;inset-inline-start:0;top:.6em;width:5px;height:5px;border-radius:50%;background:var(--slate-400)}
.skill-card ul li:last-child{margin-bottom:0}
.methodologies{margin-top:2.5rem;text-align:center}
.methodologies h3{font-size:1.125rem;font-weight:800;color:var(--slate-900);margin-bottom:.35rem}
.methodologies p{color:var(--fg-muted);font-size:1rem;margin-bottom:1.4rem}

/* ---------- Projects ---------- */
.filter-bar{display:flex;flex-wrap:wrap;justify-content:center;gap:.6rem;margin-bottom:2.5rem}
.filter-btn{padding:.55rem 1.1rem;border-radius:999px;border:1px solid var(--slate-300);background:var(--white);font-size:.875rem;font-weight:700;color:var(--slate-600);transition:background-color var(--transition),border-color var(--transition),color var(--transition)}
.filter-btn:hover{border-color:var(--slate-500);color:var(--slate-900)}
.filter-btn.active{background:var(--slate-800);border-color:var(--slate-800);color:var(--white)}
.projects-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.5rem}
@media(max-width:1000px){.projects-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.projects-grid{grid-template-columns:1fr}}
.project-card{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-xl);padding:1.6rem;display:flex;flex-direction:column;gap:.85rem;transition:box-shadow var(--transition),transform var(--transition)}
.project-card:hover{box-shadow:var(--shadow-md);transform:translateY(-3px)}
.project-card.hidden{display:none}
.project-top{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem}
.project-top h3{font-size:1rem;font-weight:800;color:var(--slate-900);line-height:1.5}
.chip{flex-shrink:0;font-size:.8125rem;font-weight:800;color:var(--slate-600);background:var(--slate-100);border:1px solid var(--slate-200);border-radius:999px;padding:.25rem .65rem;white-space:nowrap}
.chip-live{background:#ecfdf5;color:var(--ok);border-color:#a7f3d0}
.chip-soon{background:#fff7ed;color:var(--warn);border-color:#fed7aa}
.chip-oss{background:#eff6ff;color:#1d4ed8;border-color:#bfdbfe}
.chip-private{background:#fef2f2;color:var(--danger);border-color:#fecaca}
.chip-internal{background:#f5f3ff;color:#6d28d9;border-color:#ddd6fe}
.project-card .p-year{font-size:.8125rem;color:var(--fg-faint);font-weight:600;margin-top:-.5rem}
.project-card p{color:var(--slate-600);font-size:1rem;flex-grow:1}
.project-tags{display:flex;flex-wrap:wrap;gap:.4rem}
.project-tags .tag{font-size:.8125rem;color:var(--fg-muted);background:var(--slate-50);border:1px solid var(--slate-200);padding:.2rem .55rem;border-radius:.4rem}
.project-link{display:inline-flex;align-items:center;gap:.4rem;font-size:.875rem;font-weight:700;color:var(--slate-900);margin-top:.4rem;text-underline-offset:3px}
.project-link:hover{text-decoration:underline}
.project-link.disabled{color:var(--fg-faint);pointer-events:none;cursor:default}
.project-link svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.disclaimer{font-size:.8125rem;color:var(--warn);background:#fff7ed;border:1px solid #fed7aa;border-radius:.4rem;padding:.3rem .55rem;margin-top:.2rem;display:block;font-weight:600}

/* ---------- Services ---------- */
.services-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1.5rem}
@media(max-width:1000px){.services-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.services-grid{grid-template-columns:1fr}}
.service-card{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-xl);padding:1.75rem;transition:box-shadow var(--transition),transform var(--transition)}
.service-card:hover{box-shadow:var(--shadow-md);transform:translateY(-3px)}
.service-card .icon{width:44px;height:44px;border-radius:var(--radius-md);background:var(--slate-800);color:var(--white);display:flex;align-items:center;justify-content:center;margin-bottom:1rem}
.service-card .icon svg{width:22px;height:22px;stroke:var(--white);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.service-card h3{font-size:1rem;font-weight:800;color:var(--slate-900);margin-bottom:.75rem}
.service-card ul li{font-size:1rem;color:var(--slate-600);padding-inline-start:1.1rem;position:relative;margin-bottom:.45rem}
.service-card ul li::before{content:'';position:absolute;inset-inline-start:0;top:.6em;width:5px;height:5px;border-radius:50%;background:var(--slate-400)}

/* ---------- Contact ---------- */
.contact-section{background:var(--slate-900);color:var(--white)}
.contact-section .section-head h2{color:var(--white)}
.contact-section .section-eyebrow{color:var(--on-dark-muted)}
.contact-section .section-head p{color:var(--on-dark-body)}
.contact-section .section-divider{background:var(--white)}
.contact-grid{display:grid;grid-template-columns:1fr 1fr;gap:3rem;align-items:start}
@media(max-width:880px){.contact-grid{grid-template-columns:1fr;gap:2rem}}
.contact-info-list{display:flex;flex-direction:column;gap:.9rem}
.contact-info-item{display:flex;align-items:center;gap:.85rem;padding:1rem 1.15rem;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);border-radius:var(--radius-md);transition:background var(--transition)}
.contact-info-item:hover{background:rgba(255,255,255,.09)}
.contact-info-item .ic{width:38px;height:38px;border-radius:var(--radius-md);background:rgba(255,255,255,.1);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.contact-info-item .ic svg{width:18px;height:18px;stroke:var(--white);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.contact-info-item .txt{min-width:0;overflow:hidden}
.contact-info-item .txt .k{font-size:.8125rem;color:var(--on-dark-muted);display:block}
.contact-info-item .txt .v{font-size:1rem;font-weight:700;overflow-wrap:break-word;word-break:break-word;color:var(--white)}
.contact-form{background:var(--white);color:var(--slate-800);border-radius:var(--radius-xl);padding:2rem}
.form-row{margin-bottom:1.1rem}
.form-row label{display:block;font-size:.875rem;font-weight:800;margin-bottom:.4rem;color:var(--slate-700)}
.form-row .hint{font-size:.8125rem;color:var(--fg-muted);font-weight:500;margin-top:.25rem}
.form-row input,.form-row textarea{width:100%;padding:.75rem .9rem;border:1px solid var(--field-border);border-radius:var(--radius-md);font-size:1rem;transition:border-color var(--transition),box-shadow var(--transition);background:var(--slate-50)}
.form-row input:focus,.form-row textarea:focus{outline:none;border-color:var(--slate-800);box-shadow:0 0 0 3px var(--ring);background:var(--white)}
.form-row textarea{resize:vertical;min-height:110px}
.form-note{font-size:.8125rem;color:var(--fg-muted);margin-top:.75rem;text-align:center;line-height:1.7}
.form-note a{color:var(--slate-700);text-decoration:underline;font-weight:700}
.form-2col{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
@media(max-width:600px){.form-2col{grid-template-columns:1fr}}
.form-status{font-size:.875rem;padding:.8rem;border-radius:var(--radius-md);margin-top:.8rem;text-align:center;font-weight:700;display:none}
.form-status.ok{background:#ecfdf5;color:var(--ok);border:1px solid #a7f3d0;display:block}
.form-status.err{background:#fef2f2;color:var(--danger);border:1px solid #fecaca;display:block}
.form-privacy{font-size:.8125rem;color:var(--fg-muted);padding:.6rem;background:var(--slate-50);border-radius:var(--radius-md);margin-bottom:1rem}

/* ---------- Footer ---------- */
.site-footer{background:var(--slate-900);color:var(--on-dark-body);padding-block:2rem;text-align:center;font-size:.875rem}
.site-footer b{color:var(--white)}
.site-footer a{color:var(--on-dark-link);text-decoration:underline;text-underline-offset:3px;margin-inline:.35rem;font-weight:600}
.site-footer a:hover{color:var(--white)}
.site-footer .footer-links{margin:.4rem 0 .6rem;display:flex;flex-wrap:wrap;justify-content:center;gap:.25rem}
.site-footer .footer-meta{font-size:.8125rem;color:var(--on-dark-muted);margin-top:.5rem}

/* ---------- Back to top ---------- */
.back-to-top{position:fixed;inset-inline-end:1.25rem;bottom:1.25rem;width:44px;height:44px;border-radius:999px;background:var(--slate-800);color:var(--white);display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow-lg);opacity:0;pointer-events:none;transform:translateY(10px);transition:opacity var(--transition),transform var(--transition),background var(--transition);z-index:90}
html[dir="ltr"] .back-to-top{inset-inline-end:auto;inset-inline-start:1.25rem}
.back-to-top.show{opacity:1;pointer-events:auto;transform:none}
.back-to-top:hover{background:var(--slate-700)}
.back-to-top svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- Toast ---------- */
.toast{position:fixed;bottom:24px;inset-inline:24px;max-width:420px;margin-inline:auto;padding:14px 22px;border-radius:12px;font-weight:700;z-index:200;box-shadow:0 12px 32px rgba(15,23,42,.25);text-align:center;animation:toast-in .4s ease-out}
.toast-ok{background:var(--ok);color:var(--white)}
.toast-err{background:var(--danger);color:var(--white)}
@keyframes toast-in{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:none}}

/* ---------- Cookie/privacy consent banner ---------- */
.consent-banner{position:fixed;left:0;right:0;bottom:0;background:var(--slate-900);color:var(--white);padding:1rem 1.25rem;z-index:190;display:none;box-shadow:0 -8px 24px rgba(15,23,42,.25);font-size:1rem}
.consent-banner.show{display:block}
.consent-inner{max-width:var(--container);margin-inline:auto;display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap}
.consent-banner p{margin:0;color:var(--on-dark-body);flex:1;min-width:260px}
.consent-banner a{color:var(--on-dark-link);text-decoration:underline}
.consent-banner button{background:var(--white);color:var(--slate-900);padding:.6rem 1.2rem;border-radius:var(--radius-md);font-weight:700;white-space:nowrap}
.consent-banner button:hover{background:var(--slate-100)}

/* ---------- Update available PWA ---------- */
.update-banner{position:fixed;left:0;right:0;top:0;background:var(--accent);color:var(--accent-ink);padding:.7rem 1rem;z-index:300;font-size:.875rem;font-weight:700;text-align:center;display:none}
.update-banner.show{display:block}
.update-banner button{margin-inline-start:.8rem;background:var(--accent-ink);color:var(--accent-text);padding:.3rem .8rem;border-radius:var(--radius-md)}

/* ---------- Reveal on scroll ---------- */
.reveal{opacity:0;transform:translateY(20px);transition:opacity .6s ease,transform .6s ease}
.reveal.on{opacity:1;transform:none}

/* ---------- Top nav (sub-pages) ---------- */
nav.top{background:var(--white);border-bottom:1px solid var(--slate-200);padding:.8rem 0}
nav.top .container{display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap}
nav.top a{color:var(--slate-600);font-weight:700;font-size:1rem}
nav.top a:hover{color:var(--slate-900)}
nav.top .top-links{display:flex;gap:1rem;flex-wrap:wrap}

/* ---------- Reveal animations ---------- */
@media(prefers-reduced-motion:reduce){
  .reveal{opacity:1;transform:none;transition:none}
  .hero-availability::before{animation:none}
  html{scroll-behavior:auto}
  *{animation:none!important;transition:none!important}
}

/* ---------- Print ---------- */
@media print{
  :root{--white:var(--white);--slate-900:var(--black);--slate-800:var(--black)}
  body{background:var(--white);font-size:.8125rem;color:var(--black)}
  .site-header,.filter-bar,.contact-form,.hero-actions,.site-footer,.back-to-top,.consent-banner,.update-banner,.toolbar,nav.top{display:none!important}
  .reveal{opacity:1!important;transform:none!important;transition:none!important}
  section{padding-block:1.2rem;page-break-inside:avoid}
  .projects-grid,.skills-grid,.edu-grid,.services-grid,.about-grid,.contact-grid,.ach-grid{grid-template-columns:1fr 1fr!important;gap:.8rem}
  .contact-section{background:var(--white);color:var(--black)}
  a{color:var(--black);text-decoration:none}
  a[href^="http"]::after{content:" (" attr(href) ")";font-size:.8125rem;color:#444;font-weight:400}
  .btn,.chip{border:1px solid var(--black);color:var(--black);background:var(--white)!important}
}

/* ---------- High contrast mode ---------- */
@media(prefers-contrast:more){
  :root{--slate-200:var(--black);--slate-300:var(--black);--slate-400:var(--black);--slate-500:var(--black);--slate-600:var(--black);--slate-700:var(--black);--slate-800:var(--black)}
  .btn-outline,.project-card,.service-card,.skill-card,.edu-card,.about-card,.fact,.course-tags .tag{border-width:2px}
}

/* ==============================================
   Dark theme (cyber)
   ============================================== */
html[data-theme="dark"]{color-scheme:dark;
  --fg-strong:var(--slate-50);--fg-body:#e6ecf4;--fg-muted:#c6d1e0;--fg-faint:#a5b4c8;--accent-text:#67e8f9;--field-bg:var(--dark-surface);--field-border:#7c8ba1;--card:var(--slate-800);--line:var(--slate-600);--focus:var(--accent);
}
html[data-theme="dark"] body{background:var(--dark-bg);color:var(--slate-200)}
html[data-theme="dark"] .site-header{background:rgba(11,17,32,.88);border-bottom-color:var(--slate-700)}
html[data-theme="dark"] .brand,
html[data-theme="dark"] .nav-links a.is-active{color:var(--slate-200)}
html[data-theme="dark"] .nav-links a{color:var(--slate-300)}
html[data-theme="dark"] .nav-links a:hover{color:var(--accent)}
html[data-theme="dark"] .nav-toggle,
html[data-theme="dark"] .btn-outline{background:var(--slate-800);color:var(--slate-200);border-color:var(--slate-600)}
html[data-theme="dark"] .btn-outline:hover{background:var(--slate-700);border-color:var(--accent);color:var(--accent)}
html[data-theme="dark"] .btn-primary{background:var(--accent);color:var(--accent-ink)}
html[data-theme="dark"] .btn-primary:hover{background:#3ee0f8}
html[data-theme="dark"] .hero{background:linear-gradient(180deg,var(--dark-bg) 0%,var(--slate-800) 100%)}
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .section-head h2,
html[data-theme="dark"] .stat .num,
html[data-theme="dark"] .ach-card .num,
html[data-theme="dark"] .about-card strong,
html[data-theme="dark"] .edu-card h3,
html[data-theme="dark"] .skill-card h3,
html[data-theme="dark"] .project-top h3,
html[data-theme="dark"] .service-card h3,
html[data-theme="dark"] .timeline-item h4,
html[data-theme="dark"] .fact .v,
html[data-theme="dark"] .project-link{color:var(--slate-100)}
html[data-theme="dark"] .project-link{color:var(--accent)}
html[data-theme="dark"] .hero .role{color:var(--slate-300)}
html[data-theme="dark"] .hero blockquote{color:var(--slate-300);border-color:var(--slate-600)}
html[data-theme="dark"] .badge{background:var(--slate-800);border-color:var(--slate-600);color:var(--accent)}
html[data-theme="dark"] .section-alt{background:var(--slate-800)}
html[data-theme="dark"] .section-divider{background:var(--accent)}
html[data-theme="dark"] .about-card,
html[data-theme="dark"] .edu-card,
html[data-theme="dark"] .skill-card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .fact,
html[data-theme="dark"] .course-tags .tag{background:var(--dark-surface);border-color:var(--slate-700)}
html[data-theme="dark"] .about-card p,
html[data-theme="dark"] .edu-card ul li,
html[data-theme="dark"] .skill-card ul li,
html[data-theme="dark"] .project-card p,
html[data-theme="dark"] .service-card ul li,
html[data-theme="dark"] .timeline-item p,
html[data-theme="dark"] .timeline-item ul li,
html[data-theme="dark"] .hero-meta{color:var(--slate-300)}
html[data-theme="dark"] .stat .label,
html[data-theme="dark"] .section-head p,
html[data-theme="dark"] .section-eyebrow{color:var(--slate-400)}
html[data-theme="dark"] .edu-icon,
html[data-theme="dark"] .skill-card .icon,
html[data-theme="dark"] .service-card .icon{background:var(--accent)}
html[data-theme="dark"] .edu-icon svg,
html[data-theme="dark"] .skill-card .icon svg,
html[data-theme="dark"] .service-card .icon svg{stroke:var(--accent-ink)}
html[data-theme="dark"] .edu-card .yr,
html[data-theme="dark"] .timeline-year{background:var(--accent);color:var(--accent-ink)}
html[data-theme="dark"] .timeline::before{background:var(--slate-700)}
html[data-theme="dark"] .timeline-item::before{background:var(--dark-bg);border-color:var(--accent)}
html[data-theme="dark"] .skill-tags .tag,
html[data-theme="dark"] .project-tags .tag,
html[data-theme="dark"] .chip{background:var(--slate-800);border-color:var(--slate-600);color:var(--slate-300)}
html[data-theme="dark"] .chip-live{background:#022c22;color:#6ee7b7;border-color:#065f46}
html[data-theme="dark"] .chip-soon{background:#431407;color:#fdba74;border-color:#7c2d12}
html[data-theme="dark"] .chip-oss{background:#172554;color:#93c5fd;border-color:#1e40af}
html[data-theme="dark"] .chip-private{background:#450a0a;color:#fca5a5;border-color:#7f1d1d}
html[data-theme="dark"] .chip-internal{background:#2e1065;color:#ddd6fe;border-color:#5b21b6}
html[data-theme="dark"] .filter-btn{background:var(--slate-800);border-color:var(--slate-600);color:var(--slate-300)}
html[data-theme="dark"] .filter-btn:hover{border-color:var(--accent);color:var(--accent)}
html[data-theme="dark"] .filter-btn.active{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
html[data-theme="dark"] .course-tags .tag{background:var(--slate-800);border-color:var(--slate-700);color:var(--slate-300)}
html[data-theme="dark"] .site-footer{background:var(--slate-900)}
html[data-theme="dark"] nav.top{background:var(--dark-bg);border-bottom-color:var(--slate-700)}
html[data-theme="dark"] nav.top a{color:var(--slate-300)}
html[data-theme="dark"] nav.top a:hover{color:var(--accent)}
html[data-theme="dark"] .form-row input,
html[data-theme="dark"] .form-row textarea{background:var(--slate-800);border-color:var(--slate-600);color:var(--slate-200)}
html[data-theme="dark"] .form-row input:focus,
html[data-theme="dark"] .form-row textarea:focus{background:var(--dark-surface);border-color:var(--accent);box-shadow:0 0 0 3px rgba(34,211,238,.2)}
html[data-theme="dark"] .form-note{color:var(--slate-400)}
html[data-theme="dark"] .form-privacy{background:var(--slate-800);color:var(--slate-300)}
html[data-theme="dark"] .contact-info-item{background:rgba(255,255,255,.04)}
html[data-theme="dark"] .back-to-top{background:var(--accent);color:var(--accent-ink)}
html[data-theme="dark"] .back-to-top:hover{background:#3ee0f8}
html[data-theme="dark"] a{text-decoration-thickness:1px}
html[data-theme="dark"] .disclaimer{background:#431407;color:#fdba74;border-color:#7c2d12}
html[data-theme="dark"] .hero-availability{background:rgba(4,120,87,.2);color:#6ee7b7;border-color:#065f46}

/* ==============================================
   Sub-page (articles, case studies, legal, 404)
   ============================================== */
.subpage header{background:var(--slate-900);color:var(--white);padding:3rem 0 2.5rem;text-align:center}
.subpage header .eyebrow{font-size:.8125rem;font-weight:800;color:var(--on-dark-muted);letter-spacing:.08em;text-transform:uppercase}
.subpage header h1{font-size:clamp(1.5rem,4vw,2.2rem);font-weight:800;margin:.5rem 0;line-height:1.3}
.subpage header p{color:var(--on-dark-body);max-width:680px;margin-inline:auto;font-size:1rem}
.subpage main{padding:3rem 0 4rem}
.subpage h2{font-size:1.25rem;font-weight:800;margin:2.2rem 0 .8rem;padding-bottom:.4rem;border-bottom:2px solid var(--slate-800);color:var(--slate-900)}
html[data-theme="dark"] .subpage h2,html.subpage[data-theme="dark"] h2{border-bottom-color:var(--accent);color:var(--slate-100)}
.subpage p{color:var(--slate-600);margin-bottom:.9rem}
html[data-theme="dark"] .subpage p,html.subpage[data-theme="dark"] p{color:var(--slate-300)}
.subpage ul,.subpage ol{margin:0 0 1rem;padding-inline-start:1.4rem}
.subpage li{color:var(--slate-600);margin-bottom:.45rem}
html[data-theme="dark"] .subpage li,html.subpage[data-theme="dark"] li{color:var(--slate-300)}
.subpage table{width:100%;border-collapse:collapse;margin:1rem 0;font-size:1rem}
.subpage th,.subpage td{border:1px solid var(--slate-200);padding:.6rem .8rem}
html[dir="rtl"] .subpage th,html[dir="rtl"] .subpage td{text-align:right}
html[dir="ltr"] .subpage th,html[dir="ltr"] .subpage td{text-align:left}
.subpage th{background:var(--slate-100);font-weight:800;color:var(--slate-900)}
html[data-theme="dark"] .subpage th,html.subpage[data-theme="dark"] th{background:var(--slate-700);color:var(--slate-100)}
html[data-theme="dark"] .subpage td,html.subpage[data-theme="dark"] td{border-color:var(--slate-600)}
.subpage .callout{background:var(--slate-50);border:1px solid var(--slate-200);border-radius:.75rem;padding:1.2rem 1.4rem;margin:1.2rem 0}
html[data-theme="dark"] .subpage .callout,html.subpage[data-theme="dark"] .callout{background:var(--slate-800);border-color:var(--slate-700)}
.subpage .callout b{color:var(--slate-900)}
html[data-theme="dark"] .subpage .callout b,html.subpage[data-theme="dark"] .callout b{color:var(--slate-100)}
.subpage .tags{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}
.subpage .tags span{font-size:.8125rem;font-weight:700;background:var(--slate-100);border:1px solid var(--slate-200);border-radius:999px;padding:.3rem .8rem;color:var(--slate-700)}
html[data-theme="dark"] .subpage .tags span,html.subpage[data-theme="dark"] .tags span{background:var(--slate-800);border-color:var(--slate-600);color:var(--slate-300)}
.subpage footer{border-top:1px solid var(--slate-200);padding:1.5rem 0;text-align:center;color:var(--fg-muted);font-size:.875rem}
html[data-theme="dark"] .subpage footer,html.subpage[data-theme="dark"] footer{border-top-color:var(--slate-700);color:var(--slate-400)}

/* ---------- Error 404 ---------- */
.error-page{font-family:var(--font-ui);background:var(--slate-50);color:var(--slate-900);display:grid;place-items:center;min-height:100vh;margin:0;text-align:center;padding:1.5rem}
.error-page .code{font-size:clamp(4rem,14vw,6rem);font-weight:800;color:var(--fg-faint);line-height:1}
.error-page h1{font-size:1.5rem;font-weight:800;margin:.8rem 0 .4rem}
.error-page p{color:var(--slate-600);margin:0 0 1.6rem;max-width:480px}
.error-page .actions{display:flex;flex-wrap:wrap;justify-content:center;gap:.6rem}

/* ---------- Offline page ---------- */
.offline-page{min-height:100vh;display:grid;place-items:center;padding:2rem;text-align:center;font-family:var(--font-ui);background:var(--slate-50);color:var(--slate-900)}
.offline-page h1{font-size:2rem;font-weight:800;margin-bottom:.6rem}
.offline-page p{color:var(--slate-600);margin-bottom:1.5rem;max-width:500px}

/* ---------- vcard download button ---------- */
.vcard-link{display:inline-flex;align-items:center;gap:.4rem}
.vcard-link svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ==============================================
   Project detail pages
   ============================================== */
.project-hero{background:linear-gradient(135deg,var(--slate-900) 0%,#0c4a6e 100%);color:var(--white);padding:4rem 0 3rem;text-align:center}
html[data-theme="dark"] .project-hero{background:linear-gradient(135deg,var(--slate-900) 0%,#0c4a6e 100%)}
.project-hero .eyebrow{font-size:.8125rem;font-weight:800;color:#7dd3fc;letter-spacing:.08em;text-transform:uppercase}
.project-hero h1{font-size:clamp(1.6rem,4.5vw,2.6rem);font-weight:800;margin:.6rem 0 .8rem;line-height:1.3}
.project-hero p{color:var(--slate-300);max-width:720px;margin-inline:auto;font-size:1rem}
.project-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:1rem;max-width:960px;margin:-1.5rem auto 0;padding:1.4rem 1.6rem;background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:0 16px 40px rgba(15,23,42,.08);position:relative;z-index:2}
html[data-theme="dark"] .project-meta{background:var(--slate-700);border-color:var(--slate-600);box-shadow:0 16px 40px rgba(0,0,0,.4)}
.project-meta .pm{display:flex;flex-direction:column;gap:.2rem}
.project-meta .pm b{font-size:.8125rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:var(--accent-text)}
.project-meta .pm span{font-size:1rem;font-weight:700;color:var(--slate-700)}
html[data-theme="dark"] .project-meta .pm span{color:var(--slate-200)}
.project-body{padding:3rem 0 4rem}
.project-body h2{font-size:1.25rem;font-weight:800;margin:2rem 0 .7rem;padding-bottom:.35rem;border-bottom:2px solid var(--slate-800);color:var(--slate-900)}
html[data-theme="dark"] .project-body h2{border-bottom-color:var(--accent);color:var(--slate-100)}
.project-body h3{font-size:1.125rem;font-weight:800;margin:1.3rem 0 .5rem;color:var(--slate-800)}
html[data-theme="dark"] .project-body h3{color:var(--slate-100)}
.project-body p{color:var(--slate-600);margin-bottom:.85rem;line-height:1.7}
html[data-theme="dark"] .project-body p{color:var(--slate-300)}
.project-body ul,.project-body ol{margin:0 0 1rem;padding-inline-start:1.4rem}
.project-body li{color:var(--slate-600);margin-bottom:.4rem;line-height:1.7}
html[data-theme="dark"] .project-body li{color:var(--slate-300)}
.project-body .tags{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}
.project-body .tags span{font-size:.8125rem;font-weight:700;background:var(--slate-100);border:1px solid var(--slate-200);border-radius:999px;padding:.3rem .8rem;color:var(--slate-700)}
html[data-theme="dark"] .project-body .tags span{background:var(--slate-800);border-color:var(--slate-600);color:var(--slate-300)}
.project-body .callout{background:var(--slate-50);border:1px solid var(--slate-200);border-radius:.75rem;padding:1.1rem 1.3rem;margin:1.2rem 0;border-inline-start:4px solid var(--accent)}
html[data-theme="dark"] .project-body .callout{background:var(--slate-800);border-color:var(--slate-700)}
.project-body .callout b{color:var(--slate-900)}
html[data-theme="dark"] .project-body .callout b{color:var(--slate-100)}
.project-body .disclaimer-box{background:#fef2f2;border:1px solid #fecaca;color:#991b1b;border-radius:.75rem;padding:1rem 1.2rem;margin:1.5rem 0;font-size:1rem;font-weight:700}
html[data-theme="dark"] .project-body .disclaimer-box{background:#431407;color:#fdba74;border-color:#7c2d12}
.project-actions{display:flex;flex-wrap:wrap;gap:.7rem;margin:1.8rem 0}
.project-actions .btn{white-space:nowrap}
.project-nav{display:flex;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin-top:3rem;padding-top:2rem;border-top:1px solid var(--line)}
html[data-theme="dark"] .project-nav{border-top-color:var(--slate-600)}
.project-nav a{font-weight:700;color:var(--accent-text);text-decoration:none;display:inline-flex;align-items:center;gap:.35rem}
.project-nav a:hover{text-decoration:underline}
.project-stack{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(200px,100%),1fr));gap:.75rem;margin:1rem 0}
.project-stack .stack-item{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:.75rem 1rem;font-size:1rem;font-weight:700;color:var(--slate-700)}
html[data-theme="dark"] .project-stack .stack-item{background:var(--slate-800);border-color:var(--slate-600);color:var(--slate-200)}
.project-stack .stack-item small{display:block;font-weight:600;color:var(--fg-muted);font-size:.8125rem;margin-top:.15rem}
html[data-theme="dark"] .project-stack .stack-item small{color:var(--slate-400)}
/* feature grid on project pages */
.feature-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:1rem;margin:1rem 0}
.feature-grid .fg{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1.1rem 1.2rem}
html[data-theme="dark"] .feature-grid .fg{background:var(--slate-800);border-color:var(--slate-700)}
.feature-grid .fg h4{font-size:1rem;font-weight:800;margin-bottom:.35rem;color:var(--slate-800)}
html[data-theme="dark"] .feature-grid .fg h4{color:var(--slate-100)}
.feature-grid .fg p{font-size:.875rem;color:var(--slate-600);margin:0;line-height:1.7}
html[data-theme="dark"] .feature-grid .fg p{color:var(--slate-300)}

/* ==============================================
   Certifications page
   ============================================== */
.certs-intro{background:linear-gradient(135deg,var(--slate-900) 0%,#064e3b 100%);color:var(--white);padding:4rem 0 3rem;text-align:center}
html[data-theme="dark"] .certs-intro{background:linear-gradient(135deg,var(--slate-900) 0%,#064e3b 100%)}
.certs-intro .eyebrow{font-size:.8125rem;font-weight:800;color:#6ee7b7;letter-spacing:.08em;text-transform:uppercase}
.certs-intro h1{font-size:clamp(1.6rem,4.5vw,2.5rem);font-weight:800;margin:.6rem 0 .8rem;line-height:1.3}
.certs-intro p{color:#d1fae5;max-width:720px;margin-inline:auto;font-size:1rem}
.certs-body{padding:3rem 0 4rem}
.cert-track{margin:2.2rem 0}
.cert-track-title{display:flex;align-items:center;gap:.7rem;font-size:1.25rem;font-weight:800;color:var(--slate-900);padding-bottom:.5rem;border-bottom:2px solid var(--slate-800);margin-bottom:1rem}
html[data-theme="dark"] .cert-track-title{color:var(--slate-100);border-bottom-color:var(--accent)}
.cert-track-title .ct-icon{width:28px;height:28px;background:var(--accent);color:var(--accent-ink);border-radius:8px;display:inline-grid;place-items:center;font-weight:800;font-size:.875rem}
.cert-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(280px,100%),1fr));gap:1rem}
.cert-card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1.2rem 1.3rem;display:flex;flex-direction:column;gap:.4rem;transition:transform .2s,box-shadow .2s,border-color .2s}
html[data-theme="dark"] .cert-card{background:var(--slate-800);border-color:var(--slate-700)}
.cert-card:hover{transform:translateY(-2px);box-shadow:0 10px 28px rgba(15,23,42,.1);border-color:var(--accent)}
.cert-card .cert-top{display:flex;justify-content:space-between;align-items:flex-start;gap:.6rem}
.cert-card .cert-name{font-size:1rem;font-weight:800;color:var(--slate-800);line-height:1.3}
html[data-theme="dark"] .cert-card .cert-name{color:var(--slate-100)}
.cert-card .cert-badge{font-size:.8125rem;font-weight:800;padding:.2rem .55rem;border-radius:6px;white-space:nowrap;letter-spacing:.03em}
.badge-earned{background:var(--ok);color:var(--white)}
.badge-inprogress{background:#b45309;color:var(--white)}
.badge-planned{background:#475569;color:var(--white)}
.cert-card .cert-vendor{font-size:.8125rem;color:var(--fg-muted);font-weight:700;text-transform:uppercase;letter-spacing:.06em}
html[data-theme="dark"] .cert-card .cert-vendor{color:var(--slate-400)}
.cert-card .cert-desc{font-size:.875rem;color:var(--slate-600);margin-top:.3rem;line-height:1.5}
html[data-theme="dark"] .cert-card .cert-desc{color:var(--slate-300)}
.cert-card .cert-status{font-size:.8125rem;font-weight:700;margin-top:auto;padding-top:.5rem;color:var(--accent-text)}
.cert-note{background:#fffbeb;border:1px solid #fde68a;border-radius:12px;padding:1.1rem 1.3rem;margin:1.5rem 0;color:#92400e;font-size:1rem}
html[data-theme="dark"] .cert-note{background:#422006;border-color:#78350f;color:#fcd34d}
.cert-note b{color:#78350f}
html[data-theme="dark"] .cert-note b{color:#fcd34d}


/* ============================================================
   v3 additions — consistent chrome across every page
   ============================================================ */

/* English pages use Inter for Latin glyphs, Cairo for Arabic ones */
html[lang="en"]{--font-ui:var(--font-ui-en)}

/* Rich footer inside sub-pages (overrides the minimal .subpage footer) */
.subpage footer.site-footer{border-top:0;padding-block:2.4rem;text-align:center;color:var(--on-dark-body);font-size:.875rem}
.subpage footer.site-footer a{color:var(--on-dark-link)}
footer.site-footer{margin-top:0}

/* Theme toggle placed inside the sub-page top bar */
nav.top .top-links{align-items:center}
nav.top .nav-toggle{width:38px;height:38px;margin-inline-start:.25rem}

/* Keyboard focus ring for the toggle + filter buttons */
.filter-btn:focus-visible{outline:3px solid var(--slate-800);outline-offset:2px}
html[data-theme="dark"] .filter-btn:focus-visible{outline-color:var(--accent)}

/* ------------------------------------------------------------
   Architecture diagrams (inline SVG figures on project pages)
   ------------------------------------------------------------ */
.fig{margin:1.6rem 0;background:var(--slate-50);border:1px solid var(--slate-200);border-radius:var(--radius-lg);padding:1.1rem}
.fig svg{display:block;width:100%;height:auto}
.fig figcaption{margin-top:.6rem;font-size:.8125rem;color:var(--fg-muted);text-align:center;font-weight:600}
html[data-theme="dark"] .fig{background:var(--slate-800);border-color:var(--slate-700)}
html[data-theme="dark"] .fig figcaption{color:var(--slate-400)}
.fig .fbox{fill:var(--white);stroke:var(--slate-300);stroke-width:1.5;rx:10}
.fig .fbox-hi{fill:var(--slate-800);stroke:var(--slate-800)}
.fig .flabel{font:600 12px var(--font-ui);fill:var(--slate-700)}
.fig .flabel-inv{font:700 12px var(--font-ui);fill:var(--white)}
.fig .fsub{font:500 10px var(--font-ui);fill:var(--slate-500)}
.fig .farrow{stroke:var(--slate-400);stroke-width:1.6;fill:none;marker-end:url(#fah)}
html[data-theme="dark"] .fig .fbox{fill:var(--dark-surface);stroke:var(--slate-600)}
html[data-theme="dark"] .fig .fbox-hi{fill:var(--accent);stroke:var(--accent)}
html[data-theme="dark"] .fig .flabel{fill:var(--slate-200)}
html[data-theme="dark"] .fig .flabel-inv{fill:var(--accent-ink)}
html[data-theme="dark"] .fig .fsub{fill:var(--slate-400)}

/* Project page extras */
.challenge-list li{margin-bottom:.6rem}
.challenge-list b{color:var(--slate-800)}
html[data-theme="dark"] .challenge-list b{color:var(--slate-100)}
.status-row{display:flex;flex-wrap:wrap;gap:.5rem;margin:.8rem 0 0}
.status-pill{font-size:.8125rem;font-weight:800;padding:.28rem .7rem;border-radius:999px;background:var(--slate-100);border:1px solid var(--slate-200);color:var(--slate-600)}
html[data-theme="dark"] .status-pill{background:var(--dark-surface);border-color:var(--slate-700);color:var(--slate-300)}

/* Language switch button in the top bar of sub-pages */
nav.top .top-links a[lang],nav.top .top-links a[hreflang]{font-weight:700}

/* CV pages: the rich footer must never break the printed sheet */
@media print{footer.site-footer{display:none!important}}

.filter-status{text-align:center;font-size:.875rem;font-weight:700;color:var(--fg-muted);margin:-1.4rem 0 1.6rem;min-height:1.2em}
html[data-theme="dark"] .filter-status{color:var(--slate-400)}

/* ---------- Long-form articles ---------- */
.post{max-width:820px;margin-inline:auto}
.post-head{margin-bottom:1.6rem}
.post-head h1{font-size:clamp(1.5rem,3.4vw,2.05rem);line-height:1.3;margin:.35rem 0 .8rem}
.post-body{font-size:1rem;line-height:1.9}
.post-body h2{margin-top:2rem;font-size:1.25rem}
.post-body h3{margin-top:1.5rem;font-size:1.125rem}
.post-body p{margin-bottom:1.1rem;color:var(--slate-700)}
.post-body ul,.post-body ol{margin:0 0 1.2rem 1.2rem;color:var(--slate-700)}
.post-body li{margin-bottom:.6rem}
.post-body b{color:var(--slate-900)}
.post-foot{margin-top:2.4rem;padding-top:1.2rem;border-top:1px solid var(--slate-200);font-size:1rem;color:var(--fg-muted)}
html[data-theme="dark"] .post-body p,html[data-theme="dark"] .post-body li{color:var(--slate-300)}
html[data-theme="dark"] .post-body b{color:var(--slate-100)}
html[data-theme="dark"] .post-foot{border-color:var(--slate-700);color:var(--slate-400)}

/* ---------- Lab notes index ---------- */
.postgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:1.1rem}
.postcard{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-lg);padding:1.15rem;display:flex;flex-direction:column;gap:.5rem;transition:transform var(--transition),border-color var(--transition),box-shadow var(--transition)}
.postcard:hover{transform:translateY(-3px);border-color:var(--slate-400);box-shadow:0 12px 28px rgba(15,23,42,.08)}
.postcard h3{margin:0;font-size:1rem;line-height:1.5}
.postcard h3 a{color:var(--slate-900);text-decoration:none}
.postcard h3 a:hover{text-decoration:underline}
.postcard p{margin:0;font-size:1rem;line-height:1.7;color:var(--slate-600)}
.postcard-meta{font-size:.8125rem;font-weight:800;color:var(--fg-muted)}
.read-more{margin-top:auto;font-size:.875rem;font-weight:800;color:var(--slate-700);text-decoration:none}
.read-more:hover{text-decoration:underline}
html[data-theme="dark"] .postcard{background:var(--dark-surface);border-color:var(--slate-700)}
html[data-theme="dark"] .postcard h3 a{color:var(--slate-100)}
html[data-theme="dark"] .postcard p{color:var(--slate-300)}
html[data-theme="dark"] .read-more{color:var(--slate-200)}
.feed-links{font-size:.875rem;font-weight:700;margin-top:.4rem}

/* ---------- Service packages ---------- */
.packages{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr));gap:1.1rem;margin:1.4rem 0 2rem}
.package{position:relative;background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-lg);padding:1.3rem}
.package h3{margin:0 0 .2rem;font-size:1.125rem}
.package-featured{border-color:var(--slate-900);box-shadow:0 14px 34px rgba(15,23,42,.08)}
.pkg-sub{margin:0 0 .8rem;font-size:.875rem;color:var(--fg-muted);font-weight:700}
.pkg-badge{position:absolute;top:-.7rem;inset-inline-start:1.1rem;background:var(--slate-900);color:var(--white);font-size:.8125rem;font-weight:800;padding:.22rem .6rem;border-radius:999px}
.package ul{margin:0 0 .8rem 1.1rem;font-size:1rem;color:var(--slate-600)}
.package li{margin-bottom:.45rem}
.pkg-meta{margin:0;font-size:.8125rem;color:var(--fg-muted)}
html[data-theme="dark"] .package{background:var(--dark-surface);border-color:var(--slate-700)}
html[data-theme="dark"] .package-featured{border-color:var(--accent)}
html[data-theme="dark"] .pkg-badge{background:var(--accent);color:var(--accent-ink)}
html[data-theme="dark"] .package ul{color:var(--slate-300)}
html[data-theme="dark"] .pkg-sub{color:var(--slate-400)}

/* ---------- Result stories ---------- */
.story{background:var(--white);border:1px solid var(--slate-200);border-radius:var(--radius-lg);padding:1.3rem;margin-bottom:1.2rem}
.story h2{margin-top:0;font-size:1.25rem}
.story-grid{display:grid;grid-template-columns:150px 1fr;gap:.5rem 1rem;margin:0}
.story-grid dt{font-weight:800;font-size:.875rem;color:var(--fg-muted);padding-top:.15rem}
.story-grid dd{margin:0;font-size:1rem;color:var(--slate-700);line-height:1.7}
html[data-theme="dark"] .story{background:var(--dark-surface);border-color:var(--slate-700)}
html[data-theme="dark"] .story-grid dt{color:var(--slate-400)}
html[data-theme="dark"] .story-grid dd{color:var(--slate-300)}
@media(max-width:640px){.story-grid{grid-template-columns:1fr;gap:.1rem .5rem}.story-grid dt{margin-top:.6rem}}

/* ---------- Metrics table (evidence page) ---------- */
table.metrics{width:100%;border-collapse:collapse;margin:1rem 0 1.4rem;font-size:1rem}
table.metrics th,table.metrics td{border:1px solid var(--slate-200);padding:.65rem .8rem;text-align:start;vertical-align:top}
table.metrics th{background:var(--slate-100);font-weight:800;color:var(--slate-800)}
table.metrics td{color:var(--slate-700)}
html[data-theme="dark"] table.metrics th{background:var(--slate-800);color:var(--slate-100)}
html[data-theme="dark"] table.metrics th,html[data-theme="dark"] table.metrics td{border-color:var(--slate-700);color:var(--slate-300)}
.note-note{font-size:.875rem;color:var(--fg-muted);border-inline-start:3px solid var(--slate-300);padding-inline-start:.8rem;line-height:1.7}
html[data-theme="dark"] .note-note{color:var(--slate-400);border-inline-start-color:var(--slate-600)}

/* ---------- Reading progress ---------- */
.progress-bar{position:fixed;top:0;inset-inline:0;height:3px;background:var(--focus);z-index:400;transform:scaleX(0);transform-origin:100% 50%;pointer-events:none}

/* ---------- Internal search ---------- */
.search-btn{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:var(--radius-md);border:1px solid var(--slate-200);background:var(--white);cursor:pointer;color:var(--slate-700)}
.search-btn:hover{border-color:var(--slate-400)}
.search-overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:420;display:none;padding:8vh 1rem 0;backdrop-filter:blur(2px)}
.search-overlay.open{display:block}
.search-box{max-width:640px;margin-inline:auto;background:var(--white);border-radius:var(--radius-lg);padding:1rem;box-shadow:0 24px 60px rgba(0,0,0,.3)}
.search-box input{width:100%;font-family:inherit;font-size:1rem;padding:.8rem 1rem;border:1px solid var(--slate-300);border-radius:var(--radius-md)}
.search-results{list-style:none;margin:.8rem 0 0;padding:0;max-height:56vh;overflow:auto}
.search-results li a{display:block;padding:.6rem .7rem;border-radius:var(--radius-md);text-decoration:none;color:var(--slate-800)}
.search-results li a:hover,.search-results li a:focus{background:var(--slate-100)}
.search-results small{display:block;color:var(--fg-muted);font-size:.8125rem;margin-top:.15rem}
.search-hint{font-size:.8125rem;color:var(--fg-muted);margin:.6rem 0 0}
html[data-theme="dark"] .search-btn{background:var(--dark-surface);border-color:var(--slate-700);color:var(--slate-200)}
html[data-theme="dark"] .search-box{background:var(--slate-800);color:var(--slate-200)}
html[data-theme="dark"] .search-box input{background:var(--dark-surface);border-color:var(--slate-600);color:var(--slate-100)}
html[data-theme="dark"] .search-results li a{color:var(--slate-200)}
html[data-theme="dark"] .search-results li a:hover{background:var(--slate-700)}

/* ---------- Related projects ---------- */
.related{margin-top:2.2rem;padding-top:1.2rem;border-top:1px solid var(--slate-200)}
.related h2{font-size:1.125rem;margin-top:0}
.related-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr));gap:.7rem}
.related-grid a{display:block;padding:.75rem .9rem;border:1px solid var(--slate-200);border-radius:var(--radius-md);text-decoration:none;color:var(--slate-800);font-weight:700;font-size:1rem;background:var(--white)}
.related-grid a:hover{border-color:var(--slate-400)}
.related-grid small{display:block;font-weight:600;color:var(--fg-muted);font-size:.8125rem;margin-top:.2rem}
html[data-theme="dark"] .related{border-color:var(--slate-700)}
html[data-theme="dark"] .related-grid a{background:var(--dark-surface);border-color:var(--slate-700);color:var(--slate-100)}
html[data-theme="dark"] .related-grid small{color:var(--slate-400)}

/* ---------- Floating language switch ---------- */
html[data-theme="dark"] 
/* ---------- Lab teaser on the home page ---------- */
.lab-teaser{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr));gap:1rem;margin-top:1.2rem}
@media print{}


/* ===== generated dark-mode contrast coverage ===== */
html[data-theme="dark"] hr{border-top:1px solid var(--slate-700)}
html[data-theme="dark"] .site-header{border-bottom:1px solid var(--slate-700)}
html[data-theme="dark"] .brand:hover{color:var(--slate-50)}
html[data-theme="dark"] .hero-avatar{background:var(--slate-700)}
html[data-theme="dark"] .about-card a{color:var(--slate-50)}
html[data-theme="dark"] .fact .k{color:#c6d1e0}
html[data-theme="dark"] .achievements-section .section-head p{color:#a5b4c8}
html[data-theme="dark"] .achievements-section .section-divider{background:var(--slate-800)}
html[data-theme="dark"] .achievements-section .section-eyebrow{color:#a5b4c8}
html[data-theme="dark"] .ach-card .label{color:#a5b4c8}
html[data-theme="dark"] .edu-card .inst{color:#e6ecf4}
html[data-theme="dark"] .courses-wrap h3{color:var(--slate-50)}
html[data-theme="dark"] .courses-wrap>p{color:#c6d1e0}
html[data-theme="dark"] .course-tags .tag:hover{border-color:var(--slate-600)}
html[data-theme="dark"] .timeline-item .role-line{color:#c6d1e0}
html[data-theme="dark"] .timeline-item .sub-heading{color:var(--slate-50)}
html[data-theme="dark"] .skill-subgroup .sub-label{color:#c6d1e0}
html[data-theme="dark"] .methodologies h3{color:var(--slate-50)}
html[data-theme="dark"] .methodologies p{color:#c6d1e0}
html[data-theme="dark"] .project-card .p-year{color:#a5b4c8}
html[data-theme="dark"] .project-link.disabled{color:#a5b4c8}
html[data-theme="dark"] .contact-section .section-head p{color:#a5b4c8}
html[data-theme="dark"] .contact-section .section-divider{background:var(--slate-800)}
html[data-theme="dark"] .contact-info-item .txt .k{color:#a5b4c8}
html[data-theme="dark"] .contact-form{background:var(--slate-800);color:var(--slate-50)}
html[data-theme="dark"] .form-row label{color:#e6ecf4}
html[data-theme="dark"] .form-row .hint{color:#c6d1e0}
html[data-theme="dark"] .form-row input, html[data-theme="dark"] .form-row textarea{border:1px solid var(--slate-600);background:var(--slate-800)}
html[data-theme="dark"] .form-row input:focus, html[data-theme="dark"] .form-row textarea:focus{background:var(--slate-800)}
html[data-theme="dark"] .form-note a{color:#e6ecf4}
html[data-theme="dark"] .site-footer{color:var(--on-dark-body)}
html[data-theme="dark"] .site-footer a{color:var(--on-dark-link)}
html[data-theme="dark"] .site-footer .footer-meta{color:var(--on-dark-muted)}
html[data-theme="dark"] .consent-banner p{color:var(--on-dark-body)}
html[data-theme="dark"] .consent-banner button{background:var(--slate-800);color:var(--slate-50)}
html[data-theme="dark"] .consent-banner button:hover{background:var(--dark-surface)}
html[data-theme="dark"] nav.top{border-bottom:1px solid var(--slate-700)}
html[data-theme="dark"] .subpage header .eyebrow,html.subpage[data-theme="dark"] header .eyebrow{color:#a5b4c8}
html[data-theme="dark"] .subpage header p,html.subpage[data-theme="dark"] header p{color:#a5b4c8}
html[data-theme="dark"] .subpage th, html[data-theme="dark"] .subpage td,html.subpage[data-theme="dark"] th,html.subpage[data-theme="dark"] td{border:1px solid var(--slate-700)}
html[data-theme="dark"] .subpage footer,html.subpage[data-theme="dark"] footer{border-top:1px solid var(--slate-700)}
html[data-theme="dark"] .error-page{background:var(--slate-800);color:var(--slate-50)}
html[data-theme="dark"] .error-page .code{color:#a5b4c8}
html[data-theme="dark"] .error-page p{color:#c6d1e0}
html[data-theme="dark"] .offline-page{background:var(--slate-800);color:var(--slate-50)}
html[data-theme="dark"] .offline-page p{color:#c6d1e0}
html[data-theme="dark"] .project-hero p{color:var(--slate-300)}
html[data-theme="dark"] .subpage footer.site-footer,html.subpage[data-theme="dark"] footer.site-footer{color:var(--on-dark-body)}
html[data-theme="dark"] .subpage footer.site-footer a,html.subpage[data-theme="dark"] footer.site-footer a{color:var(--on-dark-link)}
html[data-theme="dark"] .post-body ul, html[data-theme="dark"] .post-body ol{color:#e6ecf4}
html[data-theme="dark"] .postcard:hover{border-color:var(--slate-600)}
html[data-theme="dark"] .postcard-meta{color:#c6d1e0}
html[data-theme="dark"] .pkg-meta{color:#c6d1e0}
html[data-theme="dark"] table.metrics th, html[data-theme="dark"] table.metrics td{border:1px solid var(--slate-700)}
html[data-theme="dark"] .note-note{border-inline-start:3px solid var(--slate-600)}
html[data-theme="dark"] .search-btn:hover{border-color:var(--slate-600)}
html[data-theme="dark"] .search-results li a:hover, html[data-theme="dark"] .search-results li a:focus{background:var(--dark-surface)}
html[data-theme="dark"] .search-results small{color:#c6d1e0}
html[data-theme="dark"] .search-hint{color:#c6d1e0}
html[data-theme="dark"] .related-grid a:hover{border-color:var(--slate-600)}
/* ===== فقرات التذييل الداكن (جولة رابعة) ===== */
/* تذييل الموقع (سطح داكن دائمًا) — مُوجَّه بدقّة */
.site-footer p,.subpage footer.site-footer p{color:var(--on-dark-body)}
.site-footer .footer-meta,.subpage footer.site-footer .footer-meta{color:var(--on-dark-muted)}
.site-footer b,.subpage footer.site-footer b{color:var(--white)}
.consent-banner p{color:var(--on-dark-body)}
.consent-banner a{color:var(--on-dark-link)}
/* تذييل المقال (سطح فاتح) */
.post-foot b{color:var(--fg-strong)}
html[data-theme="dark"] .post-foot b{color:var(--slate-50)}
html[data-theme="dark"] .post-foot{color:var(--slate-300)}
html[data-theme="dark"] .post-foot a{color:#7dd3fc}

/* ===== بعد تصحيح ترتيب العناوين (SEO) — مطابقة بصرية ===== */
.feature-grid .fg h3{font-size:1rem;font-weight:800;margin:0 0 .35rem;color:var(--slate-800);border:0;padding:0}
html[data-theme="dark"] .feature-grid .fg h3{color:var(--slate-100)}
.timeline-item h3{font-size:1.125rem;font-weight:800;color:var(--slate-900);margin-bottom:.35rem}
html[data-theme="dark"] .timeline-item h3{color:var(--slate-100)}
.package h3,.package h2{margin:0 0 .2rem;font-size:1.125rem;border:0;padding:0;color:var(--slate-900)}
html[data-theme="dark"] .package h2{color:var(--slate-50)}
.postcard h3,.postcard h2{margin:0;font-size:1rem;line-height:1.5;border:0;padding:0}
.postcard h3 a,.postcard h2 a{color:var(--slate-900);text-decoration:none}
.postcard h3 a:hover,.postcard h2 a:hover{text-decoration:underline}
html[data-theme="dark"] .postcard h3 a,html[data-theme="dark"] .postcard h2 a{color:var(--slate-100)}
.projidx-card h3,.projidx-card h2{margin:0;font-size:1.125rem;font-weight:800;border:0;padding:0}

/* ===== جولة الاستجابة (6) — شبكات مرنة، جداول قابلة للتمرير، أهداف لمس أكبر ===== */
.projidx-grid,.postgrid,.projects-grid,.services-grid{grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr))}
.btn{max-width:100%}
code,kbd,samp{overflow-wrap:anywhere}
pre{max-width:100%;overflow-x:auto;white-space:pre}
.project-actions{flex-wrap:wrap;gap:.6rem}
table.metrics,table.metrics>*{max-width:100%}
.site-footer a,.subpage footer.site-footer a,.footer-links a{display:inline-block;padding-block:.22rem;min-height:24px}
.project-link{padding-block:.18rem;min-height:24px}
.read-more,.postcard-meta a{padding-block:.15rem;min-height:24px}
.toolbar a,.toolbar button{min-height:24px}
@media(max-width:760px){
  .subpage table,table.metrics{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border-collapse:collapse}
  .subpage table th,.subpage table td,table.metrics th,table.metrics td{white-space:normal;word-break:break-word}
  .hero-actions,.hero-cta,.cta-row,.nav-list{flex-wrap:wrap}
}
@media(max-width:520px){
  .btn{white-space:normal;text-align:center;padding:.7rem 1.1rem;font-size:1rem;line-height:1.5}
  h1,h2,h3{overflow-wrap:break-word}
  .subpage main{padding:2rem 0 3rem}
  .site-footer{font-size:.875rem}
  .footer-links{gap:6px 10px}
}
@media(max-width:380px){
  .container{padding-inline:.9rem}
    .fact .v,.stat .v{font-size:1.5rem}
}

/* ===== جولة الاستجابة (6ب) — منع تضخّم الأعمدة ووسائط مرنة ===== */
.about-grid>*,.edu-grid>*,.skills-grid>*,.projects-grid>*,.services-grid>*,.contact-grid>*,.projidx-grid>*,.postgrid>*{min-width:0}
.about-card img,.about-card svg,.edu-card img,.post-body img,.project-body img,.project-hero img,.about-section img{max-width:100%;height:auto}
@media(max-width:880px){.about-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:820px){.edu-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:680px){.skills-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:640px){.projects-grid,.services-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:520px){.about-card{padding:1.15rem}.read-more,.project-link{font-size:.875rem}}

@media(max-width:520px){.about-facts{grid-template-columns:minmax(0,1fr)}}

html[data-theme="dark"] .package h3{color:var(--slate-50)}


/* ==================================================================
   v3.3.0 — audit fixes (see changelog)
   ================================================================== */
/* dark surfaces inside the light theme get the light focus ring */
.achievements-section,.contact-section,.site-footer,.consent-banner,.subpage header,.project-hero,.certs-intro,.toast{--focus:var(--accent)}
.contact-form,.nojs-note{--focus:#0e7490}
html[data-theme="dark"] .contact-form,html[data-theme="dark"] .nojs-note{--focus:var(--accent)}
main:focus{outline:none}
.subpage main.main-wrap{padding:0}
.certs-body{padding:3rem 0 4rem}
body.modal-open{overflow:hidden}
a,button,input,select,textarea,summary,label{touch-action:manipulation}
h1,h2,h3{text-wrap:balance}
.stat .num,.ach-card .num{font-variant-numeric:tabular-nums;direction:ltr;unicode-bidi:isolate}
html:not(.js) #contactForm{display:none}
html.js .nojs-note{display:none}
.nojs-note{background:var(--white);color:var(--slate-800);border:1px solid var(--line);border-radius:var(--radius-lg);padding:1rem 1.2rem}
.nojs-note a{text-decoration:underline}

/* the same header on sub-pages (a div[role=banner], so the dark page-hero rules for <header> do not touch it) */
.site-header .nav-links{margin:0;padding:0;list-style:none}
.site-header .nav-links li{margin:0}
.page-body{padding:3rem 0 4rem}
@media(max-width:520px){.page-body{padding:2rem 0 3rem}}
.nav-links a[aria-current="page"]{color:var(--slate-900);font-weight:800}
html[data-theme="dark"] .nav-links a[aria-current="page"]{color:var(--white)}
.projects-note{max-width:720px;margin:-1.2rem auto 1.6rem;text-align:center;font-size:.875rem;color:var(--fg-muted)}
.projects-note a{text-decoration:underline;text-underline-offset:3px}
html[data-theme="dark"] .projects-note{color:#c6d1e0}
.subpage .projects-note{margin:.2rem auto 1.4rem}
/* phones: long card lists show the first few; everything is in the page and one tap away */
.show-all{display:none;margin-top:1rem}
@media(max-width:640px){
  .m-collapsed > .m-more{display:none}
  .show-all{display:flex}
  .show-all[hidden]{display:none}
  section{padding-block:2.75rem}
  .hero{padding-block:2.5rem 2.25rem}
  .achievements-section{padding-block:2.5rem}
}
@media print{.site-header,.show-all{display:none!important}.m-collapsed > .m-more{display:revert!important}}
/* header: one row from 1280px up, menu button below that; always sticky */
.site-header .container{max-width:1280px}
.main-nav{gap:1rem}
.nav-links{gap:.55rem 1.05rem}
.nav-links a{display:inline-flex;align-items:center;min-height:28px}
.nav-links .btn-sm{padding:.45rem .8rem}
@media(min-width:1280px){.nav-links{flex-wrap:nowrap}}
@media(max-width:1279px){
  .nav-links{max-height:calc(100vh - var(--header-h));max-height:calc(100dvh - var(--header-h));overflow-y:auto;overscroll-behavior:contain}
  .nav-links li{display:flex;justify-content:center}
}
nav.top a{display:inline-flex;align-items:center;min-height:28px}
.footer-links a{display:inline-flex;align-items:center;justify-content:center;min-height:28px;min-width:28px}
.project-link,.projidx-link,.read-more{min-height:28px}
.project-link svg{transition:transform var(--transition)}
html[dir="ltr"] .project-link svg{transform:scaleX(-1)}
.copy-btn{display:inline-flex;align-items:center;min-height:32px}
pre.keyblock:focus-visible{outline:3px solid var(--focus);outline-offset:2px}

/* back-to-top: not focusable while hidden, clear of the home indicator */
.back-to-top{visibility:hidden;bottom:calc(1.25rem + env(safe-area-inset-bottom,0px));transition:opacity var(--transition),visibility var(--transition)}
.back-to-top.show{visibility:visible}
#backToTop{display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-height:44px;padding:0;margin:0;color:var(--white);text-decoration:none}
#backToTop:hover{color:var(--white);text-decoration:none}
@media(max-width:760px){.site-footer{padding-bottom:5rem}}
html[data-theme="dark"] #backToTop,html[data-theme="dark"] #backToTop:hover{color:var(--accent-ink)}
.form-row label{min-height:24px}
.search-box input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;display:none}

/* privacy notice: compact, never more than a thin bar */
.consent-banner{padding:.7rem 1rem calc(.7rem + env(safe-area-inset-bottom,0px));font-size:.875rem}
.consent-inner{flex-wrap:nowrap;gap:.8rem}
.consent-banner p{min-width:0;line-height:1.5}
.consent-banner button{flex-shrink:0;min-height:44px;min-width:64px}
@media(max-width:520px){.consent-banner{font-size:.8125rem}}
.update-banner button{min-height:32px}

/* form: 16px controls (no zoom on iOS), visible error state, inline messages */
.form-row input,.form-row textarea{font-size:1rem}
.form-row [aria-invalid="true"]{border-color:var(--danger);box-shadow:0 0 0 3px rgba(185,28,28,.15)}
.field-error{margin:.35rem 0 0;color:var(--danger);font-size:.875rem;font-weight:700}
html[data-theme="dark"] .form-row [aria-invalid="true"]{border-color:#fca5a5;box-shadow:0 0 0 3px rgba(252,165,165,.2)}
html[data-theme="dark"] .field-error{color:#fca5a5}
.contact-form button[aria-disabled="true"]{opacity:.7;pointer-events:none}
.toast-out{opacity:0;transform:translateY(20px);transition:opacity .4s,transform .4s}

/* search dialog */
.search-overlay{overscroll-behavior:contain;overflow-y:auto;padding-bottom:2rem}
.search-head{display:flex;gap:.5rem;align-items:stretch}
.search-head input{flex:1;min-width:0}
.search-close{flex-shrink:0;width:48px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--field-border);border-radius:var(--radius-md);background:var(--white);color:var(--slate-800)}
.search-close:hover{background:var(--slate-100)}
.search-box input{border-color:var(--field-border)}
.search-empty{padding:.8rem .9rem;color:var(--fg-muted)}
html[data-theme="dark"] .search-close{background:var(--slate-800);color:var(--slate-200);border-color:#7c8ba1}
html[data-theme="dark"] .search-empty{color:#c6d1e0}
@media(hover:none),(pointer:coarse){.search-hint{display:none}}

/* 404 page: second-language block */
.error-alt{margin-top:1.6rem;padding-top:1.2rem;border-top:1px solid var(--line)}
