/* =========================================================
   Portfolio — Youssef Bouladjeraf
   Design system partagé
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Couleurs — neutres froids + un seul accent bleu */
  --bg:           oklch(0.992 0.004 250);
  --surface:      #ffffff;
  --surface-2:    oklch(0.975 0.005 250);
  --ink:          oklch(0.235 0.018 255);
  --ink-soft:     oklch(0.42 0.018 255);
  --muted:        oklch(0.56 0.015 255);
  --line:         oklch(0.912 0.008 255);
  --line-strong:  oklch(0.85 0.01 255);
  --accent:       oklch(0.55 0.16 256);
  --accent-ink:   oklch(0.46 0.16 256);
  --accent-soft:  oklch(0.955 0.028 256);
  --accent-line:  oklch(0.86 0.06 256);

  --nav-bg:       oklch(0.992 0.004 250 / 0.82);

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;

  --maxw: 1120px;
  --pad: clamp(20px, 5vw, 56px);

  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --shadow-sm: 0 1px 2px oklch(0.5 0.02 255 / 0.04), 0 2px 6px oklch(0.5 0.02 255 / 0.05);
  --shadow-md: 0 4px 14px oklch(0.45 0.03 255 / 0.07), 0 14px 40px oklch(0.45 0.03 255 / 0.06);
}

/* ---------- Thème sombre ---------- */
html[data-theme="dark"] {
  --bg:           oklch(0.185 0.014 260);
  --surface:      oklch(0.225 0.016 260);
  --surface-2:    oklch(0.265 0.016 260);
  --ink:          oklch(0.955 0.006 260);
  --ink-soft:     oklch(0.80 0.012 260);
  --muted:        oklch(0.63 0.014 260);
  --line:         oklch(0.32 0.014 260);
  --line-strong:  oklch(0.40 0.016 260);
  --accent:       oklch(0.72 0.14 256);
  --accent-ink:   oklch(0.80 0.12 256);
  --accent-soft:  oklch(0.31 0.055 262);
  --accent-line:  oklch(0.45 0.09 260);

  --nav-bg:       oklch(0.185 0.014 260 / 0.78);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.25), 0 2px 8px oklch(0 0 0 / 0.28);
  --shadow-md: 0 6px 18px oklch(0 0 0 / 0.32), 0 18px 46px oklch(0 0 0 / 0.36);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; color: var(--ink); }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1.5px;
  background: var(--accent-line);
  display: inline-block;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- Top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 16px var(--pad);
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-head);
  font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
}
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  letter-spacing: -0.02em;
}
.brand small { display: block; font-family: var(--font-mono); font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }

.nav__links { display: flex; align-items: center; gap: 6px; }
.nav__links a {
  font-family: var(--font-mono);
  font-size: 13px; letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 8px 14px; border-radius: var(--r-sm);
  transition: color .15s ease, background .15s ease;
}
.nav__links a:hover { color: var(--ink); background: var(--surface-2); }
.nav__links a.active { color: var(--accent-ink); background: var(--accent-soft); }
.nav__cta {
  font-family: var(--font-mono); font-size: 13px;
  padding: 9px 16px !important; border-radius: var(--r-sm);
  background: var(--ink) !important; color: var(--bg) !important;
  margin-left: 6px;
}
.nav__cta:hover { background: var(--accent-ink) !important; }

.nav__toggle {
  display: none; background: none; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); width: 42px; height: 38px; cursor: pointer;
  color: var(--ink);
}
.nav__toggle span { display: block; width: 18px; height: 1.6px; background: currentColor; margin: 3.5px auto; transition: .25s; }

/* ---------- Contrôles nav (thème + burger) ---------- */
.nav__controls { display: flex; align-items: center; gap: 10px; }
.nav__inner > .nav__links { margin-left: auto; }
.nav__inner > .nav__controls { margin-left: 16px; }
.theme-btn {
  display: inline-grid; place-items: center; position: relative;
  width: 38px; height: 38px; cursor: pointer;
  background: none; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  color: var(--ink-soft);
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.theme-btn:hover { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.theme-btn svg { width: 18px; height: 18px; position: absolute; transition: opacity .25s ease, transform .35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.theme-btn .ic-moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-btn .ic-sun  { opacity: 0; transform: rotate(-90deg) scale(0.5); }
html[data-theme="dark"] .theme-btn .ic-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }
html[data-theme="dark"] .theme-btn .ic-sun  { opacity: 1; transform: rotate(0) scale(1); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  padding: 13px 22px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Tags / chips ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-soft);
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
}
.tag--accent { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: clamp(60px, 9vw, 120px); background: var(--surface); }
.footer__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 52px var(--pad);
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px;
}
.footer h4 { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.footer a { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; transition: color .15s; }
.footer a:hover { color: var(--accent-ink); }
.footer__list { display: flex; flex-direction: column; align-items: flex-start; }
.footer__big { font-family: var(--font-head); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.footer__big span { color: var(--muted); }
.footer__bottom {
  border-top: 1px solid var(--line);
  padding: 18px var(--pad);
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}

/* ---------- Image placeholders (à remplacer) ---------- */
.ph {
  position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(135deg,
      oklch(0.95 0.006 255) 0 11px,
      oklch(0.975 0.004 255) 11px 22px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--muted);
}
.ph__label {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.04em;
  background: var(--surface); border: 1px solid var(--line-strong);
  padding: 7px 13px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 8px;
}
.ph__label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(0.16, 1, 0.3, 1), transform .7s cubic-bezier(0.16, 1, 0.3, 1); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
/* Variantes directionnelles */
.reveal[data-anim="left"] { transform: translateX(-26px); }
.reveal[data-anim="right"] { transform: translateX(26px); }
.reveal[data-anim="scale"] { transform: scale(0.96); }
.reveal[data-anim="left"].in,
.reveal[data-anim="right"].in,
.reveal[data-anim="scale"].in { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- Generic section spacing ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section--tight { padding: clamp(40px, 6vw, 72px) 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .footer__inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav__links {
    position: fixed; inset: 65px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 12px var(--pad) 22px;
    box-shadow: var(--shadow-md);
    transform: translateY(-130%); transition: transform .3s ease;
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 13px 14px; font-size: 14px; }
  .nav__cta { margin-left: 0; text-align: center; }
  .nav__toggle { display: block; }
  .footer__inner { grid-template-columns: 1fr; gap: 28px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
}
