/* =========================================================
   Mohamed Ali Hachicha, Portfolio
   Visual system: clean, senior, one accent.
   ========================================================= */

:root {
  --bg: #fafafa;
  --bg-white: #ffffff;
  --ink: #16202b;
  --muted: #5b6b7a;
  --accent: #0f2a43;       /* navy */
  --link: #1f6feb;         /* confident blue */
  --link-press: #1857c0;
  --line: #e3e8ee;
  --line-soft: #eef1f5;

  --maxw: 1080px;
  --gutter: clamp(20px, 5vw, 40px);

  --radius-sm: 8px;
  --radius-md: 12px;

  --shadow-card: 0 1px 2px rgba(22, 32, 43, 0.04), 0 6px 24px rgba(22, 32, 43, 0.05);
  --shadow-card-hover: 0 2px 4px rgba(22, 32, 43, 0.06), 0 14px 40px rgba(22, 32, 43, 0.09);

  --ease: cubic-bezier(0.2, 0, 0, 1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-press); }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- skip link (a11y) ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---------- layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(56px, 9vw, 100px);
}
.section--white { background: var(--bg-white); border-block: 1px solid var(--line-soft); }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(26px, 3.4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-head { margin-bottom: clamp(28px, 4vw, 44px); max-width: 640px; }
.section-head .lead {
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
}

/* =========================================================
   Header / nav
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  transition: padding 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 18px;
  transition: padding 0.22s var(--ease);
}
.site-header.is-scrolled { box-shadow: 0 1px 0 rgba(22, 32, 43, 0.04); }
.site-header.is-scrolled .wrap { padding-block: 11px; }

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
}
.brand .brand-dot { color: var(--link); }
.brand .brand-full {
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 30px);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
}
.nav-links a {
  position: relative;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  transition: color 0.14s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
/* active section highlight (scrollspy) */
.nav-links a.is-current { color: var(--ink); font-weight: 600; }
.nav-links a.is-current::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--link);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: clamp(14px, 2.4vw, 24px);
}
.lang-switch a { color: var(--muted); }
.lang-switch a:hover { color: var(--ink); }
.lang-switch .is-active { color: var(--ink); font-weight: 600; }
.lang-switch .sep { color: var(--line); }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.005em;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease),
              border-color 0.14s var(--ease), transform 0.14s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #163a5c; color: #fff; }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover { background: #fff; border-color: #cfd8e2; color: var(--ink); }
.btn--sm { padding: 9px 15px; font-size: 14px; }
.btn--on-dark { background: #fff; color: var(--accent); }
.btn--on-dark:hover { background: #eef2f7; color: var(--accent); }
.btn--on-dark-ghost {
  background: transparent; color: #fff; border-color: rgba(255,255,255,0.34);
}
.btn--on-dark-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }

.header-cta { display: inline-flex; }

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

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(64px, 11vw, 124px) clamp(48px, 8vw, 92px);
}
/* subtle decorative background accent */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 70% at 88% -5%, rgba(31, 111, 235, 0.10), transparent 60%),
    radial-gradient(50% 60% at 0% 0%, rgba(15, 42, 67, 0.05), transparent 55%);
}
.hero .wrap { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--link); }
.hero h1 {
  font-size: clamp(38px, 7vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin-bottom: 14px;
  overflow-wrap: break-word;
}
.hero .subtitle {
  font-size: clamp(19px, 2.6vw, 23px);
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 22px;
}
.hero .value {
  font-size: clamp(18px, 2.4vw, 21px);
  color: var(--muted);
  max-width: 640px;
  line-height: 1.5;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}
.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 38px;
}
.trust .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
}
.trust .chip .dot {
  width: 7px; height: 7px; border-radius: 999px; background: var(--link);
}

/* =========================================================
   About
   ========================================================= */
.about-body { max-width: 720px; }
.about-body p { color: var(--ink); }
.about-body p + p { margin-top: 18px; }

/* =========================================================
   Work
   ========================================================= */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: clamp(22px, 3vw, 30px);
  transition: box-shadow 0.22s var(--ease), transform 0.22s var(--ease),
              border-color 0.22s var(--ease);
}
.card:hover { box-shadow: var(--shadow-card-hover); border-color: #d8e0ea; transform: translateY(-2px); }

.card-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.card-what { color: var(--muted); font-size: 15.5px; margin-bottom: 16px; }

.outcomes { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 9px; }
.outcomes li {
  position: relative;
  padding-left: 22px;
  font-size: 15.5px;
  line-height: 1.5;
}
.outcomes li::before {
  content: "";
  position: absolute;
  left: 2px; top: 9px;
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--link);
}
.outcomes b { font-weight: 700; color: var(--ink); }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.tag {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  background: #f1f5fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  letter-spacing: 0.005em;
}

/* featured FFY card */
.card--featured {
  grid-column: 1 / -1;
  padding: 0;
  overflow: hidden;
}
.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
}
.featured-content { padding: clamp(26px, 3.4vw, 40px); display: flex; flex-direction: column; }
/* fill the full width nicely: two columns of outcomes on wider screens */
@media (min-width: 680px) {
  .card--featured .outcomes { grid-template-columns: 1fr 1fr; gap: 10px 32px; }
}
.featured-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--link);
  background: #eaf2fe;
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 16px;
}
.card--featured .card-name { font-size: 26px; }
.card--featured .card-what { font-size: 16px; max-width: 60ch; }

/* =========================================================
   Skills
   ========================================================= */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px 40px;
}
.skill-group .skill-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 11px;
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tags span {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 12px;
}

/* =========================================================
   Working with AI
   ========================================================= */
.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.ai-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: clamp(20px, 2.6vw, 26px);
}
.ai-item .ai-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--link);
  margin-bottom: 10px;
}
.ai-item p:last-child { color: var(--ink); font-size: 15.5px; }

/* =========================================================
   Open source strip
   ========================================================= */
.oss {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  padding: clamp(28px, 4vw, 44px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 26px;
}
.oss .oss-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: #8fb6e6; margin-bottom: 12px;
}
.oss .oss-name {
  font-size: clamp(22px, 3.2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.015em;
  font-feature-settings: "tnum";
}
.oss .oss-name code {
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.oss .oss-desc { color: #c5d6ec; margin-top: 10px; max-width: 52ch; font-size: 15.5px; }
.oss-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* =========================================================
   Education & certs
   ========================================================= */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.edu-block .block-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 16px;
}
.edu-item { padding-block: 14px; border-top: 1px solid var(--line); }
.edu-item:first-of-type { border-top: none; padding-top: 0; }
.edu-item .deg { font-weight: 600; font-size: 16px; }
.edu-item .meta { color: var(--muted); font-size: 14.5px; margin-top: 3px; }

.cert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.cert-list li {
  position: relative; padding-left: 22px; font-size: 15.5px;
}
.cert-list li::before {
  content: ""; position: absolute; left: 2px; top: 9px;
  width: 7px; height: 7px; border-radius: 2px; background: var(--line);
  border: 1px solid #cdd6e0;
}
.lang-list { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* =========================================================
   Contact / footer
   ========================================================= */
.contact { background: var(--bg-white); border-top: 1px solid var(--line); }
.contact-prompt {
  font-size: clamp(24px, 3.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  max-width: 18ch;
  margin-bottom: 28px;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}
.contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease), transform 0.14s var(--ease);
}
.contact-link:hover { border-color: #cfd8e2; background: #fff; color: var(--ink); transform: translateY(-2px); }
.contact-link .ci {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
}
.contact-link .ci svg { width: 20px; height: 20px; }
.contact-link .cl-label { font-size: 12.5px; color: var(--muted); }
.contact-link .cl-value { font-weight: 600; font-size: 15px; word-break: break-word; }

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.foot .foot-brand { font-weight: 600; color: var(--ink); }

/* =========================================================
   Scroll reveal (progressive enhancement)
   Hidden start state only applies when JS is active (html.js),
   so no-JS visitors and crawlers always see the content.
   ========================================================= */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  will-change: opacity, transform;
}
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .work-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .oss { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .trio { grid-template-columns: 1fr; }

  /* collapsible nav */
  .nav-toggle {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 42px; height: 42px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--ink);
  }
  .nav-toggle svg { width: 22px; height: 22px; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 18px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-links a { padding: 12px 2px; border-bottom: 1px solid var(--line-soft); font-size: 16px; }
  .nav-links a.is-current::after { display: none; }
  .lang-switch { border-left: none; padding-left: 2px; padding-top: 14px; }
  .header-cta { margin-top: 14px; }
  .header-cta .btn { width: 100%; }
}

@media (max-width: 420px) {
  .hero-actions .btn { flex: 1 1 auto; }
}
