/* ===========================================================
   E-Portfolio - Ibrahim Afkir
   Shared design system
   Clean technical-modern · Geist + Geist Mono · violet accent
   =========================================================== */

/* Fonts (Nunito · Poppins · Geist Mono) are loaded via <link> in each page's <head>. */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces & ink (cool neutral) */
  --bg:        oklch(0.985 0.004 290);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.972 0.005 290);
  --ink:       oklch(0.235 0.02 285);
  --ink-2:     oklch(0.44 0.02 285);
  --ink-title: oklch(0.28 0.008 285);  /* heading ink — near-black, slightly toward gray */
  --muted:     oklch(0.585 0.014 285);
  --line:      oklch(0.912 0.006 290);
  --line-2:    oklch(0.86 0.008 290);

  /* Accent - overridable by Tweaks (hue swap) */
  --accent-h:  292;
  --accent:      oklch(0.55 0.17 var(--accent-h));
  --accent-2:    oklch(0.47 0.18 var(--accent-h));
  --accent-ink:  oklch(0.42 0.185 var(--accent-h));
  --accent-soft: oklch(0.965 0.022 var(--accent-h));
  --accent-line: oklch(0.90 0.05 var(--accent-h));

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 36px;

  /* Shadows (violet-tinted, soft) */
  --shadow-xs: 0 1px 2px oklch(0.4 0.04 290 / 0.06);
  --shadow-sm: 0 2px 8px oklch(0.4 0.05 290 / 0.06), 0 1px 2px oklch(0.4 0.05 290 / 0.05);
  --shadow:    0 10px 30px oklch(0.4 0.06 290 / 0.08), 0 2px 6px oklch(0.4 0.05 290 / 0.05);
  --shadow-lg: 0 24px 60px oklch(0.38 0.07 290 / 0.14), 0 6px 16px oklch(0.4 0.06 290 / 0.08);

  /* Type */
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', 'JetBrains Mono', monospace;

  /* Layout */
  --maxw: 1200px;
  --nav-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Font-size tweak hook */
:root { --fs: 1; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: calc(16px * var(--fs));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.12; font-weight: 700; letter-spacing: -0.01em; color: var(--ink-title); text-wrap: balance; }
.display, .h1, .h2, .h3, .h4 { font-family: var(--font); }
.display {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.h1 { font-size: clamp(2.1rem, 4.2vw, 3.3rem); letter-spacing: -0.012em; }
.h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); letter-spacing: -0.01em; }
.h3 { font-size: clamp(1.2rem, 1.8vw, 1.45rem); }
.lead { font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: var(--ink-2); line-height: 1.55; text-wrap: pretty; font-weight: 400; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent-line);
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(20px, 5vw, 40px); }
.section { padding-block: clamp(64px, 9vw, 128px); }
.section--tight { padding-block: clamp(48px, 6vw, 80px); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; }

.section-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: clamp(36px, 5vw, 60px); max-width: 640px; }
.section-head.is-wide { max-width: 820px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-size: 0.96rem; font-weight: 500;
  padding: 0.78em 1.3em;
  border-radius: var(--r-sm);
  transition: transform 0.45s var(--ease), background 0.25s, box-shadow 0.35s, border-color 0.25s, color 0.25s;
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 1.05em; height: 1.05em; transition: transform 0.4s var(--ease); }
.btn--primary { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-sm); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--primary:hover svg { transform: translateX(3px); }
.btn--accent { background: var(--accent); color: oklch(0.99 0.01 var(--accent-h)); box-shadow: 0 6px 18px oklch(0.55 0.17 var(--accent-h) / 0.32); }
.btn--accent:hover { transform: translateY(-2px); background: var(--accent-2); box-shadow: 0 12px 26px oklch(0.55 0.17 var(--accent-h) / 0.4); }
.btn--accent:hover svg { transform: translateX(3px); }
.btn--ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow-xs); }
.btn--ghost:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.btn--ghost:hover svg { transform: translateX(3px); }
.btn--sm { padding: 0.6em 1em; font-size: 0.88rem; }

/* ---------- Tags / chips ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.34em 0.7em;
  border-radius: 999px;
  letter-spacing: -0.01em;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.tag--accent { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-line); }

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: oklch(0.985 0.004 290 / 0.72);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s, transform 0.35s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(20px, 5vw, 40px); display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; font-family: var(--font); font-weight: 800; letter-spacing: -0.01em; font-size: 1.35rem; color: var(--ink); transform-origin: left center; transition: color 0.25s var(--ease), transform 0.3s var(--ease); }
.brand:hover { color: var(--accent); transform: scale(1.06); }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__link {
  position: relative;
  font-size: 0.94rem; font-weight: 450; color: var(--ink-2);
  padding: 0.5rem 0.85rem; border-radius: var(--r-xs);
  transition: color 0.2s, background 0.2s;
}
.nav__link:hover { color: var(--ink); background: var(--surface-2); }
.nav__link.is-active { color: var(--ink); }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 0.85rem; right: 0.85rem; bottom: 0.18rem;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.nav__cta { margin-left: 6px; }
/* Distinctive nav call-to-action: soft accent pill with a live pulse dot */
.nav__cta .btn {
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid var(--accent-line); border-radius: 999px;
  box-shadow: none; font-weight: 600; gap: 8px;
  transition: background .25s, color .25s, border-color .25s, transform .35s var(--ease), box-shadow .35s;
}
.nav__cta .btn::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent); animation: navPulse 2.4s var(--ease) infinite;
}
.nav__cta .btn:hover {
  background: var(--accent); color: oklch(0.99 0.01 var(--accent-h));
  border-color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 8px 20px oklch(0.55 0.17 var(--accent-h) / 0.35);
}
.nav__cta .btn:hover::before { background: oklch(0.99 0.01 var(--accent-h)); animation: none; }
@keyframes navPulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.55 0.17 var(--accent-h) / 0.5); }
  70%  { box-shadow: 0 0 0 6px oklch(0.55 0.17 var(--accent-h) / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.55 0.17 var(--accent-h) / 0); }
}
@media (prefers-reduced-motion: reduce) { .nav__cta .btn::before { animation: none; } }
.nav__toggle { display: none; width: 40px; height: 40px; border-radius: var(--r-xs); align-items: center; justify-content: center; }
.nav__toggle:hover { background: var(--surface-2); }
.nav__toggle svg { width: 22px; height: 22px; }

/* ---------- Placeholder media ---------- */
.ph {
  position: relative;
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(135deg,
    oklch(0.93 0.01 290 / 0.7) 0, oklch(0.93 0.01 290 / 0.7) 1px,
    transparent 1px, transparent 11px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: grid; place-items: center;
  overflow: hidden;
  color: var(--muted);
}
.ph__label {
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.02em;
  background: var(--surface); border: 1px solid var(--line);
  padding: 0.4em 0.75em; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 0.5em;
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}
.ph__label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.ph--accent { background-color: var(--accent-soft); background-image: repeating-linear-gradient(135deg, oklch(0.7 0.12 var(--accent-h) / 0.18) 0, oklch(0.7 0.12 var(--accent-h) / 0.18) 1px, transparent 1px, transparent 11px); border-color: var(--accent-line); }

/* ---------- Real image in a media slot ---------- */
/* Drops a real <img> into any sizing class (aspect-ratio + radius) used by .ph */
.is-media { width: 100%; object-fit: cover; display: block; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer__inner { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-block: clamp(48px, 6vw, 72px); }
.footer__brand { max-width: 320px; }
.footer__col h4 { font-size: 0.78rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 500; margin-bottom: 16px; }
.footer__col a { display: block; color: var(--ink-2); font-size: 0.96rem; padding: 5px 0; transition: color 0.2s, transform 0.3s var(--ease); width: fit-content; }
.footer__col a:hover { color: var(--accent-ink); transform: translateX(3px); }
.footer__bottom { border-top: 1px solid var(--line); padding-block: 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 0.84rem; }
.footer__bottom .mono { font-family: var(--mono); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.07s; }
.reveal[data-delay="2"] { transition-delay: 0.14s; }
.reveal[data-delay="3"] { transition-delay: 0.21s; }
.reveal[data-delay="4"] { transition-delay: 0.28s; }
.reveal[data-delay="5"] { transition-delay: 0.35s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Utilities ---------- */
.divider { height: 1px; background: var(--line); border: none; }
.grid { display: grid; gap: clamp(20px, 2.5vw, 28px); }
.text-accent { color: var(--accent-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Mobile nav ---------- */
@media (max-width: 760px) {
  /* auto-hide on scroll down, reveal on scroll up */
  .nav.nav--hidden { transform: translateY(-100%); }
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: oklch(0.985 0.004 290 / 0.97);
    backdrop-filter: blur(14px);
    padding: 16px clamp(20px, 5vw, 40px) 24px;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity 0.25s, transform 0.3s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__link { padding: 0.85rem 0.5rem; font-size: 1.05rem; }
  .nav__link.is-active::after { left: 0.5rem; right: auto; width: 18px; bottom: 0.55rem; }
  .nav__cta { margin: 8px 0 0; }
  .nav__cta .btn { width: 100%; justify-content: center; }
  .nav__toggle { display: inline-flex; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}
