/* The four section pages (portfolio, projets, le coin des dev, contact).
   Same world as the home: black, JetBrains Mono, white neon, a discreet violet light. Text first
   appears as code and decodes itself (js/decode.js); blocks rise in as they enter the screen. */

:root {
  --line: #1c1f26;
  --line-2: #2a2e37;
  --panel: rgba(13, 17, 23, 0.82);
  --soft: #c3c8cf;
  --violet: 150, 110, 255;
  --code-kw: #ff7b72;
  --code-fn: #d2a8ff;
  --code-str: #a5d6ff;
  --code-num: #79c0ff;
  --code-com: #8b949e;
  --wrap: min(100% - 32px, 1120px);
}

/* ---------- the ground: a faint grid, a violet glow, scan lines ---------- */
.pg {
  position: relative;
  min-height: 100svh;
  padding: calc(104px + env(safe-area-inset-top, 0px)) 0 96px;
  overflow: clip;
  background: var(--bg);
  isolation: isolate;
}
.pg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 85% 10%, rgba(var(--violet), 0.16), rgba(var(--violet), 0) 70%),
    radial-gradient(45% 40% at 0% 90%, rgba(var(--violet), 0.08), rgba(var(--violet), 0) 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 64px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 100%;
  mask-image: radial-gradient(120% 90% at 50% 30%, #000 40%, transparent 100%);
  pointer-events: none;
}
.pg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.wrap { width: var(--wrap); margin-inline: auto; }

/* on a page that scrolls, the bar needs its own ground */
/* (on a pseudo-element: a backdrop-filter on the bar itself would trap the fixed phone menu inside it) */
html:not(.is-home) .bandeau::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(5, 6, 8, 0.94), rgba(5, 6, 8, 0.78));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}

/* ---------- type ---------- */
.pg .kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.pg .kicker b { color: #fff; font-weight: 700; text-shadow: 0 0 10px rgba(255, 255, 255, 0.6); }
.pg .kicker::after {
  content: "";
  width: 0.55em;
  height: 1.05em;
  background: var(--ink);
  animation: blink 1s steps(1) infinite;
}
.h1 {
  margin: 0;
  font-size: clamp(40px, 7.4vw, 92px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  color: #fff;
  text-shadow: 0 0 34px rgba(255, 255, 255, 0.16);
}
.lead {
  max-width: 62ch;
  margin: 22px 0 0;
  color: var(--soft);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.75;
}
.sec { margin-top: clamp(80px, 12vw, 148px); }
.sec__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.sec__num { color: rgb(var(--violet)); font-size: 13px; letter-spacing: 0.1em; }
.sec__title {
  margin: 0;
  font-size: clamp(26px, 3.6vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.sec__note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.muted { color: var(--muted); }

/* ---------- decode: text that starts as code ---------- */
html.dec [data-decode] { visibility: hidden; animation: dec-failsafe 0s linear 2.5s forwards; }
html.dec-ready [data-decode] { visibility: visible; animation: none; }
@keyframes dec-failsafe { to { visibility: visible; } }
[data-decode].is-coded { color: rgba(var(--violet), 0.85); text-shadow: 0 0 12px rgba(var(--violet), 0.35); }
[data-decode] { transition: color 360ms ease, text-shadow 360ms ease; }

/* ---------- reveal: blocks rise in once ---------- */
html.dec-ready [data-reveal] { opacity: 0; transform: translateY(18px); }
html.dec-ready [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: var(--d, 0ms);
}

/* ---------- a window: the frame of every picture and code block ---------- */
.win {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 30px 90px -30px rgba(var(--violet), 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.win__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-2);
  background: rgba(22, 27, 34, 0.9);
  color: var(--muted);
  font-size: 12px;
}
.win__bar i { width: 10px; height: 10px; border-radius: 50%; background: #3a3f48; }
.win__bar i:nth-child(1) { background: #ff5f57; }
.win__bar i:nth-child(2) { background: #febc2e; }
.win__bar i:nth-child(3) { background: #28c840; margin-right: 8px; }
.win__bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win img { display: block; width: 100%; height: auto; }

/* ---------- buttons ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink);
  font: 500 14px/1 var(--mono);
  letter-spacing: 0.04em;
  text-decoration: none;
  background: rgba(13, 17, 23, 0.7);
  transition: transform 160ms var(--ease-out), border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}
.btn--main { border-color: #fff; background: #fff; color: #050608; font-weight: 700; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: rgba(var(--violet), 0.9); box-shadow: 0 0 24px rgba(var(--violet), 0.35); }
  .btn--main:hover { background: #e8e2ff; }
}

/* ---------- portfolio: who I am ---------- */
.me { display: grid; grid-template-columns: 1.08fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.me__pic { rotate: -1.2deg; }
.me__pic .win { animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 36px; }
.fact { padding: 18px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.fact b { display: block; color: #fff; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -0.02em; }
.fact span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.skill {
  position: relative;
  padding: 26px 22px 24px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  transition: transform 220ms var(--ease-out), border-color 220ms ease;
}
.skill__icon { color: #fff; font-size: 13px; letter-spacing: 0.06em; text-shadow: 0 0 10px rgba(255, 255, 255, 0.6); }
.skill h3 { margin: 18px 0 10px; color: #fff; font-size: 19px; }
.skill p { margin: 0; color: var(--soft); font-size: 14px; line-height: 1.7; }
.skill ul { margin: 16px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.skill li { padding: 5px 9px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--muted); font-size: 12px; }
@media (hover: hover) and (pointer: fine) {
  .skill:hover { transform: translateY(-3px); border-color: rgba(var(--violet), 0.6); }
}

.projs { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.proj { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.proj .win { transition: transform 260ms var(--ease-out), box-shadow 260ms ease; }
.proj .win img { aspect-ratio: 16 / 9; object-fit: cover; transition: transform 500ms var(--ease-out); }
.proj__body { padding: 22px 4px 0; }
.proj__tag { color: rgb(var(--violet)); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.proj h3 { margin: 10px 0 10px; color: #fff; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.01em; }
.proj p { margin: 0; color: var(--soft); font-size: 15px; line-height: 1.7; }
.proj__nums { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.proj__nums b { color: #fff; }
.proj__more { display: inline-block; margin-top: 18px; color: #fff; font-size: 14px; }
.proj:focus-visible { outline: 2px solid #fff; outline-offset: 6px; border-radius: 14px; }
@media (hover: hover) and (pointer: fine) {
  .proj:hover .win { transform: translateY(-4px); box-shadow: 0 40px 110px -30px rgba(var(--violet), 0.55); }
  .proj:hover .win img { transform: scale(1.025); }
  .proj:hover .proj__more { text-decoration: underline; text-underline-offset: 4px; }
}

.path { margin: 0; padding: 0; list-style: none; border-inline-start: 1px solid var(--line-2); }
.path li { position: relative; padding-block: 0 30px; padding-inline: 28px 0; }
.path li::before {
  content: "";
  position: absolute;
  inset-inline-start: -5px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}
.path li:last-child { padding-bottom: 0; }
.path__when { color: rgb(var(--violet)); font-size: 13px; letter-spacing: 0.06em; }
.path__what { margin: 6px 0 4px; color: #fff; font-size: 18px; font-weight: 700; }
.path__where { color: var(--muted); font-size: 14px; }

.cta {
  margin-top: clamp(80px, 12vw, 140px);
  padding: clamp(32px, 5vw, 56px);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(var(--violet), 0.18), rgba(var(--violet), 0) 60%),
    var(--panel);
  text-align: left;
}
.cta .sec__title { font-size: clamp(24px, 3.2vw, 38px); }

/* ---------- projets: one long case per project ---------- */
.case { scroll-margin-top: 96px; }
.case + .case { margin-top: clamp(96px, 14vw, 170px); }
.case__head { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; margin-bottom: 30px; }
.case__badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badge { padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--soft); font-size: 12px; }
.badge--live { border-color: rgba(40, 200, 64, 0.5); color: #9ff0ad; }
.badge--live::before { content: "● "; color: #28c840; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(22px, 4vw, 44px); align-items: start; }
.split--wide { grid-template-columns: 1.35fr 1fr; }
.split > * { min-width: 0; }   /* a wide table or code block scrolls inside its column instead of widening it */
.block { margin-top: clamp(40px, 6vw, 64px); }
.block h3 { margin: 0 0 14px; color: #fff; font-size: clamp(19px, 2vw, 23px); }
.block p { margin: 0 0 12px; color: var(--soft); font-size: 15px; line-height: 1.75; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { position: relative; padding-block: 0 12px; padding-inline: 26px 0; color: var(--soft); font-size: 15px; line-height: 1.65; }
.list li::before { content: ">"; position: absolute; inset-inline-start: 0; color: rgb(var(--violet)); }
.list b { color: #fff; font-weight: 700; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.metric { padding: 20px 18px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.metric b { display: block; color: #fff; font-size: clamp(26px, 3vw, 36px); letter-spacing: -0.02em; }
.metric span { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.metric--hot { border-color: rgba(var(--violet), 0.7); box-shadow: 0 0 40px rgba(var(--violet), 0.18); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.tbl { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl caption { padding: 14px 18px 0; color: var(--muted); font-size: 12.5px; text-align: start; caption-side: top; }
.tbl th, .tbl td { padding: 13px 18px; text-align: end; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-size: 11.5px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.tbl th:first-child, .tbl td:first-child { text-align: start; }
.tbl td { color: var(--soft); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .best td { color: #fff; font-weight: 700; background: rgba(var(--violet), 0.08); }

.code { margin: 0; padding: 22px 24px; font: 500 13.5px/1.75 var(--mono); color: #c9d1d9; white-space: pre; overflow-x: auto; }
.code .kw { color: var(--code-kw); } .code .fn { color: var(--code-fn); } .code .str { color: var(--code-str); }
.code .num { color: var(--code-num); } .code .com { color: var(--code-com); }

/* ---------- le coin des dev: work in progress ---------- */
.wip { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 5vw, 60px); align-items: center; }
.wip__stamp {
  display: inline-block;
  margin-top: 26px;
  padding: 10px 16px;
  border: 1px dashed rgba(var(--violet), 0.8);
  border-radius: 8px;
  color: #e3d8ff;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 0 30px rgba(var(--violet), 0.2);
}
.term { padding: 20px 22px; font: 500 13.5px/1.9 var(--mono); color: var(--soft); min-height: 320px; }
.term p { margin: 0; white-space: pre-wrap; }
.term .ok { color: #9ff0ad; }
.term .warn { color: #febc2e; }
.term .dim { color: var(--muted); }
.term .cur::after { content: ""; display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px; vertical-align: -0.2em; background: var(--ink); animation: blink 1s steps(1) infinite; }
.bar { height: 8px; margin: 14px 0 6px; border-radius: 4px; background: #161b22; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #fff, rgb(var(--violet))); box-shadow: 0 0 14px rgba(var(--violet), 0.6); transition: width 1600ms var(--ease-out); }
.is-in .bar i { width: var(--w, 30%); }
.soon { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.soon__card { padding: 22px 20px; border: 1px dashed var(--line-2); border-radius: 14px; background: rgba(13, 17, 23, 0.5); }
.soon__card b { display: block; color: #fff; font-size: 16px; }
.soon__card > span { display: block; margin-top: 8px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.photo-slot { aspect-ratio: 4 / 5; display: grid; place-items: center; position: relative; overflow: hidden; }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot__wait {
  position: relative;
  padding: 24px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
  text-align: center;
}
.photo-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(var(--violet), 0.07) 0 2px, transparent 2px 6px),
    radial-gradient(60% 50% at 50% 40%, rgba(var(--violet), 0.18), transparent 70%);
}
.links { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.link {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 12px 18px 12px 12px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 200ms var(--ease-out), border-color 200ms ease, box-shadow 200ms ease;
}
.link__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #0b0e13;
  border: 1px solid var(--line-2);
  color: #fff;
}
.link__icon svg { width: 24px; height: 24px; display: block; }
.link--github .link__icon { background: #f0f6fc; color: #0d1117; border-color: #f0f6fc; }
.link--insta .link__icon { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); border-color: transparent; }
.link--exist .link__icon { background: #fff; color: #050608; border-color: #fff; }
.link--exist .link__icon b { font: 700 13px/1 var(--mono); letter-spacing: -0.02em; }
.link__label { display: block; color: var(--muted); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.link__value { display: block; margin-top: 5px; color: #fff; font-size: clamp(15px, 1.6vw, 18px); overflow-wrap: anywhere; }
.link__go { color: var(--muted); font-size: 18px; transition: transform 200ms var(--ease-out), color 200ms ease; }
.link:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.link:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) {
  .link:hover { border-color: rgba(var(--violet), 0.7); box-shadow: 0 0 34px rgba(var(--violet), 0.2); transform: translateY(-2px); }
  .link:hover .link__go { color: #fff; transform: translateX(3px); }
}
.copy {
  margin-top: 14px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: none;
  color: var(--soft);
  font: 500 13px/1 var(--mono);
  cursor: pointer;
}
.copy:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.copy.is-done { color: #9ff0ad; border-color: rgba(40, 200, 64, 0.5); }

/* ---------- footer ---------- */
.foot {
  width: var(--wrap);
  margin: clamp(80px, 12vw, 130px) auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
}
.foot a { color: var(--soft); text-underline-offset: 3px; }

/* ---------- narrow screens ---------- */
@media (max-width: 899px) {
  .me, .split, .split--wide, .wip, .contact { grid-template-columns: 1fr; }
  .me__pic { rotate: none; order: -1; }
  .skills { grid-template-columns: 1fr 1fr; }
  .projs { grid-template-columns: 1fr; }
  .case__head { grid-template-columns: 1fr; }
  .contact .photo-slot { aspect-ratio: 16 / 11; }
}
@media (max-width: 599px) {
  .pg { padding-top: calc(88px + env(safe-area-inset-top, 0px)); }
  .facts { grid-template-columns: 1fr 1fr; }
  .skills, .metrics, .soon { grid-template-columns: 1fr; }
  .btn { flex: 1 1 100%; justify-content: center; min-height: 52px; }
  .link { grid-template-columns: 46px 1fr auto; min-height: 70px; gap: 12px; }
  .link__icon { width: 46px; height: 46px; }
  .code { font-size: 12px; padding: 18px; }
  .term { min-height: 0; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg .kicker::after, .term .cur::after { animation: none; }
  .me__pic .win { animation: none; }
  .bar i { transition: none; }
}

/* ---------- Arabic: right to left, an Arabic typeface for the text, code stays latin ---------- */
html[lang="ar"] body { font-family: "IBM Plex Sans Arabic", var(--mono); }
html[lang="ar"] :is(.code, .term, .dive, .pg .kicker, .bandeau__brand, .win__bar, .tbl td) { font-family: var(--mono); }
.code, .term, .pg .kicker, .win__bar { direction: ltr; unicode-bidi: isolate; }
.code, .term { text-align: left; }
html[lang="ar"] :is(.menu__link, .proj__tag, .link__label, .tbl th, .wip__stamp, .sec__num, .fact span, .skill__icon, .path__when) { letter-spacing: 0; }
html[lang="ar"] :is(.h1, .sec__title, .proj h3, .skill h3) { letter-spacing: 0; line-height: 1.25; }
html[lang="ar"] .lead { line-height: 1.9; }
@media (hover: hover) and (pointer: fine) {
  html[dir="rtl"] .link:hover .link__go { transform: translateX(-3px); }
}
/* latin values inside Arabic pages (phone, e-mail, addresses, copyright) keep their own order */
html[dir="rtl"] :is(.link__value, .foot > span:first-child) { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .link__value { text-align: right; }
html[lang="ar"] .copy { font-family: "IBM Plex Sans Arabic", var(--mono); }
