/* =========================================================
   Mohammad Alem — CV / Portfolio
   ========================================================= */

:root {
  --bg:            #0a0612;
  --bg-2:          #110a1f;
  --surface:       #15101f;
  --surface-2:     #1d1633;
  --border:        #2a2240;
  --border-strong: #3b2f5c;

  --text:          #f1ecfa;
  --text-dim:      #b1a5cf;
  --text-mute:     #7c70a0;

  --accent:        #c77eff;
  --accent-2:      #8b5cf6;
  --accent-3:      #ff7ad9;
  --accent-glow:   rgba(199, 126, 255, 0.45);

  --grad-accent:   linear-gradient(135deg, #c77eff 0%, #8b5cf6 50%, #ff7ad9 100%);

  --font-display:  "Bricolage Grotesque", "Sora", system-ui, sans-serif;
  --font-body:     "Manrope", system-ui, -apple-system, sans-serif;
  --font-mono:     "JetBrains Mono", ui-monospace, monospace;
  --font-pixel:    "Press Start 2P", "JetBrains Mono", monospace;

  --radius-sm: 6px;
  --radius:    14px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow:    0 12px 40px -12px rgba(139, 92, 246, 0.25), 0 4px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 80px -30px rgba(199, 126, 255, 0.45), 0 10px 30px rgba(0, 0, 0, 0.6);

  --container: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
}

/* ------------ Reset ------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #1a0c2c; }

/* ------------ Base ------------ */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 800px at 80% -10%, rgba(199, 126, 255, 0.08), transparent 60%),
    radial-gradient(900px 700px at -10% 30%, rgba(139, 92, 246, 0.10), transparent 55%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

main { position: relative; z-index: 1; }

/* ------------ Animated background ------------ */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(199, 126, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(199, 126, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 40%, transparent 80%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 40%, transparent 80%);
  pointer-events: none;
  opacity: 0.7;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.4;
  animation: drift 22s ease-in-out infinite alternate;
}
.blob--1 { background: #8b5cf6; top: -120px; left: -100px; }
.blob--2 { background: #c77eff; bottom: -160px; right: -120px; animation-delay: -8s; }
.blob--3 { background: #ff7ad9; top: 40%; left: 60%; width: 360px; height: 360px; opacity: 0.25; animation-delay: -14s; }

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(40px, -30px, 0) scale(1.08); }
  100% { transform: translate3d(-30px, 40px, 0) scale(0.96); }
}

/* ------------ Header ------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(10, 6, 18, 0.55);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.site-header.is-scrolled {
  background: rgba(10, 6, 18, 0.82);
  border-bottom-color: var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--grad-accent);
  color: #1a0c2c;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 20px -6px var(--accent-glow);
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav { display: flex; align-items: center; }
.nav__list {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav__link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color .2s ease, background .2s ease, transform .15s ease;
}
.nav__link:hover { color: var(--text); background: rgba(199, 126, 255, 0.08); }
.nav__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.nav__link--cta {
  margin-left: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: linear-gradient(180deg, rgba(199, 126, 255, 0.15), rgba(139, 92, 246, 0.05));
}
.nav__link--cta:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(199, 126, 255, 0.25), rgba(139, 92, 246, 0.10));
}

/* Hamburger */
.nav__toggle {
  display: none;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}
.nav__bar {
  position: absolute;
  left: 9px; right: 9px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, top .25s ease;
}
.nav__bar:nth-child(1) { top: 13px; }
.nav__bar:nth-child(2) { top: 19px; }
.nav__bar:nth-child(3) { top: 25px; }
.nav__toggle.is-open .nav__bar:nth-child(1) { top: 19px; transform: rotate(45deg); }
.nav__toggle.is-open .nav__bar:nth-child(2) { opacity: 0; }
.nav__toggle.is-open .nav__bar:nth-child(3) { top: 19px; transform: rotate(-45deg); }

/* ------------ Buttons ------------ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  transition: transform .15s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease, color .2s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--sm { padding: 10px 16px; font-size: 14px; border-radius: 8px; }
.btn--lg { padding: 18px 28px; font-size: 17px; border-radius: 12px; }

.btn--primary {
  background: var(--grad-accent);
  color: #1a0c2c;
  box-shadow: 0 10px 28px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn--primary:hover { box-shadow: 0 16px 42px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--accent);
  background: rgba(199, 126, 255, 0.08);
  color: var(--text);
}

.btn--link {
  padding: 10px 4px;
  background: transparent;
  color: var(--accent);
  border-radius: 4px;
}
.btn--link:hover { color: #e9c8ff; transform: none; }

/* "Game portfolio" pixel CTA */
.btn--game {
  position: relative;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14.5px;
  letter-spacing: 0.02em;
  isolation: isolate;
}
.btn--game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(199, 126, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .6s ease;
  z-index: -1;
}
.btn--game:hover::before { transform: translateX(100%); }
.btn__pixel {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--accent);
  box-shadow:
    -10px 0 0 var(--accent),
     0 -10px 0 var(--accent),
    -10px -10px 0 transparent,
     10px 0 0 var(--accent-3);
  margin-right: 4px;
  animation: blink 1.6s steps(2, end) infinite;
}
@keyframes blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.3; }
}

/* ------------ Hero ------------ */
.hero {
  position: relative;
  padding: clamp(60px, 10vw, 120px) var(--gutter) clamp(80px, 12vw, 140px);
  max-width: var(--container);
  margin: 0 auto;
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(21, 16, 31, 0.6);
  margin-bottom: 24px;
}
.eyebrow__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.2); opacity: 0.7; } }

.hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 8vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin-bottom: 14px;
}
.grad {
  background: var(--grad-accent);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.hero__role {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 22px;
  letter-spacing: 0.02em;
}
.hero__role .sep { color: var(--accent); margin: 0 6px; }

.hero__bio {
  color: var(--text-dim);
  font-size: clamp(16px, 1.6vw, 18px);
  max-width: 52ch;
  margin-bottom: 36px;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 36px;
}

.hero__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero__stack li {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-mute);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px dashed var(--border);
}

/* Avatar */
.hero__avatar { display: flex; justify-content: center; }
.avatar-frame {
  position: relative;
  width: min(360px, 80vw);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  overflow: hidden;
  isolation: isolate;
}
.avatar-frame::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: var(--grad-accent);
  border-radius: inherit;
  z-index: -2;
  opacity: 0.5;
  filter: blur(20px);
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 8px);
}
.avatar-frame__corner {
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid var(--accent);
  z-index: 2;
}
.avatar-frame__corner--tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.avatar-frame__corner--tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.avatar-frame__corner--bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.avatar-frame__corner--br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
.avatar-frame__badge {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: rgba(10, 6, 18, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: var(--font-pixel);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--accent);
  z-index: 3;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 36px;
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  display: grid; place-items: start center;
  padding-top: 6px;
}
.scroll-hint span {
  width: 3px; height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: scrollDot 1.6s ease-in-out infinite;
}
@keyframes scrollDot {
  0% { transform: translateY(0); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: translateY(12px); opacity: 0; }
}

/* ------------ Sections ------------ */
.section {
  padding: clamp(80px, 10vw, 140px) var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
}
.section__head { margin-bottom: 56px; }
.section__label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 14px;
}
.section__lede {
  color: var(--text-dim);
  font-size: clamp(15px, 1.4vw, 17px);
  max-width: 56ch;
}

/* ------------ Projects ------------ */
.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .35s ease, border-color .3s ease, box-shadow .35s ease;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent, var(--accent), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-6px);
  border-color: transparent;
  box-shadow: var(--shadow-lg);
}
.card:hover::before { opacity: 1; }

.card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #1a1230;
}
.card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}
.card:hover .card__media img { transform: scale(1.06); }

.card__play {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  background: rgba(10, 6, 18, 0.45);
  opacity: 0;
  transition: opacity .3s ease;
}
.card__play svg {
  width: 56px; height: 56px;
  padding: 14px;
  background: var(--grad-accent);
  border-radius: 50%;
  color: #1a0c2c;
  box-shadow: 0 12px 30px -8px var(--accent-glow);
  transform: scale(0.85);
  transition: transform .3s ease;
}
.card__media:hover .card__play,
.card__media:focus-visible .card__play { opacity: 1; }
.card__media:hover .card__play svg { transform: scale(1); }
.card__media:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.card__ribbon {
  position: absolute;
  top: 14px; right: 14px;
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 6px 9px;
  background: rgba(10, 6, 18, 0.85);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.card__body {
  padding: 26px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
}
.card__dot { color: var(--accent); }
.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.card__desc { color: var(--text-dim); font-size: 15.5px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags li {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(199, 126, 255, 0.10);
  border: 1px solid rgba(199, 126, 255, 0.25);
  color: #e2cfff;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 6px;
}

/* ------------ Contact ------------ */
.section--contact { text-align: center; }
.contact { max-width: 720px; margin: 0 auto; }
.contact .section__label,
.contact .section__title { text-align: center; }
.contact__lede {
  color: var(--text-dim);
  font-size: clamp(16px, 1.6vw, 18px);
  margin: 16px auto 36px;
  max-width: 56ch;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
}
.social {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-weight: 500;
  transition: transform .15s ease, color .2s ease, border-color .2s ease, background .2s ease;
}
.social:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(199, 126, 255, 0.08);
  transform: translateY(-2px);
}
.social:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ------------ Footer ------------ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-mute);
  position: relative;
  z-index: 1;
}
.footer__top { color: var(--text-dim); }
.footer__top:hover { color: var(--accent); }

/* ------------ Reveal animation ------------ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ------------ Responsive ------------ */
@media (max-width: 900px) {
  .hero__inner {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .hero__avatar { order: -1; justify-content: flex-start; }
  .avatar-frame { width: min(260px, 70vw); }

  .projects { grid-template-columns: 1fr; }

  .nav__toggle { display: block; }
  .nav__list {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px var(--gutter) 22px;
    background: rgba(10, 6, 18, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
  }
  .nav__list.is-open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .nav__link, .nav__link--cta { padding: 14px 14px; border-radius: 10px; }
  .nav__link--cta { margin-left: 0; text-align: center; }
}

@media (max-width: 560px) {
  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { justify-content: center; }
  .site-footer { flex-direction: column; text-align: center; }
  .scroll-hint { display: none; }
  .card__body { padding: 22px 20px 24px; }
  .card__actions { flex-wrap: wrap; }
}

@media (min-width: 1400px) {
  .section, .hero { max-width: 1280px; }
}
