/* ==========================================================================
   Abdessamad Traibiz — Portfolio 2026
   Palette : bleu nuit + safran. Typo : Archivo (largeur variable), Readex Pro (ar)
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2-variations"), url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-ext.woff2") format("woff2-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0;
}
@font-face {
  font-family: "Readex Pro";
  src: url("../fonts/readex-arabic.woff2") format("woff2-variations");
  font-weight: 160 700; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2-variations");
  font-weight: 100 800; font-display: swap;
}

:root {
  --bg: #EDF0F5;
  --bg-2: #E3E8F0;
  --surface: #FFFFFF;
  --ink: #0D1A33;
  --muted: #56617A;
  --line: rgba(13, 26, 51, .13);
  --accent: #EFA622;
  --accent-ink: #8A5600;
  --on-accent: #0D1A33;
  --code-base: rgba(13, 26, 51, .085);
  --code-hi: #0D1A33;
  --code-k: #8A5600;
  --shadow: 0 30px 60px -30px rgba(13, 26, 51, .35);
  --font: "Archivo", "Readex Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1320px;
  --pad: clamp(1.25rem, 4vw, 3rem);
  --hd-h: 72px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r-lg: 22px;
  --r-md: 14px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0B1324;
  --bg-2: #0F1A30;
  --surface: #132039;
  --ink: #E9EDF5;
  --muted: #96A2BA;
  --line: rgba(233, 237, 245, .12);
  --accent: #F4B740;
  --accent-ink: #F4B740;
  --on-accent: #0B1324;
  --code-base: rgba(233, 237, 245, .06);
  --code-hi: #E9EDF5;
  --code-k: #F4B740;
  --shadow: 0 30px 70px -30px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hd-h) + 12px); overflow-x: clip; }
html:not(.lenis) { scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.6; font-stretch: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
html.i18n-pending body { opacity: 0; }
html[dir="rtl"] body { font-family: "Readex Pro", var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--on-accent); }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }
.muted { color: var(--muted); }
.ico { width: 1.15em; height: 1.15em; flex: none; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.skip { position: fixed; top: -100px; inset-inline-start: 1rem; z-index: 200; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: 10px; font-weight: 600; }
.skip:focus { top: 1rem; }
.no-trans, .no-trans * { transition: none !important; }

/* ---------- progress ---------- */
.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 120; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
[dir="rtl"] .progress span { transform-origin: 100% 50%; }

/* ---------- buttons ---------- */
.btn {
  --h: 3.25rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  height: var(--h); padding-inline: 1.5rem; border-radius: 999px;
  font-weight: 600; font-size: 1rem; font-stretch: 108%; white-space: nowrap;
  position: relative; overflow: hidden; isolation: isolate;
  transition: color .35s var(--ease), border-color .35s var(--ease);
}
.btn-small { --h: 2.5rem; padding-inline: 1rem; font-size: .92rem; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost, .btn-small { border: 1px solid var(--line); }
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink);
  border-radius: inherit; transform: translateY(101%); transition: transform .5s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn:hover { color: var(--bg); border-color: var(--ink); }
.btn .ico { transition: transform .45s var(--ease); }
.btn-primary:hover .ico:not(.flip-rtl) { transform: translateX(3px); }

.link-line { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .45s var(--ease); padding-bottom: 2px; }
[dir="rtl"] .link-line { background-position: 100% 100%; }
.link-line:hover { background-size: 100% 1px; }

/* ---------- header ---------- */
.site-header { position: fixed; inset: 0 0 auto; z-index: 100; height: var(--hd-h); transition: transform .5s var(--ease), background-color .4s, border-color .4s; border-bottom: 1px solid transparent; }
.site-header.is-scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); border-color: var(--line); }
.site-header.is-hidden { transform: translateY(-100%); }
.hd-inner { height: 100%; max-width: 1600px; margin-inline: auto; padding-inline: var(--pad); display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 700; font-stretch: 115%; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: .9rem; font-weight: 800; font-stretch: 125%; transition: transform .6s var(--ease), background-color .4s; }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); background: var(--accent); color: var(--on-accent); }
.brand-name { font-size: 1rem; }
.main-nav { margin-inline: auto; }
.main-nav ul { display: flex; gap: .25rem; }
.nav-link { position: relative; display: block; padding: .5rem .8rem; font-size: .95rem; color: var(--muted); transition: color .3s; }
.nav-link::after { content: ""; position: absolute; inset-inline: .8rem; bottom: .25rem; height: 1px; background: var(--accent); transform: scaleX(0); transition: transform .45s var(--ease); }
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after, .nav-link:hover::after { transform: scaleX(1); }
.hd-tools { display: flex; align-items: center; gap: .6rem; margin-inline-start: auto; }
.main-nav + .hd-tools { margin-inline-start: 0; }

.lang-switch { position: relative; display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.lang-btn { position: relative; z-index: 1; width: 2.3rem; height: 2rem; border-radius: 999px; font-size: .78rem; font-weight: 700; font-stretch: 112%; color: var(--muted); transition: color .35s; }
.lang-btn[lang="ar"] { font-family: "Readex Pro", sans-serif; font-size: .95rem; }
.lang-btn[aria-pressed="true"] { color: var(--on-accent); }
.lang-pill { position: absolute; top: 3px; left: 0; width: 2.3rem; height: 2rem; border-radius: 999px; background: var(--accent); transition: transform .55s var(--ease); }

.theme-btn { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.theme-ico { position: relative; width: 1.15rem; height: 1.15rem; }
.theme-ico .ico { position: absolute; inset: 0; transition: transform .7s var(--ease), opacity .5s; }
[data-theme="dark"] .theme-ico .sun { transform: rotate(-90deg) scale(.4); opacity: 0; }
[data-theme="light"] .theme-ico .moon { transform: rotate(90deg) scale(.4); opacity: 0; }
.theme-btn:hover .ico { color: var(--accent-ink); }

.burger { display: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line); position: relative; }
.burger span { position: absolute; left: 30%; right: 30%; height: 1.5px; background: currentColor; transition: transform .5s var(--ease); }
.burger span:first-child { top: 42%; } .burger span:last-child { top: 58%; }
.burger[aria-expanded="true"] span:first-child { transform: translateY(2.5px) rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { transform: translateY(-2.5px) rotate(-45deg); }

.mnav[hidden] { display: none; }
.mnav { position: fixed; inset: 0; z-index: 90; background: var(--bg); padding: calc(var(--hd-h) + 2rem) var(--pad) 2rem; display: flex; flex-direction: column; justify-content: space-between; clip-path: circle(0 at calc(100% - 3rem) 2.2rem); transition: clip-path .8s var(--ease); }
[dir="rtl"] .mnav { clip-path: circle(0 at 3rem 2.2rem); }
.mnav.is-open { clip-path: circle(150% at calc(100% - 3rem) 2.2rem); }
[dir="rtl"] .mnav.is-open { clip-path: circle(150% at 3rem 2.2rem); }
.mnav-link { display: block; overflow: hidden; font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 800; font-stretch: 120%; line-height: 1.15; padding-block: .1em; }
.mnav-text { display: inline-block; }
.mnav-foot { display: flex; flex-direction: column; gap: 1.5rem; align-items: flex-start; }

.socials { display: flex; gap: .5rem; flex-wrap: wrap; }
.socials a { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); transition: color .3s, border-color .3s, background-color .3s; }
.socials a:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.socials .ico { width: 1.05rem; height: 1.05rem; }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; overflow: hidden; padding-block: calc(var(--hd-h) + 2rem) 5rem; --mx: 70%; --my: 40%; }
.hero-code { position: absolute; inset: 0; pointer-events: none; user-select: none; }
.code-grid { position: absolute; inset: -2rem; display: grid; grid-template-columns: repeat(3, minmax(28rem, 1fr)); gap: 2rem 3rem; padding: 2rem; direction: ltr; text-align: left; }
.code-grid pre { margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.75; white-space: pre; }
.code-grid b { font-weight: inherit; }
.code-base { color: var(--code-base); }
.code-reveal { color: var(--code-hi); opacity: .78;
  -webkit-mask-image: radial-gradient(circle var(--spot, 240px) at var(--mx) var(--my), #000 0%, rgba(0,0,0,.55) 45%, transparent 100%);
          mask-image: radial-gradient(circle var(--spot, 240px) at var(--mx) var(--my), #000 0%, rgba(0,0,0,.55) 45%, transparent 100%);
}
.code-reveal .k, .code-reveal .c { color: var(--code-k); }
.code-reveal .s { opacity: .75; }
.hero-spot { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle 420px at var(--mx) var(--my), color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 30%; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }

.hero-inner { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, .8fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero-text { min-width: 0; }
.hero-name { font-weight: 800; font-stretch: 125%; line-height: .9; letter-spacing: -.02em; font-size: clamp(2.3rem, 6.4vw, 7.6rem); margin-bottom: 1.75rem; }
.hn-line { display: block; white-space: nowrap; }
.hn-line + .hn-line { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.hn-line + .hn-line .ch.is-hot { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
.ch { display: inline-block; font-variation-settings: "wdth" var(--wd, 125), "wght" var(--wg, 800); will-change: transform; }
[dir="rtl"] .hero-name { font-stretch: 100%; line-height: 1.15; letter-spacing: 0; }
[dir="rtl"] .hn-line + .hn-line { -webkit-text-stroke-width: 1.2px; }
.wd { display: inline-block; white-space: nowrap; }

.hero-role { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35em .6em; font-size: clamp(1.1rem, 1.8vw, 1.5rem); font-weight: 500; font-stretch: 110%; margin-bottom: 1rem; }
.rot { position: relative; display: inline-grid; color: var(--accent-ink); font-weight: 700; overflow: hidden; vertical-align: bottom; }
.rot-item { grid-area: 1 / 1; white-space: nowrap; }
html.js .rot-item:not(:first-child) { opacity: 0; }
.hero-line { color: var(--muted); max-width: 34ch; font-size: clamp(1rem, 1.3vw, 1.15rem); margin-bottom: 2.25rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; }

.hero-portrait { justify-self: end; width: 100%; max-width: 420px; perspective: 900px; }
.portrait-frame { position: relative; border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 5; background: var(--bg-2); box-shadow: var(--shadow); transform-style: preserve-3d; }
.portrait-frame img { width: 100%; height: 115%; object-fit: cover; object-position: 50% 18%; }
.portrait-frame::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--line); pointer-events: none; }

.hero-hint { position: absolute; z-index: 2; inset-inline-start: var(--pad); bottom: 2rem; display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); }
.hint-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ping 2.2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 10px transparent; } }
.hero-scroll { position: absolute; z-index: 2; left: 50%; bottom: 1.5rem; width: 1px; height: 64px; background: var(--line); overflow: hidden; }
.scroll-line { position: absolute; inset: 0; background: var(--ink); animation: drip 2.2s var(--ease) infinite; }
@keyframes drip { 0% { transform: translateY(-100%); } 60%, 100% { transform: translateY(100%); } }

/* ---------- marquee ---------- */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding-block: 1.1rem; direction: ltr; }
.marquee-track { display: flex; width: max-content; align-items: center; gap: 2rem; will-change: transform; }
.marquee span { font-size: clamp(1.4rem, 3vw, 2.4rem); font-weight: 700; font-stretch: 118%; white-space: nowrap; }
.marquee i { width: .55rem; height: .55rem; background: var(--accent); border-radius: 2px; transform: rotate(45deg); flex: none; }

/* ---------- sections ---------- */
.section { padding-block: clamp(5rem, 11vw, 9.5rem); position: relative; }
.sec-title { font-size: clamp(2.3rem, 6.2vw, 5.8rem); font-weight: 800; font-stretch: 125%; line-height: .95; letter-spacing: -.025em; margin-bottom: clamp(2rem, 5vw, 4rem); }
[dir="rtl"] .sec-title, [dir="rtl"] .contact-title, [dir="rtl"] .d-title { font-stretch: 100%; letter-spacing: 0; line-height: 1.2; }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 3rem; align-items: flex-end; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.sec-head .sec-title { margin-bottom: 0; }
.sec-intro { color: var(--muted); max-width: 46ch; flex: 0 1 26rem; padding-bottom: .6rem; }
.sub-title { font-size: 1.05rem; font-weight: 700; font-stretch: 112%; margin-bottom: 1.5rem; display: flex; align-items: center; gap: .75rem; }
.sub-title::before { content: ""; width: 1.5rem; height: 2px; background: var(--accent); flex: none; }

/* about */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.about-text { font-size: clamp(1.4rem, 2.6vw, 2.35rem); line-height: 1.32; font-weight: 500; letter-spacing: -.012em; }
[dir="rtl"] .about-text { line-height: 1.7; letter-spacing: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin-bottom: 2rem; }
.stats li { padding: 1.4rem 0; display: flex; flex-direction: column; gap: .2rem; }
.stats li + li { padding-inline-start: 1.2rem; border-inline-start: 1px solid var(--line); }
.stat-num { font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 800; font-stretch: 125%; line-height: 1; color: var(--accent-ink); }
.stat-label { font-size: .88rem; color: var(--muted); line-height: 1.3; }
.facts { display: grid; margin: 0; }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding-block: .85rem; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .92rem; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.facts dd a { transition: color .3s; } .facts dd a:hover { color: var(--accent-ink); }
.facts dd a + a { margin-inline-start: 1rem; }

/* journey */
.journey-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 6rem); }
.timeline { position: relative; padding-inline-start: 2.2rem; display: grid; gap: 2.6rem; }
.tl-line { position: absolute; inset-inline-start: 5px; top: .5rem; bottom: .5rem; width: 1px; background: var(--line); }
.tl-line span { position: absolute; inset: 0; background: var(--accent); transform-origin: top; }
.tl-item { position: relative; }
.tl-dot { position: absolute; inset-inline-start: -2.2rem; top: .45rem; width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.tl-item:first-of-type .tl-dot { background: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
.tl-date { font-size: .88rem; color: var(--muted); margin-bottom: .35rem; font-variant-numeric: tabular-nums; }
.tl-role { font-size: clamp(1.25rem, 2vw, 1.6rem); font-weight: 700; font-stretch: 110%; line-height: 1.2; }
.tl-org { color: var(--accent-ink); font-weight: 600; margin: .2rem 0 .6rem; }
.tl-org a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl-desc { color: var(--muted); max-width: 58ch; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.tags li { font-size: .8rem; font-weight: 600; padding: .32rem .7rem; border-radius: 999px; border: 1px solid var(--line); }
.journey-side .sub-title:not(:first-child) { margin-top: 3rem; }
.edu, .uni { display: grid; gap: 1.4rem; }
.edu h4, .uni h4 { font-size: 1.08rem; font-weight: 650; line-height: 1.35; margin-bottom: .2rem; }

/* skills */
.skills { background: var(--bg-2); transition: background-color .5s var(--ease); }
.skills-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(2rem, 4vw, 3.5rem); }
.skill-group h3 { font-size: .95rem; font-weight: 700; font-stretch: 112%; padding-bottom: 1rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--ink); }
.skill-group ul { display: grid; gap: 1.35rem; }
.skill-top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; margin-bottom: .55rem; }
.skill-name { font-weight: 550; font-size: .98rem; line-height: 1.3; }
.skill-val { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.skill-bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.skill-bar span { display: block; height: 100%; width: calc(var(--v) * 1%); background: var(--accent); border-radius: inherit; transform-origin: 0 50%; }
[dir="rtl"] .skill-bar span { transform-origin: 100% 50%; }
.skills-cv { margin-top: clamp(3rem, 6vw, 4.5rem); }

/* projects */
.filters { position: relative; display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: 4px; border: 1px solid var(--line); border-radius: 999px; margin-bottom: 2.5rem; }
.filter { position: relative; z-index: 1; padding: .6rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--muted); transition: color .35s, background-color .35s; display: inline-flex; gap: .3rem; }
.filter.is-active { color: var(--on-accent); }
.filter .count { font-size: .68rem; opacity: .7; top: -.35em; }
.filter-pill { position: absolute; top: 4px; left: 0; height: calc(100% - 8px); border-radius: 999px; background: var(--accent); transition: transform .55s var(--ease), width .55s var(--ease); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 2.5vw, 2rem); }
.card.is-hidden { display: none; }
.card-link { display: block; position: relative; }
.card-media { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16 / 11; background: var(--bg-2); position: relative; transform: translateZ(0); }
.card-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transform: scale(1.02); transition: transform 1.1s var(--ease); }
.card-media::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--line); }
.card-link:hover .card-media img { transform: scale(1.09); }
.card-body { padding: 1.1rem .2rem 0; padding-inline-end: 3rem; }
.card-title { font-size: 1.2rem; font-weight: 700; font-stretch: 108%; line-height: 1.25; }
.card-meta { display: flex; gap: 1rem; color: var(--muted); font-size: .9rem; margin-top: .3rem; }
.card-year { font-variant-numeric: tabular-nums; }
.card-arrow { position: absolute; inset-inline-end: .2rem; bottom: .3rem; width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); transition: background-color .4s, color .4s, transform .5s var(--ease), border-color .4s; }
[dir="rtl"] .card-arrow .ico { transform: scaleX(-1); }
.card-link:hover .card-arrow { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: rotate(45deg); }
[dir="rtl"] .card-link:hover .card-arrow { transform: rotate(-45deg); }
.projects-more { margin-top: 3rem; font-size: 1.1rem; }
.projects-more a { font-weight: 600; }

/* certificates */
.certs { overflow: hidden; }
.certs-viewport { overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--pad); scrollbar-width: none; padding-inline: var(--pad); }
.certs-viewport::-webkit-scrollbar { display: none; }
.certs-track { display: flex; gap: clamp(1rem, 2.5vw, 2rem); width: max-content; padding-bottom: .5rem; }
.cert { margin: 0; width: clamp(15rem, 30vw, 26rem); flex: none; scroll-snap-align: start; }
.cert-link { display: block; height: clamp(12rem, 22vw, 18rem); border-radius: var(--r-md); overflow: hidden; background: #fff; border: 1px solid var(--line); padding: .6rem; transition: transform .6s var(--ease), border-color .4s; }
.cert-link img { width: 100%; height: 100%; object-fit: contain; }
.cert-link:hover { transform: translateY(-6px); border-color: var(--accent); }
.cert figcaption { margin-top: .9rem; font-weight: 600; font-size: .98rem; line-height: 1.35; }
html.has-pin .certs-viewport { overflow: visible; scroll-snap-type: none; }
html.has-pin .certs-pin { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-top: var(--hd-h); }
html.has-pin .certs .sec-head { margin-bottom: 2rem; }
html.has-pin .cert { width: auto; }
html.has-pin .cert-link { height: min(46vh, 30rem); }
html.has-pin .cert-link img { width: auto; max-width: none; height: 100%; }
html.has-pin .cert figcaption { max-width: 22rem; }

/* contact */
.contact-title { font-size: clamp(2.4rem, 8vw, 7.6rem); font-weight: 800; font-stretch: 125%; line-height: .92; letter-spacing: -.03em; max-width: 14ch; }
.contact-lead { font-size: clamp(1.1rem, 1.6vw, 1.35rem); color: var(--muted); margin: 1.5rem 0 clamp(3rem, 6vw, 5rem); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(2.5rem, 6vw, 6rem); }
.ci-row { padding-block: 1.1rem; border-bottom: 1px solid var(--line); display: grid; gap: .25rem; }
.ci-row:first-child { border-top: 1px solid var(--line); }
.ci-k { font-size: .88rem; color: var(--muted); }
.ci-v { font-size: clamp(1.05rem, 1.6vw, 1.3rem); font-weight: 600; display: flex; align-items: center; gap: .6rem; overflow-wrap: anywhere; }
.copy-btn { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); transition: color .3s, border-color .3s; flex: none; }
.copy-btn:hover { color: var(--accent-ink); border-color: var(--accent); }
.copy-btn .ico { width: 1rem; height: 1rem; }
.socials-lg { margin: 1.75rem 0; }
.map { border-radius: var(--r-md); overflow: hidden; height: 220px; background: var(--bg-2); border: 1px solid var(--line); }
.map iframe { width: 100%; height: 100%; border: 0; filter: grayscale(1) contrast(1.05); opacity: .9; }
[data-theme="dark"] .map iframe { filter: grayscale(1) invert(.92) hue-rotate(180deg) contrast(.9); }

.contact-form { position: relative; display: grid; gap: 1.1rem; align-content: start; }
.field { position: relative; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1.55rem 1.1rem .65rem; outline: none; resize: vertical;
  transition: border-color .3s, box-shadow .3s, background-color .5s;
}
.field textarea { min-height: 11rem; }
.field label { position: absolute; inset-inline-start: 1.1rem; top: 1.1rem; color: var(--muted); pointer-events: none; transform-origin: 0 0; transition: transform .35s var(--ease), color .3s; }
[dir="rtl"] .field label { transform-origin: 100% 0; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.field input:focus + label, .field textarea:focus + label,
.field input:not(:placeholder-shown) + label, .field textarea:not(:placeholder-shown) + label { transform: translateY(-.62rem) scale(.78); color: var(--accent-ink); }
.field.is-invalid input, .field.is-invalid textarea { border-color: #D2493B; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.btn-send { justify-self: start; --h: 3.6rem; padding-inline: 2rem; }
.btn-send[disabled] { opacity: .7; pointer-events: none; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding-top: 3.5rem; overflow: hidden; }
.ft-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1.5rem; }
.ft-mail { font-size: clamp(1.1rem, 2.4vw, 2rem); font-weight: 700; font-stretch: 112%; transition: color .3s; overflow-wrap: anywhere; }
.ft-mail:hover { color: var(--accent-ink); }
.ft-word { font-size: clamp(2.5rem, 7.4vw, 9rem); font-weight: 900; line-height: .85; letter-spacing: -.035em; white-space: nowrap; text-align: center; margin: 3rem 0 1.5rem; }
.ft-word span { display: inline-block; font-variation-settings: "wdth" var(--fw, 125), "wght" 900; }
[dir="rtl"] .ft-word { letter-spacing: 0; line-height: 1.2; }
.ft-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.5rem 2rem; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.to-top { display: inline-flex; gap: .5rem; align-items: center; color: var(--ink); font-weight: 600; }

/* cursor */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.js .cursor { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 150; }
  .cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; border-radius: 50%; will-change: transform; }
  .cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent); }
  .cursor-ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); display: grid; place-items: center; transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background-color .35s, border-color .35s; }
  .cursor-label { font-size: .78rem; font-weight: 700; color: var(--on-accent); opacity: 0; transition: opacity .2s; white-space: nowrap; }
  .cursor.is-link .cursor-ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: var(--accent); }
  .cursor.is-label .cursor-ring { width: 104px; height: 104px; margin: -52px 0 0 -52px; background: var(--accent); border-color: var(--accent); }
  .cursor.is-label .cursor-label { opacity: 1; }
  .cursor.is-label .cursor-dot { opacity: 0; }
  .cursor.is-hidden { opacity: 0; }
}

/* toast */
.toast { visibility: hidden; position: fixed; z-index: 160; bottom: 1.5rem; left: 50%; transform: translate(-50%, 150%); max-width: min(92vw, 30rem); padding: .95rem 1.3rem; border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-weight: 500; box-shadow: var(--shadow); transition: transform .6s var(--ease), visibility .6s; }
.toast.is-on { visibility: visible; transform: translate(-50%, 0); }
.toast.is-error { background: #C2402F; color: #fff; }

/* ---------- detail page ---------- */
.d-hero { padding-top: calc(var(--hd-h) + clamp(2.5rem, 6vw, 5rem)); padding-bottom: clamp(2rem, 4vw, 3rem); }
.back-link { display: inline-flex; gap: .5rem; align-items: center; color: var(--muted); font-weight: 600; margin-bottom: 2rem; transition: color .3s; }
.back-link:hover { color: var(--ink); }
.d-title { font-size: clamp(2.2rem, 7vw, 6.6rem); font-weight: 800; font-stretch: 125%; line-height: .95; letter-spacing: -.025em; max-width: 16ch; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.d-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); margin: 0; border-top: 1px solid var(--line); }
.d-meta div { padding: 1.1rem 0; padding-inline-end: 1rem; }
.d-meta dt { font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.d-meta dd { margin: 0; font-weight: 600; }
.d-gallery { padding-bottom: clamp(3rem, 6vw, 5rem); }
.gal-swiper { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.gal-swiper .swiper-slide { display: flex; justify-content: center; align-items: center; aspect-ratio: 16 / 9; background: var(--bg-2); }
.gal-swiper .swiper-slide img { width: 100%; height: 100%; object-fit: contain; }
.gal-link { display: block; width: 100%; height: 100%; }
.gal-ui { position: absolute; z-index: 5; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; align-items: center; gap: .8rem; padding: .35rem; border-radius: 999px; background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--line); }
.gal-ui button { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; transition: background-color .3s, color .3s; }
.gal-ui button:hover { background: var(--accent); color: var(--on-accent); }
.gal-pag { position: static !important; width: auto !important; font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.2rem; text-align: center; }
.d-body { padding-bottom: clamp(4rem, 8vw, 7rem); }
.d-body-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); }
.d-desc { font-size: clamp(1.3rem, 2.4vw, 2.1rem); font-weight: 500; line-height: 1.35; letter-spacing: -.01em; }
[dir="rtl"] .d-desc { line-height: 1.7; letter-spacing: 0; }
.d-cta { margin-top: 2.5rem; white-space: normal; height: auto; min-height: var(--h); padding-block: .8rem; }
.d-pn { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 2rem); padding-bottom: clamp(4rem, 8vw, 7rem); }
.pn { position: relative; display: grid; gap: .4rem; padding: 1.5rem; min-height: 13rem; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; isolation: isolate; align-content: end; }
.pn-next { text-align: end; }
.pn-k { color: var(--muted); font-size: .9rem; }
.pn-t { font-size: clamp(1.3rem, 2.5vw, 2rem); font-weight: 800; font-stretch: 118%; line-height: 1.1; }
.pn-img { position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .6s var(--ease); }
.pn-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 0%, color-mix(in srgb, var(--bg) 92%, transparent) 75%); }
.pn-img img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.1); transition: transform 1.2s var(--ease); }
.pn:hover .pn-img { opacity: 1; }
.pn:hover .pn-img img { transform: scale(1); }

/* 404 */
.nf-hero { text-align: center; justify-content: center; }
.nf-inner { position: relative; z-index: 2; display: grid; justify-items: center; gap: 1.25rem; }
.nf-code { font-size: clamp(7rem, 26vw, 20rem); font-weight: 900; font-stretch: 125%; line-height: .8; letter-spacing: -.04em; color: transparent; -webkit-text-stroke: 2px var(--ink); direction: ltr; }
.nf-title { font-size: clamp(1.6rem, 3.5vw, 2.6rem); font-weight: 800; font-stretch: 115%; }
.nf-text { color: var(--muted); max-width: 44ch; margin-bottom: 1rem; }

/* glightbox */
.goverlay { background: rgba(6, 10, 20, .92) !important; }
.glightbox-clean .gslide-description { background: #fff; }
.glightbox-clean .gslide-title { font-family: var(--font); margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .main-nav { display: none; }
  .burger { display: block; }
  .hd-tools, .main-nav + .hd-tools { margin-inline-start: auto; }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .hero { align-items: flex-start; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; justify-self: start; max-width: 9.5rem; }
  .portrait-frame { border-radius: 20px; }
  .hero-hint { display: none; }
  .code-grid { grid-template-columns: repeat(2, minmax(26rem, 1fr)); }
  .about-grid, .journey-grid, .contact-grid, .d-body-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  :root { --hd-h: 64px; }
  body { font-size: 1rem; }
  .brand-name, .hide-sm { display: none; }
  .hero { padding-bottom: 6rem; }
  .hn-line + .hn-line { -webkit-text-stroke-width: 1.2px; }
  .hero-cta .btn { flex: 1 1 100%; }
  .cards { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .stats li + li { padding-inline-start: .8rem; }
  .facts div { grid-template-columns: 1fr; gap: .1rem; }
  .filters { border-radius: var(--r-md); display: flex; }
  .filter-pill { display: none; }
  .filter.is-active { background: var(--accent); }
  .d-pn { grid-template-columns: 1fr; }
  .pn-next { text-align: start; }
  .btn-send { justify-self: stretch; }
  .code-grid pre { font-size: 11.5px; }
  .gal-swiper .swiper-slide { aspect-ratio: 4 / 3; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  html.js .rot-item:not(:first-child) { display: none; }
}

/* view transition (theme switch) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

/* ---------- WhatsApp widget (fait maison, sans script externe) ---------- */
.wa { position: fixed; z-index: 140; inset-inline-end: clamp(1rem, 2.5vw, 1.75rem); bottom: calc(clamp(1rem, 2.5vw, 1.75rem) + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: flex-end; gap: .9rem; }
[dir="rtl"] .wa { align-items: flex-start; }
html.menu-open .wa { opacity: 0; pointer-events: none; }
.wa-btn { position: relative; width: 3.75rem; height: 3.75rem; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 1px color-mix(in srgb, var(--on-accent) 8%, transparent); transition: transform .5s var(--ease), box-shadow .4s; }
.wa-btn:hover { transform: translateY(-3px) scale(1.04); }
.wa { animation: wa-pop .9s cubic-bezier(.34,1.56,.64,1) 1.4s both; }
@keyframes wa-pop { from { opacity: 0; transform: translateY(20px) scale(.6); } to { opacity: 1; transform: none; } }
.wa-btn::before { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--accent); animation: wa-ring 2.8s var(--ease) infinite; pointer-events: none; }
.wa-btn[aria-expanded="true"]::before { animation: none; opacity: 0; }
@keyframes wa-ring { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(1.55); opacity: 0; } }
.wa-btn::after { content: ""; position: absolute; top: .2rem; inset-inline-end: .2rem; width: .8rem; height: .8rem; border-radius: 50%; background: #25D366; border: 2px solid var(--bg); }
.wa-btn[aria-expanded="true"]::after { display: none; }
.wa-ico { position: absolute; display: grid; place-items: center; transition: transform .5s var(--ease), opacity .3s; }
.wa-ico .ico { width: 1.7rem; height: 1.7rem; }
.wa-ico-x { opacity: 0; transform: rotate(-90deg) scale(.5); }
.wa-ico-x .ico { width: 1.4rem; height: 1.4rem; }
.wa-btn[aria-expanded="true"] .wa-ico-chat { opacity: 0; transform: rotate(90deg) scale(.5); }
.wa-btn[aria-expanded="true"] .wa-ico-x { opacity: 1; transform: none; }

.wa-tip { position: absolute; bottom: .95rem; inset-inline-end: 4.6rem; white-space: nowrap; background: var(--ink); color: var(--bg); font-size: .85rem; font-weight: 600; padding: .55rem .9rem; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; transform: translateX(8px); pointer-events: none; transition: opacity .35s, transform .5s var(--ease); }
[dir="rtl"] .wa-tip { transform: translateX(-8px); }
.wa.show-tip .wa-tip, .wa-btn:hover + .wa-tip, .wa:has(.wa-btn:hover) .wa-tip { opacity: 1; transform: none; }
.wa.is-open .wa-tip { opacity: 0 !important; }

.wa-card { width: min(21.5rem, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 60px -20px rgba(6, 12, 26, .45); transform-origin: bottom right; }
[dir="rtl"] .wa-card { transform-origin: bottom left; }
.wa-card:not([hidden]) { animation: wa-in .5s var(--ease); }
@keyframes wa-in { from { opacity: 0; transform: translateY(12px) scale(.94); } to { opacity: 1; transform: none; } }
.wa-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1rem 1rem 1.1rem; background: #0D1A33; color: #E9EDF5; }
.wa-avatar { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid var(--accent); flex: none; }
.wa-name { font-weight: 700; font-stretch: 110%; line-height: 1.2; }
.wa-status { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: #AEB8CC; margin-top: .15rem; }
.wa-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #25D366; flex: none; }
.wa-x { margin-inline-start: auto; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; color: #AEB8CC; transition: background-color .3s, color .3s; flex: none; }
.wa-x:hover { background: rgba(255,255,255,.1); color: #fff; }
.wa-x .ico { width: 1.05rem; height: 1.05rem; }
.wa-body { padding: 1.1rem; background: var(--bg-2); background-image: radial-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px); background-size: 14px 14px; }
.wa-bubble { position: relative; background: var(--surface); border-radius: 4px 16px 16px 16px; padding: .8rem .95rem; font-size: .93rem; line-height: 1.5; display: grid; gap: .2rem; max-width: 92%; box-shadow: 0 2px 6px rgba(6,12,26,.08); }
[dir="rtl"] .wa-bubble { border-radius: 16px 4px 16px 16px; }
.wa-bubble strong { font-weight: 700; }
.wa-cta { display: flex; align-items: center; justify-content: center; gap: .55rem; margin: 1rem; height: 3rem; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; transition: filter .3s, transform .4s var(--ease); }
.wa-cta:hover { filter: brightness(1.05); transform: translateY(-2px); }
.wa-cta .ico { width: 1.2rem; height: 1.2rem; }
@media (max-width: 640px) { .wa-btn { width: 3.4rem; height: 3.4rem; } .wa-tip { display: none; } }

[data-theme="dark"] .wa-head { background: #070E1C; border-bottom: 1px solid var(--line); }
[data-theme="dark"] .wa-card { border-color: rgba(233,237,245,.16); }
